当前位置: 代码迷 >> Web前端 >> GraeseMonkey中引来脚本
  详细解决方案

GraeseMonkey中引来脚本

热度:315   发布时间:2012-09-21 15:47:26.0
GraeseMonkey中引入脚本

var STK;

// Add jQuery
??? (function(){
??????? if (typeof unsafeWindow.STK == 'undefined') {
??????????? var GM_Head = document.getElementsByTagName('head')[0] || document.documentElement,
??????????????? GM_JQ = document.createElement('script');
???
??????????? GM_JQ.src = 'http://stk.js';
??????????? GM_JQ.type = 'text/javascript';
??? ??? ??? GM_JQ.charset = 'UTF-8';
??????????? GM_JQ.async = true;
???
??????????? GM_Head.insertBefore(GM_JQ, GM_Head.firstChild);
??????? }
??????? GM_wait();
??? })();

// Check if jQuery's loaded
??? function GM_wait() {
??????? if (typeof unsafeWindow.STK == 'undefined') {
??????????? window.setTimeout(GM_wait, 100);
??????? } else {
??????????? STK = unsafeWindow.STK;
??????????? letsJSTK();
??????? }
??? }

// All your GM code must be inside this function
??? function letsJSTK() {
??? ??? alert(STK);
??? }

  相关解决方案