瀏覽代碼

added script searching back

Signed-off-by: Gerald <[email protected]>
Gerald 11 年之前
父節點
當前提交
f44adc71d2
共有 4 個文件被更改,包括 7 次插入20 次删除
  1. 0 7
      options.html
  2. 1 5
      options.js
  3. 2 2
      popup.css
  4. 4 6
      popup.js

+ 0 - 7
options.html

@@ -42,13 +42,6 @@
 				<div id=tabSettings class=hide>
 					<h1 data-i18n=labelSettings></h1>
 					<div><label><input type=checkbox id=cUpdate><span data-i18n=labelAutoUpdate></span></label></div>
-					<table>
-						<tr>
-							<td><span data-i18n=labelSearchLink></span></td>
-							<td class=expand><input type=text id=tSearch></td>
-							<td><button id=bDefSearch data-i18n=buttonDefault></button></td>
-						</tr>
-					</table>
 					<fieldset class=title>
 						<legend data-i18n=labelDataImport></legend>
 						<button id=bImport data-i18n=buttonImportData></button><input type=file class=hide id=iImport>

+ 1 - 5
options.js

@@ -167,11 +167,8 @@ function confirmCancel(dirty){
 }
 
 // Advanced
-var H=$('#iImport'),S=$('#tSearch'),V=$('#bVacuum');
+var H=$('#iImport'),V=$('#bVacuum');
 $('#cUpdate').onchange=function(){chrome.runtime.sendMessage({cmd:'AutoUpdate',data:this.checked});};
-S.title=_('hintSearchLink');
-S.onchange=function(){chrome.runtime.sendMessage({cmd:'SetOption',data:{key:'search',value:S.value}});};
-$('#bDefSearch').onclick=function(){S.value=_('defaultSearch');S.onchange();};
 H.onchange=function(e){
 	zip.createReader(new zip.BlobReader(e.target.files[0]),function(r){
 		r.getEntries(function(e){
@@ -401,7 +398,6 @@ function loadOptions(o){
 		ids.push(i.id);addItem(map[i.id]={obj:i});
 	});
 	$('#cUpdate').checked=o.settings.autoUpdate;
-	S.value=o.settings.search;
 	xD.checked=o.settings.withData;
 	switchTab();
 }

+ 2 - 2
popup.css

@@ -5,5 +5,5 @@ html,body{height:auto;background:inherit;}
 .menu>div.disabled{color:gray;}
 .menu>div.disabled:hover{color:silver;}
 .menu>div span{display:inline-block;width:20px;}
-.menu>hr{border:none;border-top:1px dashed gray;}
-.expand>td{border-top:1px dashed gray;}
+.menu>hr{border:none;border-top:1px solid silver;}
+.expand>td{border-top:1px solid silver;}

+ 4 - 6
popup.js

@@ -55,7 +55,7 @@ function initMenu(){
 			});
 		}
   });
-  /*if(/^https?:\/\//i.test(tab.url)) {
+  if(/^https?:\/\//i.test(tab.url)) {
 		var d=addItem(_('menuFindScripts'), {
 			holder: pT,
 			symbol: '➤',
@@ -64,14 +64,12 @@ function initMenu(){
 		loadItem(d,false);
 		chrome.runtime.sendMessage({cmd:'GetOption',data:'search'},function(o){
 			d.onclick=function(){
-				var q='site:userscripts.org+inurl:show+'+tab.url.replace(/^.*?:\/\/([^\/]*?)\.\w+\/.*$/, function(v,g){
-					return g.replace(/\.(com|..)$/, '').replace(/\./g, '+');
-				});
-				chrome.tabs.create({url:o.replace('*',q)});
+				var h=tab.url.match(/:\/\/(?:www\.)?([^\/]*)/);
+				chrome.tabs.create({url:'https://greasyfork.org/scripts/search?q='+h[1]});
 			};
 			loadItem(d,true);
 		});
-	}*/
+	}
   ia=addItem(_('menuScriptEnabled'), {
     holder: pT,
 		symbol: '✓',