Advertisement
Guest User

iha pics/vids

a guest
Mar 31st, 2015
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         My Fancy New Userscript
  3. // @namespace    http://your.homepage/
  4. // @version      0.1
  5. // @description  enter something useful
  6. // @author       You
  7. // @match        http://*.iha.ee/*
  8. // @grant        none
  9. // ==/UserScript==
  10.  
  11. loadScript("http://code.jquery.com/jquery-1.11.2.min.js", function(){
  12.    $("td[background]").each(function(){
  13.        var obj = $(this);
  14.        var image = obj.attr("background");
  15.        obj.find("img").attr("src", image);
  16.    });
  17.  
  18.    var clicked = false;
  19.  
  20.    var video_url = new Array(
  21.                     "http://www.iha.ee/index.php?mode=video&id=4176",
  22.                     "http://www.iha.ee/index.php?mode=video&id=4180",
  23.                     "http://www.iha.ee/index.php?mode=video&id=4202",
  24.                     "http://www.iha.ee/index.php?mode=video&id=4361"
  25.                    );
  26.  
  27.         $("img[src*='vid2.iha.ee']").each(function(){
  28.  
  29.                 var obj = $(this);
  30.  
  31.                 obj.bind("click", function(e){
  32.                         e.preventDefault();
  33.                         var id = $(this).parent().attr("href").split("id=")[1];
  34.                         loadVideo( id, 0 );
  35.                 });
  36.  
  37.         });
  38.         var output_obj = false;
  39.         function loadVideo( id, dummy ){
  40.                 var dummy_url = video_url[dummy];
  41.                 $.ajax({
  42.                         url: dummy_url,
  43.                         dataType: "html",
  44.                         success: function(response){
  45.                                 var content = $(response);
  46.                                 var player = content.find("#player");
  47.                                 if( player.size() == 0 ){ loadVideo(id, dummy+1);  return false;}
  48.  
  49.                                 var mac = response.split("%26mac%3D")[1].split("&type=flv")[0];
  50.                                 var playerHTML = '<embed style="position:fixed; z-index:990; top:0; left:10%; right:0; width:80%; bottom:0;" flashvars="file=http%3A%2F%2Fwww.iha.ee%2Fshow_video_get.php%3Fid%3D'+id+'%26mac%3D'+mac+'&amp;type=flv&amp;bufferlength=3&amp;autostart=true" wmode="opaque" allowscriptaccess="always" allowfullscreen="true" quality="high" name="ply" id="ply"  src="player_iha.swf" type="application/x-shockwave-flash">';
  51.  
  52.                                 $("body").append(output_obj = $(playerHTML));
  53.                         }
  54.                 });
  55.         };
  56.  
  57.         $(window).bind("keypress", function(e){
  58.                 if( e.keyCode == 27 ){
  59.                         if( output_obj ){
  60.                                 output_obj.remove();
  61.                                 output_obj = false;
  62.                         };
  63.                 };
  64.         });
  65.  
  66.    $(window).bind("keypress", function(e){
  67.        if( e.keyCode == 60 || e.charCode == 60 && !clicked ){
  68.            clicked = true;
  69.            var images = $(".member").find("img[src*='img2.iha.ee']");
  70.  
  71.            if( images.size() == 0 ){ return false; }
  72.            var parent = images.eq(0).parents("table:first").parents("table:first");
  73.                          if( parent.is(".AccPicBg") ){
  74.                                 parent = parent.parents("table:first");
  75.                          };
  76.            var output = '';
  77.            var output_obj;
  78.  
  79.            images.each(function(){
  80.                var anchor = $(this).parents("a:first").attr("href");
  81.                var src = $(this).attr("src");
  82.                var hash = src.split("iha.ee/")[1].split("/")[1].split("e")[0];
  83.                output+= '<a href="'+anchor+'" data-hash="'+hash+'" target="_blank" style="display:block;"><img src="'+src+'" style="width:100%; margin-bottom:20px;" /></a>';
  84.            });
  85.  
  86.            parent.after( output_obj = $(output));
  87.            parent.remove();
  88.  
  89.            output_obj.each(function(){
  90.                var obj = $(this);
  91.                var url = obj.attr("href");
  92.                var hash = obj.attr("data-hash");
  93.                $.ajax({
  94.                    url: url,
  95.                    dataType: "html",
  96.                    success: function( response ){
  97.                        var image = $(response).find(".pic_show").find(".Top_pic:first");
  98.                        var td = image.parents("td:first");
  99.                        var src;
  100.  
  101.                        if( td.attr("background") ){
  102.                            src = td.attr("background");
  103.                        }else{
  104.                            src = image.attr("src")
  105.                        };
  106.                        obj.find("img").attr("src", src );
  107.                    }
  108.                });
  109.  
  110.            });
  111.  
  112.  
  113.        };
  114.    });
  115.  
  116. });
  117.  
  118. function loadScript(url, callback)
  119. {
  120.    // Adding the script tag to the head as suggested before
  121.    var head = document.getElementsByTagName('head')[0];
  122.    var script = document.createElement('script');
  123.    script.type = 'text/javascript';
  124.    script.src = url;
  125.  
  126.    // Then bind the event to the callback function.
  127.    // There are several events for cross browser compatibility.
  128.    script.onreadystatechange = callback;
  129.    script.onload = callback;
  130.  
  131.    // Fire the loading
  132.    head.appendChild(script);
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement