Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Event Drivers
- var cooldown = true;
- document.getElementById('divThreads').addEventListener("mouseover", function (e) {
- if (e)
- if (e.target.className == 'imgLink' || e.target.tagName == "IMG") {
- hoverImg(e);
- }
- if (e.target.className == "myQuote") {
- if (cooldown) {
- hoverThis(e);
- cooldown = false;
- setTimeout(function () {
- cooldown = true;
- }, 500);
- }
- }
- });
- var targetNode = document.getElementsByClassName('divPosts')[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');
- for (var i = 0; i < quotes.length; ++i) {
- prepNewhovers([quotes[i]]);
- console.log('mutated');
- newcount();
- }
- }
- }
- };
- var observer = new MutationObserver(callback);
- observer.observe(targetNode, config);
- //Image Hover
- var imagehover = document.createElement('div');
- imagehover.style = 'pointer-events: none;z-index: 9999999;position:fixed;top:20px;right:20px;max-width:90%;height:700px';
- imagehover.id = 'imageHover';
- document.body.appendChild(imagehover);
- function hoverImg(e) {
- if (e.target.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.className == 'quotebox') {
- return;
- }
- if (e.target.src && e.target.src.indexOf('video') > -1) {
- var ext = e.target.src.split('video')[1];
- imagehover.innerHTML = '<video style="width:auto;height:100%;" src="' + e.target.src.replace("t_", "") + '.' + ext + '" autoplay controls loop>';
- } else {
- if (e.target.className == 'imgExpanded') {
- return;
- }
- imagehover.innerHTML = '<img style="width:auto;height:100%;" src="' + e.target.parentElement.href + '">';
- }
- e.target.addEventListener("mouseout", function (e) {
- imagehover.innerHTML = '';
- });
- }
- $(document).on('ready', function() {
- if(active_page == "thread") {
- $duration = 1000;
- $("a[href='#bannerImage']").on("click", function(e) {
- e.preventDefault();
- $("html, body").stop().animate({ scrollTop: 0 }, $duration);
- });
- $("a[href='#footer']").on("click", function(e) {
- e.preventDefault();
- $("html, body").stop().animate({ scrollTop: $(document).height()-$(window).height() }, $duration);
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement