Save GameFAQs as textfile.
当前为
// ==UserScript==
// @name Save GameFAQs as textfile
// @description Save GameFAQs as textfile.
// @namespace undefined
// @include https://www.gamefaqs.com/*
// @version 0.1b
// @grant 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'),
p2 = p[p.length - 3];
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';
p2.appendChild(doc.createElement('br'));
p2.appendChild(a);
// doc.body.appendChild(a);
}
}) ();