Discussions » Development

anybody help to delevop Twitter Instagram Cards

§
Posted: 2014.12.07.
Edited: 2014.12.07.

anybody help to delevop Twitter Instagram Cards

hello sir ,

my script Twitter Instagram Cards- photo view is not working from last one month .... i donot know how to change .. so please modify the java script ....it is very help full script for twitter users .. thanks you

// ==/UserScript==

$documentHeight = '';

function height(){

    if($documentHeight != document.body.scrollHeight){
       loadInstagram();
    }
    setTimeout(function(){ height(); },3000);

}

function loadInstagram(){
    $documentHeight = document.body.scrollHeight;
    $('body').find('.js-tweet-text').each(function(key,value){
        if ( value.innerHTML.indexOf("instagr.am") >= 0 ){
            if( value.innerHTML.indexOf('div class="instagram"') >= 0 ){ }else{
                $instagram = value.innerHTML.split('http://instagr.am/p/');
                $instagram = $instagram[1].split('/"');
                $instagram = $instagram[0];
                $(this).append('<div class="instagram" style="margin-top: 10px; margin-bottom: 5px;"><img width="435" src="http://instagr.am/p/'+$instagram+'/media" /></div>');
            }
        }else if( value.innerHTML.indexOf("instagram.com/p/") >= 0 ){
            if( value.innerHTML.indexOf('div class="instagram"') >= 0 ){ }else{
                $instagram = value.innerHTML.split('instagram.com/p/');
                $instagram = $instagram[1].split('/"');
                $instagram = $instagram[0];
                $(this).append('<div class="instagram" style="margin-top: 10px; margin-bottom: 5px;"><img width="435" src="http://instagr.am/p/'+$instagram+'/media" /></div>');
            }
        }
    });
}
$(document).ready(function(){
    loadInstagram(); 
    height();
});
woxxomMod
§
Posted: 2014.12.07.
Edited: 2014.12.07.

You could have posted a link to the code, and provided a test page url.

As for the problem, the script uses image urls like this: http://instagram.com/p/vi0YErAPOx/media which is redirected then to the image itself, so maybe browsers don't like it. Try fetching the images with jQuery.ajax() and display them in the callback.

§
Posted: 2014.12.08.

thanks for reply.... i donot know how can reduce this problem

You could have posted a link to the code, and provided a test page url.

As for the problem, the script uses image urls like this: http://instagram.com/p/vi0YErAPOx/media which is redirected then to the image itself, so maybe browsers don't like it. Try fetching the images with jQuery.ajax() and display them in the callback.

Post reply

Sign in to post a reply.