I'm working on the translation of the dashboard/admin of Shopify using Tampermonkey.
For security purposes, there's some parts of the Shopify Admin Dashboard I don't want Tampermonkey to work with. There's text created by the merchant (in products, pages, collections, templates...) which Tampermonkey would replace which is really dangerous.
There's 2 approaches to solve this:
@exclude
directive.I've used the latter but the script is not listening to @exclude. Here is the userscript:
// ==UserScript==
// @name Shopify_Admin_Spanish
// @namespace http://*.myshopify.com/admin
// @version 0.1
// @description Tu tienda Shopify, por detrás, en español!
// @exclude https://*.myshopify.com/admin/products
// @exclude https://*.myshopify.com/admin/collections
// @exclude https://*.myshopify.com/admin/blogs
// @exclude https://*.myshopify.com/admin/pages
// @exclude https://*.myshopify.com/admin/themes
// @match https://*.myshopify.com/*
// @copyright microapps.com
// ==/UserScript==
PS. I did all checks using Google Chrome, and am not willing to use any other browser.
Tampermonkey is a donationware userscript manager that is available as a browser extension. This software enables the user to add and use userscripts, which are JavaScript programs that can be used to modify web pages.
Tampermonkey is a browser extension that allows you to manage user scripts to modify and alter webpages.
@exclude
is very precise. You need to put a trailing asterisk on each of the exclude lines. EG:
// @exclude https://*.myshopify.com/admin/products*
// @exclude https://*.myshopify.com/admin/collections*
// @exclude https://*.myshopify.com/admin/blogs*
// @exclude https://*.myshopify.com/admin/pages*
// @exclude https://*.myshopify.com/admin/themes*
Consider (and install) this Tampermonkey script:
// ==UserScript==
// @name _match and exclude testing
// @match http://*.stackexchange.com/*
//
// @exclude http://*.stackexchange.com/questions*
// @exclude http://*.stackexchange.com/tags
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @grant GM_addStyle
// ==/UserScript==
$("body").prepend ('<h1 style="background: yellow;">Match Script fired on this page.</h1>');
If you then visit arduino.stackexchange.com/tags, the script won't fire, but when visiting:
it will!
Changing the second exclude line to:
// @exclude http://*.stackexchange.com/tags*
fixes the problem.
If you still have difficulty, specify your versions of Chrome, Tampermonkey, and operating system. And, provide target page(s) that demonstrate the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With