2011-01-05 5 views
2

ブックマークレットでjqueryをリンクおよびロードする例が見つかりましたが、jqueryとjquery-uiの両方がロードされているケースは見つかりませんでした。以下の要点が正しく機能するようになり link text 更新:jQuery Bookmarklet Generator jqueryとjquery-uiのブックマークレットへの読み込みをどのように入れ子にするのですか?

  • better stronger safer jqueryify bookmarklet
    • は、ここで私が働いている主旨です。

      <a href='javascript:(function(e,a,g,h,f,z,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js";c.onload=c.onreadystatechange=function(){z=a.createElement("script");z.type="text/javascript";z.src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js";z.onload=z.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}}})(window,document,"1.4.4",function($,L){/*ENTER JQUERY-UI CODE HERE*/});'>CC</a> 
      

    答えて

    2

    私は仕事するには、次のブックマークレットを得た:

    javascript:(function(){var s1=window.document.createElement('script');s1.setAttribute('src','http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js');window.document.body.appendChild(s1);var s2=window.document.createElement('script');s2.setAttribute('src','http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js');window.document.body.appendChild(s2);s1.onload=s1.onreadystatechange=function(){if(!this.readyState||this.readyState=='loaded'||this.readyState=='complete'){s2.onload=s2.onreadystatechange=function(){if(!this.readyState||this.readyState=='loaded'||this.readyState=='complete'){$('div').draggable();$('div').resizable();$('div').css({'border-style':'dashed','border-width':'3px','border-color':'black','background':'#00ccFF'});}};}};})(); 
    

    参考文献:

      javascript: 
      (function(){ 
          var s1=window.document.createElement('script'); 
          s1.setAttribute('src','http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js'); 
          window.document.body.appendChild(s1); 
          var s2=window.document.createElement('script'); 
          s2.setAttribute('src','http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js'); 
          window.document.body.appendChild(s2); 
          s1.onload=s1.onreadystatechange=function(){ 
          if(!this.readyState||this.readyState=='loaded'||this.readyState=='complete'){ 
           s2.onload=s2.onreadystatechange=function(){ 
           if(!this.readyState||this.readyState=='loaded'||this.readyState=='complete'){ 
            $('div').draggable(); 
            $('div').resizable(); 
            $('div').css({'border-style':'dashed','border-width':'3px','border-color':'black','background':'#00ccFF'}); 
           } 
           } 
           ; 
          } 
          } 
          ; 
      } 
      )(); 
      

      ここで白パージスペース、使用可能な状態で圧縮された同じブックマークレットです

    • 私は次のサイトを見つけましたver読みやすさを改善し、ブックマークレットを記述するための便利Y:
    を外出先で subsimple.com
  • はまた、テストjsfiddle.netのために非常に有用証明しました
  • 関連する問題