Created
October 5, 2018 16:17
-
-
Save surajitbasak109/15043e3abf0259c0a109a247004c06c1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Download in a text file | |
// @namespace https://www.youtube.com/user/surajitbasak109 | |
// @version 1 | |
// @description This script downloads webpage in a text file | |
// @author Surajit Basak | |
// @match http*://*/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var a = document.createElement('a'); | |
document.body.appendChild(a); | |
a.textContent = 'Download in a text format'; | |
a.setAttribute('style', 'position: fixed; top: 0px; right: 0px; border-radius: 15px; width: 300px; padding: 10px 12px; background-color: darkred; color: white; z-index: 99999'); | |
var blob = new Blob([document.body.innerText], {type: 'text/plain'}); | |
var url = window.URL.createObjectURL(blob); | |
a.href = url; | |
a.download = document.title + '.txt'; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment