Let me show you an example how to convert a Userscript like “Pinterest without registration” to a basic Chrome Extension.
- Get the Userscript from https://greasyfork.org/en/scripts/6325-pinterest-without-registration.
- Install it to Tampermonkey or Greasemonkey.
- Test it at http://pinterest.com
- Create a new directory on your disk like “ChromeExtensionPinterest”
- Create inside this directory a file “content.js”
- Create inside this directory a file “manifest.json”
{ "manifest_version": 2, "name": "Pinterest Extension", "version": "0.1", "browser_action": { }, "content_scripts": [ { "matches": [ "https://*.pinterest.com/*" ], "js": ["jquery-2.1.4.min.js", "content.js"] } ] } - Don’t forget to download and copy jquery-2.2.3.js from http://code.jquery.com
-
jQuery isn’t necessary, but it makes everything easier.
- Install your new Chrome Extension
$(document).ready(function () {
if(!!$("div.HomePage").length)
location.href = "https://www.pinterest.com/categories";
$("head").append("<style>.UnauthBanner, body > .Modal, .ModalManager > .Modal {display: none !important; } " +
".noScroll { overflow: auto !important; } " +
"div.gridContainer > div, .Grid { height: auto !important; }</style>");
$("body").removeClass("noTouch");
$('.leftHeaderContent > .searchFormHidden').css('float', 'right');
$('.searchFormHidden').removeClass('searchFormHidden');
$('form[name=search] .tokenizedInputWrapper').css({
'border-left': $('form[name=search] .tokenizedInputWrapper').css('border-right'),
'border-radius': '6px'
});
});