CSS

Tuesday, September 13, 2011

Ngerubah favicon Blog pake script

function gantiFavicon(){
  var link = document.createElement('link');
      link.async = 'true';
      link.type = 'image/x-icon';
      link.rel = 'shortcut icon';
      link.href = '';
  document.getElementsByTagName('head')[0].appendChild(link);
}

Cobian heula ah bisi bohong :P

Kumaha upami we change that script janten something like this..

function gantiFavicon(pakeIni){
  var link = document.createElement('link');
      link.async = 'true';
      link.type = 'image/x-icon';
      link.rel = 'shortcut icon';
      link.href = pakeIni;
  document.getElementsByTagName('head')[0].appendChild(link);
}

gantiFavicon('http://graph.facebook.com/4/picture');

Kumaha upami kita selipin
gantiFavicon('http://graph.facebook.com/4/picture');
tadi di script login facebook yang udah kita punya..

function loadAplikasiPesbuk(appid){
  window.fbAsyncInit = function() {
    FB.init({appId: appid, status: true, cookie: true, xfbml: true});
    FB.getLoginStatus(tulisDitelLogin);
  };
  (function() {
    var e = document.createElement('script'); e.async = 'true';
        e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
    document.getElementById('fb-root').appendChild(e);
  }());
}

function tulisDitelLogin(tahMere){
  //blah.. blah.. blah.. weh disini mah script tetek bengek login..

  if(tahMere.session && tahMere.session.uid){
    gantiFavicon('http://graph.facebook.com/'+tahMere.session.uid+'/picture');
  }
}

loadAplikasiPesbuk('131581493563698');

Cobian deui lah hayoh :P

6 comments:

.Aink- said...

lamun misalna kieu http://graph.facebook.com/loggedinuser/picture geuning teu bijil a ??

Irland said...

atuh loggedinuser mah tidak ada dalm rumus per FBJS an :P

loggedinuser mah system xfbml <fb:name :D

kin.. kin urang apdet bari kokoreh ..

ACC Creations said...

kalau scrip nya di simpan di bagian mananya blog ??? maaf saya newbe yang lg belajar

Irland said...

dibagian mana aja juga bohel ko, saya mah orangnya bebas :P

coba click disini

Bayu Octhavian said...

kalo mau ganti navbar kaya punya blog i9ni gimana ??

--=::[Black Aиt Was Here]::=-- said...

gampang..
<style type="text/css">
.navbar{
display:block; position:fixed;
top:0; left:0;
width:100%; height:30px;
visibility:visible;
}
</style>