baidut
4/9/2016 - 6:54 AM

小书签问题,未解决 https://github.com/oscarotero/bookmarklets

小书签问题,未解决 https://github.com/oscarotero/bookmarklets

javascript:(function(){

alert('1')
 if (!($ = window.jQuery)) { // typeof jQuery=='undefined' works too
   alert('2')
    script = document.createElement( 'script' );
    script.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js'; 
    script.onload=releasetheKraken;
    document.body.appendChild(script);
    alert('233')
} 
else {
  alert('3')
    releasetheKraken();
    alert('333')
}
 
function releasetheKraken() {
    $('a').each(function() {
        var href = $(this).attr('href');
        if (href.indexOf('http:') > -1) {
            href = href.replace('https:', 'http:');
            $(this).attr('href', href);
        }
    });
    $('img').each(function() {
        var href = $(this).attr('src');
        var d = new Date();
        if (href.indexOf('http:') > -1) {
            href = href.replace('https:', 'http:');
            $(this).attr('src', href+"?"+d.getTime());
        }
    });
    $('link').each(function() {
    // The Kraken has been released, master!
    // Yes, I'm being childish. Place your code here 
        var href = $(this).attr('href');
        if (href.indexOf('http:') > -1) {
            href = href.replace('https:', 'http:');
            $(this).attr('href', href);
        }
    });
    alert('ok')
}

 } )()