From 1cceb2e62061c4acf1f177c114d5543310fee441 Mon Sep 17 00:00:00 2001 From: feiruo Date: Mon, 4 Aug 2014 03:53:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NoShowBorder.uc.js | 2 +- README.md | 97 +- Saying/Saying.uc.js | 854 ++-- Saying/hitokoto.json | 3530 +---------------- Saying/veryCD.json | 2 +- TabPlus.uc.js | 8 +- anoBtn/anoBtn.uc.js | 21 +- bookmarkallmod.uc.js | 48 +- hitokoto/README.md | 11 - hitokoto/hitokoto.json | 3430 ---------------- hitokoto/hitokoto.uc.js | 261 -- showFlagS/README.md | 24 +- showFlagS/showFlagS.uc.js | 47 +- ...41\265\350\267\263\350\275\2541.6.user.js" | 36 - 14 files changed, 541 insertions(+), 7830 deletions(-) delete mode 100644 hitokoto/README.md delete mode 100644 hitokoto/hitokoto.json delete mode 100644 hitokoto/hitokoto.uc.js delete mode 100644 "\347\231\276\345\272\246\347\233\230\345\210\206\344\272\253\351\241\265\350\267\263\350\275\2541.6.user.js" diff --git a/NoShowBorder.uc.js b/NoShowBorder.uc.js index baf092b..63f8a02 100644 --- a/NoShowBorder.uc.js +++ b/NoShowBorder.uc.js @@ -1,12 +1,12 @@ // ==UserScript== // @name noshowborder.uc.js // @description 无边框 -// @compatibility Firefox 8.0 // @charset UTF-8 // @include chrome://browser/content/browser.xul // @id [8DB2CA3E] // @startup window.chromemargin.init(); // @shutdown window.chromemargin.onDestroy(); +// @homepageURL https://github.com/feiruo/userchromejs/ // @version 1.2.1 // ==/UserScript== (function() { diff --git a/README.md b/README.md index f6843ec..5adb1c1 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,61 @@ userChromeJS ============ -一些修改、原创的自用脚本,可能包含个人使用习惯。 - -####AwesomeBookmarkbar.uc.js -点击地址栏显示书签工具栏。
-鼠标移到地址栏自动显示书签工具栏,移出隐藏。
-地址栏任意按键,地址栏失去焦点后自动隐藏书签工具栏。
-左键点击书签后自动隐藏书签工具栏。 - -####bookmarkallmod.uc.js -退出浏览器的时候保存所有未关闭的页面为书签
-可以自定义保存位置(书签工具栏/书签菜单),保存目录等
-但设置了保存次数之后,达到数量会自动删除较早的条目。 - -####bookmarkBtn.uc.js -可移动书签菜单按钮
-方便FF23以下版本和UX版本。 - -####NoShowBorder.uc.js -FF去边框,延迟生效,新版UI适用。
-定制动作之后再次生效。 - -####starClickMod.uc.js -多功能收藏按钮,支持UX版Fireofx
-单击收藏按钮自动弹出书签编辑面板
-自动获取上次使用的文件夹并选中
-书签编辑面板自动展开文件夹选择面板
-书签编辑面板增加关键字、标签、侧边栏打开等
-右键单击收藏按钮从收藏中删除当前页面。 - -####StarUrlicon.uc.js -新版UI移动整个书签按钮到地址栏。
-添加右键 显示/隐藏 书签侧栏,中键删除当前页面书签。
-推荐和bookmarkBtn.uc.js同时使用,并使用CSS。 +####一些修改、原创的自用脚本,可能包含个人使用习惯。 +#####AwesomeBookmarkbar.uc.js +- 点击地址栏显示书签工具栏; +- 鼠标移到地址栏自动显示书签工具栏,移出隐藏; +- 地址栏任意按键,地址栏失去焦点后自动隐藏书签工具栏; +- 左键点击书签后自动隐藏书签工具栏。 + +#####bookmarkallmod.uc.js +- 退出浏览器的时候保存所有未关闭的页面为书签; +- 可以自定义保存位置(书签工具栏/书签菜单),保存目录等; +- 但设置了保存次数之后,达到数量会自动删除较早的条目。 + +#####bookmarkBtn.uc.js +- 可移动书签菜单按钮; +- 方便FF23以下版本和UX版本。 + +#####NoShowBorder.uc.js +- FF去边框。 + +#####starClickMod.uc.js +- 多功能收藏按钮,支持UX版Fireofx; +- 单击收藏按钮自动弹出书签编辑面板; +- 自动获取上次使用的文件夹并选中; +- 书签编辑面板自动展开文件夹选择面板; +- 书签编辑面板增加关键字、标签、侧边栏打开等; +- 右键单击收藏按钮从收藏中删除当前页面。 + +#####StarUrlicon.uc.js +- 新版UI移动整个书签按钮到地址栏; +- 添加右键 显示/隐藏 书签侧栏,中键删除当前页面书签; +- 推荐和bookmarkBtn.uc.js同时使用,并使用CSS: #bookmarks-menu-button > dropmarker {display: none !important;} - -####UserCSSLoader.uc.js -增加暂时的启用停用。
-增加重载userChrome.css和重载userContent.css。
- -####UserScriptLoaderPlus.uc.js -ywzhaiqi的修改版 https://github.com/ywzhaiqi/userChromeJS/tree/master/UserScriptLoaderPlus
-修改为所有脚本的配置都保存在json文件内。 + +#####TabPlus.uc.js +- 标签管理,新标签打开(智能利用空白标签): +1. 地址栏新标签打开 +2. 新标签打开书签,历史和搜索栏 +3. 左键双击标签关闭 +4. 滚轮切换标签 +5. 标签上点击鼠标右键关闭标签 +6. 标签栏空白部分中键恢复关闭的标签 +7. 中键锁定标签 +8. 双击标签刷新 +9. 未加载标签上双击刷新 +10. 紧邻当前标签新建标签页 +11. 关闭标签聚焦左侧标签 +- 不需要的功能请自行注释掉。 + + +#####UserCSSLoader.uc.js +- 增加暂时的启用停用; +- 增加简单在样式站安装功能; +- 增加重载userChrome.css和重载userContent.css。 + +#####UserScriptLoaderPlus.uc.js +- ywzhaiqi的修改版 https://github.com/ywzhaiqi/userChromeJS/tree/master/UserScriptLoaderPlus +- 修改为所有脚本的配置都保存在json文件内。 diff --git a/Saying/Saying.uc.js b/Saying/Saying.uc.js index ede9e16..db3bd5f 100644 --- a/Saying/Saying.uc.js +++ b/Saying/Saying.uc.js @@ -1,491 +1,452 @@ // ==UserScript== -// @name Saying.uc.js +// @name Saying // @description 地址栏自定义语句 // @author feiruo -// @version 1.2 -// @charset utf-8 // @compatibility Firefox 16 +// @charset UTF-8 // @include chrome://browser/content/browser.xul // @id [09BD42EC] -// @idNote ID用于识别,请勿更改!(为原始文件CRC32) -// @optionsURL about:config?filter=saying. -// @startup window.saying.init(); -// @shutdown window.saying.onDestroy(true); +// @startup window.Saying.init(); +// @shutdown window.Saying.onDestroy(true); +// @optionsURL about:config?filter=Saying. // @reviewURL http://bbs.kafan.cn/thread-1654067-1-1.html -// @namespace https://github.com/feiruo/userChromeJS/tree/master/Saying +// @homepageURL https://github.com/feiruo/userChromeJS/tree/master/Saying // @note 地址栏显示自定义语句,根据网址切换。 // @note 目前可自动获取的有VeryCD标题上的,和hitokoto API。 // @note 每次关闭浏览器后数据库添加获取过的内容,并去重复。 // @note 左键图标复制内容,中键重新获取,右键弹出菜单。 -// @note 1.1 增加地址栏文字长度设置,避免撑长地址栏。 +// @version 1.2 +// @version 1.1 增加地址栏文字长度设置,避免撑长地址栏。 // ==/UserScript== location == "chrome://browser/content/browser.xul" && (function() { - if (window.saying) { - window.saying.onDestroy(); - delete window.saying; + if (window.Saying) { + window.Saying.onDestroy(); + delete window.Saying; } - //VeryCD(名言名句)或hitokoto。 - sayingType = 'veryCD', - //0为地址栏文字显示,1为自动弹出 - autotip = 0, + var Saying = { + //VeryCD(名言名句)或hitokoto。 + SayingType: 'VeryCD', - //如果是地址栏文字,文字长度(个数,包括标点符号),留空或0则全部显示 - SayingLong = 0, + //是否自动弹出文字 + autotip: false, - //autotip=1时有效,设置自动弹出时,多少秒后关闭弹窗 - autotiptime = 5000, + //如果是地址栏文字,文字长度(个数,包括标点符号),留空或0则全部显示 + SayingLong: 0, - //是否混合随机显示 - random = true, + //autotip=true时有效,设置自动弹出时,多少秒后关闭弹窗 + autotiptime: 5000, - //数据库文件位置 - saying_Path = 'lib\\saying.json', //此数据库为自定义数据库,不更新只读取。 - hitokoto_Path = 'lib\\hitokoto.json', - veryCD_Path = 'lib\\veryCD.json', + //是否混合随机显示 + Random: true, - //毫秒, 延迟时间,时间内未取得hitokoto在线数据,则使用本地数据库 - Local_Delay = 2500, + //毫秒, 延迟时间,时间内未取得在线数据,则使用本地数据库 + Local_Delay: 2500, - saying_lib = false, - saying_json = [], - hitokoto_lib = false, - hitokoto_json = [], - veryCD_lib = false, - veryCD_json = []; + //数据库文件位置 + hitokoto_Path: 'lib\\hitokoto.json', + VeryCD_Path: 'lib\\VeryCD.json', + Saying_Path: 'lib\\Saying.json', //此数据库为自定义数据库,不更新只读取。 - window.saying = { - debug: true, + isFirestRun: true, + hitokoto_lib: null, + VeryCD_lib: null, + Saying_lib: null, + hitokoto_json: [], + VeryCD_json: [], + Saying_json: [], + SayingHash: [], isReqHash: [], - sayingHash: [], - - init: function() { - var self = this; - - this._prefs = Components.classes["@mozilla.org/preferences-service;1"] - .getService(Components.interfaces.nsIPrefService) - .getBranch("userChromeJS.saying."); - this._prefs.QueryInterface(Components.interfaces.nsIPrefBranch2); + }; + Saying.init = function() { + this.getPrefs(); + this.addIcon(); + this.getVeryCD(); + this.onLocationChange(); + + if (!this.autotip) + this.addlabel(); + + if (this.isFirestRun) { + this.hitokoto_lib = this.loadFile(this.hitokoto_Path); + if (this.hitokoto_lib) this.hitokoto_json = JSON.parse(this.hitokoto_lib); + + this.VeryCD_lib = this.loadFile(this.VeryCD_Path); + if (this.VeryCD_lib) this.veryCD_json = JSON.parse(this.VeryCD_lib); + + this.Saying_lib = this.loadFile(this.Saying_Path); + if (this.Saying_lib) this.saying_json = JSON.parse(this.Saying_lib); + } + + Saying.progressListener = { + onLocationChange: function() { + Saying.onLocationChange(); + }, + onProgressChange: function() {}, + onSecurityChange: function() {}, + onStateChange: function() {}, + onStatusChange: function() {} + }; + window.getBrowser().addProgressListener(Saying.progressListener); + + window.addEventListener("unload", function() { + Saying.finsh('all'); + Saying.onDestroy(); + }, false); + }; + Saying.onDestroy = function(isAlert) { + window.getBrowser().removeProgressListener(Saying.progressListener); + if (isAlert) { + Saying.finsh('all'); + $("Saying-popup").parentNode.removeChild($("Saying-popup")); + $("Saying-icon").parentNode.removeChild($("Saying-icon")); + $("SayingTip").parentNode.removeChild($("SayingTip")); + $("Saying-statusbarpanel").parentNode.removeChild($("Saying-statusbarpanel")); + } + }; + Saying.getPrefs = function() { + this._prefs = Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefService) + .getBranch("userChromeJS.Saying."); + this._prefs.QueryInterface(Components.interfaces.nsIPrefBranch2); - if (!this._prefs.prefHasUserValue("type")) { - this._prefs.setCharPref("type", sayingType); - } else { - sayingType = this._prefs.getCharPref("type"); - } + if (!this._prefs.prefHasUserValue("SayingType") || this._prefs.getPrefType("SayingType") != Ci.nsIPrefBranch.PREF_STRING) + this._prefs.setCharPref("SayingType", this.SayingType); - if (!this._prefs.prefHasUserValue("random")) { - this._prefs.setIntPref("random", random); - } else { - random = this._prefs.getIntPref("random"); - } + if (!this._prefs.prefHasUserValue("Random") || this._prefs.getPrefType("Random") != Ci.nsIPrefBranch.PREF_BOOL) + this._prefs.setBoolPref("Random", this.Random) - saying_lib = this.loadFile(saying_Path); - hitokoto_lib = this.loadFile(hitokoto_Path); - veryCD_lib = this.loadFile(veryCD_Path); - - if (saying_lib) saying_json = JSON.parse(saying_lib); - if (hitokoto_lib) hitokoto_json = JSON.parse(hitokoto_lib); - if (veryCD_lib) veryCD_json = JSON.parse(veryCD_lib); - - if (autotip == 0) - this.addlabel(); - - this.addIcon(); - this.getVeryCD(); - this.onLocationChange(); - this.progressListener = { - onLocationChange: function() { - self.onLocationChange(); - }, - onProgressChange: function() {}, - onSecurityChange: function() {}, - onStateChange: function() {}, - onStatusChange: function() {} - }; - window.getBrowser().addProgressListener(this.progressListener); - - window.addEventListener("unload", function() { - saying.finsh('all'); - saying.onDestroy(); - }, false); - }, - - onDestroy: function(isAlert) { - window.getBrowser().removeProgressListener(this.progressListener); - if (isAlert) { - $("saying-popup").parentNode.removeChild($("saying-popup")); - $("saying-icon").parentNode.removeChild($("saying-icon")); - $("sayingtip").parentNode.removeChild($("sayingtip")); - $("saying-statusbarpanel").parentNode.removeChild($("saying-statusbarpanel")); + this.SayingType = this._prefs.getCharPref("SayingType"); + this.Random = this._prefs.getBoolPref("Random"); + }; + Saying.addIcon = function() { + this.icon = $('urlbar-icons').appendChild($C('image', { + id: 'Saying-icon', + context: 'Saying-popup', + src: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAY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GhBovoW9i095OPzRPyTfFkzyFe1Y1gmggD0eUIoxaU68cgrVzlb2M5ta4Qm4yxVOhvmqWmWPGNoc3aOVu14B9r5tKyHPucKZHPAKZmDE/4FfP05vqO/HLUAAAAASUVORK5CYII=', + tooltip: 'SayingTip', + style: 'padding: 0px 2px' + })); + + this.icon.addEventListener("click", function(event) { + if (event.button == 0) { + Cc['@mozilla.org/widget/clipboardhelper;1'].createInstance(Ci.nsIClipboardHelper).copyString($("SayingPopupLabel").textContent); + } else if (event.button == 1) { + Saying.onLocationChange(true); } - }, - - addIcon: function() { - this.icon = $('urlbar-icons').appendChild($C('image', { - id: 'saying-icon', - context: 'saying-popup', - src: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAADbklEQVQ4jTWKW0ybZQBA/8Rnn40PvhgfNIsajTHenozTZMZb9MlF4+XBYGam28wWXBySMfkCImxcZMKADGqhgVK0XAstLRRKaQcUKLRQWqAttD8t/bmW9uP44DzJeTpHOcjnz0kphZRSNLjj4rW7S+JsQ0C8fHNE6G0zQspjkZNSZB8+UuZE7jAlpNwXUkqhqMf5ah5SNx7jzC037xmSvNUa5+2GAN0Pov9n8kA6k2IptkWTN40jAUpS00Q+f4Q8PeHusJ9HP2vmyctdvFlu5ePGWT6snaS0x8P1xkGe+Lwa04iN33pcvFgX5JnyWZRtTRNoEdDW+aXdyRtXdDRMbGCJZLGu57BuSIyBY+pdO1ztmOXBtJ22PgvPFVl4vzOFEt8/FKe7a2zNOen1q4wnwZUE2+Z/WiJ5rFFwxU9Y3NplL70Ch8tcqrzPmbI5FFVdEcdLI0z7Anh2wbUNjugptk1Jf+gEvW+XuskYo5FDdnbWOEj6ON3zc6P8T54vNKNoc2aRXnCwmJEs7Erc21kGw3s4onk65lUM8yrf66dp9u4yE02T14LAJj+3/MPTP5pRVLtepNNx1rIwqx5gj+1hCKiMRY+od4Xp8ie5ZJiiqHcRdyLHxPIqairM/lGCL6rMKAGHWfi1fTypHMPrGRrdMX4fC9Mb0Ljc5qKkd4mS1iEK6ocxL2cwrRxT2jUOchvIonhGTGIgnKHFl6TSuU5xl5syk5vW6TiFTUOUdE1hMhr5qeIe3VMhrFtQcN/LnR4HAMpMf7todYW52DXPN21efm3txzAwStVQAKPDzfWKJi58fZHHHn8dUdPGSALEUIiXrnWyEIujRGx6oR+Y5FyFjfOVgzgmxkmpIVrtPjZjAabdDj658RdPnb/NHx1DGINZKkbWeOFaN6X9ARTNrhOhlQAfVFh495aZ7uYavFYDCXUNUIE9+kedjI/b+XvKT+1kku90Hp69YuCCbg4ladMJkNwZnOfVIjPN99rIL9g4TQfQNnyo3lEIumDVSV2vhx+My7xzs4dhX5iKXh+K9JhEd0cfHxV38q3eR0F1Pwn/FGhBovoW9i095OPzRPyTfFkzyFe1Y1gmggD0eUIoxaU68cgrVzlb2M5ta4Qm4yxVOhvmqWmWPGNoc3aOVu14B9r5tKyHPucKZHPAKZmDE/4FfP05vqO/HLUAAAAASUVORK5CYII=', - tooltip: 'sayingtip', - style: 'padding: 0px 2px' - })); - - this.icon.addEventListener("click", function(event) { - if (event.button == 0) { - Cc['@mozilla.org/widget/clipboardhelper;1'].createInstance(Ci.nsIClipboardHelper).copyString($("sayingPopupLabel").textContent); - } else if (event.button == 1) { - saying.onLocationChange(true); - } - }, false); - - var popup = $C('menupopup', { - id: 'saying-popup', - position: 'at_pointer' - }); - - popup.appendChild($C('menuitem', { - label: "复制内容", - oncommand: "saying.copy();" - })); - - popup.appendChild($C('menuitem', { - label: "重新获取", - oncommand: "saying.onLocationChange(true);" - })); - - popup.appendChild($C('menuitem', { - label: "去重保存", - oncommand: "saying.finsh('all');" - })); - - popup.appendChild($C('menuseparator')); - - popup.appendChild($C('menuitem', { - label: "hitokoto", - id: "sayinghitokoto", - type: "radio", - oncommand: 'saying.lookup("set","hitokoto");' - })); - - popup.appendChild($C('menuitem', { - label: "名言名句", - id: "sayingVeryCD", - type: "radio", - oncommand: 'saying.lookup("set","veryCD");' - })); - - popup.appendChild($C('menuitem', { - label: "手动设定", - id: "sayingSaying", - type: "radio", - oncommand: 'saying.lookup("set","saying");' - })); - - popup.appendChild($C('menuseparator')); - - popup.appendChild($C('menuitem', { - label: "混合随机", - id: "sayingRandom", - type: "checkbox", - oncommand: 'saying.random();' - })); - - $('mainPopupSet').appendChild(popup); - if (sayingType == "veryCD") - $("sayingVeryCD").setAttribute('checked', true); - else if (sayingType == "hitokoto") - $("sayinghitokoto").setAttribute('checked', true); - else if (sayingType == "saying") - $("sayingSaying").setAttribute('checked', true); - - if (random) - $("sayingRandom").setAttribute('checked', (($("sayingRandom").value != random) ? true : false)); - else - $("sayingRandom").setAttribute('checked', (($("sayingRandom").value != random) ? false : true)); - - var xmltt = '\ - \ -