Tempermonkey user script unable run on Wikipedia site when user already signed-in - tampermonkey

I have a Tempermonkey user script seems stop working on Wikipedia when I'm in the signed-in state or navigate to Traditional Chinese site (this page).
My user script is quite simple:
// ==UserScript==
// #name TEST
// #version 1.0
// #description TEST
// #license MIT
// #match *://*/*
// #run-at document-end
// ==/UserScript==
(function() {
'use strict';
document.body.innerHTML = 'Will' + document.body.innerHTML;
})();
If I'm not sign-in into Wikipedia site, the English version is working normally. If I switch to another language version other than English, it's simply not working. Sometimes I reload the page, the user script might run. It's not stable. I don't know why. There is no related error message in the F12 Console.
Update: It seems related this this issue.

Related

Inject style in chrome-extensions:// using Tampermonkey

What i basically want is
inject filter:invert(1) into the default pdf reader extension of chrome
// ==UserScript==
// #name Dark mode pdf
// #namespace http://tampermonkey.net/
// #version 0.1
// #description try to take over the world!
// #author You
// #match chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html
// #icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// #grant GM_addStyle
// ==/UserScript==
(function() {
GM_addStyle("embed{filter:invert(1);}");
})();
i tried this but it didn't work && if you press ctrl+shift+i on the pdf reader page thenthese show rather than the one i want to edit in, to get those i need to right click on the pdf then go to inspect meaning inspecting the embed. So can anyone help with this script, or tell how to inject style in embed of extension.
I don't think tampermonkey is allowed to alter a binary viewer extension
JavaScript programs that can be used to modify web pages.
PDFs are NOT web html pages they are Application/pdf so run outside of the html, they need to "Do it Themselves" here in a FireFox extension pressing I I can invert the binary view of this page as HTML OR PDF, should be the same in Chrome's Foxit extension, but dont think they added that yet? You will need to alter the exe or dll.
Here too the online web page can be at a click inverted in the binary view, however, I do not recommend online web html as a good experience in a pdf viewer as Stack Overflow complains Windows app browsing is out of date (Win 11 still uses Trident), and its very slow.

How to use GTM in ReactJS to track all pages upon user consent

I have designed a site in ReactJS and have a number of tracking tools and session cookies embedded. Therefore due to the legalisations I need to get user consent first before I can enable any form of tracking. Besides GTM, I have facebook, HotJar and so on.
I am using 'react-cookie-consent' to run the cookie banner. I have managed to control all other cookies/tracking tools by creating functions and only execute them once user has give the relevant consent. I have done the same for GTM however it does not seem to be working properly.
I have imported import TagManager from "react-gtm-module" into my cookie page and put the following code in a function which only runs if user presses accept.
const tagManagerArgs = {
gtmId: "GTM-*******", // My GTMID
dataLayerName: "PageDataLayer"
};
TagManager.initialize(tagManagerArgs);
and have pasted the following code in each page under componentDidMount() function and have imported import TagManager from "react-gtm-module" as well.
const tagManagerArgs = {
dataLayer: {
page: "home", //Specific to each page
pagePath: "/home" //Specific to each page
},
dataLayerName: "PageDataLayer"
};
TagManager.dataLayer(tagManagerArgs);
The GTM is triggered once when the user presses the accept button and it appears it is only triggered for the page where the cookie consent banner is on and none of the other pages.
What I want is only when the user presses accept, to then enable the tracking on all pages.
Am I doing something wrong?
Update 01/11/2019
I am still waiting for an answer, not sure if I can repost the question and whether this edit bumps this post :)

Access GM_getValue outside of script

Basically the question title. It would greatly benefit me. I want to be able to access GM_getValue outside of my userscript for debugging purposes, or, at the very least, the values and names themselves.
I am in Chrome on Windows 10.
Latest Tampermonkey beta (and eventually normal Tampermonkey) displays the GM values in its dashboard script editor in Storage tab.
Visual method: use Storage Area Explorer extension:
Open the Tampermonkey dashboard page and invoke devtools by F12 or CtrlShifti
In Storage Area Explorer panel scroll to the bottom to find the #uid# of your script by name, then find its data in #st# key with that UID:
Dumping in the console:
One-time setup: add a new code snippet in devtools - Sources - Snippets subpanel and save it:
function dumpGM_data(scriptName) {
chrome.storage.local.get(null, data => {
const UID = Object.keys(data).find(k => k.startsWith('#uid#') &&
data[k].value == scriptName);
if (UID)
console.log(data[UID.replace('#uid', '#st')].value.data);
});
}
Open the Tampermonkey dashboard page and invoke devtools by F12 or CtrlShifti
open and run that snippet: CtrlEnter - it'll be usable until you close the dashboard page
invoke it in the console:
dumpGM_data('SE Preview on hover')
Inspect/dump/edit the database file directly:
Use any LevelDB tool you can find (or compile one yourself) on the ldb database file under Chrome user profile directory in Local Extension Settings/dhdgffkkebhmkfjojejmpbldmpobfkfo or Local Extension Settings/gcalenpjmijncebpfijmoaglllgpjagf for Tampermonkey beta.

HTML5/Angular JS webpage keeps loading while signing in after immediate logout

We have an angularJS/html5 site. While trying to log in to the site immediately after logout causing the home page to keep loading continuously and it doesnot proceed further. After we close the browser and then try to sign in after some time the page loads properly.
Any solutions.
Please help!
Have you considered using the Router to change your view after logging in or out? In the example below, I called the router to take the user to /home (which should be defined in your routes) after logging out.
logout(): void {
//do other logout stuff here
this.router.navigate(['/home']);
}
You can view the documentation here:https://angular.io/docs/ts/latest/tutorial/toh-pt5.html

How to load staring window form in offline mode in a hybrid mobile application

I am new to hybrid mobile app development. Normally the frontend of my mobile application is developed with ionic, cordova and angular.js and the back end is .net.
This is the scenario I wanted to implement
In my mobile app, when the user is in online mode (with internet connection) the app automatically connect with remote database(host in somewhere else) and load the user templates which is saved in remote database. Actually the templates consists the user window for each type user.For example login widow for adult users,login window for young users, login widow for kids and etc.So then user can select the right template for him/her.
And the next part is the complicated part for me.
When the user in online mode, the app should download all the templates from the remote DB and save it in the local storage od the mobile device.Then when the user launch the app in offline mode(internet connection turned off) again the app should load the templates from the local storage(from the place where the templates are saved in online mode) and then the user can select the window as previously.
Actually this requirement is quite difficult to tackle with for me.So any help in this regards is highly appreciated.I don't have any idea about how to solve this problem.Please help me.Thanking you
add connection plugin.
write angular wrapper or use ng cordova.
write callback function in angualr for information on connection.
a) in this angualr function change $state to that you need.
first of all you create Two global variabel ex. var his = 0; var her = 0; and your select category section if we select his on thai click function his = 1; and onload page function set if condition like if (his == 1) {
load json throw your his themes.
};
**And still you have any confusion then message me.**

Resources