Kawiesh

Self-created bookmarklets

Nov 7th, 2020 (edited)
1,143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //-------------------Time------------
  2. let date= new Date(),
  3. hh= date.getHours(),
  4. mm= date.getMinutes();
  5.  
  6. let ampm= (hh>=12) ? "PM" : "AM";
  7.  
  8. if (hh>12) hh= hh-12;
  9. if (mm<10) mm= 0+''+mm;
  10.  
  11. let time= `${hh}:${mm} ${ampm}`;
  12.  
  13.  
  14. //-----------------------------Unmask Password----------------
  15. let input= document.querySelectorAll("input[type='password']");
  16. input.forEach(i=> i.type= "text")
  17.  
  18. //-------------------Limit Google Search To documents only---------------------
  19. let url= "https://google.com/search?q=",
  20. query= document.querySelector("[name='q']").value,
  21. ext= " (ext:pdf OR ext:doc OR ext:docx OR ext:ppt OR ext:pptx OR ext:xls OR ext:xlsx)";
  22.  
  23. location= url + query + ext;
  24.  
  25. //-----------------------Urban Dictionary (Remove '?' from URL)-----------------------------
  26. let a= window.location.href;
  27. let b= a.split('?term=');
  28. let c= b[0];
  29. let d= b[1];
  30. if (d.includes('?')) {
  31. d= d.replace('?','');
  32. location.replace(c+'?term='+d);
  33. }
  34.  
  35. //------------------------Blogger (Reload web/desktop version)------------------
  36. let a= window.location.href;
  37. let b= a.split('?m=');
  38. let c= b[0];
  39. let d= b[1];
  40. if (d==='1') {
  41. d=0;
  42. location.replace(c+'?m='+d);
  43. }
  44.  
  45. //----------
  46. let a= window.location.href;
  47. let b= a.split('?m=');
  48. let c= b[0];
  49. let d= b[1];
  50. if (d.includes('1')) {
  51. d=d.replace('1','0');
  52. location.replace(c+'?m='+d);
  53. }
  54.  
  55. //--------  
  56. let a= window.location.href;
  57. let b= a.split('?m=');
  58. let c= b[1];
  59. if (c==1) {
  60. window.location= a.replace('?m=1', '?m=0');
  61. };
  62.  
  63. //------------Date & Time (Display in HTML)-------------------------
  64. let a= new Date(),
  65. b= a.getFullYear(),
  66. c= a.getMonth()+1,
  67. d= a.getDate(),
  68. e= a.getHours(),
  69. f= a.getMinutes();
  70.  
  71. if (c<10) c= 0+''+c;
  72. if (d<10) d= 0+''+d;
  73. if (f<10) f= 0+''+f;
  74.    
  75. if (e===12) e= '12'+':'+f+' PM';
  76. if (e===24 || e===0) e= '12'+':'+f+' AM';
  77. if (e<12) e= e+':'+f+' AM';
  78. if (e>12) e= (e-12)+':'+f+' PM';
  79.  
  80. if (c==01) c= 'Jan.';
  81. if (c==02) c= 'Feb.';
  82. if (c==03) c= 'Mar.';
  83. if (c==04) c= 'Apr.';
  84. if (c==05) c= 'May';
  85. if (c==06) c= 'Jun.';
  86. if (c==07) c= 'Jul.';
  87. if (c==08) c= 'Aug.';
  88. if (c==09) c= 'Sep.';
  89. if (c==10) c= 'Oct.';
  90. if (c==11) c= 'Nov.';
  91. if (c==12) c= 'Dec.';
  92.  
  93. g= d+' '+c+' '+b;
  94. h= e;
  95.  
  96. document.write(g+' ['+h+']');
  97.  
  98. //----Time
  99. function time(x="hm"){
  100. let a= new Date().toLocaleTimeString('en-US');
  101. let b= a.split(":");
  102. let h= b[0], m= b[1], s= b[2];
  103. if(x=="hm") return (h+":"+m+ s.match(/\D+/g));
  104. if(x=="hms") return (h+":"+m+":"+s);
  105. };
  106.  
  107. element.innerHTML= time;
  108.  
  109.  
  110. //--------------Google Search Date Range (Custom Input)-----------------------
  111. let url = window.location.href,
  112.        a = new Date();
  113.        b = a.getFullYear(),
  114.        c = (a.getMonth() + 1),
  115.        d = a.getDate(),
  116.        e = c + '/' + d + '/' + b,
  117.       sd = window.prompt('Start date (MM/DD/YYYY)', e),
  118.       ed = window.prompt('End date (MM/DD/YYYY)', e);
  119. location = url + '&tbs=cdr:1,cd_min:' + sd + ',cd_max:' + ed;
  120.  
  121. //minified:
  122. javascript:void%20function(){javascript:(function(){let%20f=window.location.href,g=new%20Date;b=g.getFullYear(),c=g.getMonth()+1,d=g.getDate(),e=c+%22/%22+d+%22/%22+b,sd=window.prompt(%22Start%20date%20(MM/DD/YYYY)%22,e),ed=window.prompt(%22End%20date%20(MM/DD/YYYY)%22,e),location=f+%22%26tbs=cdr:1,cd_min:%22+sd+%22,cd_max:%22+ed})()}();
  123.  
  124.  
  125. //--------------
  126. let a= location.hostname+'/search?q=';
  127. if (!a.includes('www.google')) alert ('Not on Google');
  128. else {
  129. b= document.forms[0].elements['q'].value,
  130. c= new Date(),
  131. d= c.getFullYear(),
  132. e= c.getMonth()+1,
  133. f= c.getDate(),
  134. g= e+'/'+f+'/'+d,
  135. h= prompt('Enter start date (Month/Day/Year)','01/01/2000'),
  136. i= prompt('Enter end date (Month/Day/Year)',g),
  137. j= '&tbs=cdr:1,cd_min:'+h+',cd_max:'+i,
  138. k= location.protocol+'//';
  139.  
  140. location= k+a+b+j;
  141. }
  142.  
  143. //------------------Welk lidwoord-------------------------
  144. location.href='https://www.welklidwoord.be/'+getSelection().toString()
  145.        
  146.  
  147. //Custom Input
  148. let a= 'https://www.welklidwoord.be/';
  149. let b= window.prompt('Typ een woord in!','');
  150. let c= 'Niets getypt of geannuleerd !';
  151. if (b==null) alert(c);
  152. else
  153. window.open(a+b);
  154.  
  155. //Selection as Input
  156. let a= 'https://www.welklidwoord.be/';
  157. let b= getSelection().toString();
  158. let c= 'Je hebt niets geselecteerd!';
  159. let d= 'Selecteer slechts ÉÉN woord!';
  160. if (b=='') alert (c);
  161. else if (b.includes(' ')) alert (d);
  162. else
  163. window.open(a+b);
  164.  
  165. //------------------Load Tumbex version of Tumblr--------------------------
  166. var a = window.location.host,
  167. b = a.split('.'), c= b[0], d= b[1],e = b[2];
  168. window.open('https://tumbex.com/' + c + '.' + d)
  169.  
  170. //------
  171. let a = window.location.host,
  172.     b = a.split('.'),
  173.     c = b[0],
  174.     d = b[1],
  175.     e = b[2];
  176. window.open('https://tumbex.com/' + c + '.' + d)
  177.  
  178. //----------
  179. let a= 'https://www.tumbex.com/',
  180.     b= location.host,
  181.     c= b.replace('.com','');
  182. location.replace(a+c);
  183.  
  184. //----------
  185. let a= location.href;
  186.     a= decodeURIComponent(a);
  187.     b= location.protocol;
  188.     c= location.hostname;
  189.     d= a.replace(b,'');
  190.     d= d.replace('.com','');    
  191.     e= 'https://tumbex.com/';
  192.  
  193. if (a.includes('safe-mode?url=')) {
  194.     a= a.split('?url=')[1];
  195.     a= a.split('/')[2];
  196.     a= a.replace ('.com','');
  197.     location= e+a;
  198. }
  199.  
  200. else if (c != 'www.tumblr.com') location= e+d;
  201.  
  202. //------------------CHECK YOUTUBE GEO RESTRICTION--------------------------
  203. var url = window.location.href
  204. var getpart = url.split('=');
  205. var vidid = getpart[1];
  206. location = 'https://watannetwork.com/tools/blocked/#url='+ vidid;
  207.  
  208. //---------Playstore APK search on Google------------------------
  209. let a= location.href;
  210. if (a.includes('store/apps/details?')){
  211. let b= a.match(/\?id=.+?&/).toString(),
  212. c= b.replace(/\?id=|&/g,''),
  213. d= 'https://google.com/search?q=',
  214. e= ' apk';
  215. window.open(d+c+e);}
  216. else alert ('Not on an app page on PlayStore');
  217.  
  218. //---------------GOOGLE SEARCH CURRENT SITE-------------------------
  219. let a= location.hostname;
  220.     b= a.split('.');
  221.     c= 'https://google.com/search?q=site:';
  222.     d= prompt('Enter search term to Google');
  223.  
  224. if (b[0]=='m' || b[0]=='mobile') {
  225. let e= b[1]+'.'+b[2]; //or e=b.slice(1).join('.');
  226.     f= c+e+' '+d;
  227. window.open(f);
  228. }
  229. else {
  230. let g= c+a+' '+d;
  231. window.open(g);
  232. }
  233.  
  234.  
  235. //------LINKIFY-------
  236.  
  237.  
  238. let a= document.querySelectorAll("a");
  239. let regex= /(https?\:\/\/|javascript\:).+/;
  240. let b= [...a].map(i=>i.innerHTML);
  241.  
  242. if(!sessionStorage.urltext) sessionStorage.urltext= JSON.stringify(b);
  243.  
  244. a.forEach((i,x)=>{
  245. if(!regex.test(i.text)){
  246. i.text= i.href;
  247. }
  248. else{
  249. let c= JSON.parse(sessionStorage.urltext);
  250. i.innerHTML= c[x];
  251. }
  252. });
  253.  
  254.  
  255. let obu = false;
  256. window.onunload = window.onbeforeunload= function(){
  257. if(!obu){
  258. obu= true;
  259. sessionStorage.removeItem("urltext");
  260. }};
Advertisement
Add Comment
Please, Sign In to add comment