Я вижу, что вы приняли ответ, и это совершенно правильно и здорово, но я хотел бы предоставить полезный инструмент, который я сделал для себя.
Это генератор букмарклетов, который называется zbooks .
(Да, это мой веб-сайт, нет, я не пытаюсь спамить вас, на этой странице нет объявлений, я ничего не получаю от вас, используя его)
Это JQuery включен, и я думаю, что он прост в использовании (но я его построил, так что, кто знает).Если вам нужно подробное объяснение того, как его использовать, дайте мне знать, чтобы я мог сделать его лучше.Вы можете даже просмотреть источник , если хотите.
Важной частью является бизнес-логика, которая выводит jQuery на страницу:
//s used for the Script element
var s = document.createElement('script');
//r used for the Ready state
var r = false;
//set the script to the latest version of jQuery
s.setAttribute('src', 'http://code.jquery.com/jquery-latest.min.js');
//set the load/readystate events
s.onload = s.onreadystatechange = function()
{
/**
* LOAD/READYSTATE LOGIC
* execute if the script hasn't been ready yet and:
* - the ready state isn't set
* - the ready state is complete
* - note: readyState == 'loaded' executes before the script gets called so
* we skip this event because it wouldn't have loaded the init event yet.
*/
if ( !r && (!this.readyState || this.readyState == 'complete' ) )
{
//set the ready flag to true to keep the event from initializing again
r = true;
//prevent jQuery conflicts by placing jQuery in the zbooks object
window.zbooks = {'jQuery':jQuery.noConflict()};
//make a new zbook
window.zbooks[n] = new zbooks(c);
}
};
//append the jQuery script to the body
b.appendChild(s);