Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Granblue Fantasy Texthooker
- // @namespace Granblue.Fantasy.Texthooker
- // @version 0.1
- // @description Granblue Fantasy Texthooker
- // @author Anonymous
- // @match *://game.granbluefantasy.jp/*
- // @grant none
- //
- // IMPORTANT - IMPORTANT - IMPORTANT - IMPORTANT - IMPORTANT !!!!!!!
- // Go in settings > quests and toggle "display text instantly" on
- // see https://imgur.com/a/PlmsowT
- // IMPORTANT - IMPORTANT - IMPORTANT - IMPORTANT - IMPORTANT !!!!!!
- //
- // ==/UserScript==
- var adviceTxt = "";
- var messageTxt = "";
- var explainTxt = "";
- var popupTxt = "";
- var oldAdviceTxt = "";
- var oldMessageTxt = "";
- var oldExplainTxt = "";
- var oldPopupTxt = "";
- /*
- function addGlobalStyle(css) {
- var head, style;
- head = document.getElementsByTagName('head')[0];
- if (!head) { return; }
- style = document.createElement('style');
- style.type = 'text/css';
- style.innerHTML = css;
- head.appendChild(style);
- }
- addGlobalStyle('* { -webkit-user-select: all !important; }');
- */
- void function mymain() {
- const copyToClipboard = str => {
- const myel = document.createElement('textarea');
- myel.value = str;
- myel.setAttribute('readonly', '');
- myel.style.position = 'absolute';
- myel.style.left = '-9999px';
- document.body.appendChild(myel);
- myel.select();
- document.execCommand('copy');
- document.body.removeChild(myel);
- };
- function toTxt(prt) {
- if (prt != null && prt.length >= 1) {
- return prt[0].outerHTML.replace(/<[^>]*>/g, '').replace(/\n/g,'');
- }
- return "";
- }
- var prtMessage = document.getElementsByClassName('prt-message-area');
- var prtAdvice = document.getElementsByClassName('prt-advice');
- var prtExplain = document.getElementsByClassName('prt-explain');
- var prtPopup = document.getElementsByClassName('prt-popup-body');
- messageTxt = toTxt(prtMessage);
- if (messageTxt != "") {
- if (messageTxt != oldMessageTxt) {
- oldMessageTxt = messageTxt;
- console.log(messageTxt);
- copyToClipboard(messageTxt);
- }
- }
- adviceTxt = toTxt(prtAdvice);
- if (adviceTxt != "") {
- if (adviceTxt != oldAdviceTxt) {
- oldAdviceTxt = adviceTxt;
- console.log(adviceTxt);
- copyToClipboard(adviceTxt);
- }
- }
- explainTxt = toTxt(prtExplain);
- if (explainTxt != "") {
- if (explainTxt != oldExplainTxt) {
- oldExplainTxt = explainTxt;
- console.log(explainTxt);
- copyToClipboard(explainTxt);
- }
- }
- popupTxt = toTxt(prtPopup);
- if (popupTxt != "") {
- if (popupTxt != oldPopupTxt) {
- oldPopupTxt = popupTxt;
- console.log(popupTxt);
- copyToClipboard(popupTxt);
- }
- }
- setTimeout(mymain, 700);
- }();
Advertisement
Add Comment
Please, Sign In to add comment