「Instagram」タグアーカイブ

Instagramの画像をPCで開いたらI4PCへのリンクを付けるだけのGreasemonkeyスクリプト

PCでInstagramのLikeやコメントが残せる「I4PC」が便利なのですぐそっちに移動できるようにリンク付けます。
※listagramでやったアレとほぼ同じです…。

ダウンロード : instagram_i4pc.user.js
Instagramの仕様変更に伴い終了。


// ==UserScript==
// @name           instagram i4pc
// @description    add instagram photo info, i4pc link
// @version        1.3
// @author         oflow
// @namespace      http://oflow.me/
// @include        http://instagr.am/p/*
// @exclude        https://*
// ==/UserScript==

(function() {
    var css = [
        '.profile-photo { float: none !important; position: absolute; }',
        '.profile-info { float: none !important; margin-left: 60px; }',
        '.profile-info h1 { margin-bottom: 0.3em; }',
        '.profile-info h1 span { font-weight: normal; margin-left: 0.5em; font-size: 90%; }'
    ].join('');

    function getMeta() {
        var meta = document.getElementsByTagName( 'meta' );
        for ( var i = 0, length = meta.length; i < length; i++ ) {
            if ( meta[i].getAttribute( 'property' ) == 'og:description' ) {
                addOgDescription( meta[i].getAttribute( 'content' ) );
                break;
            }
        }
    }

    function addOgDescription( content ) {
        if ( !content ) return;
        var span = document.createElement( 'span' );
        span.appendChild( document.createTextNode( content ) );
        var h1 = document.getElementsByTagName( 'h1' )[0];
        if ( h1 ) {
            h1.appendChild( span );
        }
    }

    function addI4PC() {
        var profileImg = document.getElementsByClassName( 'photo-info' )[0].getElementsByTagName( 'img' )[0];
        if ( !profileImg ) return;
        if ( !//profile_([0-9]+)_/.test( profileImg.src ) ) {
            return;
        }
        var id = RegExp.$1;
        var profileInfo = document.getElementsByClassName( 'profile-info' )[0];
        profileInfo.appendChild( document.createTextNode( ' · ' ) );
        var a = document.createElement( 'a' );
        a.href = 'http://www.i4pc.jp/user/' + id;
        a.appendChild( document.createTextNode( 'I4PC' ) );
        profileInfo.appendChild( a );
    }
    GM_addStyle( css );
    getMeta();
    addI4PC();

} )();

instagramの画像見たときにアーカイブ(listagram)のリンク付けるだけのGreasemonkeyスクリプト

instagramでアップロードした画像を一覧表示してくれる「listagram」というサイトがめっちゃ便利なんでinstagram開いたら「アーカイブ」ってリンク追加しただけ。

ついでに説明っぽいのあったら付け足してる。

2011/02/07
プロフィール画像設定してない場合はユーザーID取得できないので「アーカイブ」のリンク追加しないように修正

ダウンロード: instagram_archive.user.js
(listagramよりI4PCの方が個人的に好きなので終了)


// ==UserScript==
// @name           instagram archives
// @description    add instagram photo info, listagram archive link
// @version        1.3
// @author         oflow
// @namespace      http://oflow.me/
// @include        http://instagr.am/p/*
// @exclude        https://*
// ==/UserScript==

(function() {
    var css = [
        '.profile-photo { float: none !important; position: absolute; }',
        '.profile-info { float: none !important; margin-left: 60px; }',
        '.profile-info h1 { margin-bottom: 0.3em; }',
        '.profile-info h1 span { font-weight: normal; margin-left: 0.5em; font-size: 90%; }'
    ].join('');

    function getMeta() {
        var meta = document.getElementsByTagName( 'meta' );
        for ( var i = 0, length = meta.length; i < length; i++ ) {
            if ( meta[i].getAttribute( 'property' ) == 'og:description' ) {
                addOgDescription( meta[i].getAttribute( 'content' ) );
                break;
            }
        }
    }

    function addOgDescription( content ) {
        if ( !content ) return;
        var span = document.createElement( 'span' );
        span.appendChild( document.createTextNode( content ) );
        var h1 = document.getElementsByTagName( 'h1' )[0];
        if ( h1 ) {
            h1.appendChild( span );
        }
    }

    function addListagram() {
        var profileImg = document.getElementsByClassName( 'photo-info' )[0].getElementsByTagName( 'img' )[0];
        if ( !profileImg ) return;
        if ( !//profile_([0-9]+)_/.test( profileImg.src ) ) {
            return;
        }
        var id = RegExp.$1;
        var profileInfo = document.getElementsByClassName( 'profile-info' )[0];
        profileInfo.appendChild( document.createTextNode( ' · ' ) );
        var a = document.createElement( 'a' );
        a.href = 'http://listagr.am/u/' + id;
        a.appendChild( document.createTextNode( 'アーカイブ' ) );
        profileInfo.appendChild( a );
    }
    GM_addStyle( css );
    getMeta();
    addListagram();

} )();