bunda1, видно руки кривые http://upwap.ru/2923128. Пока остановился на закладке http://upwap.ru/2923131
Отсутствует
bunda1
Да, подтверждаю, всё работает. Последняя строка кода впечатлила,
разве что, наверное, нехватает удаления Listener'a.
Ну и, как обычно, руки чешутся переделать. Несмотря на то,
что плагинов не держу, сделал себе её как кнопку-сниппет,
типа «Переключение логических preferences», вроде работает...
const s = "dom.ipc.plugins.enabled"; const imgTrue = "chrome://mozapps/skin/plugins/pluginGeneric-16.png"; const imgFalse = "chrome://mozapps/skin/plugins/notifyPluginBlocked.png"; var button = this; var pref = Application.prefs.get(s); this.onclick = function(e) { if(e.button) return; pref.value = !pref.value; } function toggleImage() { button.image = pref.value ? imgTrue : imgFalse; } toggleImage(); pref.events.addListener("change", toggleImage, false); this.onDestroy = function() { pref.events.removeListener("change", toggleImage, false); }
Что за файлохостинг . Но ничего, взял лупу, и
сложилось такое впечатление, что ты скопировал эту длиннющюю строку
(custombutton://%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%......)
в одну из вкладок CB-редактора. Если так, то это неправильно.
Лучше выдели её и перетащи мышкой прямо в адресную строку.
Отредактировано Dumby (02-12-2012 19:34:01)
Отсутствует
Можно ли сделать простой конвертер валют, что-то вроде этого - Google Currency Converter
Что не устраивает в нем, это то что конвертирует по тройному клику, а там бывает выделяются лишнии цифры и в итоге расчет неправильный получается.
Т.е. логика такая, при нажатии берется выделенный текст, в фоне отправляется в гугл с добавлением "в рубли" и обратно во всплывающем окне возвращает результат.
Отредактировано Kamui (02-12-2012 19:12:50)
Отсутствует
Dumby
Красивый код. Я его тоже добавлю в сниппеты. Да и про this.onDestroy я забыл.
Может так лучше:
Добавлено 02-12-2012 19:17:51
manuk
Я кое что исправил в кнопке: Сегодня 15:04:04
Отредактировано bunda1 (02-12-2012 19:17:51)
Отсутствует
Можно ли сделать простой конвертер валют, что-то вроде этого - Google Currency Converter
Что не устраивает в нем, это то что конвертирует по тройному клику, а там бывает выделяются лишнии цифры и в итоге расчет неправильный получается.
Попробуй заменить 3 на 2 в:
Рестарт.
Отсутствует
bunda1, Dumby, спасибо! Всё получилось. И работает без рестарта! Этот "контейнер" при просмотре флеш процессор сильно напрягает в ФФ17. А при его отключении WMP плагин не работает. Для меня нужная кнопка.
Отредактировано manuk (02-12-2012 20:13:31)
Отсутствует
Да, я пробовал, но так он срабатывает еще чаще.....
А если только правым кликом:
Отсутствует
bunda1, Dumby, спасибо! Всё получилось. И работает без рестарта!
Не понятно как у вас без рестарта работает, в about:config переключает, да, но без рестарта в силу не вступает.
Лучше спросить у знающих - чем лезть не зная.
Отсутствует
bunda1
Так гораздо лучше, благодарю я так понимаю нельзя заблокировать появление контекстного меню?
if ( e.button == 2 && e.detail == 2 ) { document.getElementById("contentAreaContextMenu").hidePopup();
или
Отсутствует
С первым кодом пишет:
со вторым:
Отсутствует
Kamui
if ( e.button == 2 && e.detail == 2 ) { setTimeout(function() { document.getElementById("contentAreaContextMenu").hidePopup(); }, 0)
Отсутствует
Все равно не работает ну да ладно, уже достаточно удобно а можно сделать чтобы например с зажатым alt'ом только срабатывал скрипт?
Как не работает. Я проверил, у меня с этим кодом меню появляется и тут же само закрывается. Насчет alt не понятно, alt + лкм или как?
Отсутствует
Как не работает. Я проверил, у меня с этим кодом меню появляется и тут же само закрывается. Насчет alt не понятно, alt + лкм или как?
Пишет:
Использую CB UserScriptLoader, что-то мне кажется он виноват.
По поводу альта, можно было бы alt+2хЛКМ?
Отсутствует
Kamui
Я тоже использую CB UserScriptLoader.
Я попробовал alt+2хЛКМ и это не удобно:
Попробуй просто alt+ЛКМ
Отсутствует
[
Я тоже использую CB UserScriptLoader.
Пробовал CB UserScriptLoader даже на чистом профиле [firefox]16.02, значок в панели дополнений почему-то не появляется.
Отредактировано villa7 (03-12-2012 11:46:50)
Лучше спросить у знающих - чем лезть не зная.
Отсутствует
villa7
Попробуй эту CB UserScriptLoader кнопку но удали старую + рестарт.
custombutton://%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0D%0A%3Ccustombutton%20xmlns%3Acb%3D%22http%3A//xsms.nm.ru/custombuttons/%22%3E%0A%20%20%3Cname%3EUserScriptLoader%3C/name%3E%0A%20%20%3Cimage%3E%3C%21%5BCDATA%5Bdata%3Aimage/png%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACOElEQVQ4ja3Q3UtTcRgH8N8f4K11FaRrVGumlTXndPYiyQqkCyPoLroOCbyJSCGJUhOGUSnShVqtFpYlW/lCKiPmy5zinObZdJtn29nZcW7nnB39TapvF+WdI4W+95/n+zwPIf8zwnRFt+AyIj5VDn7CAN5ZiphDD25Mh+jIaUSGixEePAnWXhTaeYCr/OdWogMZoR2Z2DPQyBNsrpqxEWiF4muG4LwK9nOhvCOOT5Y1iks3sSV0IP29CrLnAkS3EalxPRR/CxJTN8Dai35kXZ+fNGQyfBs2Q7chz1dCcp9FasIAxd+E5GwtwoNl8H3QqnZuHy+tSc5fRybejvTCRUiz55CaKoPsvQV5sR7ciAnBvoJLWdtjTn1aCTWARlshz52HOG1E0lkCxd+C+LdrCH7S1mXHjhLd2nQ1MvxzyF4TxJlKpCYrsD6mQ3rpEUL92l+BPg1d6T1Kl98dpr43asq8OkSZ7nyeEEII59DzElMHGm3DJmvGRvAxFH8TFF8T0osPIXkaIc7UI+W6i+TEHbD9VWC68hRPx4E//+BGz6QiX4tpeOgUZQdO0FV7IQ3ZCqi8+ACC7TjWhkwQ3Q2IfrmCZcsxMF0HX2Q9ZzuBj9rRdVctpLn7EN33ELaZwPSoRE/nvv3/xIQQEnivgeRpBDdcg5W3BWB68s27gn/xDDdUjejAZfheqxOezrzdtRJCiNeamxPo1WLFqgHzUtW8a7idZesRr9+i5r1Pc3P2jAkhhLGodXs1vwEkf3FKAtNVEwAAAABJRU5ErkJggg%3D%3D%5D%5D%3E%3C/image%3E%0A%20%20%3Cmode%3E0%3C/mode%3E%0A%20%20%3Cinitcode%3E//%20UserScriptLoader.uc.js%20....................................................................................................%0A//%20https%3A//raw.github.com/Griever/userChromeJS/master/UserScriptLoader/UserScriptLoader.uc.js%0A%0A//%20%u0411%u043B%u043E%u043A%u0438%u0440%u043E%u0432%u0430%u0442%u044C%20%u043F%u043E%u0432%u0442%u043E%u0440%u043D%u044B%u0439%20%u0437%u0430%u043F%u0443%u0441%u043A%20%u0444%u0443%u043D%u043A%u0446%u0438%u0439%20%u0438%20%u043E%u0431%u0440%u0430%u0431%u043E%u0442%u0447%u0438%u043A%u043E%u0432%20%u043F%u0440%u0438%20%u043E%u0442%u043A%u0440%u044B%u0442%u0438%u0438%20%u043D%u0430%u0441%u0442%u0440%u043E%u0439%u043A%u0438%20%u043F%u0430%u043D%u0435%u043B%u0435%u0439%20%u043D%u043E%20%u0440%u0430%u0437%u0440%u0435%u0448%u0438%u0442%u044C%20%u043E%u0431%u043D%u043E%u0432%u043B%u0435%u043D%u0438%u0435%20%u043A%u043D%u043E%u043F%u043A%u0438%20........................%0Aif%20%28this.hasAttribute%28%22stop%22%29%29%20return%3B%20%0A%0A%28function%20%28css%29%20%7B%0A%0Aconst%20GLOBAL_EXCLUDES%20%3D%20%5B%0A%09%22chrome%3A*%22%0A%09%2C%22jar%3A*%22%0A%09%2C%22resource%3A*%22%0A%5D%3B%0A%0A%0Aconst%20%7B%20classes%3A%20Cc%2C%20interfaces%3A%20Ci%2C%20utils%3A%20Cu%2C%20results%3A%20Cr%20%7D%20%3D%20Components%3B%0Aif%20%28%21window.Services%29%20Cu.import%28%22resource%3A//gre/modules/Services.jsm%22%29%3B%0A%0Aif%20%28window.USL%29%20%7B%0A%09window.USL.destroy%28%29%3B%0A%09delete%20window.USL%3B%0A%7D%0A%0Avar%20USL%20%3D%20%7B%7D%3B%0A%0A//%20Class%0AUSL.PrefManager%20%3D%20function%20%28str%29%20%7B%0A%09var%20root%20%3D%20%27UserScriptLoader.%27%3B%0A%09if%20%28str%29%0A%09%09root%20+%3D%20str%3B%0A%09this.pref%20%3D%20Services.prefs.getBranch%28root%29%3B%0A%7D%3B%0AUSL.PrefManager.prototype%20%3D%20%7B%0A%09setValue%3A%20function%28name%2C%20value%29%20%7B%0A%09%09try%20%7B%0A%09%09%09switch%28typeof%20value%29%20%7B%0A%09%09%09%09case%20%27string%27%20%3A%0A%09%09%09%09%09var%20str%20%3D%20Cc%5B%22@mozilla.org/supports-string%3B1%22%5D.createInstance%28Ci.nsISupportsString%29%3B%0A%09%09%09%09%09str.data%20%3D%20value%3B%0A%09%09%09%09%09this.pref.setComplexValue%28name%2C%20Ci.nsISupportsString%2C%20str%29%3B%0A%09%09%09%09%09break%3B%0A%09%09%09%09case%20%27number%27%20%3A%20this.pref.setIntPref%28name%2C%20value%29%3B%20break%3B%0A%09%09%09%09case%20%27boolean%27%3A%20this.pref.setBoolPref%28name%2C%20value%29%3B%20break%3B%0A%09%09%09%7D%0A%09%09%7D%20catch%28e%29%20%7B%20%7D%0A%09%7D%2C%0A%09getValue%3A%20function%28name%2C%20defaultValue%29%7B%0A%09%09var%20value%20%3D%20defaultValue%3B%0A%09%09try%20%7B%0A%09%09%09switch%28this.pref.getPrefType%28name%29%29%20%7B%0A%09%09%09%09case%20Ci.nsIPrefBranch.PREF_STRING%3A%20value%20%3D%20this.pref.getComplexValue%28name%2C%20Ci.nsISupportsString%29.data%3B%20break%3B%0A%09%09%09%09case%20Ci.nsIPrefBranch.PREF_INT%20%20%20%3A%20value%20%3D%20this.pref.getIntPref%28name%29%3B%20break%3B%0A%09%09%09%09case%20Ci.nsIPrefBranch.PREF_BOOL%20%20%3A%20value%20%3D%20this.pref.getBoolPref%28name%29%3B%20break%3B%0A%09%09%09%7D%0A%09%09%7D%20catch%28e%29%20%7B%20%7D%0A%09%09return%20value%3B%0A%09%7D%2C%0A%09deleteValue%3A%20function%28name%29%20%7B%0A%09%09try%20%7B%0A%09%09%09this.pref.deleteBranch%28name%29%3B%0A%09%09%7D%20catch%28e%29%20%7B%20%7D%0A%09%7D%2C%0A%09listValues%3A%20function%28%29%20this.pref.getChildList%28%22%22%2C%20%7B%7D%29%2C%0A%7D%3B%0A%0AUSL.ScriptEntry%20%3D%20function%20%28aFile%29%20%7B%0A%09this.init.apply%28this%2C%20arguments%29%3B%0A%7D%3B%0AUSL.ScriptEntry.prototype%20%3D%20%7B%0A%09init%3A%20function%28aFile%29%20%7B%0A%09%09this.file%20%3D%20aFile%3B%0A%09%09this.leafName%20%3D%20aFile.leafName%3B%0A%09%09this.path%20%3D%20aFile.path%3B%0A%09%09this.lastModifiedTime%20%3D%20aFile.lastModifiedTime%3B%0A%09%09this.code%20%3D%20USL.loadText%28aFile%29%3B%0A%09%09this.getMetadata%28%29%3B%0A%09%09this.disabled%20%3D%20false%3B%0A%09%09this.requireSrc%20%3D%20%22%22%3B%0A%09%09this.resources%20%3D%20%7B%7D%3B%0A%0A%09%09this.run_at%20%3D%20%22run-at%22%20in%20this.metadata%20%3F%20this.metadata%5B%22run-at%22%5D%5B0%5D%20%3A%20%22document-end%22%3B%0A%09%09this.name%20%3D%20%22name%22%20in%20this.metadata%20%3F%20this.metadata.name%5B0%5D%20%3A%20this.leafName%3B%0A%09%09if%20%28this.metadata.delay%29%20%7B%0A%09%09%09let%20delay%20%3D%20parseInt%28this.metadata.delay%5B0%5D%2C%2010%29%3B%0A%09%09%09this.delay%20%3D%20isNaN%28delay%29%20%3F%200%20%3A%20Math.max%28delay%2C%200%29%3B%0A%09%09%7D%20else%20if%20%28this.run_at%20%3D%3D%3D%20%22document-idle%22%29%20%7B%0A%09%09%09this.delay%20%3D%200%3B%0A%09%09%7D%0A%09%09this.includeRegExp%20%3D%20this.metadata.include%20%3F%20this.createRegExp%28this.metadata.include%29%20%3A%20/%5Ehttps%3F%3A%5C/%5C/.*/%3B%0A%09%09this.excludeRegExp%20%3D%20this.metadata.exclude%20%3F%20this.createRegExp%28this.metadata.exclude%29%20%3A%20/%5E%24/%3B%0A%0A%09%09this.prefName%20%3D%20%27scriptival.%27%20+%20%28this.metadata.namespace%20%7C%7C%20%27nonamespace/%27%29%20+%20%27/%27%20+%20this.name%20+%20%27.%27%3B%0A%09%09this.__defineGetter__%28%27pref%27%2C%20function%28%29%20%7B%0A%09%09%09delete%20this.pref%3B%0A%09%09%09return%20this.pref%20%3D%20new%20USL.PrefManager%28this.prefName%29%3B%0A%09%09%7D%29%3B%0A%0A%09%09if%20%28this.metadata.resource%29%20%7B%0A%09%09%09this.metadata.resource.forEach%28function%28r%29%7B%0A%09%09%09%09let%20res%20%3D%20r.split%28/%5Cs+/%29%3B%0A%09%09%09%09this.resources%5Bres%5B0%5D%5D%20%3D%20%7B%20url%3A%20res%5B1%5D%20%7D%3B%0A%09%09%09%7D%2C%20this%29%3B%0A%09%09%7D%0A%0A%09%09this.getRequire%28%29%3B%0A%09%09this.getResource%28%29%3B%0A%09%7D%2C%0A%09getMetadata%3A%20function%28%29%20%7B%0A%09%09this.metadata%20%3D%20%7B%7D%3B%0A%09%09let%20m%20%3D%20this.code.match%28/%5C/%5C/%5Cs*%3D%3DUserScript%3D%3D%5B%5Cs%5CS%5D+%3F%5C/%5C/%5Cs*%3D%3D%5C/UserScript%3D%3D/%29%3B%0A%09%09if%20%28%21m%29%0A%09%09%09return%3B%0A%09%09m%20%3D%20%28m+%27%27%29.split%28/%5B%5Cr%5Cn%5D+/%29%3B%0A%09%09for%20%28let%20i%20%3D%200%3B%20i%20%26lt%3B%20m.length%3B%20i++%29%20%7B%0A%09%09%09if%20%28%21/%5C/%5C/%5Cs*%3F@%28%5CS+%29%28%24%7C%5Cs+%28%5B%5E%5Cr%5Cn%5D+%29%29/.test%28m%5Bi%5D%29%29%0A%09%09%09%09continue%3B%0A%09%09%09let%20name%20%20%3D%20RegExp.%241.toLowerCase%28%29.trim%28%29%3B%0A%09%09%09let%20value%20%3D%20RegExp.%243%3B%0A%09%09%09if%20%28this.metadata%5Bname%5D%29%20%7B%0A%09%09%09%09this.metadata%5Bname%5D.push%28value%29%3B%0A%09%09%09%7D%20else%20%7B%0A%09%09%09%09this.metadata%5Bname%5D%20%3D%20%5Bvalue%5D%3B%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%2C%0A%09createRegExp%3A%20function%28urlarray%29%20%7B%0A%09%09let%20regstr%20%3D%20urlarray.map%28function%28url%29%20%7B%0A%09%09%09url%20%3D%20url.replace%28/%28%5B%28%29%5B%5C%5D%7B%7D%7C+.%2C%5E%24%3F%5C%5C%5D%29/g%2C%20%22%5C%5C%241%22%29%3B%0A%09%09%09url%20%3D%20url.replace%28/%5C*+/g%2C%20%22.*%22%29%3B%0A%09%09%09url%20%3D%20url.replace%28/%5E%5C.%5C*%5C%3A%3F%5C/%5C//%2C%20%22https%3F%3A//%22%29%3B%0A%09%09%09url%20%3D%20url.replace%28/%5E%5C.%5C*/%2C%20%22https%3F%3A.*%22%29%3B%0A%09%09%09url%20%3D%20url.replace%28/%5E%28%5B%5E%3A%5D*%3F%3A%5C/%5C/%5B%5E%5C/%5C*%5D+%29%5C.tld%5Cb/%2C%22%241%5C.%28%3F%3Acom%7Cnet%7Corg%7Cinfo%7C%28%3F%3A%28%3F%3Aco%7Cne%7Cor%29%5C%5C.%29%3Fjp%29%22%29%3B%0A%09%09%09//url%20%3D%20url.replace%28/%5C.tld%5C//%2C%22%5C.%28%3F%3Acom%7Cnet%7Corg%7Cinfo%7C%28%3F%3A%28%3F%3Aco%7Cne%7Cor%29%5C%5C.%29%3Fjp%29/%22%29%3B%0A%09%09%09return%20%22%5E%22%20+%20url%20+%20%22%24%22%3B%0A%09%09%7D%29.join%28%27%7C%27%29%3B%0A%09%09return%20new%20RegExp%28regstr%29%3B%0A%09%7D%2C%0A%09isURLMatching%3A%20function%28url%29%20%7B%0A%09%09return%20%21this.disabled%20%26amp%3B%26amp%3B%20%0A%09%09%20%20%20%20%20%20%20%20this.includeRegExp.test%28url%29%20%26amp%3B%26amp%3B%0A%09%09%20%20%20%20%20%20%20%21this.excludeRegExp.test%28url%29%3B%0A%09%7D%2C%0A%09getResource%3A%20function%28%29%20%7B%0A%09%09if%20%28%21this.metadata.resource%29%20return%3B%0A%09%09var%20self%20%3D%20this%3B%0A%09%09for%20%28let%20%5Bname%2C%20aaa%5D%20in%20Iterator%28this.resources%29%29%20%7B%0A%09%09%09let%20obj%20%3D%20aaa%3B%0A%09%09%09let%20url%20%3D%20obj.url%3B%0A%09%09%09let%20aFile%20%3D%20USL.REQUIRES_FOLDER.clone%28%29%3B%0A%09%09%09aFile.QueryInterface%28Ci.nsILocalFile%29%3B%0A%09%09%09aFile.appendRelativePath%28encodeURIComponent%28url%29%29%3B%0A%09%09%09if%20%28aFile.exists%28%29%20%26amp%3B%26amp%3B%20aFile.isFile%28%29%29%20%7B%0A%09%09%09%09let%20fileURL%20%3D%20Services.io.getProtocolHandler%28%22file%22%29.QueryInterface%28Ci.nsIFileProtocolHandler%29.getURLSpecFromFile%28aFile%29%3B%0A%09%09%09%09USL.getLocalFileContents%28fileURL%2C%20function%28bytes%2C%20contentType%29%7B%0A%09%09%09%09%09let%20ascii%20%3D%20/%5Etext%7Cjavascript/.test%28contentType%29%3B%0A%09%09%09%09%09if%20%28ascii%29%20%7B%0A%09%09%09%09%09%09try%20%7B%20bytes%20%3D%20decodeURIComponent%28escape%28bytes%29%29%3B%20%7D%20catch%28e%29%20%7B%7D%0A%09%09%09%09%09%7D%0A%09%09%09%09%09obj.bytes%20%3D%20bytes%3B%0A%09%09%09%09%09obj.contentType%20%3D%20contentType%3B%0A%09%09%09%09%7D%29%3B%0A%09%09%09%09continue%3B%0A%09%09%09%7D%0A%09%09%09USL.getContents%28url%2C%20function%28bytes%2C%20contentType%29%7B%0A%09%09%09%09let%20ascii%20%3D%20/%5Etext%7Cjavascript/.test%28contentType%29%3B%0A%09%09%09%09if%20%28ascii%29%20%7B%0A%09%09%09%09%09try%20%7B%20bytes%20%3D%20decodeURIComponent%28escape%28bytes%29%29%3B%20%7D%20catch%28e%29%20%7B%7D%0A%09%09%09%09%7D%0A%09%09%09%09let%20data%20%3D%20ascii%20%3F%20USL.saveText%28aFile%2C%20bytes%29%20%3A%20USL.saveFile%28aFile%2C%20bytes%29%3B%0A%09%09%09%09obj.bytes%20%3D%20data%3B%0A%09%09%09%09obj.contentType%20%3D%20contentType%3B%0A%09%09%09%7D%29%3B%0A%09%09%7D%0A%09%7D%2C%0A%09getRequire%3A%20function%28%29%20%7B%0A%09%09if%20%28%21this.metadata.require%29%20return%3B%0A%09%09var%20self%20%3D%20this%3B%0A%09%09this.metadata.require.forEach%28function%28url%29%7B%0A%09%09%09let%20aFile%20%3D%20USL.REQUIRES_FOLDER.clone%28%29%3B%0A%09%09%09aFile.QueryInterface%28Ci.nsILocalFile%29%3B%0A%09%09%09aFile.appendRelativePath%28encodeURIComponent%28url%29%29%3B%0A%09%09%09if%20%28aFile.exists%28%29%20%26amp%3B%26amp%3B%20aFile.isFile%28%29%29%20%7B%0A%09%09%09%09self.requireSrc%20+%3D%20USL.loadText%28aFile%29%20+%20%22%3B%5Cr%5Cn%22%3B%0A%09%09%09%09return%3B%0A%09%09%09%7D%0A%09%09%09USL.getContents%28url%2C%20function%28bytes%2C%20contentType%29%7B%0A%09%09%09%09let%20ascii%20%3D%20/%5Etext%7Cjavascript/.test%28contentType%29%3B%0A%09%09%09%09if%20%28ascii%29%20%7B%0A%09%09%09%09%09try%20%7B%20bytes%20%3D%20decodeURIComponent%28escape%28bytes%29%29%3B%20%7D%20catch%28e%29%20%7B%7D%0A%09%09%09%09%7D%0A%09%09%09%09let%20data%20%3D%20ascii%20%3F%20USL.saveText%28aFile%2C%20bytes%29%20%3A%20USL.saveFile%28aFile%2C%20bytes%29%3B%0A%09%09%09%09self.requireSrc%20+%3D%20data%20+%20%27%3B%5Cr%5Cn%27%3B%0A%09%09%09%7D%29%3B%0A%09%09%7D%2C%20this%29%3B%0A%09%7D%2C%0A%7D%3B%0A%0AUSL.Console%20%3D%20function%20Console%28%29%20%7B%7D%3B%0AUSL.Console.prototype%20%3D%20%7B%0A%09__exposedProps__%3A%20%7B%0A%09%09log%3A%20%22r%22%2C%0A%09%09dir%3A%20%22r%22%2C%0A%09%09time%3A%20%22r%22%2C%0A%09%09timeEnd%3A%20%22r%22%2C%0A%09%7D%2C%0A%09log%3A%20function%28str%29%7B%20Application.console.log%28str%29%3B%20%7D%2C%0A%09dir%3A%20function%28obj%29%7B%20window.inspectObject%3F%20inspectObject%28obj%29%3A%20this.log%28obj%29%3B%20%7D%2C%0A%09time%3A%20function%28name%29%20%7B%20this%5B%27_%27%20+%20name%5D%20%3D%20new%20Date%28%29.getTime%28%29%3B%20%7D%2C%0A%09timeEnd%3A%20function%28name%29%20%7B%0A%09%09if%20%28typeof%20this%5B%27_%27%20+%20name%5D%20%3D%3D%20%27undefined%27%29%0A%09%09%09return%20this.log%28%27timeEnd%3A%20Error%27%20+%20name%29%3B%0A%09%09this.log%28name%20+%20%27%3A%27%20+%20%28new%20Date%28%29.getTime%28%29%20-%20this%5B%27_%27%20+%20name%5D%29%29%3B%0A%09%09delete%20this%5B%27_%27%20+%20name%5D%3B%0A%09%7D%2C%0A%09__noSuchMethod__%3A%20function%28id%2C%20args%29%7B%20this.log%28%27console.%27%20+%20id%20+%20%27%20is%20not%20function%27%29%3B%20%7D%0A%7D%3B%0A%0AUSL.API%20%3D%20function%28script%2C%20sandbox%2C%20win%2C%20doc%29%20%7B%0A%09var%20self%20%3D%20this%3B%0A%0A%09this.GM_log%20%3D%20function%28%29%20%7B%0A%09%09Services.console.logStringMessage%28%22%5B%22+%20script.name%20+%22%5D%20%22%20+%20Array.slice%28arguments%29.join%28%22%2C%20%22%29%29%3B%0A%09%7D%3B%0A%0A%09this.GM_xmlhttpRequest%20%3D%20function%28obj%29%20%7B%0A%09%09if%28typeof%28obj%29%20%21%3D%20%27object%27%20%7C%7C%20%28typeof%28obj.url%29%20%21%3D%20%27string%27%20%26amp%3B%26amp%3B%20%21%28obj.url%20instanceof%20String%29%29%29%20return%3B%0A%0A%09%09var%20baseURI%20%3D%20Services.io.newURI%28win.location.href%2C%20null%2C%20null%29%3B%0A%09%09obj.url%20%3D%20Services.io.newURI%28obj.url%2C%20null%2C%20baseURI%29.spec%3B%0A%09%09var%20req%20%3D%20new%20XMLHttpRequest%28%29%3B%0A%09%09req.open%28obj.method%20%7C%7C%20%27GET%27%2Cobj.url%2Ctrue%29%3B%0A%09%09if%28typeof%28obj.headers%29%20%3D%3D%20%27object%27%29%20for%28var%20i%20in%20obj.headers%29%20req.setRequestHeader%28i%2Cobj.headers%5Bi%5D%29%3B%0A%09%09%5B%27onload%27%2C%27onerror%27%2C%27onreadystatechange%27%5D.forEach%28function%28k%29%20%7B%0A%09%09%09if%28obj%5Bk%5D%20%26amp%3B%26amp%3B%20%28typeof%28obj%5Bk%5D%29%20%3D%3D%20%27function%27%20%7C%7C%20obj%5Bk%5D%20instanceof%20Function%29%29%20req%5Bk%5D%20%3D%20function%28%29%20%7B%0A%09%09%09%09obj%5Bk%5D%28%7B%0A%09%09%09%09%09__exposedProps__%3A%20%7B%0A%09%09%09%09%09%09status%3A%20%22r%22%2C%0A%09%09%09%09%09%09statusText%3A%20%22r%22%2C%0A%09%09%09%09%09%09responseHeaders%3A%20%22r%22%2C%0A%09%09%09%09%09%09responseText%3A%20%22rw%22%2C%0A%09%09%09%09%09%09readyState%3A%20%22r%22%2C%0A%09%09%09%09%09%09finalUrl%3A%20%22r%22%0A%09%09%09%09%09%7D%2C%0A%09%09%09%09%09status%20%20%20%20%20%20%20%20%20%20%3A%20%28req.readyState%20%3D%3D%204%29%20%3F%20req.status%20%3A%200%2C%0A%09%09%09%09%09statusText%20%20%20%20%20%20%3A%20%28req.readyState%20%3D%3D%204%29%20%3F%20req.statusText%20%3A%20%27%27%2C%0A%09%09%09%09%09responseHeaders%20%3A%20%28req.readyState%20%3D%3D%204%29%20%3F%20req.getAllResponseHeaders%28%29%20%3A%20%27%27%2C%0A%09%09%09%09%09responseText%20%20%20%20%3A%20req.responseText%2C%0A%09%09%09%09%09readyState%20%20%20%20%20%20%3A%20req.readyState%2C%0A%09%09%09%09%09finalUrl%20%20%20%20%20%20%20%20%3A%20%28req.readyState%20%3D%3D%204%29%20%3F%20req.channel.URI.spec%20%3A%20%27%27%20%7D%29%3B%0A%09%09%09%7D%3B%0A%09%09%7D%29%3B%0A%0A%09%09if%28obj.overrideMimeType%29%20req.overrideMimeType%28obj.overrideMimeType%29%3B%0A%09%09var%20c%20%3D%200%3B%0A%09%09var%20timer%20%3D%20setInterval%28function%28%29%20%7B%20if%28req.readyState%20%3D%3D%201%20%7C%7C%20++c%20%26gt%3B%20100%29%20%7B%20clearInterval%28timer%29%3B%20req.send%28obj.data%20%7C%7C%20null%29%3B%20%7D%20%7D%2C10%29%3B%0A%09%09USL.debug%28script.name%20+%20%27%20GM_xmlhttpRequest%20%27%20+%20obj.url%29%3B%0A%09%7D%3B%0A%0A%09this.GM_addStyle%20%3D%20function%20GM_addStyle%28code%29%20%7B%0A%09%09var%20head%20%3D%20doc.getElementsByTagName%28%27head%27%29%5B0%5D%3B%0A%09%09if%20%28head%29%20%7B%0A%09%09%09var%20style%20%3D%20doc.createElement%28%27style%27%29%3B%0A%09%09%09style.type%20%3D%20%27text/css%27%3B%0A%09%09%09style.appendChild%28doc.createTextNode%28code+%27%27%29%29%3B%0A%09%09%09head.appendChild%28style%29%3B%0A%09%09%09return%20style%3B%0A%09%09%7D%0A%09%7D%3B%0A%0A%09this.GM_setValue%20%3D%20function%28name%2C%20value%29%20%7B%0A%09%09return%20USL.USE_STORAGE_NAME.indexOf%28name%29%20%26gt%3B%3D%200%3F%0A%09%09%09USL.database.pref%5Bscript.prefName%20+%20name%5D%20%3D%20value%3A%0A%09%09%09script.pref.setValue%28name%2C%20value%29%3B%0A%09%7D%3B%0A%0A%09this.GM_getValue%20%3D%20function%28name%2C%20def%29%20%7B%0A%09%09return%20USL.USE_STORAGE_NAME.indexOf%28name%29%20%26gt%3B%3D%200%3F%0A%09%09%09USL.database.pref%5Bscript.prefName%20+%20name%5D%20%7C%7C%20def%3A%0A%09%09%09script.pref.getValue%28name%2C%20def%29%3B%0A%09%7D%3B%0A%0A%09this.GM_listValues%20%3D%20function%28%29%20%7B%0A%09%09var%20p%20%3D%20script.pref.listValues%28%29%3B%0A%09%09var%20s%20%3D%20%5Bx%20for%28x%20in%20USL.database.pref%5Bscript.prefName%20+%20name%5D%29%5D%3B%0A%09%09s.forEach%28function%28e%2C%20i%2C%20a%29%20a%5Bi%5D%20%3D%20e.replace%28script.prefName%2C%20%27%27%29%29%3B%0A%09%09p.push.apply%28p%2C%20s%29%3B%0A%09%09return%20p%3B%0A%09%7D%3B%0A%0A%09this.GM_deleteValue%20%3D%20function%28name%29%20%7B%0A%09%09return%20USL.USE_STORAGE_NAME.indexOf%28name%29%20%26gt%3B%3D%200%3F%0A%09%09%09delete%20USL.database.pref%5Bscript.prefName%20+%20name%5D%3A%0A%09%09%09script.pref.deleteValue%28name%29%3B%0A%09%7D%3B%0A%0A%09this.GM_registerMenuCommand%20%3D%20function%28label%2C%20func%2C%20aAccelKey%2C%20aAccelModifiers%2C%20aAccessKey%29%20%7B%0A%09%09let%20uuid%20%3D%20self.GM_generateUUID%28%29%3B%0A%09%09win.USL_registerCommands%5Buuid%5D%20%3D%20%7B%0A%09%09%09label%3A%20label%2C%0A%09%09%09func%3A%20func%2C%0A%09%09%09accelKey%3A%20aAccelKey%2C%0A%09%09%09accelModifiers%3A%20aAccelModifiers%2C%0A%09%09%09accessKey%3A%20aAccessKey%2C%0A%09%09%09tooltiptext%3A%20script.name%0A%09%09%7D%3B%0A%09%09return%20uuid%3B%0A%09%7D%3B%0A%09%0A%09this.GM_unregisterMenuCommand%20%3D%20function%28aUUID%29%20%7B%0A%09%09return%20delete%20win.USL_registerCommands%5BaUUID%5D%3B%0A%09%7D%3B%0A%0A%09this.GM_enableMenuCommand%20%3D%20function%28aUUID%29%20%7B%0A%09%09let%20item%20%3D%20win.USL_registerCommands%5BaUUID%5D%3B%0A%09%09if%20%28item%29%20delete%20item.disabled%3B%0A%09%7D%3B%0A%09%0A%09this.GM_disableMenuCommand%20%3D%20function%28aUUID%29%20%7B%0A%09%09let%20item%20%3D%20win.USL_registerCommands%5BaUUID%5D%3B%0A%09%09if%20%28item%29%20item.disabled%20%3D%20%22true%22%3B%0A%09%7D%3B%0A%0A%09this.GM_getResourceText%20%3D%20function%28name%29%20%7B%0A%09%09let%20obj%20%3D%20script.resources%5Bname%5D%3B%0A%09%09if%20%28obj%29%20return%20obj.bytes%3B%0A%09%7D%3B%0A%0A%09this.GM_getResourceURL%20%3D%20function%28name%29%20%7B%0A%09%09let%20obj%20%3D%20script.resources%5Bname%5D%3B%0A%09%09try%20%7B%0A%09%09%09if%20%28obj%29%20return%20%27data%3A%27%20+%20obj.contentType%20+%20%27%3Bbase64%2C%27%20+%20btoa%28obj.bytes%29%3B%0A%09%09%7D%20catch%20%28e%29%20%7B%0A%09%09%09USL.error%28e%29%3B%0A%09%09%7D%0A%09%7D%3B%0A%0A%09this.GM_getMetadata%20%3D%20function%28key%29%20%7B%0A%09%09return%20script.metadata%5Bkey%5D%20%3F%20script.metadata%5Bkey%5D.slice%28%29%20%3A%20void%200%3B%0A%09%7D%3B%0A%7D%3B%0AUSL.API.prototype%20%3D%20%7B%0A%09GM_openInTab%3A%20function%28url%2C%20loadInBackground%2C%20reuseTab%29%20%7B%0A%09%09openLinkIn%28url%2C%20loadInBackground%20%3F%20%22tabshifted%22%20%3A%20%22tab%22%2C%20%7B%7D%29%3B%0A%09%7D%2C%0A%09GM_setClipboard%3A%20function%28str%29%20%7B%0A%09%09if%20%28str.constructor%20%3D%3D%3D%20String%20%7C%7C%20str.constructor%20%3D%3D%3D%20Number%29%20%7B%0A%09%09%09Cc%5B%27@mozilla.org/widget/clipboardhelper%3B1%27%5D.getService%28Ci.nsIClipboardHelper%29.copyString%28str%29%3B%0A%09%09%7D%0A%09%7D%2C%0A%09GM_safeHTMLParser%3A%20function%28code%29%20%7B%0A%09%09let%20HTMLNS%20%3D%20%22http%3A//www.w3.org/1999/xhtml%22%3B%0A%09%09let%20gUnescapeHTML%20%3D%20Cc%5B%22@mozilla.org/feed-unescapehtml%3B1%22%5D.getService%28Ci.nsIScriptableUnescapeHTML%29%3B%0A%09%09let%20doc%20%3D%20document.implementation.createDocument%28HTMLNS%2C%20%22html%22%2C%20null%29%3B%0A%09%09let%20body%20%3D%20document.createElementNS%28HTMLNS%2C%20%22body%22%29%3B%0A%09%09doc.documentElement.appendChild%28body%29%3B%0A%09%09body.appendChild%28gUnescapeHTML.parseFragment%28code%2C%20false%2C%20null%2C%20body%29%29%3B%0A%09%09return%20doc%3B%0A%09%7D%2C%0A%09GM_generateUUID%3A%20function%28%29%20%7B%0A%09%09return%20Cc%5B%22@mozilla.org/uuid-generator%3B1%22%5D.getService%28Ci.nsIUUIDGenerator%29.generateUUID%28%29.toString%28%29%3B%0A%09%7D%2C%0A%7D%3B%0A%0A%0AUSL.database%20%3D%20%7B%20pref%3A%20%7B%7D%2C%20resource%3A%20%7B%7D%20%7D%3B%0AUSL.readScripts%20%3D%20%5B%5D%3B%0AUSL.USE_STORAGE_NAME%20%3D%20%5B%27cache%27%2C%20%27cacheInfo%27%5D%3B%0AUSL.initialized%20%3D%20false%3B%0AUSL.eventName%20%3D%20%22USL_DocumentStart%22%20+%20Math.random%28%29%3B%0A%0AUSL.__defineGetter__%28%22pref%22%2C%20function%28%29%7B%0A%09delete%20this.pref%3B%0A%09return%20this.pref%20%3D%20new%20USL.PrefManager%28%29%3B%0A%7D%29%3B%0A%0AUSL.__defineGetter__%28%22SCRIPTS_FOLDER%22%2C%20function%28%29%7B%0A%09let%20folderPath%20%3D%20this.pref.getValue%28%27SCRIPTS_FOLDER%27%2C%20%22%22%29%3B%0A%09let%20aFolder%20%3D%20Cc%5B%27@mozilla.org/file/local%3B1%27%5D.createInstance%28Ci.nsILocalFile%29%0A%09if%20%28%21folderPath%29%20%7B%0A%09%09aFolder.initWithPath%28Services.dirsvc.get%28%22UChrm%22%2C%20Ci.nsIFile%29.path%29%3B%0A%09%09aFolder.appendRelativePath%28%27UserScriptLoader%27%29%3B%0A%09%7D%20else%20%7B%0A%09%09aFolder.initWithPath%28folderPath%29%3B%0A%09%7D%0A%09if%20%28%20%21aFolder.exists%28%29%20%7C%7C%20%21aFolder.isDirectory%28%29%20%29%20%7B%0A%09%09aFolder.create%28Ci.nsIFile.DIRECTORY_TYPE%2C%200664%29%3B%0A%09%7D%0A%09delete%20this.SCRIPTS_FOLDER%3B%0A%09return%20this.SCRIPTS_FOLDER%20%3D%20aFolder%3B%0A%7D%29%3B%0A%0AUSL.__defineGetter__%28%22REQUIRES_FOLDER%22%2C%20function%28%29%7B%0A%09let%20aFolder%20%3D%20this.SCRIPTS_FOLDER.clone%28%29%3B%0A%09aFolder.QueryInterface%28Ci.nsILocalFile%29%3B%0A%09aFolder.appendRelativePath%28%27require%27%29%3B%0A%09if%20%28%20%21aFolder.exists%28%29%20%7C%7C%20%21aFolder.isDirectory%28%29%20%29%20%7B%0A%09%09aFolder.create%28Ci.nsIFile.DIRECTORY_TYPE%2C%200664%29%3B%0A%09%7D%0A%09delete%20this.REQUIRES_FOLDER%3B%0A%09return%20this.REQUIRES_FOLDER%20%3D%20aFolder%3B%0A%7D%29%3B%0A%0AUSL.__defineGetter__%28%22EDITOR%22%2C%20function%28%29%7B%0A%09delete%20this.EDITOR%3B%0A%09return%20this.EDITOR%20%3D%20this.pref.getValue%28%27EDITOR%27%2C%20%22%22%29%20%7C%7C%20Services.prefs.getCharPref%28%22view_source.editor.path%22%29%3B%0A%7D%29%3B%0A%0AUSL.__defineGetter__%28%22disabled_scripts%22%2C%20function%28%29%7B%0A%09let%20ds%20%3D%20this.pref.getValue%28%27script.disabled%27%2C%20%27%27%29%3B%0A%09delete%20this.disabled_scripts%3B%0A%09return%20this.disabled_scripts%20%3D%20ds%3F%20ds.split%28%27%7C%27%29%20%3A%20%5B%5D%3B%0A%7D%29%3B%0A%0AUSL.__defineGetter__%28%22GLOBAL_EXCLUDES_REGEXP%22%2C%20function%28%29%7B%0A%09let%20regexp%20%3D%20null%3B%0A%09let%20ge%20%3D%20USL.pref.getValue%28%27GLOBAL_EXCLUDES%27%2C%20null%29%3B%0A%09ge%20%3D%20ge%20%3F%20ge.trim%28%29.split%28/%5Cs*%5C%2C%5Cs*/%29%20%3A%20GLOBAL_EXCLUDES%3B%0A%09try%20%7B%0A%09%09regexp%20%3D%20new%20RegExp%28ge.map%28USL.wildcardToRegExpStr%29.join%28%22%7C%22%29%29%3B%0A%09%7D%20catch%20%28e%29%20%7B%0A%09%09regexp%20%3D%20/%5E%28%3F%3Achrome%7Cresource%7Cjar%29%3A/%3B%0A%09%7D%0A%09delete%20this.GLOBAL_EXCLUDES_REGEXP%3B%0A%09return%20this.GLOBAL_EXCLUDES_REGEXP%20%3D%20regexp%3B%0A%7D%29%3B%0A%0Avar%20DISABLED%20%3D%20true%3B%0AUSL.__defineGetter__%28%22disabled%22%2C%20function%28%29%20DISABLED%29%3B%0AUSL.__defineSetter__%28%22disabled%22%2C%20function%28bool%29%7B%0A%09if%20%28bool%29%20%7B%0A%09%09this.icon.setAttribute%28%22state%22%2C%20%22disable%22%29%3B%0A%09%09gBrowser.mPanelContainer.removeEventListener%28USL.eventName%2C%20this%2C%20false%29%3B%0A%09%7D%20else%20%7B%0A%09%09this.icon.setAttribute%28%22state%22%2C%20%22enable%22%29%3B%0A%09%09gBrowser.mPanelContainer.addEventListener%28USL.eventName%2C%20this%2C%20false%29%3B%0A%09%7D%0A%09return%20DISABLED%20%3D%20bool%3B%0A%7D%29%3B%0A%0Avar%20DEBUG%20%3D%20USL.pref.getValue%28%27DEBUG%27%2C%20false%29%3B%0AUSL.__defineGetter__%28%22DEBUG%22%2C%20function%28%29%20DEBUG%29%3B%0AUSL.__defineSetter__%28%22DEBUG%22%2C%20function%28bool%29%20%7B%0A%09DEBUG%20%3D%20%21%21bool%3B%0A%09let%20elem%20%3D%20%24%28%22UserScriptLoader-debug-mode%22%29%3B%0A%09if%20%28elem%29%20elem.setAttribute%28%22checked%22%2C%20DEBUG%29%3B%0A%09return%20bool%3B%0A%7D%29%3B%0A%0Avar%20HIDE_EXCLUDE%20%3D%20USL.pref.getValue%28%27HIDE_EXCLUDE%27%2C%20false%29%3B%0AUSL.__defineGetter__%28%22HIDE_EXCLUDE%22%2C%20function%28%29%20HIDE_EXCLUDE%29%3B%0AUSL.__defineSetter__%28%22HIDE_EXCLUDE%22%2C%20function%28bool%29%7B%0A%09HIDE_EXCLUDE%20%3D%20%21%21bool%3B%0A%09let%20elem%20%3D%20%24%28%22UserScriptLoader-hide-exclude%22%29%3B%0A%09if%20%28elem%29%20elem.setAttribute%28%22checked%22%2C%20HIDE_EXCLUDE%29%3B%0A%09return%20bool%3B%0A%7D%29%3B%0A%0Avar%20CACHE_SCRIPT%20%3D%20USL.pref.getValue%28%27CACHE_SCRIPT%27%2C%20true%29%3B%0AUSL.__defineGetter__%28%22CACHE_SCRIPT%22%2C%20function%28%29%20CACHE_SCRIPT%29%3B%0AUSL.__defineSetter__%28%22CACHE_SCRIPT%22%2C%20function%28bool%29%7B%0A%09CACHE_SCRIPT%20%3D%20%21%21bool%3B%0A%09let%20elem%20%3D%20%24%28%22UserScriptLoader-cache-script%22%29%3B%0A%09if%20%28elem%29%20elem.setAttribute%28%22checked%22%2C%20CACHE_SCRIPT%29%3B%0A%09return%20bool%3B%0A%7D%29%3B%0A%0AUSL.getFocusedWindow%20%3D%20function%20%28%29%20%7B%0A%09var%20win%20%3D%20document.commandDispatcher.focusedWindow%3B%0A%09return%20%28%21win%20%7C%7C%20win%20%3D%3D%20window%29%20%3F%20content%20%3A%20win%3B%0A%7D%3B%0A%0AUSL.init%20%3D%20function%28%29%7B%0A%09USL.loadSetting%28%29%3B%0A%09USL.style%20%3D%20addStyle%28css%29%3B%0A%0A%09USL.icon%20%3D%20%24%28%27status-bar%27%29.appendChild%28%24E%28%0A%09%09%26lt%3Bstatusbarpanel%20id%3D%22UserScriptLoader-icon%22%20%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20class%3D%22statusbarpanel-iconic%22%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20context%3D%22UserScriptLoader-popup%22%20%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20onclick%3D%22USL.iconClick%28event%29%3B%22%20%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20style%3D%22text-decoration%3A%20none%3B%22/%26gt%3B%0A%09%29%29%3B%0A%0A/*%09USL.icon%20%3D%20%24%28%27urlbar-icons%27%29.appendChild%28%24E%28%0A%09%09%26lt%3Bimage%20id%3D%22UserScriptLoader-icon%22%20%0A%09%09%20%20%20%20%20%20%20context%3D%22UserScriptLoader-popup%22%20%0A%09%09%20%20%20%20%20%20%20onclick%3D%22USL.iconClick%28event%29%3B%22/%26gt%3B%0A%09%29%29%3B%0A*/%09%0A%20%20%20%20%20%20%20%20USL.icon.style.padding%20%3D%20%270px%202px%27%3B%0A%09%0A%09USL.popup%20%3D%20%24%28%27mainPopupSet%27%29.appendChild%28%24E%28%0A%09%09%26lt%3Bmenupopup%20id%3D%22UserScriptLoader-popup%22%20%0A%09%09%20%20%20%20%20%20%20%20%20%20%20onpopupshowing%3D%22USL.onPopupShowing%28event%29%3B%22%0A%09%09%20%20%20%20%20%20%20%20%20%20%20onpopuphidden%3D%22USL.onPopupHidden%28event%29%3B%22%0A%09%09%20%20%20%20%20%20%20%20%20%20%20onclick%3D%22USL.menuClick%28event%29%3B%22%26gt%3B%0A%09%09%09%26lt%3Bmenuseparator%20id%3D%22UserScriptLoader-menuseparator%22/%26gt%3B%0A%09%09%09%26lt%3Bmenu%20label%3D%22User%20Script%20Command%22%0A%09%09%09%20%20%20%20%20%20id%3D%22UserScriptLoader-register-menu%22%0A%09%09%09%20%20%20%20%20%20accesskey%3D%22C%22%26gt%3B%0A%09%09%09%09%26lt%3Bmenupopup%20id%3D%22UserScriptLoader-register-popup%22/%26gt%3B%0A%09%09%09%26lt%3B/menu%26gt%3B%0A%09%09%09%26lt%3Bmenuitem%20label%3D%22Save%20Script%22%0A%09%09%09%20%20%20%20%20%20%20%20%20%20id%3D%22UserScriptLoader-saveMenu%22%0A%09%09%09%20%20%20%20%20%20%20%20%20%20accesskey%3D%22S%22%0A%09%09%09%20%20%20%20%20%20%20%20%20%20oncommand%3D%22USL.saveScript%28%29%3B%22/%26gt%3B%0A%09%09%09%26lt%3Bmenu%20label%3D%22Menu%22%20id%3D%22UserScriptLoader-submenu%22%26gt%3B%0A%09%09%09%09%26lt%3Bmenupopup%20id%3D%22UserScriptLoader-submenu-popup%22%26gt%3B%0A%09%09%09%09%09%26lt%3Bmenuitem%20label%3D%22delete%20pref%20storage%22%0A%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20oncommand%3D%22USL.deleteStorage%28%27pref%27%29%3B%22%20/%26gt%3B%0A%09%09%09%09%09%26lt%3Bmenuseparator/%26gt%3B%0A%09%09%09%09%09%26lt%3Bmenuitem%20label%3D%22Hide%20exclude%20script%22%0A%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20id%3D%22UserScriptLoader-hide-exclude%22%0A%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20accesskey%3D%22N%22%0A%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20type%3D%22checkbox%22%0A%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20checked%3D%7BUSL.HIDE_EXCLUDE%7D%0A%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20oncommand%3D%22USL.HIDE_EXCLUDE%20%3D%20%21USL.HIDE_EXCLUDE%3B%22%20/%26gt%3B%0A%09%09%09%09%09%26lt%3Bmenuitem%20label%3D%22Open%20Scripts%20Folder%22%0A%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20id%3D%22UserScriptLoader-openFolderMenu%22%0A%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20accesskey%3D%22O%22%0A%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20oncommand%3D%22USL.openFolder%28%29%3B%22%20/%26gt%3B%0A%09%09%09%09%09%26lt%3Bmenuitem%20label%3D%22Rebuild%22%0A%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20accesskey%3D%22R%22%0A%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20oncommand%3D%22USL.rebuild%28%29%3B%22%20/%26gt%3B%0A%09%09%09%09%09%26lt%3Bmenuitem%20label%3D%22Cache%20Script%22%0A%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20id%3D%22UserScriptLoader-cache-script%22%0A%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20accesskey%3D%22C%22%0A%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20type%3D%22checkbox%22%0A%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20checked%3D%7BUSL.CACHE_SCRIPT%7D%0A%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20oncommand%3D%22USL.CACHE_SCRIPT%20%3D%20%21USL.CACHE_SCRIPT%3B%22%20/%26gt%3B%0A%09%09%09%09%09%26lt%3Bmenuitem%20label%3D%22DEBUG%20MODE%22%0A%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20id%3D%22UserScriptLoader-debug-mode%22%0A%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20accesskey%3D%22D%22%0A%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20type%3D%22checkbox%22%0A%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20checked%3D%7BUSL.DEBUG%7D%0A%09%09%09%09%09%20%20%20%20%20%20%20%20%20%20oncommand%3D%22USL.DEBUG%20%3D%20%21USL.DEBUG%3B%22%20/%26gt%3B%0A%09%09%09%09%26lt%3B/menupopup%26gt%3B%0A%09%09%09%26lt%3B/menu%26gt%3B%0A%09%09%26lt%3B/menupopup%26gt%3B%0A%09%29%29%3B%0A%0A%09USL.menuseparator%20%3D%20%24%28%27UserScriptLoader-menuseparator%27%29%3B%0A%09USL.registMenu%20%20%20%20%3D%20%24%28%27UserScriptLoader-register-menu%27%29%3B%0A%09USL.saveMenu%20%20%20%20%20%20%3D%20%24%28%27UserScriptLoader-saveMenu%27%29%3B%0A%0A%09USL.rebuild%28%29%3B%0A%09USL.disabled%20%3D%20USL.pref.getValue%28%27disabled%27%2C%20false%29%3B%0A%09window.addEventListener%28%27unload%27%2C%20USL%2C%20false%29%3B%0A%09Services.obs.addObserver%28USL%2C%20%22content-document-global-created%22%2C%20false%29%3B%0A%09USL.debug%28%27observer%20start%27%29%3B%0A%09USL.initialized%20%3D%20true%3B%0A%7D%3B%0A%0AUSL.uninit%20%3D%20function%20%28%29%20%7B%0A%09window.removeEventListener%28%27unload%27%2C%20USL%2C%20false%29%3B%0A%09Services.obs.removeObserver%28USL%2C%20%22content-document-global-created%22%29%3B%0A%09USL.debug%28%27observer%20end%27%29%3B%0A%09USL.saveSetting%28%29%3B%0A%7D%3B%0A%0AUSL.destroy%20%3D%20function%20%28%29%20%7B%0A%09window.removeEventListener%28%27unload%27%2C%20USL%2C%20false%29%3B%0A%09Services.obs.removeObserver%28USL%2C%20%22content-document-global-created%22%29%3B%0A%09USL.log%28%27observer%20end%27%29%3B%0A%0A%09let%20disabledScripts%20%3D%20%5Bx.leafName%20for%20each%28x%20in%20USL.readScripts%29%20if%20%28x.disabled%29%5D%3B%0A%09USL.pref.setValue%28%27script.disabled%27%2C%20disabledScripts.join%28%27%7C%27%29%29%3B%0A%09USL.pref.setValue%28%27disabled%27%2C%20USL.disabled%29%3B%0A%09USL.pref.setValue%28%27HIDE_EXCLUDE%27%2C%20USL.HIDE_EXCLUDE%29%3B%0A%0A%09var%20e%20%3D%20document.getElementById%28%22UserScriptLoader-icon%22%29%3B%0A%09if%20%28e%29%20e.parentNode.removeChild%28e%29%3B%0A%09var%20e%20%3D%20document.getElementById%28%22UserScriptLoader-popup%22%29%3B%0A%09if%20%28e%29%20e.parentNode.removeChild%28e%29%3B%0A%09if%20%28USL.style%29%20USL.style.parentNode.removeChild%28USL.style%29%3B%0A%09USL.disabled%20%3D%20true%3B%0A%7D%3B%0A%0AUSL.handleEvent%20%3D%20function%20%28event%29%20%7B%0A%09switch%28event.type%29%20%7B%0A%09%09case%20USL.eventName%3A%0A%09%09%09var%20win%20%3D%20event.target.defaultView%3B%0A%09%09%09win.USL_registerCommands%20%3D%20%7B%7D%3B%0A%09%09%09win.USL_run%20%3D%20%5B%5D%3B%0A%09%09%09if%20%28USL.disabled%29%20return%3B%0A%09%09%09if%20%28USL.readScripts.length%20%3D%3D%3D%200%29%20return%3B%0A%09%09%09this.injectScripts%28win%29%3B%0A%09%09%09break%3B%0A%09%09case%20%22unload%22%3A%0A%09%09%09this.uninit%28%29%3B%0A%09%09%09break%3B%0A%09%7D%0A%7D%3B%0A%0AUSL.observe%20%3D%20function%20%28subject%2C%20topic%2C%20data%29%20%7B%0A%09if%20%28topic%20%3D%3D%3D%20%22content-document-global-created%22%29%20%7B%0A%09%09var%20doc%20%3D%20subject.document%3B%0A%09%09var%20evt%20%3D%20doc.createEvent%28%22Events%22%29%3B%0A%09%09evt.initEvent%28USL.eventName%2C%20true%2C%20false%29%3B%0A%09%09doc.dispatchEvent%28evt%29%3B%0A%09%7D%0A%7D%3B%0A%0AUSL.createMenuitem%20%3D%20function%20%28%29%20%7B%0A%09if%20%28USL.popup.firstChild%20%21%3D%20USL.menuseparator%29%20%7B%0A%09%09var%20range%20%3D%20document.createRange%28%29%3B%0A%09%09range.setStartBefore%28USL.popup.firstChild%29%3B%0A%09%09range.setEndBefore%28USL.menuseparator%29%3B%0A%09%09range.deleteContents%28%29%3B%0A%09%09range.detach%28%29%3B%0A%09%7D%0A%09USL.readScripts.forEach%28function%28script%29%7B%0A%09%09let%20m%20%3D%20document.createElement%28%27menuitem%27%29%3B%0A%09%09m.setAttribute%28%27label%27%2C%20script.name%29%3B%0A%09%09m.setAttribute%28%22class%22%2C%20%22UserScriptLoader-item%22%29%3B%0A%09%09m.setAttribute%28%27checked%27%2C%20%21script.disabled%29%3B%0A%09%09m.setAttribute%28%27type%27%2C%20%27checkbox%27%29%3B%0A%09%09m.setAttribute%28%27oncommand%27%2C%20%27this.script.disabled%20%3D%20%21this.script.disabled%3B%27%29%3B%0A%09%09m.script%20%3D%20script%3B%0A%09%09USL.popup.insertBefore%28m%2C%20USL.menuseparator%29%3B%0A%09%7D%29%3B%0A%7D%3B%0A%0AUSL.rebuild%20%3D%20function%28%29%20%7B%0A%09USL.disabled_scripts%20%3D%20%5Bx.leafName%20for%20each%28x%20in%20USL.readScripts%29%20if%20%28x.disabled%29%5D%3B%0A%09USL.pref.setValue%28%27script.disabled%27%2C%20USL.disabled_scripts.join%28%27%7C%27%29%29%3B%0A%0A%09let%20newScripts%20%3D%20%5B%5D%3B%0A%09let%20ext%20%3D%20/%5C.user%5C.js%24/i%3B%0A%09let%20files%20%3D%20USL.SCRIPTS_FOLDER.directoryEntries.QueryInterface%28Ci.nsISimpleEnumerator%29%3B%0A%0A%09while%20%28files.hasMoreElements%28%29%29%20%7B%0A%09%09let%20file%20%3D%20files.getNext%28%29.QueryInterface%28Ci.nsIFile%29%3B%0A%09%09if%20%28%21ext.test%28file.leafName%29%29%20continue%3B%0A%09%09let%20script%20%3D%20loadScript%28file%29%3B%0A%09%09newScripts.push%28script%29%3B%0A%09%7D%0A%09USL.readScripts%20%3D%20newScripts%3B%0A%09USL.createMenuitem%28%29%3B%0A%0A%09function%20loadScript%28aFile%29%20%7B%0A%09%09var%20script%2C%0A%09%09%20%20%20%20leafName%20%3D%20aFile.leafName%2C%0A%09%09%20%20%20%20lastModifiedTime%20%3D%20aFile.lastModifiedTime%3B%0A%09%09USL.readScripts.some%28function%28s%2C%20i%29%7B%0A%09%09%09if%20%28s.leafName%20%3D%3D%3D%20leafName%29%20%7B%0A%09%09%09%09if%20%28s.lastModifiedTime%20%21%3D%3D%20lastModifiedTime%20%26amp%3B%26amp%3B%20USL.initialized%29%20%7B%0A%09%09%09%09%09USL.log%28s.name%20+%20%22%20reload.%22%29%3B%0A%09%09%09%09%09return%20true%3B%0A%09%09%09%09%7D%0A%09%09%09%09script%20%3D%20s%3B%0A%09%09%09%09return%20true%3B%0A%09%09%09%7D%0A%09%09%7D%29%3B%0A%0A%09%09if%20%28%21script%29%20%7B%0A%09%09%09script%20%3D%20new%20USL.ScriptEntry%28aFile%29%3B%0A%09%09%09if%20%28USL.disabled_scripts.indexOf%28leafName%29%20%21%3D%3D%20-1%29%0A%09%09%09%09script.disabled%20%3D%20true%3B%0A%09%09%7D%0A%09%09return%20script%3B%0A%09%7D%0A%7D%3B%0A%0AUSL.reloadScripts%20%3D%20function%28%29%20%7B%0A%09USL.readScripts.forEach%28function%28script%29%7B%0A%09%09let%20aFile%20%3D%20script.file%3B%0A%09%09if%20%28aFile.exists%28%29%20%26amp%3B%26amp%3B%20script.lastModifiedTime%20%21%3D%3D%20aFile.lastModifiedTimeOfLink%29%20%7B%0A%09%09%09script.init%28aFile%29%3B%0A%09%09%09USL.log%28script.name%20+%20%22%20reload.%22%29%3B%0A%09%09%7D%0A%09%7D%29%3B%0A%7D%3B%0A%0AUSL.openFolder%20%3D%20function%28%29%20%7B%0A%09USL.SCRIPTS_FOLDER.launch%28%29%3B%0A%7D%3B%0A%0AUSL.saveScript%20%3D%20function%28%29%20%7B%0A%09var%20win%20%3D%20USL.getFocusedWindow%28%29%3B%0A%09var%20doc%20%3D%20win.document%3B%0A%09var%20name%20%3D%20/%5C/%5C/%5Cs*@name%5Cs+%28.*%29/i.exec%28doc.body.textContent%29%3B%0A%09var%20filename%20%3D%20%28name%20%26amp%3B%26amp%3B%20name%5B1%5D%20%3F%20name%5B1%5D%20%3A%20win.location.href.split%28%22/%22%29.pop%28%29%29.replace%28/%5C.user%5C.js%24%7C%24/i%2C%20%22.user.js%22%29%3B%0A%0A%09//%20https%3A//developer.mozilla.org/ja/XUL_Tutorial/Open_and_Save_Dialogs%0A%09var%20fp%20%3D%20Cc%5B%22@mozilla.org/filepicker%3B1%22%5D.createInstance%28Ci.nsIFilePicker%29%3B%0A%09fp.init%28window%2C%20%22%22%2C%20Ci.nsIFilePicker.modeSave%29%3B%0A%09fp.appendFilter%28%22JS%20Files%22%2C%22*.js%22%29%3B%0A%09fp.appendFilters%28Ci.nsIFilePicker.filterAll%29%3B%0A%09fp.displayDirectory%20%3D%20USL.SCRIPTS_FOLDER%3B%20//%20nsILocalFile%0A%09fp.defaultExtension%20%3D%20%22js%22%3B%0A%09fp.defaultString%20%3D%20filename%3B%0A%09var%20res%20%3D%20fp.show%28%29%3B%0A%09if%20%28res%20%21%3D%20fp.returnOK%20%26amp%3B%26amp%3B%20res%20%21%3D%20fp.returnReplace%29%20return%3B%0A%0A%09var%20wbp%20%3D%20Cc%5B%22@mozilla.org/embedding/browser/nsWebBrowserPersist%3B1%22%5D.createInstance%28Ci.nsIWebBrowserPersist%29%3B%0A%09wbp.persistFlags%20%3D%20wbp.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION%3B%0A%09var%20uri%20%3D%20makeURI%28win.location.href%29%3B%0A%09wbp.saveURI%28uri%2C%20null%2C%20null%2C%20null%2C%20null%2C%20fp.file%29%3B%0A%7D%3B%0A%0AUSL.deleteStorage%20%3D%20function%28type%29%20%7B%0A%09var%20data%20%3D%20USL.database%5Btype%5D%3B%0A%09var%20list%20%3D%20%5Bx%20for%28x%20in%20data%29%5D%3B%0A%09if%20%28list.length%20%3D%3D%200%29%0A%09%09return%20alert%28type%20+%20%27%20is%20none.%27%29%3B%0A%0A%09list.push%28%27All%20%27%20+%20type%29%3B%0A%09var%20selected%20%3D%20%7B%7D%3B%0A%09var%20ok%20%3D%20Services.prompt.select%28%0A%09%09window%2C%20%22UserScriptLoader%20%22%20+%20type%2C%20%22Select%20delete%20URL.%22%2C%20list.length%2C%20list%2C%20selected%29%3B%0A%0A%09if%20%28%21ok%29%20return%3B%0A%09if%20%28selected.value%20%3D%3D%20list.length%20-1%29%20%7B%0A%09%09list.pop%28%29%3B%0A%09%09list.forEach%28function%28url%2C%20i%2C%20a%29%20%7B%0A%09%09%09delete%20data%5Burl%5D%0A%09%09%7D%29%3B%0A%09%09return%3B%0A%09%7D%0A%09delete%20data%5Blist%5Bselected.value%5D%5D%3B%0A%7D%3B%0A%0AUSL.onPopupShowing%20%3D%20function%28event%29%20%7B%0A%09var%20win%20%3D%20USL.getFocusedWindow%28%29%3B%0A%09var%20popup%20%3D%20event.target%3B%0A%0A%09switch%28popup.id%29%20%7B%0A%09%09case%20%27UserScriptLoader-popup%27%3A%0A%09%09%09let%20run%20%3D%20win.USL_run%3B%0A%09%09%09Array.slice%28popup.children%29.some%28function%28menuitem%29%7B%0A%09%09%09%09if%20%28%21menuitem.classList.contains%28%22UserScriptLoader-item%22%29%29%20return%20true%3B%0A%09%09%09%09let%20index%20%3D%20run%20%3F%20run.indexOf%28menuitem.script%29%20%3A%20-1%3B%0A%09%09%09%09menuitem.style.fontWeight%20%3D%20index%20%21%3D%3D%20-1%20%3F%20%22bold%22%20%3A%20%22%22%3B%0A%09%09%09%09menuitem.hidden%20%3D%20USL.HIDE_EXCLUDE%20%26amp%3B%26amp%3B%20index%20%3D%3D%3D%20-1%3B%0A%09%09%09%7D%29%3B%0A%09%09%09USL.saveMenu.hidden%20%3D%20win.document.contentType.indexOf%28%22javascript%22%29%20%3D%3D%3D%20-1%3B%0A%09%09%09b%3Aif%20%28win.USL_registerCommands%29%20%7B%0A%09%09%09%09for%20%28let%20n%20in%20win.USL_registerCommands%29%20%7B%0A%09%09%09%09%09USL.registMenu.disabled%20%3D%20false%3B%0A%09%09%09%09%09break%20b%3B%0A%09%09%09%09%7D%0A%09%09%09%09USL.registMenu.disabled%20%3D%20true%3B%0A%09%09%09%7D%20else%20%7B%0A%09%09%09%09USL.registMenu.disabled%20%3D%20true%3B%0A%09%09%09%7D%0A%09%09%09break%3B%0A%0A%09%09case%20%27UserScriptLoader-register-popup%27%3A%0A%09%09%09var%20registers%20%3D%20win.USL_registerCommands%3B%0A%09%09%09if%20%28%21registers%29%20return%3B%0A%09%09%09for%20%28let%20%5Buuid%2C%20item%5D%20in%20Iterator%28registers%29%29%20%7B%0A%09%09%09%09let%20m%20%3D%20document.createElement%28%27menuitem%27%29%3B%0A%09%09%09%09m.setAttribute%28%27label%27%2C%20item.label%29%3B%0A%09%09%09%09m.setAttribute%28%27tooltiptext%27%2C%20item.tooltiptext%29%3B%0A%09%09%09%09m.setAttribute%28%27oncommand%27%2C%20%27this.registCommand%28%29%3B%27%29%3B%0A%09%09%09%09if%20%28item.accessKey%29%0A%09%09%09%09%09m.setAttribute%28%22accesskey%22%2C%20item.accessKey%29%3B%0A%09%09%09%09if%20%28item.disabled%29%0A%09%09%09%09%09m.setAttribute%28%22disabled%22%2C%20item.disabled%29%3B%0A%09%09%09%09m.registCommand%20%3D%20item.func%3B%0A%09%09%09%09popup.appendChild%28m%29%3B%0A%09%09%09%7D%0A%09%09%09break%3B%0A%09%7D%0A%7D%3B%0A%0AUSL.onPopupHidden%20%3D%20function%28event%29%20%7B%0A%09var%20popup%20%3D%20event.target%3B%0A%09switch%28popup.id%29%20%7B%0A%09%09case%20%27UserScriptLoader-register-popup%27%3A%0A%09%09%09var%20child%20%3D%20popup.firstChild%3B%0A%09%09%09while%20%28child%20%26amp%3B%26amp%3B%20child.localName%20%3D%3D%20%27menuitem%27%29%20%7B%0A%09%09%09%09popup.removeChild%28child%29%3B%0A%09%09%09%09child%20%3D%20popup.firstChild%3B%0A%09%09%09%7D%0A%09%09%09break%3B%0A%09%7D%0A%7D%3B%0A%0AUSL.menuClick%20%3D%20function%28event%29%7B%0A%09var%20menuitem%20%3D%20event.target%3B%0A%09if%20%28event.button%20%3D%3D%200%20%7C%7C%20menuitem.getAttribute%28%27type%27%29%20%21%3D%20%27checkbox%27%29%0A%09%09return%3B%0A%0A%09event.preventDefault%28%29%3B%0A%09event.stopPropagation%28%29%3B%0A%09if%20%28event.button%20%3D%3D%201%29%20%7B%0A%09%09menuitem.doCommand%28%29%3B%0A%09%09menuitem.setAttribute%28%27checked%27%2C%20menuitem.getAttribute%28%27checked%27%29%20%3D%3D%20%27true%27%3F%20%27false%27%20%3A%20%27true%27%29%3B%0A%09%7D%20else%20if%20%28event.button%20%3D%3D%202%20%26amp%3B%26amp%3B%20USL.EDITOR%20%26amp%3B%26amp%3B%20menuitem.script%29%20%7B%0A%09%09USL.edit%28menuitem.script.path%29%3B%0A%09%7D%0A%7D%3B%0A%0AUSL.edit%20%3D%20function%28path%29%20%7B%0A%09if%20%28%21USL.EDITOR%29%20return%3B%0A%09try%20%7B%0A%09%09var%20UI%20%3D%20Cc%5B%22@mozilla.org/intl/scriptableunicodeconverter%22%5D.createInstance%28Ci.nsIScriptableUnicodeConverter%29%3B%0A%09%09UI.charset%20%3D%20window.navigator.platform.toLowerCase%28%29.indexOf%28%22win%22%29%20%26gt%3B%3D%200%3F%20%22Shift_JIS%22%3A%20%22UTF-8%22%3B%0A%09%09path%20%3D%20UI.ConvertFromUnicode%28path%29%3B%0A%09%09var%20app%20%3D%20Cc%5B%22@mozilla.org/file/local%3B1%22%5D.createInstance%28Ci.nsILocalFile%29%3B%0A%09%09app.initWithPath%28USL.EDITOR%29%3B%0A%09%09var%20process%20%3D%20Cc%5B%22@mozilla.org/process/util%3B1%22%5D.createInstance%28Ci.nsIProcess%29%3B%0A%09%09process.init%28app%29%3B%0A%09%09process.run%28false%2C%20%5Bpath%5D%2C%201%29%3B%0A%09%7D%20catch%20%28e%29%20%7B%7D%0A%7D%3B%0A%0AUSL.iconClick%20%3D%20function%28event%29%7B%0A%09if%20%28%21event%20%7C%7C%20%21event.button%29%20%7B%0A%09%09USL.disabled%20%3D%20%21USL.disabled%3B%0A%09%09USL.pref.setValue%28%27disabled%27%2C%20USL.disabled%29%3B%0A%09%7D%20else%20if%20%28event.button%20%3D%3D%201%29%20%7B%0A%09%09USL.rebuild%28%29%3B%0A%09%7D%0A%7D%3B%0A%0AUSL.retryInject%20%3D%20function%28safeWin%29%20%7B%0A%09function%20func%28event%29%20%7B%0A%09%09safeWin.removeEventListener%28%22readystatechange%22%2C%20func%2C%20true%29%3B%0A%09%09if%20%28event.target.URL%20%3D%3D%3D%20%22about%3Ablank%22%29%20return%3B%0A%09%09USL.injectScripts%28event.target.defaultView%2C%20true%29%3B%0A%09%7D%0A%09safeWin.addEventListener%28%22readystatechange%22%2C%20func%2C%20true%29%3B%0A%7D%3B%0A%0AUSL.injectScripts%20%3D%20function%28safeWindow%2C%20rsflag%29%20%7B%0A%09var%20aDocument%20%3D%20safeWindow.document%3B%0A%09var%20locationHref%20%3D%20safeWindow.location.href%3B%0A%0A%09//%20document-start%20%u3067%u30D5%u30EC%u30FC%u30E0%u3092%u958B%u3044%u305F%u969B%u306B%u3061%u3087%u3063%u3068%u304A%u304B%u3057%u3044%u306E%u3067%u2026%0A%09if%20%28%21rsflag%20%26amp%3B%26amp%3B%20locationHref%20%3D%3D%20%22%22%20%26amp%3B%26amp%3B%20safeWindow.frameElement%29%0A%09%09return%20USL.retryInject%28safeWindow%29%3B%0A%09//%20target%3D%22_blank%22%20%u3067%20about%3Ablank%20%u72B6%u614B%u3067%u958B%u304B%u308C%u308B%u306E%u3067%u2026%0A%09if%20%28%21rsflag%20%26amp%3B%26amp%3B%20locationHref%20%3D%3D%20%27about%3Ablank%27%29%0A%09%09return%20USL.retryInject%28safeWindow%29%3B%0A%0A%09if%20%28USL.GLOBAL_EXCLUDES_REGEXP.test%28locationHref%29%29%20return%3B%0A%0A%09if%20%28%21USL.CACHE_SCRIPT%29%0A%09%09USL.reloadScripts%28%29%3B%0A%0A%09var%20console%20%3D%20new%20USL.Console%28%29%3B%0A%09var%20documentEnds%20%3D%20%5B%5D%3B%0A%09var%20windowLoads%20%3D%20%5B%5D%3B%0A%0A%09USL.readScripts.filter%28function%28script%2C%20index%29%20%7B%0A%09%09//if%20%28%21/%5E%28%3F%3Ahttps%3F%7Cdata%7Cfile%7Cchrome%29%3A/.test%28locationHref%29%29%20return%3B%0A%09%09if%20%28%21script.isURLMatching%28locationHref%29%29%20return%20false%3B%0A%09%09if%20%28%22noframes%22%20in%20script%20%26amp%3B%26amp%3B%20%0A%09%09%20%20%20%20safeWindow.frameElement%20%26amp%3B%26amp%3B%20%0A%09%09%20%20%20%20%21%28safeWindow.frameElement%20instanceof%20HTMLFrameElement%29%29%0A%09%09%09return%20false%3B%0A%0A%09%09if%20%28script.run_at%20%3D%3D%3D%20%22document-start%22%29%20%7B%0A%09%09%09%22delay%22%20in%20script%20%3F%20safeWindow.setTimeout%28run%2C%20script.delay%2C%20script%29%20%3A%20run%28script%29%0A%09%09%7D%20else%20if%20%28script.run_at%20%3D%3D%3D%20%22window-load%22%29%20%7B%0A%09%09%09windowLoads.push%28script%29%3B%0A%09%09%7D%20else%20%7B%0A%09%09%09documentEnds.push%28script%29%3B%0A%09%09%7D%0A%09%7D%29%3B%0A%09if%20%28documentEnds.length%29%20%7B%0A%09%09aDocument.addEventListener%28%22DOMContentLoaded%22%2C%20function%28event%29%7B%0A%09%09%09event.currentTarget.removeEventListener%28event.type%2C%20arguments.callee%2C%20false%29%3B%0A%09%09%09documentEnds.forEach%28function%28s%29%20%22delay%22%20in%20s%20%3F%20%0A%09%09%09%09safeWindow.setTimeout%28run%2C%20s.delay%2C%20s%29%20%3A%20run%28s%29%29%3B%0A%09%09%7D%2C%20false%29%3B%0A%09%7D%0A%09if%20%28windowLoads.length%29%20%7B%0A%09%09safeWindow.addEventListener%28%22load%22%2C%20function%28event%29%20%7B%0A%09%09%09event.currentTarget.removeEventListener%28event.type%2C%20arguments.callee%2C%20false%29%3B%0A%09%09%09windowLoads.forEach%28function%28s%29%20%22delay%22%20in%20s%20%3F%20%0A%09%09%09%09safeWindow.setTimeout%28run%2C%20s.delay%2C%20s%29%20%3A%20run%28s%29%29%3B%0A%09%09%7D%2C%20false%29%3B%0A%09%7D%0A%0A%09function%20run%28script%29%20%7B%0A%09%09if%20%28safeWindow.USL_run.indexOf%28script%29%20%26gt%3B%3D%200%29%20%7B%0A%09%09%09USL.debug%28%27DABUTTAYO%21%21%21%21%21%20%27%20+%20script.name%20+%20locationHref%29%3B%0A%09%09%09return%20false%3B%0A%09%09%7D%0A%09%09if%20%28%22bookmarklet%22%20in%20script.metadata%29%20%7B%0A%09%09%09let%20func%20%3D%20new%20Function%28script.code%29%3B%0A%09%09%09safeWindow.location.href%20%3D%20%22javascript%3A%22%20+%20func.toSource%28%29%20+%20%22%28%29%3B%22%3B%0A%09%09%09safeWindow.USL_run.push%28script%29%3B%0A%09%09%09return%3B%0A%09%09%7D%0A%0A%09%09let%20sandbox%20%3D%20new%20Cu.Sandbox%28safeWindow%29%3B%0A%09%09let%20GM_API%20%3D%20new%20USL.API%28script%2C%20sandbox%2C%20safeWindow%2C%20aDocument%29%3B%0A%09%09for%20%28let%20n%20in%20GM_API%29%0A%09%09%09sandbox%5Bn%5D%20%3D%20GM_API%5Bn%5D%3B%0A%0A%09%09sandbox.XPathResult%20%20%3D%20Ci.nsIDOMXPathResult%3B%0A%09%09sandbox.unsafeWindow%20%3D%20safeWindow.wrappedJSObject%3B%0A%09%09sandbox.document%20%20%20%20%20%3D%20safeWindow.document%3B%0A%09%09sandbox.console%20%20%20%20%20%20%3D%20console%3B%0A%09%09sandbox.window%20%20%20%20%20%20%20%3D%20safeWindow%3B%0A%0A%09%09sandbox.__proto__%20%3D%20safeWindow%3B%0A%09%09USL.evalInSandbox%28script%2C%20sandbox%29%3B%0A%09%09safeWindow.USL_run.push%28script%29%3B%0A%09%7D%0A%7D%3B%0A%0AUSL.evalInSandbox%20%3D%20function%28aScript%2C%20aSandbox%29%20%7B%0A%09try%7B%0A%09%09var%20lineFinder%20%3D%20new%20Error%28%29%3B%0A%09%09Cu.evalInSandbox%28%27%28function%28%29%20%7B%27%20+%20aScript.requireSrc%20+%20%27%5Cr%5Cn%27%20+%20aScript.code%20+%20%27%5Cr%5Cn%7D%29%28%29%3B%27%2C%20aSandbox%2C%20%221.8%22%29%3B%0A%09%7D%20catch%28e%29%20%7B%0A%09%09let%20line%20%3D%20e.lineNumber%20-%20lineFinder.lineNumber%20-%20aScript.requireSrc.split%28%22%5Cn%22%29.length%3B%0A%09%09USL.error%28aScript.name%20+%20%27%20/%20line%3A%27%20+%20line%20+%20%22%5Cn%22%20+%20e%29%3B%0A%09%7D%0A%7D%3B%0A%0AUSL.log%20%3D%20function%28%29%20%7B%0A%09Services.console.logStringMessage%28%22%5BUSL%5D%20%22%20+%20Array.slice%28arguments%29%29%3B%0A%7D%3B%0A%0AUSL.debug%20%3D%20function%28%29%20%7B%0A%09if%20%28USL.DEBUG%29%20Services.console.logStringMessage%28%27%5BUSL%20DEBUG%5D%20%27%20+%20Array.slice%28arguments%29%29%3B%0A%7D%3B%0A%0AUSL.error%20%3D%20function%28%29%20%7B%0A%09var%20err%20%3D%20Cc%5B%22@mozilla.org/scripterror%3B1%22%5D.createInstance%28Ci.nsIScriptError%29%3B%0A%09err.init%28Array.slice%28arguments%29%2C%20null%2C%20null%2C%20null%2C%20null%2C%20err.errorFlag%2C%20null%29%3B%0A%09Services.console.logMessage%28err%29%3B%0A%7D%3B%0A%0AUSL.loadText%20%3D%20function%28aFile%29%20%7B%0A%09var%20fstream%20%3D%20Cc%5B%22@mozilla.org/network/file-input-stream%3B1%22%5D.createInstance%28Ci.nsIFileInputStream%29%3B%0A%09var%20sstream%20%3D%20Cc%5B%22@mozilla.org/scriptableinputstream%3B1%22%5D.createInstance%28Ci.nsIScriptableInputStream%29%3B%0A%09fstream.init%28aFile%2C%20-1%2C%200%2C%200%29%3B%0A%09sstream.init%28fstream%29%3B%0A%09var%20data%20%3D%20sstream.read%28sstream.available%28%29%29%3B%0A%09try%20%7B%20data%20%3D%20decodeURIComponent%28escape%28data%29%29%3B%20%7D%20catch%28e%29%20%7B%7D%0A%09sstream.close%28%29%3B%0A%09fstream.close%28%29%3B%0A%09return%20data%3B%0A%7D%3B%0A%0AUSL.loadBinary%20%3D%20function%28aFile%29%7B%0A%09var%20istream%20%3D%20Cc%5B%22@mozilla.org/network/file-input-stream%3B1%22%5D.createInstance%28Ci.nsIFileInputStream%29%3B%0A%09istream.init%28aFile%2C%20-1%2C%20-1%2C%20false%29%3B%0A%09var%20bstream%20%3D%20Cc%5B%22@mozilla.org/binaryinputstream%3B1%22%5D.createInstance%28Ci.nsIBinaryInputStream%29%3B%0A%09bstream.setInputStream%28istream%29%3B%0A%09return%20bstream.readBytes%28bstream.available%28%29%29%3B%0A%7D%3B%0A%0AUSL.saveText%20%3D%20function%28aFile%2C%20data%29%20%7B%0A%09var%20suConverter%20%3D%20Cc%5B%22@mozilla.org/intl/scriptableunicodeconverter%22%5D.createInstance%28Ci.nsIScriptableUnicodeConverter%29%3B%0A%09suConverter.charset%20%3D%20%22UTF-8%22%3B%0A%09data%20%3D%20suConverter.ConvertFromUnicode%28data%29%3B%0A%09return%20USL.saveFile%28aFile%2C%20data%29%3B%0A%7D%3B%0A%0AUSL.saveFile%20%3D%20function%20%28aFile%2C%20data%29%20%7B%0A%09var%20foStream%20%3D%20Cc%5B%22@mozilla.org/network/file-output-stream%3B1%22%5D.createInstance%28Ci.nsIFileOutputStream%29%3B%0A%09foStream.init%28aFile%2C%200x02%20%7C%200x08%20%7C%200x20%2C%200664%2C%200%29%3B%0A%09foStream.write%28data%2C%20data.length%29%3B%0A%09foStream.close%28%29%3B%0A%09return%20data%3B%0A%7D%3B%0A%0AUSL.loadSetting%20%3D%20function%28%29%20%7B%0A%09try%20%7B%0A%09%09var%20aFile%20%3D%20Services.dirsvc.get%28%27UChrm%27%2C%20Ci.nsILocalFile%29%3B%0A%09%09aFile.appendRelativePath%28%22UserScriptLoader.json%22%29%3B%0A%09%09var%20data%20%3D%20USL.loadText%28aFile%29%3B%0A%09%09data%20%3D%20JSON.parse%28data%29%3B%0A%09%09USL.database.pref%20%3D%20data.pref%3B%0A%09%09//USL.database.resource%20%3D%20data.resource%3B%0A%09%09USL.debug%28%27loaded%20UserScriptLoader.json%27%29%3B%0A%09%7D%20catch%28e%29%20%7B%0A%09%09USL.debug%28%27can%20not%20load%20UserScriptLoader.json%27%29%3B%0A%09%7D%0A%7D%3B%0A%0AUSL.saveSetting%20%3D%20function%28%29%20%7B%0A%09let%20disabledScripts%20%3D%20%5Bx.leafName%20for%20each%28x%20in%20USL.readScripts%29%20if%20%28x.disabled%29%5D%3B%0A%09USL.pref.setValue%28%27script.disabled%27%2C%20disabledScripts.join%28%27%7C%27%29%29%3B%0A%09USL.pref.setValue%28%27disabled%27%2C%20USL.disabled%29%3B%0A%09USL.pref.setValue%28%27HIDE_EXCLUDE%27%2C%20USL.HIDE_EXCLUDE%29%3B%0A%09USL.pref.setValue%28%27CACHE_SCRIPT%27%2C%20USL.CACHE_SCRIPT%29%3B%0A%09USL.pref.setValue%28%27DEBUG%27%2C%20USL.DEBUG%29%3B%0A%0A%09var%20aFile%20%3D%20Services.dirsvc.get%28%27UChrm%27%2C%20Ci.nsILocalFile%29%3B%0A%09aFile.appendRelativePath%28%22UserScriptLoader.json%22%29%3B%0A%09USL.saveText%28aFile%2C%20JSON.stringify%28USL.database%29%29%3B%0A%7D%3B%0A%0AUSL.getContents%20%3D%20function%28aURL%2C%20aCallback%29%7B%0A%09try%20%7B%0A%09%09urlSecurityCheck%28aURL%2C%20gBrowser.contentPrincipal%2C%20Ci.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL%29%3B%0A%09%7D%20catch%28ex%29%20%7B%0A%09%09return%3B%0A%09%7D%0A%09var%20uri%20%3D%20Services.io.newURI%28aURL%2C%20null%2C%20null%29%3B%0A%09if%20%28uri.scheme%20%21%3D%20%27http%27%20%26amp%3B%26amp%3B%20uri.scheme%20%21%3D%20%27https%27%29%0A%09%09return%20USL.error%28%27getContents%20is%20%22http%22%20or%20%22https%22%20only%27%29%3B%0A%0A%09let%20aFile%20%3D%20USL.REQUIRES_FOLDER.clone%28%29%3B%0A%09aFile.QueryInterface%28Ci.nsILocalFile%29%3B%0A%09aFile.appendRelativePath%28encodeURIComponent%28aURL%29%29%3B%0A%0A%09var%20wbp%20%3D%20Cc%5B%22@mozilla.org/embedding/browser/nsWebBrowserPersist%3B1%22%5D.createInstance%28Ci.nsIWebBrowserPersist%29%3B%0A%09if%20%28aCallback%29%20%7B%0A%09%09wbp.progressListener%20%3D%20%7B%0A%09%09%09onStateChange%3A%20function%28aWebProgress%2C%20aRequest%2C%20aStateFlags%2C%20aStatus%29%20%7B%0A%09%09%09%09if%20%28aStateFlags%20%26amp%3B%20Ci.nsIWebProgressListener.STATE_STOP%29%7B%0A%09%09%09%09%09let%20channel%20%3D%20aRequest.QueryInterface%28Ci.nsIHttpChannel%29%3B%0A%09%09%09%09%09let%20bytes%20%3D%20USL.loadBinary%28aFile%29%3B%0A%09%09%09%09%09aCallback%28bytes%2C%20channel.contentType%29%3B%0A%09%09%09%09%09return%3B%0A%09%09%09%09%7D%0A%09%09%09%7D%2C%0A%09%09%09onLocationChange%3A%20function%28aProgress%2C%20aRequest%2C%20aURI%29%7B%7D%2C%0A%09%09%09onProgressChange%3A%20function%28aWebProgress%2C%20aRequest%2C%20aCurSelfProgress%2C%20aMaxSelfProgress%2C%20aCurTotalProgress%2C%20aMaxTotalProgress%29%20%7B%7D%2C%0A%09%09%09onStatusChange%3A%20function%28aWebProgress%2C%20aRequest%2C%20aStatus%2C%20aMessage%29%20%7B%7D%2C%0A%09%09%09onSecurityChange%3A%20function%28aWebProgress%2C%20aRequest%2C%20aState%29%20%7B%7D%2C%0A%09%09%09onLinkIconAvailable%3A%20function%28aIconURL%29%20%7B%7D%2C%0A%09%09%7D%0A%09%7D%0A%09wbp.saveURI%28uri%2C%20null%2C%20null%2C%20null%2C%20null%2C%20aFile%29%3B%0A%09USL.debug%28%22getContents%3A%20%22%20+%20aURL%29%3B%0A%7D%3B%0A%0AUSL.getLocalFileContents%20%3D%20function%28aURL%2C%20callback%29%20%7B%0A%09var%20channel%20%3D%20Services.io.newChannel%28aURL%2C%20null%2C%20null%29%3B%0A%09if%20%28channel.URI.scheme%20%21%3D%20%27file%27%29%0A%09%09return%20USL.error%28%27getLocalFileContents%20is%20%22file%22%20only%27%29%3B%0A%0A%09var%20input%20%3D%20channel.open%28%29%3B%0A%09var%20binaryStream%20%3D%20Cc%5B%27@mozilla.org/binaryinputstream%3B1%27%5D.createInstance%28Ci.nsIBinaryInputStream%29%3B%0A%09binaryStream.setInputStream%28input%29%3B%0A%09var%20bytes%20%3D%20binaryStream.readBytes%28input.available%28%29%29%3B%0A%09binaryStream.close%28%29%3B%0A%09input.close%28%29%3B%0A%09callback%28bytes%2C%20channel.contentType%29%3B%0A%7D%3B%0A%0AUSL.wildcardToRegExpStr%20%3D%20function%28urlstr%29%20%7B%0A%09if%20%28urlstr%20instanceof%20RegExp%29%20return%20urlstr.source%3B%0A%09let%20reg%20%3D%20urlstr.replace%28/%5B%28%29%5C%5B%5C%5D%7B%7D%7C+.%2C%5E%24%3F%5C%5C%5D/g%2C%20%22%5C%5C%24%26amp%3B%22%29.replace%28/%5C*+/g%2C%20function%28str%29%7B%0A%09%09return%20str%20%3D%3D%3D%20%22*%22%20%3F%20%22.*%22%20%3A%20%22%5B%5E/%5D*%22%3B%0A%09%7D%29%3B%0A%09return%20%22%5E%22%20+%20reg%20+%20%22%24%22%3B%0A%7D%3B%0A%0AUSL.init%28%29%3B%0Awindow.USL%20%3D%20USL%3B%0A%0A%0Afunction%20log%28str%29%20%7B%20Application.console.log%28Array.slice%28arguments%29%29%3B%20%7D%0Afunction%20debug%28%29%20%7B%20if%20%28USL.DEBUG%29%20Application.console.log%28%27%5BUSL%20DEBUG%5D%20%27%20+%20Array.slice%28arguments%29%29%3B%7D%0A%0A//%20http%3A//gist.github.com/321205%0Afunction%20%24%28id%29%20document.getElementById%28id%29%3B%0Afunction%20U%28text%29%201%20%26lt%3B%20%27%u3042%27.length%20%3F%20decodeURIComponent%28escape%28text%29%29%20%3A%20text%3B%0Afunction%20%24E%28xml%2C%20doc%29%20%7B%0A%09doc%20%3D%20doc%20%7C%7C%20document%3B%0A%09xml%20%3D%20%26lt%3Broot%20xmlns%3D%7Bdoc.documentElement.namespaceURI%7D/%26gt%3B.appendChild%28xml%29%3B%0A%09var%20settings%20%3D%20XML.settings%28%29%3B%0A%09XML.prettyPrinting%20%3D%20false%3B%0A%09var%20root%20%3D%20new%20DOMParser%28%29.parseFromString%28xml.toXMLString%28%29%2C%20%27application/xml%27%29.documentElement%3B%0A%09XML.setSettings%28settings%29%3B%0A%09doc.adoptNode%28root%29%3B%0A%09var%20range%20%3D%20doc.createRange%28%29%3B%0A%09range.selectNodeContents%28root%29%3B%0A%09var%20frag%20%3D%20range.extractContents%28%29%3B%0A%09range.detach%28%29%3B%0A%09return%20frag.childNodes.length%20%26lt%3B%202%20%3F%20frag.firstChild%20%3A%20frag%3B%0A%7D%0A%0Afunction%20addStyle%28css%29%20%7B%0A%09var%20pi%20%3D%20document.createProcessingInstruction%28%0A%09%09%27xml-stylesheet%27%2C%0A%09%09%27type%3D%22text/css%22%20href%3D%22data%3Atext/css%3Butf-8%2C%27%20+%20encodeURIComponent%28css%29%20+%20%27%22%27%0A%09%29%3B%0A%09return%20document.insertBefore%28pi%2C%20document.documentElement%29%3B%0A%7D%0A%0A%0A%7D%29%28%26lt%3B%21%5BCDATA%5B%0A/*%20http%3A//www.famfamfam.com/lab/icons/silk/preview.php%20*/%0A%23UserScriptLoader-icon%20%7B%0A%09list-style-image%3A%20url%28data%3Aimage/png%3Bbase64%2C%0A%09%09iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACOElEQVQ4ja3Q3UtTcRgH8N8f4K11%0A%09%09FaRrVGumlTXndPYiyQqkCyPoLroOCbyJSCGJUhOGUSnShVqtFpYlW/lCKiPmy5zinObZdJtn29nZ%0A%09%09cW7nnB39TapvF+WdI4W+95/n+zwPIf8zwnRFt+AyIj5VDn7CAN5ZiphDD25Mh+jIaUSGixEePAnW%0A%09%09XhTaeYCr/OdWogMZoR2Z2DPQyBNsrpqxEWiF4muG4LwK9nOhvCOOT5Y1iks3sSV0IP29CrLnAkS3%0A%09%09EalxPRR/CxJTN8Dai35kXZ+fNGQyfBs2Q7chz1dCcp9FasIAxd+E5GwtwoNl8H3QqnZuHy+tSc5f%0A%09%09RybejvTCRUiz55CaKoPsvQV5sR7ciAnBvoJLWdtjTn1aCTWARlshz52HOG1E0lkCxd+C+LdrCH7S%0A%09%091mXHjhLd2nQ1MvxzyF4TxJlKpCYrsD6mQ3rpEUL92l+BPg1d6T1Kl98dpr43asq8OkSZ7nyeEEII%0A%09%0959DzElMHGm3DJmvGRvAxFH8TFF8T0osPIXkaIc7UI+W6i+TEHbD9VWC68hRPx4E//+BGz6QiX4tp%0A%09%09eOgUZQdO0FV7IQ3ZCqi8+ACC7TjWhkwQ3Q2IfrmCZcsxMF0HX2Q9ZzuBj9rRdVctpLn7EN33ELaZ%0A%09%09wPSoRE/nvv3/xIQQEnivgeRpBDdcg5W3BWB68s27gn/xDDdUjejAZfheqxOezrzdtRJCiNeamxPo%0A%09%091WLFqgHzUtW8a7idZesRr9+i5r1Pc3P2jAkhhLGodXs1vwEkf3FKAtNVEwAAAABJRU5ErkJggg%3D%3D%0A%09%09%29%3B%0A%7D%0A%0A%23UserScriptLoader-icon%5Bstate%3D%22disable%22%5D%20%7B%0A%09list-style-image%3A%20url%28data%3Aimage/png%3Bbase64%2C%0A%09%09iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACrElEQVQ4ja2QXUhTARzFb3f55kuB%0A%09%092EOBplLJTCtrzs/pJNHEJ03orXyIHkQkFSvSSKTmB5hRKfWSVJZhWX5MvZIuiemc05zT3Obm3Ny8%0A%09%09m7rP6+7MdnoIQWF76zwe+J3z/x+C+J+yTWd02OTpsE6lgZ5MAS1Nxvo4HxYJD+bRi1gbSYRp+DyM%0A%09%09AwmGwAHytD87m+3w2drgW38Odu0pvKst2NY3g9E0wCYtglEc7w4IW2Wpdc6lEuzY2uH5lQO3Ugin%0A%09%09Ih2OCT4YbSM2p67DOJCwG/R8Wpbi89Gt8BrK4Z7PhkshgGMyBYxWBPtsGUzDqdB85kYFbp9ILrTP%0A%09%09X4PP2gbPwmW4ZjPhmEqFW1UK92INLKO5WOmJywvavi7lexhDLVhzM9xzWXBOp8MuTQKjbYT1RzFW%0A%09%09vnIrgsPjSbyN6QL46Bdwq3LhnMmGQ5aBLQkPnqXHMPRy/fqeWFbXfYZd/niK1byPYdVvo1l1x0ma%0A%09%09IAiCsIzzaZe6Aqy5FV5jC7ZXmsBoRWA0IngWH8GlrINzpgYO+T3YJ+/A2JsD9etIRtl+4t8elrFL%0A%09%09jrVviayJusAah86xqwPxrKE/jnUv1sPWfxYbVC6cilosNCThe/FRUJmHMZhNroqzyeqgb+m/cMe2%0A%09%095GVwzT2EU3EfKlEift7mwdvXBP+CGExnOWS3uLtDWWRp4IBPsXAp62AZKYTuQxyovBDHdl8T8CQf%0A%09%09qDoC1EfAJsrAoJDUBYJnLFQBzENXoHkXs6l8GRlOCTh+/3Q39steEw5KwPEfgFVdYaH6bi50XbFQ%0A%09%09v4lq2PPFQtLoeXUDqAkHW0lgq5KA4SYHYiFpOhCw3HVape2MoVXPwkL3+5Krxx5MlET/NldFwFod%0A%09%09guWSQ6DyObsDQvLugQB1Zwwv2LCSouPVYiGppwQcv1hIGvfgv6X5zFaYeSAgAAAAAElFTkSuQmCC%0A%09%09%29%3B%0A%7D%0A%0A%0A%5D%5D%26gt%3B.toString%28%29.replace%28/%5B%5Cr%5Cn%5Ct%5D/g%2C%20%27%27%29%29%3B%0A%0A%0A%0A%0A%0A//%20%u0443%u0441%u0442%u0430%u043D%u0430%u0432%u043B%u0438%u0432%u0430%u0435%u043C%20%u0444%u043B%u0430%u0433%2C%20%u0447%u0442%u043E%u0431%u044B%20%u0444%u0443%u043D%u043A%u0446%u0438%u0438%20%u0438%20%u043E%u0431%u0440%u0430%u0431%u043E%u0442%u0447%u0438%u043A%u0438%20%u043D%u0435%20%u0438%u0441%u043F%u043E%u043B%u043D%u044F%u043B%u0430%u0441%u044C%20%u0434%u0432%u0430%u0436%u0434%u044B%20%20%0Athis.setAttribute%28%22stop%22%2C%22true%22%29%3B%3C/initcode%3E%0A%20%20%3Ccode%3E%3C%21%5BCDATA%5B/*CODE*/%5D%5D%3E%3C/code%3E%0A%20%20%3Caccelkey%3E%3C%21%5BCDATA%5B%5D%5D%3E%3C/accelkey%3E%0A%20%20%3Chelp%3E%3C%21%5BCDATA%5B%5D%5D%3E%3C/help%3E%0A%20%20%3Cattributes/%3E%0A%3C/custombutton%3E
Отсутствует
Dumby
Я тут сделал код который открывает загрузки в табе рядом с текущей вкладкой:
// Отслеживать начало загрузки и запускать нужные функции ....................................................................... var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService); function ObserveDownload_init() { observerService.addObserver(myDownloadObserver, "dl-start", false); }; var myDownloadObserver = { observe: function (subject, topic, state) { if ( topic == "dl-start" ) { if ( !custombuttons.getPrefs("browser.download.manager.showWhenStarting") && !custombuttons.getPrefs("browser.download.useToolkitUI") ) { downloadManagerInTab(); } } } }; ObserveDownload_init(); // Отслеживать все команды связные с загрузкой и запускать нужные функции ......................... function getCommand(event) { var command = event.target.getAttribute("oncommand"); Services.console.logStringMessage('command = ' + command ); if ( command == 'DownloadsIndicatorView.onCommand(event);' || command == 'BrowserDownloadsUI();' || command == 'DownloadsPanel.showDownloadsHistory();') { event.preventDefault(); event.stopPropagation(); downloadManagerInTab(true); } if ( command == "performCommand('cmd_removeFromList');" || command == 'clearDownloadList();') { document.getElementById("Browser:Reload").doCommand(); } }; window.addEventListener("command", getCommand, true); this.onDestroy = function() { window.removeEventListener("command", getCommand, true); }; /* Открывать загрузки в табе или переместить вкладку загрузок рядом с текущей вкладкой ......................................*/ function downloadManagerInTab( foregroundTab ) { closeDownloadManager(); // закрыть стандартный менеджер загрузок // переместить вкладку загрузок .... var tabCount = gBrowser.mPanelContainer.childNodes.length; var selectedIndex = gBrowser.tabContainer.selectedIndex; //gBrowser.mCurrentTab._tPos for( var i = 0; i < tabCount; i++ ) { var browser = gBrowser.getBrowserAtIndex(i); if ( browser.currentURI.spec == 'chrome://mozapps/content/downloads/downloads.xul' ) { var tab = gBrowser.mTabs[i]; var selectedIndex = (tab._tPos > selectedIndex)? selectedIndex + 1: selectedIndex; gBrowser.moveTabTo(tab, selectedIndex); if ( !!foregroundTab ) gBrowser.selectedTab = tab; return; } } // открыть вкладку загрузок .... var x = gBrowser.mCurrentTab._tPos +1; gBrowser.moveTabTo(gBrowser.addTab('chrome://mozapps/content/downloads/downloads.xul'), x); if ( !!foregroundTab ) gBrowser.mTabContainer.advanceSelectedTab(+1,true); }; // Закрыть стандартный менеджер загрузок ............................................................ function closeDownloadManager() { var wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator); var dm = wm.getMostRecentWindow("Download:Manager"); if ( dm ) dm.close(); };
Ошибка: TypeError: window.arguments is undefined
Источник: chrome://mozapps/content/downloads/downloads.js
Строка: 425Ошибка: NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIObserverService.removeObserver]
Источник: chrome://mozapps/content/downloads/downloads.js
Строка: 462
Ты вроде в этом разбираешься 03-11-2012 12:48:48
Посмотри пожалуйста код
Отредактировано bunda1 (03-12-2012 13:37:06)
Отсутствует
но постоянно в консоли появляются ошибки
Можно вот так попробовать:
var tab = gBrowser.addTab("chrome://mozapps/content/downloads/downloads.xul"); tab.linkedBrowser.addEventListener("DOMContentLoaded", function setFakeArguments(e) { e.currentTarget.removeEventListener(e.type, setFakeArguments, true); var win = e.target.defaultView; win = win.wrappedJSObject || win; win.arguments = []; }, true);
Прошлое – это локомотив, который тянет за собой будущее. Бывает, что это прошлое вдобавок чужое. Ты едешь спиной вперед и видишь только то, что уже исчезло. А чтобы сойти с поезда, нужен билет. Ты держишь его в руках. Но кому ты его предъявишь?
Виктор Пелевин. Желтая стрела
Отсутствует
Infocatcher
Отлично.
Ошибки уже не появляются при открытии загрузок в табе, но все равно появляются если этот таб закрыть:
Метка времени: 03.12.2012 11:52:12
Ошибка: TypeError: window.arguments is undefined
Источник: chrome://mozapps/content/downloads/downloads.js
Строка: 425Метка времени: 03.12.2012 11:58:26
Ошибка: NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIObserverService.removeObserver]
Источник: chrome://mozapps/content/downloads/downloads.js
Строка: 462
Добавлено 03-12-2012 14:14:41
Наверно надо так:
function setFakeArguments(e) { if ( e.target.location.href !== 'chrome://mozapps/content/downloads/downloads.xul' ) return; var win = e.target.defaultView; win = win.wrappedJSObject || win; win.arguments = []; }; gBrowser.addEventListener("DOMContentLoaded", setFakeArguments, true); gBrowser.addEventListener("TabClose", setFakeArguments, true);
Отредактировано bunda1 (03-12-2012 16:09:59)
Отсутствует