// ==UserScript== // @name Save GameFAQs as textfile // @description Save GameFAQs as textfile. // @namespace undefined // @include https://www.gamefaqs.com/* // @version 0.1b // @grant none // @downloadURL none // ==/UserScript== (function () { var doc = document, text = doc.getElementById('faqtext').innerHTML, blob, a = doc.createElement('a'), filename = doc.URL.substr(doc.URL.lastIndexOf('/') + 1) + '.txt', p = doc.getElementsByTagName('p'); if (text) { text = text.replace(/<\/?span.*?>/g, ''); text = text.replace(/</g, '<'); text = text.replace(/>/g, '>'); blob = new Blob([text], { endings: 'native' }); a.href = URL.createObjectURL(blob); a.download = filename; a.textContent = 'Download Textfile'; p[7].appendChild(doc.createElement('br')); p[7].appendChild(a); // doc.body.appendChild(a); } }) ();