waitUntilExists

Is a small one function script, my most use one I use..

2014-04-14 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/386/1252/waitUntilExists.js

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         waitUntilExists
// @version      1.0
// @description  Is a small one function script, my most use one I use..
// @namespace https://greasyfork.org/users/209
// ==/UserScript==

(function ($) { 
    $.fn.waitUntilExists	= function (handler, shouldRunHandlerOnce, isChild) {
        var found	= 'found';
        var $this	= $(this.selector);
        var $elements	= $this.not(function () { return $(this).data(found); }).each(handler).data(found, true);   
        if (!isChild) {
            (window.waitUntilExists_Intervals = window.waitUntilExists_Intervals || {})[this.selector] =
                window.setInterval(function () { $this.waitUntilExists(handler, shouldRunHandlerOnce,     
        true); }, 500);
        } else if (shouldRunHandlerOnce && $elements.length) {
            window.clearInterval(window.waitUntilExists_Intervals[this.selector]);
        }
		return $this;
	}   
}(jQuery));

function navMenue()
{
    $('<style id="navMenue"></style>').appendTo('head');
    
    var newRule_navMenue = ' '
    +	'.navMenue {'
    +		'border-color: rgb(117, 98, 69);'
    +		'border-radius: 10px;'
    +		'border-width: 2px;'
    +		'border-style: solid;'
    +		'background-color: rgb(146, 133, 117);'
    +		'padding: 2px 16px;'
    +		'margin-right: 6px;'
    +		'}'
    +	'#myConfigButton {'
    +		'float: left;'
    +		'font-size: 17px;'
    +		'margin-left: 10px;'
    +		'margin-top: 11px;'
    +		'}'
    +	'a:focus, .navMenue:hover a, a:active {'
    +		'text-decoration: none;'
    +		'color: aliceblue;'
    +		'}';
    $("style#navMenue").append( newRule_navMenue );
    
    var newHtml_navMenue =
        '<span id="myConfigButton" style="float:left">'
    +		'<span id="prevMenue" class="navMenue"><a href="#"> Previous </a></span>'
    +		'<span id="nextMenue" class="navMenue"><a href="#"> Next </a></span>'
   	+		'<span id="wideMenue" class="navMenue"><a href="#"> Wide </a></span>'
   	+		'<span id="orginMenue" class="navMenue"><a href="#"> Orginal </a></span>'
    //+		'<span id="playMenue" class="navMenue"><a href="#"> Play </a></span>'
    +	'</span>';
    $( newHtml_navMenue ).insertAfter( ".fsol" );
}

function widePlayer()
{
    $('<style id="widePlayer"></style>').appendTo('head');
    
    var newRule_widePlayer = ' '
    +	'#content > div.filmborder {'
    +		'margin-left: 0px;'
    +		'width: 975px;'
    +		'}'
    +	'#content > div.filmborder > div.filmcontent {'
    +		' width: 975px;'
    +		'}'
    +	'.filmicerik object, .filmicerik embed, .filmicerik iframe, .filmicerik {'
    +		'width: 958px;'
    +		'}'
    +	'.filmcontent {'
    +		'width: 732px;'
    +		'}'
    +	'.filmicerik object, .filmicerik embed, .filmicerik iframe {'
    +		'height: 714px;'
    +		'}';
    $("style#widePlayer").append( newRule_widePlayer );	    	
}

function Colorize(thisnode)
{
    $(thisnode).prevAll().css('color','').attr('id','');
    $(thisnode).prev().css('color','lightblue').attr('id','next');
    $(thisnode).css('color','rgb(246, 120, 120)').attr('id','');
    $(thisnode).nextAll().css('color','').attr('id','');
    $(thisnode).next().css('color','rgb(146, 218, 146)').attr('id','prev'); 
}

$('#lightsoff').waitUntilExists(function()
{
    navMenue();
    
    $('#prevMenue, #nextMenue, #OrginMenue').hide();
    
    $('#content > div.leftC > div:nth-child(1)').attr('id','movies');
    
    $('#wideMenue').on('click',function(){	

        $( "#content" ).prepend( $( "#movies" ) );        
        widePlayer();
        $('#OrginMenue').show();
		$(this).hide();
        
        GM_setValue( "swefiler_state", "wide" );
    });
    
    $('#orginMenue').on('click',function(){	

        $( ".leftC" ).prepend( $( "#movies" ) );  
        $("style#widePlayer").remove(); 
        $('#wideMenue').show();
		$(this).hide();  
        
        GM_setValue( "swefiler_state", "orgin" );     
    });
    
    //GM_deleteValue( "swefiler_state" ); 
    
    $('#' + GM_getValue( 'swefiler_state' ) + 'Menue' ).click();
        
});

$('#fastdizidata > a:nth-child(1)').waitUntilExists(function()
{
    $('#prevMenue, #nextMenue').show();
    
    $('#fastdizidata > a:contains(' + $('#yazibasligi').text() + ')').each(function(){
        Colorize(this);
    });
    
    $('#fastdizidata > a').on('click',function(){
        Colorize(this);
    });
    
    $('#prevMenue').on('click',function(){
        $('#prev').click();
    });
    
    $('#nextMenue').on('click',function(){
        $('#next').click();
    });
    
    $('#playMenue').on('click',function(){
        //$('#Playerholder iframe #playerObj').playVideo();
        //$('#playerObj').get(0).play()
        var myVid = document.getElementById("playerObj");
        myVid.play();
    });
    
    $('.yazitip.cpointer').click();
});

$(document).ready(function(){

    if( $('#header .headerleft a').size() > 0 && $('.yazitip.cpointer').size() > 0 )
    {
        $('.yazitip.cpointer').click();
    }

});