Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Resize div
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  try to take over the world!
  6. // @author       You
  7. // @match        http://forum.index.hu/Article/showArticle?t=9012640
  8. // @grant        none
  9. // @require http://code.jquery.com/jquery-2.2.4.js
  10. // ==/UserScript==
  11. (function() {
  12.     'use strict';
  13.     var nr;
  14.     var id;
  15.     $(".art_t").css('max-height', 350);
  16.     $(".art_t").css('overflow: hidden', 350);
  17.  
  18.     $("<style type='text/css'> .popup-class{  position: fixed;top:0px; width:100%; background-color: white; height: 100%;  z-index:1999} </style>").appendTo("head");
  19.     $('<div/>', {
  20.         id: 'popup',
  21.         class: 'popup-class'
  22.     }).appendTo('#maindiv');
  23.     $("#popup").hide();
  24.  
  25.     var hsz;
  26.     var lgt = $('#maintd .art_rat_lft').length;
  27.     for (hsz = 0; hsz < lgt; hsz++) {
  28.         (function() {
  29.             var lft = document.getElementsByClassName("art_nr")[hsz];
  30.             var myContent = lft;
  31.             id = parseInt($(myContent).text());
  32.             $(".art_h_r").eq(hsz).append('<div style="display: inline;  cursor: pointer;" id="full_' + id + '">x</div>');
  33.             $(".art_t").eq(hsz).attr('id', 'fullt_' + id);
  34.             var target = 'fullt_' + id;
  35.  
  36.             $('#full_' + id).on('click', function() {
  37.                 fullsize(target)
  38.             });
  39.         }()); // immediate invocation
  40.  
  41.     }
  42.  
  43.  
  44.  
  45.     function fullsize(target) {
  46.         $("#popup").empty();
  47.         $(".art_t").css('max-height', '90%');
  48.         var content = $("#" + target).clone();
  49.         $("#popup").show();
  50.         $("#popup").append(content);
  51.         var gomb = '<button id="bezar">bezár</button>';
  52.         $("#popup").append(gomb);
  53.         $('#bezar').on('click', function() {
  54.             pclose()
  55.         });
  56.  
  57.     }
  58.  
  59.     function pclose() {
  60.         $("#popup").hide();
  61.         $(".art_t").css('max-height', 350);
  62.     }
  63. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement