Skip to content

Commit

Permalink
更新
Browse files Browse the repository at this point in the history
  • Loading branch information
feiruo committed Aug 4, 2014
1 parent 18de305 commit 12d6e67
Show file tree
Hide file tree
Showing 6 changed files with 268 additions and 255 deletions.
126 changes: 86 additions & 40 deletions AwesomeBookmarkbar.uc.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,102 @@
// ==UserScript==
// @name AwesomeBookmarkbar
// @description 智能书签工具栏
// @homepage https://github.com/feiruo/userchromejs/
// @author feiruo
// @charset utf-8
// @version 0.2
// @compatibility Firefox 24.0
// @note 0.2 增加鼠标移到地址栏自动显示书签工具栏,移出隐藏
// @note 点击地址栏显示书签工具栏。
// @note 地址栏任意按键,地址栏失去焦点后自动隐藏书签工具栏。
// @note 左键点击书签后自动隐藏书签工具栏。
// @name AwesomeBookmarkbar.uc.js
// @description 智能书签工具栏
// @author feiruo
// @compatibility Firefox 24.0
// @charset UTF-8
// @include chrome://browser/content/browser.xul
// @id [73FCA65B]
// @startup window.AwesomeBookmarkbar.init();
// @shutdown window.AwesomeBookmarkbar.onDestroy();
// @reviewURL http://bbs.kafan.cn/thread-1726260-1-1.html
// @homepageURL https://github.com/feiruo/userChromeJS
// @note 点击地址栏显示书签工具栏。
// @note 地址栏任意按键,地址栏失去焦点后自动隐藏书签工具栏。
// @note 左键点击书签后自动隐藏书签工具栏。
// @version 0.2.1 去除鼠标移到地址栏自动显示书签工具栏
// @version 0.2 增加鼠标移到地址栏自动显示书签工具栏,移出隐藏
// ==/UserScript==
(function() {
var PTBar = document.getElementById("PersonalToolbar");
if (window.AwesomeBookmarkbar) {
window.AwesomeBookmarkbar.onDestroy();
delete window.AwesomeBookmarkbar;
}

var PersonalToolbar = document.getElementById("PersonalToolbar");

var placesCommands = document.getElementById("placesCommands");

setToolbarVisibility(PTBar, PTBar.collapsed);
var AwesomeBookmarkbar = {};

function hideToolbar(e) {
if (e.button == 2 || (e.button == 0 && !(e.metaKey || e.shiftKey || e.ctrlKey))) return;
PTBar.collapsed = true;
}
AwesomeBookmarkbar.init = function() {
setTimeout(function() {
setToolbarVisibility(PersonalToolbar, PersonalToolbar.collapsed);
}, 500);
setToolbarVisibility(PersonalToolbar, PersonalToolbar.collapsed);
this.addListener(this.hideToolbar, this.cHideToolbar, this.mShowToolbar, this.mHideToolbar, this.keyHide);
};

PTBar.addEventListener("command", hideToolbar, false);
PTBar.addEventListener("click", hideToolbar, false);
placesCommands.addEventListener("command", hideToolbar, false);
AwesomeBookmarkbar.onDestroy = function() {
this.removeListener(this.hideToolbar, this.cHideToolbar, this.mShowToolbar, this.mHideToolbar, this.keyHide);
};

gURLBar.addEventListener('click', function(e) {
if (e.button == 0) {
PTBar.collapsed = false;
}
}, false);
AwesomeBookmarkbar.addListener = function(obj, cHideToolbar, mShowToolbar, mHideToolbar, keyHide) {
PersonalToolbar.addEventListener("command", obj, false);
PersonalToolbar.addEventListener("click", obj, false);
placesCommands.addEventListener("command", obj, false);

gURLBar.addEventListener('click', cHideToolbar, false);

PersonalToolbar.addEventListener('mouseover', mShowToolbar, false);

PersonalToolbar.addEventListener('mouseout', mHideToolbar, false);

gURLBar.addEventListener('mouseout', mHideToolbar, false);

PTBar.addEventListener('mouseover', function(e) {
PTBar.setAttribute('collapsed', 'false');
}, false);
gURLBar.addEventListener('keydown', keyHide, false);
};

PTBar.addEventListener('mouseout', function(e) {
PTBar.setAttribute('collapsed', 'true');
}, false);
AwesomeBookmarkbar.removeListener = function(obj, cHideToolbar, mShowToolbar, mHideToolbar, keyHide) {
PersonalToolbar.removeEventListener("command", obj, false);
PersonalToolbar.removeEventListener("click", obj, false);
placesCommands.removeEventListener("command", obj, false);

gURLBar.addEventListener('mouseover', function(e) {
PTBar.setAttribute('collapsed', 'false');
}, false);
gURLBar.removeEventListener('click', cHideToolbar, false);

gURLBar.addEventListener('mouseout', function(e) {
PTBar.setAttribute('collapsed', 'true');
}, false);
PersonalToolbar.removeEventListener('mouseover', mShowToolbar, false);

gURLBar.addEventListener('keydown', function(e) {
PersonalToolbar.removeEventListener('mouseout', mHideToolbar, false);

gURLBar.removeEventListener('mouseout', mHideToolbar, false);

gURLBar.removeEventListener('keydown', keyHide, false);
};

AwesomeBookmarkbar.hideToolbar = function(e) {
if (e.button == 2 || (e.button == 0 && !(e.metaKey || e.shiftKey || e.ctrlKey))) return;
PersonalToolbar.collapsed = true;
};

AwesomeBookmarkbar.cHideToolbar = function(e) {
if (e.button == 0) {
PersonalToolbar.collapsed = false;
}
};

AwesomeBookmarkbar.mShowToolbar = function(e) {
PersonalToolbar.setAttribute('collapsed', 'false');
};

AwesomeBookmarkbar.mHideToolbar = function(e) {
PersonalToolbar.setAttribute('collapsed', 'true');
};

AwesomeBookmarkbar.keyHide = function(e) {
if (window.event ? e.keyCode : e.which)
PTBar.collapsed = true;
}, false);
PersonalToolbar.collapsed = true;
};

AwesomeBookmarkbar.init();
window.AwesomeBookmarkbar = AwesomeBookmarkbar;

})();
2 changes: 1 addition & 1 deletion Saying/Saying.uc.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ location == "chrome://browser/content/browser.xul" && (function() {
Saying.lookup = function(host, type) {
var site = this.SayingType
if (this.Random) {
var Randoms = ['Saying', 'VeryCD', 'hitokoto'];
var Randoms = ['VeryCD', 'hitokoto'];
site = Randoms[Math.floor(Math.random() * Randoms.length)];
}

Expand Down
29 changes: 18 additions & 11 deletions bookmarkBtn.uc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
// ==UserScript==
// @name bookmarkBtn.uc.js
// @description 可移动书签菜单按钮
// @namespace https://github.com/feiruo/userchromejs/
// @author feiruo
// @include main
// @charset utf-8
// @version 0.2
// @note 0.2 新版添加订阅项。
// @note 可移动书签菜单按钮。
// @name bookmarkBtn.uc.js
// @description 可移动书签菜单按钮
// @author feiruo
// @compatibility Firefox 16
// @charset UTF-8
// @include chrome://browser/content/browser.xul
// @id [E9C421E6]
// @startup window.bookmarkBtn.init();
// @shutdown window.bookmarkBtn.onDestroy();
// @reviewURL http://bbs.kafan.cn/thread-1666483-1-1.html
// @homepageURL https://github.com/feiruo/userChromeJS
// @note 可移动书签菜单按钮。
// @version 0.2.1
// @version 0.2 新版添加订阅项。
// ==/UserScript==
(function() {
window.bookmarkBtn = {
Expand Down Expand Up @@ -185,9 +190,11 @@
menupopup.appendChild(menuitem);

bookmarkBtn.appendChild(menupopup);

},
}
onDestroy: function() {
$("bookmarkBtn").parentNode.removeChild($("bookmarkBtn"));
},
};
window.bookmarkBtn.init()

function $(id) {
Expand Down
77 changes: 34 additions & 43 deletions showFlagS/_showFlagS.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 12d6e67

Please sign in to comment.