2011-01-11 6 views

答えて

2

置きこれはあなたのブックマークレットのコードの開始時:

var s=window.document.createElement('script'); s.setAttribute('src','http://code.jquery.com/jquery-latest.min.js'); window.document.body.appendChild(s); 

これは、基本的にはjQueryライブラリを含んでいます。

編集:これは個人的な使い方であれば、コンピュータにjQueryのローカルコピーを保存し、そこにスクリプトの保存先を指定することができます。許可なく別のサーバーのリソースを使用することは実際には考えていません。

Edit2:申し訳ありませんが、私はあなたの質問を誤解しました。ここにコードが変更されました:

javascript:(function(){ 
var s=window.document.createElement('script'); 
s.setAttribute('src','http://code.jquery.com/jquery-latest.min.js'); 
window.document.body.appendChild(s); 
var s2=window.document.createElement('script'); 
s2.setAttribute('src','http://tablesorter.com/jquery.tablesorter.min.js'); 
window.document.body.appendChild(s2); 
$('table').tablesorter(); 
})(); 

私はそれを読みやすくするために別の行に分割しました。ここに凝縮されたバージョンです:

javascript:(function(){var s=window.document.createElement('script');s.setAttribute('src','http://code.jquery.com/jquery-latest.min.js');window.document.body.appendChild(s);var s2=window.document.createElement('script');s2.setAttribute('src','http://tablesorter.com/jquery.tablesorter.min.js');window.document.body.appendChild(s2);$('table').tablesorter();})(); 
+0

私はすでにjQueryライブラリ用JQuerifyを使用しています、私はプラグインを使用したいと思います - tablesorter – john

+1

は、私はあなたが何をしたいかを実行するために私の解決策を編集しました。 –

+0

nice、ありがとうsudo work。ブックマークレットでjquery-uiの可用性を試してみよう –

関連する問題