Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name My Fancy New Userscript
- // @namespace http://your.homepage/
- // @version 0.1
- // @description enter something useful
- // @author You
- // @match http://*.iha.ee/*
- // @grant none
- // ==/UserScript==
- loadScript("http://code.jquery.com/jquery-1.11.2.min.js", function(){
- $("td[background]").each(function(){
- var obj = $(this);
- var image = obj.attr("background");
- obj.find("img").attr("src", image);
- });
- var clicked = false;
- var video_url = new Array(
- "http://www.iha.ee/index.php?mode=video&id=4176",
- "http://www.iha.ee/index.php?mode=video&id=4180",
- "http://www.iha.ee/index.php?mode=video&id=4202",
- "http://www.iha.ee/index.php?mode=video&id=4361"
- );
- $("img[src*='vid2.iha.ee']").each(function(){
- var obj = $(this);
- obj.bind("click", function(e){
- e.preventDefault();
- var id = $(this).parent().attr("href").split("id=")[1];
- loadVideo( id, 0 );
- });
- });
- var output_obj = false;
- function loadVideo( id, dummy ){
- var dummy_url = video_url[dummy];
- $.ajax({
- url: dummy_url,
- dataType: "html",
- success: function(response){
- var content = $(response);
- var player = content.find("#player");
- if( player.size() == 0 ){ loadVideo(id, dummy+1); return false;}
- var mac = response.split("%26mac%3D")[1].split("&type=flv")[0];
- 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+'&type=flv&bufferlength=3&autostart=true" wmode="opaque" allowscriptaccess="always" allowfullscreen="true" quality="high" name="ply" id="ply" src="player_iha.swf" type="application/x-shockwave-flash">';
- $("body").append(output_obj = $(playerHTML));
- }
- });
- };
- $(window).bind("keypress", function(e){
- if( e.keyCode == 27 ){
- if( output_obj ){
- output_obj.remove();
- output_obj = false;
- };
- };
- });
- $(window).bind("keypress", function(e){
- if( e.keyCode == 60 || e.charCode == 60 && !clicked ){
- clicked = true;
- var images = $(".member").find("img[src*='img2.iha.ee']");
- if( images.size() == 0 ){ return false; }
- var parent = images.eq(0).parents("table:first").parents("table:first");
- if( parent.is(".AccPicBg") ){
- parent = parent.parents("table:first");
- };
- var output = '';
- var output_obj;
- images.each(function(){
- var anchor = $(this).parents("a:first").attr("href");
- var src = $(this).attr("src");
- var hash = src.split("iha.ee/")[1].split("/")[1].split("e")[0];
- output+= '<a href="'+anchor+'" data-hash="'+hash+'" target="_blank" style="display:block;"><img src="'+src+'" style="width:100%; margin-bottom:20px;" /></a>';
- });
- parent.after( output_obj = $(output));
- parent.remove();
- output_obj.each(function(){
- var obj = $(this);
- var url = obj.attr("href");
- var hash = obj.attr("data-hash");
- $.ajax({
- url: url,
- dataType: "html",
- success: function( response ){
- var image = $(response).find(".pic_show").find(".Top_pic:first");
- var td = image.parents("td:first");
- var src;
- if( td.attr("background") ){
- src = td.attr("background");
- }else{
- src = image.attr("src")
- };
- obj.find("img").attr("src", src );
- }
- });
- });
- };
- });
- });
- function loadScript(url, callback)
- {
- // Adding the script tag to the head as suggested before
- var head = document.getElementsByTagName('head')[0];
- var script = document.createElement('script');
- script.type = 'text/javascript';
- script.src = url;
- // Then bind the event to the callback function.
- // There are several events for cross browser compatibility.
- script.onreadystatechange = callback;
- script.onload = callback;
- // Fire the loading
- head.appendChild(script);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement