Last active
May 21, 2020 13:05
-
-
Save and-rom/29ac0ef2f5d0dacd79e3668206c02260 to your computer and use it in GitHub Desktop.
Habrahabr
This file contains 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 Habrahabr | |
// @namespace https://gist.github.com/and-rom/29ac0ef2f5d0dacd79e3668206c02260 | |
// @version 0.1.0 | |
// @author and-rom | |
// @description Clear Habrahabr post page for saving as PDF in Google Chrome. When loading finished press Alt-S. | |
// @homepage https://gist.github.com/and-rom/29ac0ef2f5d0dacd79e3668206c02260 | |
// @icon https://habr.com/images/favicon-16x16.png | |
// @icon64 https://habr.com/images/favicon-32x32.png | |
// @updateURL https://gist.github.com/and-rom/29ac0ef2f5d0dacd79e3668206c02260/raw/habrahabr.meta.js | |
// @downloadURL https://gist.github.com/and-rom/29ac0ef2f5d0dacd79e3668206c02260/raw/habrahabr.user.js | |
// @match https://habrahabr.ru/post/* | |
// @match https://geektimes.ru/post/* | |
// @grant none | |
// ==/UserScript== |
This file contains 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 Habrahabr | |
// @namespace https://gist.github.com/and-rom/29ac0ef2f5d0dacd79e3668206c02260 | |
// @version 0.1.0 | |
// @author and-rom | |
// @description Clear Habrahabr post page for saving as PDF in Google Chrome. When loading finished press Alt-S. | |
// @homepage https://gist.github.com/and-rom/29ac0ef2f5d0dacd79e3668206c02260 | |
// @icon https://habr.com/images/favicon-16x16.png | |
// @icon64 https://habr.com/images/favicon-32x32.png | |
// @updateURL https://gist.github.com/and-rom/29ac0ef2f5d0dacd79e3668206c02260/raw/habrahabr.meta.js | |
// @downloadURL https://gist.github.com/and-rom/29ac0ef2f5d0dacd79e3668206c02260/raw/habrahabr.user.js | |
// @match https://habrahabr.ru/post/* | |
// @match https://geektimes.ru/post/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
document.addEventListener('keydown', function(e) { | |
if (e.altKey) { | |
var code = (e.keyCode ? e.keyCode : e.which); | |
if (code == 83) { | |
//console.log( | |
//$("body").children(":not(.layout)").remove(); | |
//$("div.layout").children(":not(.layout__row layout__row_body)").remove(); | |
//); //; | |
var p = document.body; | |
var d = document.getElementsByClassName('layout')[0]; | |
p.innerHTML = ''; | |
p.appendChild(d); | |
var p = document.getElementsByClassName('layout')[0]; | |
var d = document.getElementsByClassName('layout__row layout__row_body')[0]; | |
p.innerHTML = ''; | |
p.appendChild(d); | |
var p = document.getElementsByClassName('layout__row layout__row_body')[0]; | |
var d = document.getElementsByClassName('column-wrapper js-sticky-wrapper')[0]; | |
p.innerHTML = ''; | |
p.appendChild(d); | |
var p = document.getElementsByClassName('column-wrapper js-sticky-wrapper')[0]; | |
var d = document.getElementsByClassName('content_left js-content_left')[0]; | |
p.innerHTML = ''; | |
p.appendChild(d); | |
var p = document.getElementsByClassName('content_left js-content_left')[0]; | |
var d = document.getElementsByClassName('post post_full')[0]; | |
p.innerHTML = ''; | |
p.appendChild(d); | |
document.getElementsByClassName('content_left js-content_left')[0].style.paddingRight = "0"; | |
var spoilers = document.querySelectorAll('.spoiler'); | |
for (var i = 0; i < spoilers.length; i++) { | |
spoilers[i].classList.add("spoiler_open"); | |
} | |
var spoiler_text = document.querySelectorAll('.spoiler_text'); | |
for (var i = 0; i < spoiler_text.length; i++) { | |
spoiler_text[i].style.display = "block"; | |
} | |
var links = document.querySelectorAll("a"), | |
style = window.getComputedStyle(links[0]), | |
color = style.getPropertyValue('color'); | |
for (var i = 0; i < links.length; i++) { | |
links[i].style.color = color; | |
} | |
document.getElementsByClassName('post__text')[0].style.textAlign = "justify"; | |
console.log("ok"); | |
} | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment