浏览代码

minor fix

Gerald 11 年之前
父节点
当前提交
478c2a14d4
共有 5 个文件被更改,包括 30 次插入24 次删除
  1. 0 7
      README.md
  2. 1 1
      manifest.json
  3. 2 2
      options.css
  4. 3 3
      options.html
  5. 24 11
      options.js

+ 0 - 7
README.md

@@ -7,10 +7,3 @@ Violentmonkey for Opera Presto: <https://github.com/gera2ld/Violentmonkey-oex>
 Multiple language
 Multiple language
 ---
 ---
 If you'd like to help with a new translation, please download `_locales/en/messages.json` and translate it into your own language. Then you may either send the new translation to me or make a pull request. Thanks in advance.
 If you'd like to help with a new translation, please download `_locales/en/messages.json` and translate it into your own language. Then you may either send the new translation to me or make a pull request. Thanks in advance.
-
-Donate
----
-* [![via PayPal](https://www.paypal.com/de_DE/DE/i/logo/paypal_logo.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&[email protected]&no_shipping=1&lc=US&currency_code=USD)
-* [![via Alipay](https://img.alipay.com/sys/personalprod/style/mc/btn-index.png)](http://me.alipay.com/gera2ld)
-
-Author: Gerald &lt;<[email protected]>&gt;

+ 1 - 1
manifest.json

@@ -1,6 +1,6 @@
 {
 {
 	"name": "Violent monkey",
 	"name": "Violent monkey",
-	"version" : "2.1.2",
+	"version" : "2.1.2.1",
 	"manifest_version" : 2,
 	"manifest_version" : 2,
 	"description" : "__MSG_extDescription__",
 	"description" : "__MSG_extDescription__",
 	"developer": {"name" : "Gerald", "url" : "http://geraldl.ml"},
 	"developer": {"name" : "Gerald", "url" : "http://geraldl.ml"},

+ 2 - 2
options.css

@@ -4,8 +4,8 @@ textarea,input[type=text]{box-sizing:border-box;width:100%;}
 .sidebar{position:fixed;background:#fafafa;width:200px;margin-top:30px;box-sizing:border-box;border:1px solid darkgray;border-radius:10px 0 0 10px;border-right:none;padding:20px 10px 10px;text-align:right;}
 .sidebar{position:fixed;background:#fafafa;width:200px;margin-top:30px;box-sizing:border-box;border:1px solid darkgray;border-radius:10px 0 0 10px;border-right:none;padding:20px 10px 10px;text-align:right;}
 .sidebar img{width:64px;}
 .sidebar img{width:64px;}
 .sidebar>hr{border:none;border-top:1px solid darkgray;}
 .sidebar>hr{border:none;border-top:1px solid darkgray;}
-.sidemenu>h3{cursor:pointer;color:gray;}
-.sidemenu>h3.selected,.sidemenu>h3:hover{color:black;}
+.sidemenu>a{color:gray;display:block;font-size:1.17em;font-weight:bold;line-height:2.5em;text-decoration:none;}
+.sidemenu>a.selected,.sidemenu>a:hover{color:black;}
 .content{background:white;margin-left:200px;box-sizing:border-box;border-left:1px solid darkgray;border-right:1px solid darkgray;height:100%;overflow-y:auto;position:relative;}
 .content{background:white;margin-left:200px;box-sizing:border-box;border-left:1px solid darkgray;border-right:1px solid darkgray;height:100%;overflow-y:auto;position:relative;}
 .content>div{margin:20px;}
 .content>div{margin:20px;}
 .controls{height:1px;}
 .controls{height:1px;}

+ 3 - 3
options.html

@@ -18,9 +18,9 @@
 				<a href=https://greasyfork.org/scripts target=_blank data-i18n=anchorGetMoreScripts></a>
 				<a href=https://greasyfork.org/scripts target=_blank data-i18n=anchorGetMoreScripts></a>
 				<hr>
 				<hr>
 				<div class=sidemenu>
 				<div class=sidemenu>
-					<h3 id=smInstalled data-i18n=sideMenuInstalled></h3>
-					<h3 id=smSettings data-i18n=sideMenuSettings></h3>
-					<h3 id=smAbout data-i18n=sideMenuAbout></h3>
+					<a id=smInstalled href=#Installed data-i18n=sideMenuInstalled></a>
+					<a id=smSettings href=#Settings data-i18n=sideMenuSettings></a>
+					<a id=smAbout href=#About data-i18n=sideMenuAbout></a>
 				</div>
 				</div>
 			</div>
 			</div>
 			<div class=content>
 			<div class=content>

+ 24 - 11
options.js

@@ -17,6 +17,11 @@ function allowUpdate(n){
 function setIcon(n,d){
 function setIcon(n,d){
 	d.src=cache[n.meta.icon]||'images/icon48.png';
 	d.src=cache[n.meta.icon]||'images/icon48.png';
 }
 }
+function getAuthor(a,n){
+	var m=n.match(/^(.*?)\s<(\S*?@\S*?)>$/),t=_('labelAuthor');
+	if(m) a.innerHTML=t+'<a href=mailto:'+m[2]+'>'+m[1]+'</a>';
+	else a.innerText=t+n;
+}
 function modifyItem(r){
 function modifyItem(r){
 	var o=map[r.id],d=o.div,n=o.obj;
 	var o=map[r.id],d=o.div,n=o.obj;
 	if(r.message) d.querySelector('.message').innerHTML=r.message;
 	if(r.message) d.querySelector('.message').innerHTML=r.message;
@@ -26,7 +31,7 @@ function modifyItem(r){
 	a=d.querySelector('.name');
 	a=d.querySelector('.name');
 	getName(a,n.custom.name||n.meta.name);
 	getName(a,n.custom.name||n.meta.name);
 	if(o=n.custom.homepage||n.meta.homepage) a.href=o;
 	if(o=n.custom.homepage||n.meta.homepage) a.href=o;
-	if(n.meta.author) d.querySelector('.author').innerText=_('labelAuthor')+n.meta.author;
+	getAuthor(d.querySelector('.author'),n.meta.author||'');
 	a=d.querySelector('.descrip');
 	a=d.querySelector('.descrip');
 	getName(a,n.meta.description||'','&nbsp;');
 	getName(a,n.meta.description||'','&nbsp;');
 	setIcon(n,d.querySelector('.icon'));
 	setIcon(n,d.querySelector('.icon'));
@@ -126,22 +131,28 @@ $('#bNew').onclick=function(){chrome.runtime.sendMessage({cmd:'NewScript'},funct
 });};
 });};
 $('#bUpdate').onclick=function(){chrome.runtime.sendMessage({cmd:'CheckUpdateAll'});};
 $('#bUpdate').onclick=function(){chrome.runtime.sendMessage({cmd:'CheckUpdateAll'});};
 function switchTab(e){
 function switchTab(e){
-	var t=e.target,i=t.id.slice(2),o=C.querySelector('#tab'+i);
-	if(!o) return;
+	var h,o;
+	if(e) {
+		e=e.target;h=e.getAttribute('href').substr(1);
+	} else {
+		h=location.hash||'#Installed';
+		h=h.substr(1);
+		e=$('#sm'+h);
+	}
+	o=C.querySelector('#tab'+h);
+	if(!o) return switchTab({target:$('#smInstalled')});
 	if(cur) {
 	if(cur) {
-		if(cur.tab==o) return;
 		cur.menu.classList.remove('selected');
 		cur.menu.classList.remove('selected');
 		cur.tab.classList.add('hide');
 		cur.tab.classList.add('hide');
 	}
 	}
-	cur={menu:t,tab:o};
-	t.classList.add('selected');
+	cur={menu:e,tab:o};
+	e.classList.add('selected');
 	o.classList.remove('hide');
 	o.classList.remove('hide');
-	switch(i) {	// init
+	switch(h) {	// init
 		case 'Settings':xLoad();break;
 		case 'Settings':xLoad();break;
 	}
 	}
 }
 }
 $('.sidemenu').onclick=switchTab;
 $('.sidemenu').onclick=switchTab;
-switchTab({target:$('#smInstalled')});
 function confirmCancel(dirty){
 function confirmCancel(dirty){
 	return !dirty||confirm(_('confirmNotSaved'));
 	return !dirty||confirm(_('confirmNotSaved'));
 }
 }
@@ -204,7 +215,7 @@ function xLoad() {
 	xL.innerHTML='';xE.disabled=false;
 	xL.innerHTML='';xE.disabled=false;
 	ids.forEach(function(i){
 	ids.forEach(function(i){
 		var d=document.createElement('div'),n=map[i].obj;
 		var d=document.createElement('div'),n=map[i].obj;
-		d.className='ellipsis';
+		d.className='ellipsis selected';
 		getName(d,n.custom.name||n.meta.name);
 		getName(d,n.custom.name||n.meta.name);
 		xL.appendChild(d);
 		xL.appendChild(d);
 	});
 	});
@@ -359,9 +370,9 @@ E.close=$('#eClose').onclick=function(){if(confirmCancel(!eS.disabled)) eClose()
 initEditor(function(o){T=o;},{save:eSave,exit:E.close,onchange:E.markDirty});
 initEditor(function(o){T=o;},{save:eSave,exit:E.close,onchange:E.markDirty});
 
 
 // Load at last
 // Load at last
-var ids,map,cache;
+var ids=[],map={},cache;
 function loadOptions(o){
 function loadOptions(o){
-	ids=[];map={};L.innerHTML='';
+	L.innerHTML='';
 	cache=o.cache;
 	cache=o.cache;
 	o.scripts.forEach(function(i){
 	o.scripts.forEach(function(i){
 		ids.push(i.id);addItem(map[i.id]={obj:i});
 		ids.push(i.id);addItem(map[i.id]={obj:i});
@@ -369,7 +380,9 @@ function loadOptions(o){
 	$('#cUpdate').checked=o.settings.autoUpdate;
 	$('#cUpdate').checked=o.settings.autoUpdate;
 	S.value=o.settings.search;
 	S.value=o.settings.search;
 	xD.checked=o.settings.withData;
 	xD.checked=o.settings.withData;
+	switchTab();
 }
 }
+switchTab();
 function updateItem(r){
 function updateItem(r){
 	if(!('id' in r)) return;
 	if(!('id' in r)) return;
 	var m=map[r.id];
 	var m=map[r.id];