Greasy Fork 还支持 简体中文。

Google Search Extra Buttons

Add buttons (last 1/2/3 days, weeks, PDF search etc.) for results of Google search page

目前為 2015-12-08 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Google Search Extra Buttons
  3. // @name:ru GoogleSearchExtraButtons
  4. // @description Add buttons (last 1/2/3 days, weeks, PDF search etc.) for results of Google search page
  5. // @description:ru Кнопки вариантов поиска для результатов Google (1-2-3 дня, недели, PDF, ...)
  6. // @version 18.2015.12.8
  7. // @namespace spmbt.github.com
  8. // @include http://www.google.*/search*
  9. // @include https://www.google.*/search*
  10. // @include https://www.google.*/*
  11. // @include https://encrypted.google.*/search*
  12. // @include https://encrypted.google.*/*
  13. // @include https://spmbt.github.io/googleSearchExtraButtons/saveYourLocalStorage.html
  14. // ==/UserScript==
  15. if(location.host=='spmbt.github.io'){
  16. window.addEventListener('message', function(ev){
  17. if(/^https?:\/\/www\.google\./.test(ev.origin)){
  18. var d = typeof ev.data =='string' && ev.data[0] =='{' ? JSON.parse(ev.data) : ev.data;
  19. if(!d.do) return;
  20. var tok = d.tok, key = d.key;
  21. switch(d.do){
  22. case 'set':
  23. var prev = localStorage[key];
  24. if(d.val !==undefined)
  25. localStorage[key] = JSON.stringify(d.val);
  26. else
  27. localStorage.removeItem(key);
  28. break;
  29. case 'get':
  30. prev = localStorage[key];
  31. prev = prev === undefined || typeof prev =='string'&& prev[0] !='{'? prev : JSON.parse(prev);
  32. break;
  33. case 'remove':
  34. prev = localStorage[key];
  35. if(prev !==undefined)
  36. localStorage.removeItem(key);
  37. }
  38. //console.log('[io]', tok, 'prev=', prev);
  39. //ev.source.postMessage(JSON.stringify(prev !==undefined ? {tok: tok, prev: prev} : {tok: tok, undef:1}), ev.origin);
  40. }},!1);
  41. }else
  42.  
  43. (function(setts){ //lang, sites, lastHoursLess
  44.  
  45. var $x = function(el, h){if(h) for(var i in h) el[i] = h[i]; return el;} //===extend===
  46. ,$pd = function(ev){ev.preventDefault();}
  47. ,lh = location.href
  48. ,d = document
  49. ,$e = function(g){ //===create or use existing element=== //g={el|clone,cl,ht,cs,at,atRemove,on,apT}
  50. g.el = g.el || g.clone ||'DIV';
  51. var o = g.o = g.clone && g.clone.cloneNode && g.clone.cloneNode(!0)
  52. || (typeof g.el =='string' ? d.createElement(g.el) : g.el);
  53. if(o){ //execute if exist
  54. if(g.cl)
  55. o.className = g.cl;
  56. if(g.clAdd)
  57. o.classList.add(g.clAdd);
  58. if(g.cs)
  59. $x(o.style, g.cs);
  60. if(g.ht || g.at){
  61. var at = g.at ||{}; if(g.ht) at.innerHTML = g.ht;}
  62. if(at)
  63. for(var i in at){
  64. if(i=='innerHTML') o[i] = at[i];
  65. else o.setAttribute(i, at[i]);}
  66. if(g.atRemove)
  67. for(var i in g.atRemove)
  68. o.removeAttribute(g.atRemove[i]);
  69. if(g.on)
  70. for(var i in g.on) if(g.on[i])
  71. o.addEventListener(i, g.on[i],!1);
  72. g.ap && o.appendChild(g.ap);
  73. g.apT && g.apT.appendChild(o);
  74. }
  75. return o;
  76. },
  77. addRules = function(css){
  78. var heads = d.getElementsByTagName('head')
  79. ,node = d.createElement('style');
  80. heads.length && heads[0].appendChild(node);
  81. node.appendChild(d.createTextNode(css));
  82. };
  83. /**
  84. * check occurrence of third-party event with growing interval
  85. * @constructor
  86. * @param{Number} h.t start period of check
  87. * @param{Number} h.i number of checks
  88. * @param{Number} h.m multiplier of period increment
  89. * @param{Function} h.check event condition
  90. * @param{Function} h.occur event handler
  91. */
  92. var Tout = function(h){
  93. var th = this;
  94. (function(){
  95. if((h.dat = h.check() )) //wait of positive result, then occurs
  96. h.occur();
  97. else if(h.i-- >0) //next slower step
  98. th.ww = setTimeout(arguments.callee, (h.t *= h.m) );
  99. })();
  100. }
  101. //for xLocStor:
  102. ,xLocStorOrigin = d.location.protocol +'//spmbt.github.io'
  103. ,qr, qrs ={} //set of queries "key-calls" (ок, toutLitt, toutLong, noService, noStorage)
  104. ,qrI = 0 //queries counter
  105. ,qrN = 12 //max number of waiting queries
  106. ,errIMax = 120, errNMax = errIMax //max number of errors
  107. ,ns ='googXButtons_' //namespace for keys
  108. ,listenMsg
  109. /**
  110. * external localStorage for using another domain if current domain storage is erased anywhere
  111. * @param{String} h.do - action: set|get|remove
  112. * @param{String} h.key
  113. * @param{Object|undefined} h.val (any type)
  114. * @param{Number|undefined} h.toutLitt
  115. * @param{Number|undefined} h.tout
  116. * @param{Function} h.cB - callback with 2 arguments
  117. * @param{Function|undefined} h.err - callback for err with one argument
  118. */
  119. ,xLocStor = function(h){
  120. var h0 = h;
  121. h.toutLitt = h.toutLitt || 400;
  122. h.tout = h.tout || 4000;
  123. var ifr = d.getElementById('xLocStor')
  124. ,query = function(){
  125. if((qrI += 1) > qrN){
  126. xCatch('longQrs', null, h);
  127. return;}
  128. ifr.contentWindow.postMessage(JSON.stringify($x({
  129. do: h.do
  130. ,tok: token
  131. ,key: ns + h.key
  132. }, h.val !==undefined ? {val: h.val}:{}) )
  133. , xLocStorOrigin);
  134. qrs[token] = $x({ //for wait of response
  135. wToutLitt: (function(h, qrI, errIMax){return setTimeout(function(){
  136. qrI -= 1;
  137. if((errIMax -= 1) >=0)
  138. ;//console.warn('toutLitt', h);
  139. chkErrMax();
  140. }, h.toutLitt);})(h, qrI, errIMax)
  141. ,wTout: (function(h, qrI){return setTimeout(function(){
  142. qrI -= 1;
  143. //xCatch('tout', null, h);
  144. //xLocStor(h0);
  145. }, h.tout);})(h, qrI)
  146. }, h);
  147. }
  148. ,token = +new Date() + (Math.random()+'').substr(1,8)
  149. ,el = h.el;
  150. delete h.el;
  151. if(ifr) query();
  152. else ifr = $e({
  153. el: 'iframe',
  154. at:{id: 'xLocStor'
  155. ,src: xLocStorOrigin +'/googleSearchExtraButtons/saveYourLocalStorage.html'},
  156. cs: {display: 'none'},
  157. on: {load: query},
  158. apT: el || d.body
  159. });
  160. if(!listenMsg) addEventListener('message', function(ev){
  161. if(ev.origin == xLocStorOrigin){ // {"tok":"<value>"[,"err":"<txt>"],"h":...}
  162. //console.log('from_io', JSON.parse(ev.data))
  163. var resp = ev.data && ev.data[0] =='{' && JSON.parse(ev.data);
  164. if(!resp) xCatch('bad_format', resp, h);
  165. if(( qr = qrs[resp.tok] )){
  166. qrI -= 1;
  167. qr.cB(resp.prev, resp.undef);
  168. var er = qr.err;
  169. delete qrs[resp.tok];} // else ignore unsufficient token
  170. if(resp.err && (!er || er(resp.err)) ) //individual or common error processing depends of er()
  171. xCatch(resp.err, resp, h);
  172. }},!1);
  173. listenMsg =1;
  174. },
  175. //for tests: localStorage.googXButtons_dwmyh = JSON.stringify({h:[1,2,1,1,1]})
  176. //$('#xLocStor').contentWindow.postMessage('{"do":"get","key":"googXButtons_dwmyh"}','https://spmbt.github.io')
  177. xCatch = function(er, resp, h){
  178. if((errIMax -= 1) >=0)
  179. console.error('tok:', resp && resp.tok ||'--','; err:', er,'; h:', h,'; respH:', resp && resp.h);
  180. chkErrMax();
  181. },
  182. chkErrMax = function(){if(!errIMax) console.error('Too many err messages:', errNMax)}
  183. ,$l ={ru:{
  184. 'search in PDF files':'поиск по документам PDF'
  185. ,'search in':'искать по'
  186. ,'from / to':'за период'
  187. ,'last':['за последний','за последние','за последнюю']
  188. ,'day':'сутки'
  189. ,'days':['дня','дней']
  190. ,'week':'неделю'
  191. ,'weeks':['недели','недель']
  192. ,'month':'месяц'
  193. ,'months':['месяца','месяцев']
  194. ,'year':'год'
  195. ,'years':['года','лет']
  196. ,'hour':'час'
  197. ,'hours':['часа','часов']
  198. ,'Settings':'Настройки'
  199. ,'of userscript':'юзерскрипта'
  200. ,'reload page for effect':'перезагрузить страницу'
  201. ,'Interface language':'Язык интерфейса'
  202. ,'Less positions at the end of selects':'Меньше выбора в конце селектов'
  203. ,'Sites':'Сайты'
  204. },fr:{
  205. 'search in PDF files':'la recherche dans les fichiers PDF'
  206. ,'search in':'rechercher dans'
  207. ,'from / to':'pour la période'
  208. ,'last':['le dernier','dans les derniers','dans les derniers']
  209. ,'day':'jour'
  210. ,'days':['jours','jours']
  211. ,'week':'semaine'
  212. ,'weeks':['semaines','semaines']
  213. ,'month':'mois'
  214. ,'months':['mois','mois']
  215. ,'year':'an'
  216. ,'years':['ans','ans']
  217. ,'hour':'heure'
  218. ,'hours':['heures','heures']
  219. ,'Settings':'Paramètres'
  220. ,'of userscript':'de Userscript'
  221. ,'reload page for effect':'recharger la page pour effet'
  222. ,'Interface language':'Langue de l\'interface'
  223. ,'Less positions at the end of selects':'Moins de choix les longues listes'
  224. ,'Sites':'Les sites'
  225. },de:{
  226. 'search in PDF files':'Suche in PDF-Dateien'
  227. ,'search in':'Suche in'
  228. ,'from / to':'im Zeitraum'
  229. ,'last':['letzte','letzte','letzte']
  230. ,'day':'Tag'
  231. ,'days':['Tage','Tage']
  232. ,'week':'Woche'
  233. ,'weeks':['Wochen','Wochen']
  234. ,'month':'Monat'
  235. ,'months':['Monate','Monate']
  236. ,'year':'Jahr'
  237. ,'years':['Jahre','Jahre']
  238. ,'hour':'Stunde'
  239. ,'hours':['Stunden','Stunden']
  240. ,'Settings':'Einstellungen'
  241. ,'of userscript':'von Userscript'
  242. ,'reload page for effect':'Seite neu laden'
  243. ,'Interface language':'Sprache'
  244. ,'Less positions at the end of selects':'Weniger Auswahl in langen Listen'
  245. ,'Sites':'Websites'
  246. },es:{
  247. 'search in PDF files':'búsqueda en archivos PDF'
  248. ,'search in':'busca en'
  249. ,'from / to':'para el período'
  250. ,'last':['el último','en los últimos','en los últimos']
  251. ,'day':'día'
  252. ,'days':['días','días']
  253. ,'week':'Semana'
  254. ,'weeks':['semanas','semanas']
  255. ,'month':'mes'
  256. ,'months':['meses','meses']
  257. ,'year':'año'
  258. ,'years':['años','años']
  259. ,'hour':'hora'
  260. ,'hours':['horas','horas']
  261. ,'Settings':'Ajustes'
  262. ,'of userscript':'de userscript'
  263. ,'reload page for effect':'página para efecto de recargar'
  264. ,'Interface language':'Idioma de interfaz'
  265. ,'Less positions at the end of selects':'Menos elección en listas largas'
  266. ,'Sites':'Sitios'
  267. }}; //if !lang, then no hints
  268. addRules('.hp .sfsbc,.sfsbc{display: inline-block}.siteList:hover button{display: block}'
  269. +'.gb_Ib >.gb_e{height:47px}.gb_Fb{z-index:1087}.tsf-p{z-index:203}'
  270. +'.lsbb .xButt,.lsbb >.siteList{z-index: 2002; width:34px; height:17px; padding:0 2px; line-height:14px;'
  271. +'font-size:14px; border:1px solid transparent; background-color:#4889f1; color:#fff; opacity: 0.64}'
  272. +'.lsbb >.siteList{width:32px; height:auto; padding:1px 0 2px; text-align:center}'
  273. +'.lsbb >.siteList .lsb{font-weight: normal; color:#d4d4d4}.lsbb .lsb:hover{opacity: 1; color:#fff}'
  274. +'.siteList .sett .txt{padding: 0 2px}'
  275. +'.siteList .settIn{display: none; width: 250px; padding: 2px 4px; text-align:left; border:1px solid #48f;'
  276. +'background-color:#eef; color:#336}'
  277. +'.siteList .settIn hr{margin:2px 0}'
  278. +'.sbibtd .sfsbc .nojsb, .siteList .sett:hover .settIn, .siteList .settIn.changed,'
  279. +'.siteList .settIn.changed .reload{display: block}.siteList .settIn .reload, .siteList.hiddn{display: none}');
  280. xLocStor({do:'get', key:'sett', val:setts, cB: function(prev,undef){
  281. S = prev || setts;
  282. S.dwmyh = S.dwmyh || setts.dwmyh; //temp. transitional expr.
  283. console.timeStamp = function(){};
  284.  
  285. new Tout({t:120, i:8, m: 1.6
  286. ,check: function(){
  287. return d && d.getElementsByName('q') && d.getElementsByName('q')[0];
  288. },
  289. occur: function(){
  290. var lang = S.lang != null && S.lang || setts.lang
  291. ,sites = S.sites && (S.sites.length && S.sites[0] || S.sites.length >1) && S.sites
  292. || typeof sites =='string'&& [sites] || !S.sites && setts.sites || null;
  293. var strSites = sites && sites.join('\n').replace(/^\n/,'\n\n') ||''
  294. ,$L = $l[lang] || $l.ru; //default template of lang
  295. if(!lang || !$l[lang] || lang =='en') for(var l in $L){ //replace 'en' lang for default or substitution
  296. if($L[l] instanceof Array) for(var l2 in $L[l])
  297. $L[l][l2] = l;
  298. else
  299. $L[l] = l;
  300. }
  301. var $LSettings = $L['Settings'];
  302. if(sites && sites.length)
  303. sites.push($LSettings)
  304. var mainPg = /\/search\?/.test(lh)
  305. ,inputSearch = this.dat
  306. ,buttSearch = d.getElementsByName("btnG") && d.getElementsByName('btnG')[0]
  307. ,buttS ={
  308. PDF:{url:'filetype:pdf', txt:$L['search in PDF files']}
  309. ,site:{url:'site:'+ S.sites[0], txt:$L['search in']+' '+ S.sites[0], one:'day'} //you may comment this line
  310. ,'.. : ..':{url:'', txt:$L['from / to']}
  311. ,'1D':{url:'&tbs=qdr:d', txt:$L['last'][1] +' '+ $L['day'], one:'day', up:13,lett:'D'}
  312. ,'1W':{url:'&tbs=qdr:w', txt:$L['last'][2] +' '+ $L['week'], one:'week', up:14,lett:'W'}
  313. ,'1M':{url:'&tbs=qdr:m', txt:$L['last'][0] +' '+ $L['month'], one:'month', up:20,lett:'M'}
  314. ,'1Y':{url:'&tbs=qdr:y', txt:$L['last'][0] +' '+ $L['year'], one:'year', up:10,lett:'Y'}
  315. ,'1H':{url:'&tbs=qdr:h', txt:$L['last'][0] +' '+ $L['hour'], one:'hour', up:23,lett:'H'}
  316. ,DOC:{url:'filetype:doc', txt:$L['search in PDF files'].replace(/PDF/,'DOC')}
  317. }, ii = 0, iD = -1;
  318. !sites && delete buttS.site;
  319. buttSearch.parentNode.style.position ='relative';
  320. if(buttSearch && top == self) for(var i in buttS) if(i !='site'|| S.sites){ //buttons under search input line
  321. if(i.length ==2) iD++; else iD=-1;
  322. var bI = buttS[i]
  323. ,Gesch = ({m:'letzter',f:'letzte',n:'letztes'})['m,f,m,n,f'.split(',')[iD]]
  324. ,hint = function(j){return (j+1) +' '+ (j % 10 || j==10 ? $L[bI.one +'s'][j % 10 <4 && (j/10|0)!=1 ?0:1] : $L[bI.one]) }
  325. ,butt2 = $e({clone: i =='site'|| i.length ==2
  326. ? $e({cl: 'siteList', cs: {cursor:'default'}, at: {site: S.sites[0], date: bI.url} })
  327. : i !='.. : ..'|| mainPg ? buttSearch : $e({cl: 'siteList hiddn'})
  328. ,clAdd:'xButt'
  329. ,atRemove: ['id', 'name']
  330. ,at: {value: iD !=-1 && S.dwmyh[iD] !=1 ? S.dwmyh[iD] + bI.lett : i
  331. ,innerHTML: '<span class=txt onclick=this.parentNode.click();return!1 title="' +(lang || i=='site'|| i=='.. : ..'
  332. ? (iD==-1 || S.dwmyh[iD]==1 ? bI.txt : $L['last'][1] +' '+ hint(S.dwmyh[iD]-1)).replace(/letzte/,Gesch) :'')+'">'
  333. +(iD !=-1 && S.dwmyh[iD] !=1 ? S.dwmyh[iD] + bI.lett : i) +'</span>'}
  334. ,cs: {position: 'absolute', top: '33px', left: (-127 + 37 * (ii++ - (ii >2 && !mainPg))) +'px'}
  335. ,on: {click: (function(bI, i, iD){
  336. return /PDF|DOC|site/.test(i)
  337. ? function(ev){
  338. if(ev.target.className =='defa')
  339. saveLocStor('','','remove'); $pd(ev);
  340. if(((ev.target.getAttribute('site') ==null && ev.target.parentNode.getAttribute('site') ==null)
  341. || ev.target.getAttribute('site')==$LSettings || ev.target.parentNode.getAttribute('site')==$LSettings)
  342. && !/PDF|DOC/.test(ev.target.getAttribute('value'))) return;
  343. console.log('clic:',i,bI,ev, ev.target.className, inputSearch.value, this.form)
  344. inputSearch.value = inputSearch.value.replace(/ site\:[\w.]*$/ig, '')
  345. .replace(/( |\+|&as_)filetype(:|%3A)[^\&]*/g,'') +' '+ (/PDF|DOC/.test(i) ? bI.url
  346. : 'site:'+ (ev.target.getAttribute('site')||ev.currentTarget.getAttribute('site')||''));
  347. if(/siteList|xButt/.test(ev.target.className)) this.form.submit();
  348. }: !bI.url ? function(ev){ //from-to date
  349. var el = d.querySelector('#cdrlnk'), o;
  350. el && el.dispatchEvent(((o = d.createEvent('Events')).initEvent('click', !0, !1), o));
  351. $pd(ev);
  352. }: function(ev){ //last interval
  353. location.href = '/search?q='+ encodeURIComponent(inputSearch.value)
  354. +((ev.target.getAttribute('date')||ev.target.parentNode.getAttribute('date'))
  355. + (ev.target.getAttribute('value')||ev.target.parentNode.getAttribute('value')).replace(/\D/g,'') || bI.url)
  356. +(/[&?]tbm=/.test(lh) ? '&'+/tbm=[^&]*/.exec(lh)[0]:''); //saving type of page
  357. S.dwmyh[iD] = +(ev.target.getAttribute('value')||ev.target.parentNode.getAttribute('value')).replace(/\D/g,'');
  358. $pd(ev);
  359. ev.stopPropagation();
  360. saveLocStor();
  361. }
  362. })(bI, i, iD),
  363. mouseover: i =='site' || i.length ==2 ? (function(bI,i){return function(ev){
  364. clearTimeout(bI.ww);
  365. ev.currentTarget.querySelector('.list').style.display ='block';
  366. }})(bI,i) :'',
  367. mouseout: i =='site' || i.length ==2 ? (function(bI,i){return function(ev){
  368. var t = ev.currentTarget;
  369. clearTimeout(bI.ww);
  370. bI.ww = setTimeout(function(){
  371. t.querySelector('.list').style.display ='none';
  372. }, 450);
  373. }})(bI,i) :'',
  374. change: saveLocStor
  375. }
  376. ,apT: buttSearch.parentNode
  377. });
  378. bI.el = butt2;
  379. if(i =='site' || i.length ==2){ //dropdown lists under some buttons
  380. var siteList = $e({cl:'list',cs:{display:'none'}, apT: butt2}), arr =[];
  381. for(var j =0; j <= bI.up -1 -(i=='1W'&& S.lastHoursLess ?4:0) -(i=='1M'&& S.lastHoursLess ?9:0); j++)
  382. if(i !='1H' || !S.lastHoursLess || j < 8 || j % 2 )
  383. arr.push(hint(j));
  384. //console.log(S.sites,i, S.dwmyh);
  385. var list = i == 'site' ? sites||[] : i =='1D'&& !sites ? arr.concat([$LSettings]) : arr;
  386. for(var j in list) if(j !=0 || iD!=-1 && S.dwmyh[iD] !=1)
  387. var sI = list[j]
  388. ,butt3 = $e({clone: sI==$LSettings
  389. ? $e({cl: 'sett lsb'})
  390. : buttSearch
  391. ,clAdd:'xButt'
  392. ,atRemove:['id','name']
  393. ,at:{value: sI
  394. ,site: sI
  395. ,date: bI.url
  396. ,title: sI==$LSettings || !lang ?'':(i =='site' ? $L['search in'] +' '+ sI
  397. : j==0 ? bI.txt : $L['last'][1] +' '+ sI).replace(/letzte/,Gesch)
  398. ,innerHTML:'<span class=txt>'+ sI +'</span>'+ (sI != $LSettings &&!(!S.sites && i =='1H')
  399. ?'':'<div class="settIn">'
  400. +$L.Settings +' '+ $L['of userscript'] +'<br>"Google Search Extra Buttons"<hr>'
  401. +$L['Interface language'] +': <select class="lang" style="width:70px">'
  402. +(function(){var s='<option'+ (lang=='en'?' selected':'') +'>en</option>';
  403. for(var i in $l)
  404. s+='<option'+ (lang==i ?' selected':'') +'>'+ i +'</option>';
  405. return s +'<option value=""'+ (lang==''?' selected':'') +'>en w/o hints</option>'})()
  406. +'</select><br>'
  407. +'<input type="checkbox" class="less" id="hoursLess"'+ (S.lastHoursLess ?' checked':'') +'/>'
  408. +'<label for="hoursLess">'+ $L['Less positions at the end of selects'] +'</label><br>'
  409. +'<i><a href="#" class="defa" style="float: right">Default settings</a></i>'
  410. +$L.Sites +': <br><textarea class="sites" style="width:97%" rows=8>'
  411. + strSites +'</textarea><br>'
  412. +'<a class="reload" href=# onclick="location.reload();return!1">'
  413. + $L['reload page for effect'] +'</a>'
  414. +'</div>')}
  415. ,cs: {position: sI != $LSettings ?'static':'absolute',display:'block', width:'auto', height: sI != $LSettings ?'18px':'16px'
  416. ,margin:'2px 0 -1px -13px', padding:0, textAlign:'left', fontWeight:'normal', opacity:1}
  417. ,on:{click: function(ev){$pd(ev)}}
  418. ,apT: siteList
  419. });
  420. siteList.style.height ='auto'; siteList.style.textAlign ='center';
  421. }
  422. }
  423. }
  424. });
  425.  
  426. }, el: d.body});
  427. var saveLocStor = function(ev, val, do2){ var aaa,aab,aac, t = ev && ev.target.form || document.documentElement || document.body;
  428. xLocStor({do: do2 ||'set', key:'sett'
  429. , val:{lang: (aaa=d.querySelectorAll('.lang', t))[aaa.length-1].value
  430. ,sites: (aab=d.querySelectorAll('.sites', t))[aab.length-1].value.replace(/^[ \t]*|[ \n\t]*$/g,'')
  431. .split('\n')
  432. ,lastHoursLess: (aac=d.querySelectorAll('.less', t))[aac.length-1].checked
  433. ,dwmyh: S.dwmyh || setts.dwmyh
  434. }
  435. ,cB: function(prev){
  436. console.info('Settings are saved. prev=', prev);}
  437. });
  438. d.querySelector('.siteList .settIn').classList.add('changed');
  439. };
  440.  
  441. })({ //write "lang:''," to remove hints; 'en' for English hints (fr - Français, es - espagnol), 'ru' for Russian
  442. lang:''|| (navigator.languages && navigator.languages[1] || navigator.language.substr(0,2)) //='' if hide hints, or 2 letters from $l{}
  443. ,sites: [ //=array or one site in string
  444. 'slashdot.org','engadget.com','techcrunch.com','habrahabr.ru','geektimes.ru'
  445. ,'smashingmagazine.com','maketecheasier.com'] //write your favorite sites
  446. ,lastHoursLess: 1 //=boolean - not show odd some values of hours after 8 h
  447. ,dwmyh: [1,1,1,1,1] //=array of numbers - current vals of days, weeks, months, years, hours
  448. });