Created
June 14, 2010 10:06
-
-
Save erikvold/437513 to your computer and use it in GitHub Desktop.
Revisions
-
erikvold revised this gist
Jun 14, 2010 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,6 @@ // @namespace jQueryForChromeExample // @include * // @author Erik Vergobbi Vold // @description This userscript is meant to be an example on how to use jQuery in a userscript on Google Chrome. // ==/UserScript== -
erikvold revised this gist
Jun 14, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ // ==UserScript== // @name jQuery For Chrome (A Cross Browser Example) // @namespace jQueryForChromeExample // @include * // @author Erik Vergobbi Vold -
erikvold revised this gist
Jun 14, 2010 . 1 changed file with 6 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,13 +11,17 @@ function addJQuery(callback) { var script = document.createElement("script"); script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"); script.addEventListener('load', function() { var script = document.createElement("script"); script.textContent = "(" + callback.toString() + ")();"; document.body.appendChild(script); }, false); document.body.appendChild(script); } // the guts of this userscript function main() { alert("There are " + $('a').length + " links on this page."); } // load jQuery and execute the main function -
erikvold revised this gist
Jun 14, 2010 . 1 changed file with 15 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,14 +2,23 @@ // @name jQuery For Chrome Example // @namespace jQueryForChromeExample // @include * // @author Erik Vergobbi Vold // @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html // @description This userscript is meant to be an example on how to use jQuery in a userscript on Google Chrome. // ==/UserScript== // a function that loads jQuery and calls a callback function when jQuery has finished loading function addJQuery(callback) { var script = document.createElement("script"); script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"); script.addEventListener('load', function() {callback();}, false); document.body.appendChild(script); } // the guts of this userscript function main() { alert("There are " + (unsafeWindow || window).$('a').length + " links on this page."); } // load jQuery and execute the main function addJQuery(main); -
erikvold revised this gist
Jun 14, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,5 +11,5 @@ var script = document.createElement("script"); script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"); script.setAttribute("async", "true"); script.onload = function() {alert("There are " + window.$('a').length + " links on this page.");}; document.body.appendChild(script); -
erikvold created this gist
Jun 14, 2010 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ // ==UserScript== // @name jQuery For Chrome Example // @namespace jQueryForChromeExample // @include * // @version 0.1 // @author Erik Vergobbi Vold // @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html // @description This userscript is meant to be an example on how to use jQuery in a userscript on Google Chrome. // ==/UserScript== var script = document.createElement("script"); script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"); script.setAttribute("async", "true"); script.onload = function() {alert("There are " + $('a').length + " links on this page.");}; document.body.appendChild(script);