Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //COMPILED SCRIPTS
- //SCRIPT OPTIONS
- var showposts = 20;
- var init = setInterval(function () {
- if(document.getElementsByClassName('fa-cog')[0]){
- go();
- if (window.location.href.indexOf('res') !== -1) {
- clear(); names(document.querySelectorAll('.quoteLink:not(.n)'));
- }
- }
- }, 500);
- function go(){
- clearInterval(init);
- if (localStorage.getItem("showposts")){
- showposts = localStorage.getItem("showposts");
- };
- var menu = document.getElementsByClassName('fa-cog')[0];
- var label = document.createElement('label');
- label.innerHTML = ' / Show Last'
- var option = document.createElement('input')
- option.type = 'text';
- option.style = "width:20px;"
- option.value = showposts;
- option.addEventListener('change', function(){
- localStorage.setItem("showposts", option.value);
- });
- label.appendChild(option);
- menu.parentNode.appendChild(label);
- }
- //POST WATCHER
- var targetNode = document.getElementsByClassName('thread-container')[0];
- var config = {childList : true};
- var callback = function (mutationsList) {
- for (var mutation of mutationsList) {
- if (mutation.type == 'childList') {
- var quotes = mutation.addedNodes[0].querySelectorAll('.quoteLink')
- names(quotes);
- clear();
- }
- }
- };
- var observer = new MutationObserver(callback);
- observer.observe(targetNode, config);
- //REMOVER
- function clear(){
- var posts = document.querySelectorAll('.post-container:not(:nth-last-child(-n+'+showposts+')):not(:first-child)'); for (i in posts){posts[i].innerHTML = '';}
- document.getElementsByClassName('message-info')[0].innerHTML = '';
- }
- //DROP ANYWHERE
- var dz = document.getElementsByClassName('dropzone')[0];
- document.addEventListener('dragover', function(e) {
- dz.style = 'position: fixed;top: 0px;left: 0px;width: 100%;height: 90000px;';
- });
- dz.addEventListener('dragleave', function(e) {
- dz.style = '';
- });
- dz.addEventListener('drop', function(e) {
- dz.style = '';
- });
- //IMAGE HOVER
- var imagehover = document.createElement('div');
- imagehover.style = 'pointer-events:none;z-index:1001;position:fixed;top:20px;right:20px;max-width:90%;height:700px';
- imagehover.id = 'imageHover';
- document.body.appendChild(imagehover);
- function hoverImg(e) {
- if (e.parentNode.className.indexOf('expanded') !== -1){
- return;
- }
- var link = e.children[0].href;
- if (e.dataset.mime == 'video/mp4'){
- imagehover.innerHTML = '<video style="width:auto;height:100%;" src="' + link + '" autoplay controls>'
- } else{
- imagehover.innerHTML = '<img style="width:auto;height:100%;" src="' + link + '">'
- }
- e.addEventListener("mouseout", function (e) {
- imagehover.innerHTML = '';
- });
- };
- document.getElementsByClassName('board-container')[0].addEventListener("mouseover", function (e) {
- if(e.path[2].className == 'post-attachment-image'){
- hoverImg(e.path[2])
- }
- });
- //QUOTE NAMES
- function names(quotes){
- if (quotes && quotes.length > 0){
- for (i in quotes){
- if (!quotes[i].hash){
- return;
- }
- var po = quotes[i].hash.replace('#', '');
- var name = '';
- var tpo = document.getElementById(po);
- if (tpo){
- name = tpo.querySelectorAll('.post-name')[0].innerHTML;
- }
- quotes[i].innerHTML = quotes[i].innerHTML + '<span> ' + name + '</span>';
- quotes[i].classList.add('n');
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement