Browse Source

added support for `@match <all_urls>`

Signed-off-by: Gerald <[email protected]>
Gerald 11 years ago
parent
commit
be3be4f1a4
5 changed files with 13 additions and 11 deletions
  1. 2 2
      background.js
  2. 3 1
      options.html
  3. 4 8
      popup.js
  4. 4 0
      style.less
  5. 0 0
      style.min.css

+ 2 - 2
background.js

@@ -10,8 +10,7 @@ function getUniqId() {
 		}
 		return s;
 	}
-	return int2str(Date.now()%0x80000*0x100+Math.floor(Math.random()*0x800))+
-		int2str(Math.floor(Math.random()*0x80000000));
+	return int2str(Date.now()%0x80000)+int2str(Math.floor(Math.random()*0x8000000000));
 }
 function notify(title,options) {
 	function show() {
@@ -182,6 +181,7 @@ function autoReg(s, w) {
 }
 var match_reg=/(.*?):\/\/([^\/]*)\/(.*)/;
 function matchTest(s,u) {
+	if(s=='<all_urls>') return true;
   var m=s.match(match_reg);
   if(!m) return false;
 	// scheme

+ 3 - 1
options.html

@@ -27,7 +27,9 @@
 					<div class=header>
 						<button id=bNew data-i18n=buttonNew></button>
 						<button id=bUpdate data-i18n=buttonUpdateAll></button>
-						<a href=https://greasyfork.org/scripts target=_blank data-i18n=anchorGetMoreScripts></a>
+						<div class=right>
+							<a href=https://greasyfork.org/scripts target=_blank data-i18n=anchorGetMoreScripts></a>
+						</div>
 					</div>
 					<div id=sList>
 						<span id=message data-i18n=msgLoading></span>

+ 4 - 8
popup.js

@@ -59,20 +59,16 @@ function initMenu(){
 			});
 		}
   });
-  if(/^https?:\/\//i.test(tab.url)) {
-		var d=addItem(_('menuFindScripts'), {
+  if(/^https?:\/\//i.test(tab.url))
+		addItem(_('menuFindScripts'), {
 			holder: pT,
 			symbols: ['fa-hand-o-right'],
 			//title: true,
-		});
-		chrome.runtime.sendMessage({cmd:'GetOption',data:'search'},function(o){
-			d.onclick=function(){
+			onclick: function(){
 				var h=tab.url.match(/:\/\/(?:www\.)?([^\/]*)/);
 				chrome.tabs.create({url:'https://greasyfork.org/scripts/search?q='+h[1]});
-			};
-			loadItem(d,0);
+			},
 		});
-	}
   ia=addItem(_('menuScriptEnabled'), {
     holder: pT,
 		symbols: ['fa-times','fa-check'],

+ 4 - 0
style.less

@@ -190,6 +190,10 @@ label>*{
 	&>.header{
 		height: @menu-height;
 		line-height: @menu-height;
+		padding: 0 .5em;
+	}
+	.right{
+		float: right;
 	}
 }
 #sList{

File diff suppressed because it is too large
+ 0 - 0
style.min.css


Some files were not shown because too many files changed in this diff