Skip to content

Instantly share code, notes, and snippets.

@oldlastman
Last active July 26, 2023 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oldlastman/5e7bcca005f5df2b619ca80be316dc7b to your computer and use it in GitHub Desktop.
Save oldlastman/5e7bcca005f5df2b619ca80be316dc7b to your computer and use it in GitHub Desktop.
// JavaScript that captures 'description' and 'robots' data , title and language. Show in alert window
javascript:(function(){var metaTags=document.getElementsByTagName("meta"),metaDescription="",metaTitle=document.title,robotIndex="",lang=document.documentElement.lang;for(var i=0;i<metaTags.length;i++)metaTags[i].name.toLowerCase()==="description"&&(metaDescription=metaTags[i].content),metaTags[i].name.toLowerCase()==="robots"&&(robotIndex=metaTags[i].content);var message="Meta Title: "+metaTitle+"\n\n"+"Meta Description: "+metaDescription+"\n\n"+"Robot Index: "+robotIndex+"\n\n"+"Language: "+lang;alert(message);})();
// every checkbox exist on page set to false
javascript:(function(){var inputs = document.querySelectorAll("input[type='checkbox']");for(var i = 0; i < inputs.length; i++) {inputs[i].checked = false;}})()
// show actual theme on WordPress
javascript:(function(){var links=document.getElementsByTagName("link");var neededElements=[];var reg=/\/wp-content\/themes\/(.)+\/style\.css/;var themeStyle="";for(var i=0,length=links.length;i<length;i++)if(links[i].rel.indexOf("stylesheet")>=0)if(links[i].href.match(reg))themeStyle=links[i].href;if(themeStyle===""){alert("Vaya parece que la web actual no est\u00e1 construida con Wordpress");return false;}var txtFile=new XMLHttpRequest;txtFile.open("GET",themeStyle,true);txtFile.onreadystatechange=function(){if(txtFile.readyState===4)if(txtFile.status===200){allText=txtFile.responseText;themeName=allText.match(/theme name:(.)+/i)||{};themeURI=allText.match(/theme URI:(.)+/i)||{};description=allText.match(/Description:(.)+/i)||{};author=allText.match(/Author:(.)+/i)||{};authorURI=allText.match(/Author URI:(.)+/i)||{};version=allText.match(/Version:(.)+/i)||{};tags=allText.match(/Tags:(.)+/i)||{};alert(themeName[0]+"\n"+themeURI[0]+"\n"+description[0]+"\n"+author[0]+"\n"+authorURI[0]+"\n"+version[0]+"\n"+tags[0])}};txtFile.send(null);})()
// count selected words and chars
javascript:(function(){var t;if (window.getSelection) t = window.getSelection();else if (document.selection) t = document.selection.createRange();if (t.text != undefined) t = t.text;if(!t || t == ""){ a = document.getElementsByTagName("textarea"); for(i=0; i<a.length; i++) { if(a[i].selectionStart != undefined && a[i].selectionStart != a[i].selectionEnd) { t = a[i].value.substring(a[i].selectionStart, a[i].selectionEnd); break; } }}if(!t || t == "")alert("please select some text");else alert("word count: " + t.toString().match(/(\S+)/g).length+" chars:"+t.toString().length);})()
// open wp-admin if website is build on WP
javascript:(function(){host=window.location.hostname;window.open("http://"+host+"/wp-admin");})()
@oldlastman
Copy link
Author

just in case how to create or edit bookmarks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment