Tampilkan postingan dengan label komentar. Tampilkan semua postingan
Tampilkan postingan dengan label komentar. Tampilkan semua postingan

Sabtu, 07 April 2012

Pasang Emoticon Kaskus dan Adsense-ID Pada Blogger Yang Menggunakan Thread Comment - Terbaru

| |
0 komentar
Sebelumnya Saya pernah membuat tutorial tentang Cara Pasang Emoticon Kaskus dan Adsense-ID pada komentar blog, dan ternyata cara itu tidak dapat diterapkan jika sobat blogger menggunakan Thread Comment atau fitur reply comment pada komentar blognya. Nah sekarang saya akan membahas tentang Cara Membuat Emoticon Kaskus dan Adsense-ID pada blog yang menggunakan thread comment atau fitur comment reply.

Agar lebih aman, sebaiknya simpan dulu template anda dengan mengklik Download Template Lengkap.
Ikuti langkah berikut ini:
1. Login ke Dasbor Anda >> Edit HTML
2. Jangan lupa centang Expand Template Widget
3. Cari kode penutup </body>
4. Simpan kode ini di atas </body>
<!-- emoticon  mainbom.com -->
<script type='text/javascript'>
//<![CDATA[
a = document.getElementById('comment-holder');
if(a) {
b = a.getElementsByTagName("p");
for(i=0; i < b.length; i++) {
if (b.item(i).getAttribute('CLASS') == 'comment-content') {
_str = b.item(i).innerHTML.replace(/:a:/gi, "<img src='http://i.imgur.com/Jnwl1.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:b:/gi, "<img src='http://i.imgur.com/h9NDs.gif' class='smiley'/>");
_str = _str.replace(/:c:/gi, "<img src='http://i.imgur.com/IL1IB.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:d:/gi, "<img src='http://i.imgur.com/k3Fdh.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:e:/gi, "<img src='http://i.imgur.com/ZDlSF.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:f:/gi, "<img src='http://i.imgur.com/OXalA.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:g:/gi, "<img src='http://i.imgur.com/cnARR.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:h:/gi, "<img src='http://i.imgur.com/WTmJr.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:i:/gi, "<img src='http://i.imgur.com/kenHK.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:j:/gi, "<img src='http://i.imgur.com/aDJrj.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:k:/gi, "<img src='http://i.imgur.com/E5qba.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:l:/gi, "<img src='http://i.imgur.com/w3vTW.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:m:/gi, "<img src='http://i.imgur.com/0WFG2.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:n:/gi, "<img src='http://i.imgur.com/bkfG8.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:o:/gi, "<img src='http://i.imgur.com/zvteN.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:p:/gi, "<img src='http://i.imgur.com/xkzm0.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:q:/gi, "<img src='http://i.imgur.com/UqDiW.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:r:/gi, "<img src='http://i.imgur.com/5uihz.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:s:/gi, "<img src='http://i.imgur.com/5O9L2.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:t:/gi, "<img src='http://i.imgur.com/7RDAt.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:u:/gi, "<img src='http://i.imgur.com/WmQPn.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:v:/gi, "<img src='http://i.imgur.com/9C3hy.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:w:/gi, "<img src='http://i.imgur.com/fFhYI.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:x:/gi, "<img src='http://i.imgur.com/e50uc.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:y:/gi, "<img src='http://i.imgur.com/RjY5y.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:z:/gi, "<img src='http://i.imgur.com/lrZEF.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:ab:/gi, "<img src='http://i.imgur.com/KJbrk.gif' alt='' width='40' class='smiley'/>");
b.item(i).innerHTML = _str;
}}}
//]]>
</script>
5. Kemudian cari lagi kode:
<div class='post-footer-line post-footer-line-3'/>
</div>
</div>
</div>
6. Dan pasang kode berikut ini di bawah  </div> yang terakhir
<!-- emoticon  mainbom.com -->
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<div style='text-align:center; font-weight:bold; margin-top:15px; margin-bottom:10px;'>
Untuk menggunakan emoticon ini, COPAS kode ke kotak komentar.
</div>
<b><img src='http://i.imgur.com/4a2GG.gif' width='40'/>
:a:
<img src='http://i.imgur.com/Jnwl1.gif' width='40'/>
:b:
<img src='http://i.imgur.com/h9NDs.gif' width='40'/>
:c:
<img src='http://i.imgur.com/IL1IB.gif' width='40'/>
:d:
<img src='http://i.imgur.com/k3Fdh.gif' width='40'/>
:e:
<img src='http://i.imgur.com/ZDlSF.gif' width='40'/>
:f:
<img src='http://i.imgur.com/OXalA.gif' width='40'/>
:g:
<img src='http://i.imgur.com/cnARR.gif' width='40'/>
:h:
<img src='http://i.imgur.com/WTmJr.gif' width='40'/>
:i:
<br/>
<img src='http://i.imgur.com/kenHK.gif' width='40'/>
:j:
<img src='http://i.imgur.com/aDJrj.gif' width='40'/>
:k:
<img src='http://i.imgur.com/E5qba.gif' width='40'/>
:l:
<img src='http://i.imgur.com/w3vTW.gif' width='40'/>
:m:
<img src='http://i.imgur.com/0WFG2.gif' width='40'/>
:n:
<img src='http://i.imgur.com/bkfG8.gif' width='40'/>
:o:
<img src='http://i.imgur.com/zvteN.gif' width='40'/>
:p:
<img src='http://i.imgur.com/xkzm0.gif' width='40'/>
:q:
<img src='http://i.imgur.com/UqDiW.gif' width='40'/>
:r:
<br/>
<img src='http://i.imgur.com/5uihz.gif' width='40'/>
:s:
<img src='http://i.imgur.com/5O9L2.gif' width='40'/>
:t:
<img src='http://i.imgur.com/7RDAt.gif' width='40'/>
:u:
<img src='http://i.imgur.com/WmQPn.gif' width='40'/>
:v:
<img src='http://i.imgur.com/9C3hy.gif' width='40'/>
:w:
<img src='http://i.imgur.com/fFhYI.gif' width='40'/>
:x:
<img src='http://i.imgur.com/e50uc.gif' width='40'/>
:y:
<img src='http://i.imgur.com/RjY5y.gif' width='40'/>
:z:
<img src='http://i.imgur.com/lrZEF.gif' width='40'/>
:ab:
<br/>
</b>
</b:if>
7. Save Template dan lihat hasilnya.

Hasilnya akan terlihat seperti ini:
emoticon kaskus dan adsense-id

Jika tidak berhasil dan Anda memiliki pertanyaan, silahkan tinggalkan komentar Anda.
Sekian, semoga bermanfaat...
Read More

Rabu, 21 Maret 2012

Cara Membuat Emoticon Kaskus dan Adsense-id di Komentar Blog

| |
0 komentar

Langsung aja tanpa basa-basi...
Sebelum mengedit template sebaiknya simpan dulu template anda dengan mengklik Download Template Lengkap agar lebih aman jika terjadi kegagalan saat mengedit template.

1. Login ke Dasbor Anda ---> Edit HTML
2. Jangan lupa centang Expand Template Widget
3. Cari kode ini:
<b:if cond='data:post.embedCommentForm'>
(di template saya ada 2 kode seperti ini, pilih yang ke 2)
4. Masukkan kode berikut ini tepat di atas kode <b:if cond='data:post.embedCommentForm'>
<b>
<img src='http://i.imgur.com/4a2GG.gif' width='40'/>
:a:
<img src='http://i.imgur.com/Jnwl1.gif' width='40'/>
:b:
<img src='http://i.imgur.com/h9NDs.gif' width='40'/>
:c:
<img src='http://i.imgur.com/IL1IB.gif' width='40'/>
:d:
<img src='http://i.imgur.com/k3Fdh.gif' width='40'/>
:e:
<img src='http://i.imgur.com/ZDlSF.gif' width='40'/>
:f:
<img src='http://i.imgur.com/OXalA.gif' width='40'/>
:g:
<img src='http://i.imgur.com/cnARR.gif' width='40'/>
:h:
<img src='http://i.imgur.com/WTmJr.gif' width='40'/>
:i:
<img src='http://i.imgur.com/kenHK.gif' width='40'/>
:j:
<img src='http://i.imgur.com/aDJrj.gif' width='40'/>
:k:
<img src='http://i.imgur.com/E5qba.gif' width='40'/>
:l:
<img src='http://i.imgur.com/w3vTW.gif' width='40'/>
:m:
<img src='http://i.imgur.com/0WFG2.gif' width='40'/>
:n:
<img src='http://i.imgur.com/bkfG8.gif' width='40'/>
:o:
<img src='http://i.imgur.com/zvteN.gif' width='40'/>
:p:
<img src='http://i.imgur.com/xkzm0.gif' width='40'/>
:q:
<img src='http://i.imgur.com/UqDiW.gif' width='40'/>
:r:
<br/>
<img src='http://i.imgur.com/5uihz.gif' width='40'/>
:s:
<img src='http://i.imgur.com/5O9L2.gif' width='40'/>
:t:
<img src='http://i.imgur.com/7RDAt.gif' width='40'/>
:u:
<img src='http://i.imgur.com/WmQPn.gif' width='40'/>
:v:
<img src='http://i.imgur.com/9C3hy.gif' width='40'/>
:w:
<img src='http://i.imgur.com/fFhYI.gif' width='40'/>
:x:
<img src='http://i.imgur.com/e50uc.gif' width='40'/>
:y:
<img src='http://i.imgur.com/RjY5y.gif' width='40'/>
:z:
<img src='http://i.imgur.com/lrZEF.gif' width='40'/>
:ab:
<br/>
</b>

5.  Pasang kode dibawah ini sebelum </body>
<!-- Emoticon  Start -->
<script type='text/javascript'>
//<![CDATA[
a = document.getElementById('comments');
if(a) {
b = a.getElementsByTagName("DD");
for(i=0; i < b.length; i++) {
if (b.item(i).getAttribute('CLASS') == 'comment-body') {
_str = b.item(i).innerHTML.replace(/:a:/gi, "<img src='http://i.imgur.com/4a2GG.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:b:/gi, "<img src='http://i.imgur.com/Jnwl1.gif' class='smiley'/>");
_str = _str.replace(/:c:/gi, "<img src='http://i.imgur.com/h9NDs.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:d:/gi, "<img src='http://i.imgur.com/IL1IB.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:e:/gi, "<img src='http://i.imgur.com/k3Fdh.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:f:/gi, "<img src='http://i.imgur.com/ZDlSF.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:g:/gi, "<img src='http://i.imgur.com/OXalA.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:h:/gi, "<img src='http://i.imgur.com/cnARR.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:i:/gi, "<img src='http://i.imgur.com/WTmJr.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:j:/gi, "<img src='http://i.imgur.com/kenHK.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:k:/gi, "<img src='http://i.imgur.com/aDJrj.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:l:/gi, "<img src='http://i.imgur.com/E5qba.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:m:/gi, "<img src='http://i.imgur.com/w3vTW.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:n:/gi, "<img src='http://i.imgur.com/0WFG2.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:o:/gi, "<img src='http://i.imgur.com/bkfG8.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:p:/gi, "<img src='http://i.imgur.com/zvteN.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:q:/gi, "<img src='http://i.imgur.com/xkzm0.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:r:/gi, "<img src='http://i.imgur.com/UqDiW.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:s:/gi, "<img src='http://i.imgur.com/5uihz.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:t:/gi, "<img src='http://i.imgur.com/5O9L2.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:u:/gi, "<img src='http://i.imgur.com/7RDAt.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:v:/gi, "<img src='http://i.imgur.com/WmQPn.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:w:/gi, "<img src='http://i.imgur.com/9C3hy.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:x:/gi, "<img src='http://i.imgur.com/fFhYI.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:y:/gi, "<img src='http://i.imgur.com/e50uc.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:z:/gi, "<img src='http://i.imgur.com/RjY5y.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:ab:/gi, "<img src='http://i.imgur.com/lrZEF.gif' alt='' width='40' class='smiley'/>");
b.item(i).innerHTML = _str;
}
}
}
a = document.getElementById('comments');
if(a) {
c = a.getElementsByTagName("DD");
for(i=0; i < c.length; i++) {
if (c.item(i).getAttribute('CLASS') == 'comment-body-author') {
_str = b.item(i).innerHTML.replace(/:a:/gi, "<img src='http://i.imgur.com/4a2GG.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:b:/gi, "<img src='http://i.imgur.com/Jnwl1.gif' class='smiley'/>");
_str = _str.replace(/:c:/gi, "<img src='http://i.imgur.com/h9NDs.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:d:/gi, "<img src='http://i.imgur.com/IL1IB.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:e:/gi, "<img src='http://i.imgur.com/k3Fdh.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:f:/gi, "<img src='http://i.imgur.com/ZDlSF.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:g:/gi, "<img src='http://i.imgur.com/OXalA.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:h:/gi, "<img src='http://i.imgur.com/cnARR.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:i:/gi, "<img src='http://i.imgur.com/WTmJr.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:j:/gi, "<img src='http://i.imgur.com/kenHK.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:k:/gi, "<img src='http://i.imgur.com/aDJrj.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:l:/gi, "<img src='http://i.imgur.com/E5qba.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:m:/gi, "<img src='http://i.imgur.com/w3vTW.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:n:/gi, "<img src='http://i.imgur.com/0WFG2.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:o:/gi, "<img src='http://i.imgur.com/bkfG8.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:p:/gi, "<img src='http://i.imgur.com/zvteN.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:q:/gi, "<img src='http://i.imgur.com/xkzm0.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:r:/gi, "<img src='http://i.imgur.com/UqDiW.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:s:/gi, "<img src='http://i.imgur.com/5uihz.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:t:/gi, "<img src='http://i.imgur.com/5O9L2.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:u:/gi, "<img src='http://i.imgur.com/7RDAt.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:v:/gi, "<img src='http://i.imgur.com/WmQPn.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:w:/gi, "<img src='http://i.imgur.com/9C3hy.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:x:/gi, "<img src='http://i.imgur.com/fFhYI.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:y:/gi, "<img src='http://i.imgur.com/e50uc.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:z:/gi, "<img src='http://i.imgur.com/RjY5y.gif' alt='' width='40' class='smiley'/>");
_str = _str.replace(/:ab:/gi, "<img src='http://i.imgur.com/lrZEF.gif' alt='' width='40' class='smiley'/>");
c.item(i).innerHTML = _str;
}
}
}
//]]>
</script>
<!-- Emoticon  End -->
6. Save template dan lihat hasilnya

Untuk menambah emoticon lain silahkan berkreasi sendiri.
Jika ada masalah silahkan komentar dibawah...
Read More

Jumat, 24 Februari 2012

Mengatasi Tombol Reply Yang Tidak Bisa di Klik Alias Error

| |
0 komentar
Tadi saya ingin membalas sebuah komentar di blog ini dan saya menemukan masalah bahwa fitur tombol reply yang ada di blog ini tidak berfungsi dan tidak berpengaruh apa-apa saat di klik, walhasil saya tidak jadi membalas komentar tersebut, hehehe..
Setelah mencari info, ternyata ada perubahan pada JavaScript thread comment. Nah untuk mengatasi masalah tersebut, Lakukan langkah-langkah berikut ini:

1. Login ke Dasbor Anda >> Rancangan >> Edit HTML
2. Centang Expand Template Widget
3. Untuk menjaga hal-hal yang tidak diinginkan saya sarankan backup dulu template blog anda dengan mengklik Download Full Template.
4. Cari kode:
<b:includable id='threaded_comment_js' var='post'>
  <script defer='defer' expr:src='data:post.commentSrc' type='text/javascript'/>

  <script type='text/javascript'>
    (function() {
      var items = <data:post.commentJso/>;
      var msgs = <data:post.commentMsgs/>;
      var postId = &#39;<data:post.id/>&#39;;
      var feed = &#39;<data:post.commentFeed/>&#39;;
      var authorName = &#39;<data:post.author/>&#39;;
      var authorUrl = &#39;<data:post.authorUrl/>&#39;;
      var blogId = &#39;<data:top.id/>&#39;;
      var baseUri = &#39;<data:post.commentBase/>&#39;;

// <![CDATA[
      feed += '?alt=json&v=2&orderby=published&reverse=false&max-results=50';
      var cursor = null;
      if (items && items.length > 0) {
        cursor = parseInt(items[items.length - 1].timestamp) + 1;
      }

      var bodyFromEntry = function(entry) {
        if (entry.gd$extendedProperty) {
          for (var k in entry.gd$extendedProperty) {
            if (entry.gd$extendedProperty[k].name == 'blogger.contentRemoved') {
              return '<span class="deleted-comment">' + entry.content.$t + '</span>';
            }
          }
        }
        return entry.content.$t;
      }

      var parse = function(data) {
        cursor = null;
        var comments = [];
        if (data && data.feed && data.feed.entry) {
          for (var i = 0, entry; entry = data.feed.entry[i]; i++) {
            var comment = {};
            // comment ID, parsed out of the original id format
            var id = /blog-(\d+).post-(\d+)/.exec(entry.id.$t);
            comment.id = id ? id[2] : null;
            comment.body = bodyFromEntry(entry);
            comment.timestamp = Date.parse(entry.published.$t) + '';
            if (entry.author && entry.author.constructor === Array) {
              var auth = entry.author[0];
              if (auth) {
                comment.author = {
                  name: (auth.name ? auth.name.$t : undefined),
                  profileUrl: (auth.uri ? auth.uri.$t : undefined),
                  avatarUrl: (auth.gd$image ? auth.gd$image.src : undefined)
                };
              }
            }
            if (entry.link) {
              if (entry.link[2]) {
                comment.link = comment.permalink = entry.link[2].href;
              }
              if (entry.link[3]) {
                var pid = /.*comments\/default\/(\d+)\?.*/.exec(entry.link[3].href);
                if (pid && pid[1]) {
                  comment.parentId = pid[1];
                }
              }
            }
            comment.deleteclass = 'item-control blog-admin';
            if (entry.gd$extendedProperty) {
              for (var k in entry.gd$extendedProperty) {
                console.log(entry.gd$extendedProperty[k].name + ' - ' + entry.gd$extendedProperty[k].value);
                if (entry.gd$extendedProperty[k].name == 'blogger.itemClass') {
                  comment.deleteclass += ' ' + entry.gd$extendedProperty[k].value;
                }
              }
            }
            comments.push(comment);
          }
        }
        return comments;
      };

      var paginator = function(callback) {
        if (hasMore()) {
          var url = feed;
          if (cursor) {
            url += '&published-min=' + new Date(cursor).toISOString();
          }
          window.bloggercomments = function(data) {
            var parsed = parse(data);
            cursor = parsed.length < 50 ? null
                : parseInt(parsed[parsed.length - 1].timestamp) + 1
            callback(parsed);
            window.bloggercomments = null;
          }
          url += '&callback=bloggercomments';
          var script = document.createElement('script');
          script.type = 'text/javascript';
          script.src = url;
          document.getElementsByTagName('head')[0].appendChild(script);
        }
      };
      var hasMore = function() {
        return !!cursor;
      };
      var getMeta = function(key, comment) {
        if ('iswriter' == key) {
          var matches = !!comment.author
              && comment.author.name == authorName
              && comment.author.profileUrl == authorUrl;
          return matches ? 'true' : '';
        } else if ('deletelink' == key) {
          return baseUri + '/delete-comment.g?blogID=' + blogId + '&postID=' + comment.id;
        } else if ('deleteclass' == key) {
          return comment.deleteclass;
        }
        return '';
      };

      var replybox = null;
      var replyUrlParts = null;
      var replyParent = undefined;

      var onReply = function(commentId, domId) {
        if (replybox == null) {
          // lazily cache replybox, and adjust to suit this style:
          replybox = document.getElementById('comment-editor');
          if (replybox != null) {
            replybox.height = '250px';
            replybox.style.display = 'block';
            replyUrlParts = replybox.src.split('#');
          }
        }
        if (replybox && (commentId !== replyParent)) {
          document.getElementById(domId).insertBefore(replybox, null);
          replybox.src = replyUrlParts[0]
              + (commentId ? '&parentID=' + commentId : '')
              + '#' + replyUrlParts[1];
          replyParent = commentId;
        }
      };

      var tok = 'comment-form_';
      var hash = window.location.hash || '';
      var startThread = hash.indexOf(tok) == 1 ? hash.substring(tok.length + 1) : undefined;

      // Configure commenting API:
      var configJso = {
        'maxDepth': 2
      };
      var provider = {
        'id': postId,
        'data': items,
        'loadNext': paginator,
        'hasMore': hasMore,
        'getMeta': getMeta,
        'onReply': onReply,
        'rendered': true,
        'initReplyThread': startThread,
        'config': configJso,
        'messages': msgs
      };

      var render = function() {
        if (window.goog && window.goog.comments) {
          var holder = document.getElementById('comment-holder');
          window.goog.comments.render(holder, provider);
        }
      };

      // render now, or queue to render when library loads:
      if (window.goog && window.goog.comments) {
        render();
      } else {
        window.goog = window.goog || {};
        window.goog.comments = window.goog.comments || {};
        window.goog.comments.loadQueue = window.goog.comments.loadQueue || [];
        window.goog.comments.loadQueue.push(render);
      }
    })();
// ]]>
  </script>
</b:includable>
5. Ganti semua kode tersebut dengan kode dibawah ini:
<b:includable id='threaded_comment_js' var='post'>
  <script async='async' expr:src='data:post.commentSrc' type='text/javascript'/>

  <script type='text/javascript'>
    (function() {
      var items = <data:post.commentJso/>;
      var msgs = <data:post.commentMsgs/>;
      var config = <data:post.commentConfig/>;

// <![CDATA[
      var cursor = null;
      if (items && items.length > 0) {
        cursor = parseInt(items[items.length - 1].timestamp) + 1;
      }

      var bodyFromEntry = function(entry) {
        if (entry.gd$extendedProperty) {
          for (var k in entry.gd$extendedProperty) {
            if (entry.gd$extendedProperty[k].name == 'blogger.contentRemoved') {
              return '<span class="deleted-comment">' + entry.content.$t + '</span>';
            }
          }
        }
        return entry.content.$t;
      }

      var parse = function(data) {
        cursor = null;
        var comments = [];
        if (data && data.feed && data.feed.entry) {
          for (var i = 0, entry; entry = data.feed.entry[i]; i++) {
            var comment = {};
            // comment ID, parsed out of the original id format
            var id = /blog-(\d+).post-(\d+)/.exec(entry.id.$t);
            comment.id = id ? id[2] : null;
            comment.body = bodyFromEntry(entry);
            comment.timestamp = Date.parse(entry.published.$t) + '';
            if (entry.author && entry.author.constructor === Array) {
              var auth = entry.author[0];
              if (auth) {
                comment.author = {
                  name: (auth.name ? auth.name.$t : undefined),
                  profileUrl: (auth.uri ? auth.uri.$t : undefined),
                  avatarUrl: (auth.gd$image ? auth.gd$image.src : undefined)
                };
              }
            }
            if (entry.link) {
              if (entry.link[2]) {
                comment.link = comment.permalink = entry.link[2].href;
              }
              if (entry.link[3]) {
                var pid = /.*comments\/default\/(\d+)\?.*/.exec(entry.link[3].href);
                if (pid && pid[1]) {
                  comment.parentId = pid[1];
                }
              }
            }
            comment.deleteclass = 'item-control blog-admin';
            if (entry.gd$extendedProperty) {
              for (var k in entry.gd$extendedProperty) {
                if (entry.gd$extendedProperty[k].name == 'blogger.itemClass') {
                  comment.deleteclass += ' ' + entry.gd$extendedProperty[k].value;
                }
              }
            }
            comments.push(comment);
          }
        }
        return comments;
      };

      var paginator = function(callback) {
        if (hasMore()) {
          var url = config.feed + '?alt=json&v=2&orderby=published&reverse=false&max-results=50';
          if (cursor) {
            url += '&published-min=' + new Date(cursor).toISOString();
          }
          window.bloggercomments = function(data) {
            var parsed = parse(data);
            cursor = parsed.length < 50 ? null
                : parseInt(parsed[parsed.length - 1].timestamp) + 1
            callback(parsed);
            window.bloggercomments = null;
          }
          url += '&callback=bloggercomments';
          var script = document.createElement('script');
          script.type = 'text/javascript';
          script.src = url;
          document.getElementsByTagName('head')[0].appendChild(script);
        }
      };
      var hasMore = function() {
        return !!cursor;
      };
      var getMeta = function(key, comment) {
        if ('iswriter' == key) {
          var matches = !!comment.author
              && comment.author.name == config.authorName
              && comment.author.profileUrl == config.authorUrl;
          return matches ? 'true' : '';
        } else if ('deletelink' == key) {
          return config.baseUri + '/delete-comment.g?blogID='
               + config.blogId + '&postID=' + comment.id;
        } else if ('deleteclass' == key) {
          return comment.deleteclass;
        }
        return '';
      };

      var replybox = null;
      var replyUrlParts = null;
      var replyParent = undefined;

      var onReply = function(commentId, domId) {
        if (replybox == null) {
          // lazily cache replybox, and adjust to suit this style:
          replybox = document.getElementById('comment-editor');
          if (replybox != null) {
            replybox.height = '250px';
            replybox.style.display = 'block';
            replyUrlParts = replybox.src.split('#');
          }
        }
        if (replybox && (commentId !== replyParent)) {
          document.getElementById(domId).insertBefore(replybox, null);
          replybox.src = replyUrlParts[0]
              + (commentId ? '&parentID=' + commentId : '')
              + '#' + replyUrlParts[1];
          replyParent = commentId;
        }
      };

      var hash = (window.location.hash || '#').substring(1);
      var startThread, targetComment;
      if (/^comment-form_/.test(hash)) {
        startThread = hash.substring('comment-form_'.length);
      } else if (/^c[0-9]+$/.test(hash)) {
        targetComment = hash.substring(1);
      }

      // Configure commenting API:
      var configJso = {
        'maxDepth': config.maxThreadDepth
      };
      var provider = {
        'id': config.postId,
        'data': items,
        'loadNext': paginator,
        'hasMore': hasMore,
        'getMeta': getMeta,
        'onReply': onReply,
        'rendered': true,
        'initComment': targetComment,
        'initReplyThread': startThread,
        'config': configJso,
        'messages': msgs
      };

      var render = function() {
        if (window.goog && window.goog.comments) {
          var holder = document.getElementById('comment-holder');
          window.goog.comments.render(holder, provider);
        }
      };

      // render now, or queue to render when library loads:
      if (window.goog && window.goog.comments) {
        render();
      } else {
        window.goog = window.goog || {};
        window.goog.comments = window.goog.comments || {};
        window.goog.comments.loadQueue = window.goog.comments.loadQueue || [];
        window.goog.comments.loadQueue.push(render);
      }
    })();
// ]]>
  </script>
</b:includable>
6. Save Template dan lihat hasilnya
Read More

Jumat, 17 Februari 2012

Cara Membuat Fitur Reply Comment Seperti Wordpress di Blogger - Terbaru

| |
0 komentar
Kita mungkin iri melihat fitur reply comment pada blog wordpress teman-teman yang lain, nah blogger jg tidak mau kalah dengan fitur seperti itu dan sekarang di blogger juga sudah bisa ditambahkan fitur comment reply atau thread comments. Sebenarnya cara ini sangat mudah dilakukan, tinggal mengubah sedikit kode template html anda.
Disini saya akan mejelaskan cara yang paling simple dengan mengedit template.
1. Login ke Dasbor Anda ---> Edit HTML
2. Jangn lupa centang Expand Template Widget
3. Cari kode ini:
<b:include data='post' name='comments'/>
 (di template saya ada 4 kode seperti itu)
4. Ganti semua kode diatas dengan :
<b:if cond='data:post.showThreadedComments'>
<b:include data='post' name='threaded_comments'/>
<b:else/>
<b:include data='post' name='comments'/>
</b:if>
 5. Save.

Dan hasilnya akan seperti ini:



Sampai disini, fitur replay comment atau thread comments blogger anda sudah jadi.
Semoga bermanfaat...
Read More

Labels

Tips n Trick (41) tutorial blog (37) Software (20) Tips Blogging (20) RF PrivateServer (17) tutorial (17) Information (14) Tips Blog (14) tips (14) Blogger (13) blog (12) Free Domain (10) Wordpress (10) Games (8) facebook (8) tools (6) tutorial facebook (6) About SEO (5) Movie (5) Skin RF Online (5) media sosial (5) Operation System (4) Webdesign (4) iklan (4) komentar (4) news (4) video (4) custom domain (3) internet tools (3) script (3) youtube (3) Google Apps (2) back to top (2) custom domain 2012 (2) domain (2) domain gratis (2) emoticon (2) facebook chat (2) hacking (2) internet (2) intuit (2) photoshop (2) science (2) time line (2) widget (2) Block Quote (1) CPM (1) Google Drive (1) Lirik Lagu (1) Popads (1) Sail Komodo 2013 (1) Winrar (1) Wisata Indonesia (1) adsense (1) alternatif adsense (1) animal (1) anti copas (1) aplikasi portable (1) backup template (1) berita nasional (1) chat (1) cinta Indonesia (1) convert (1) custom (1) data backup (1) dofollow (1) domain.com (1) event Indonesia (1) feedburner (1) feedburner. subscribe (1) form contact us (1) foto (1) gambar berjalan (1) google insight (1) google plus (1) hosting (1) hosting gratis (1) lebaran (1) marquee text (1) media player (1) musik (1) next page (1) nofollow (1) open source (1) pasang lagu (1) pesawat (1) pilkada (1) pramugari (1) search (1) seo (1) shukoi (1) simbol (1) tabel (1) tampilan blogger baru (1) teks berjalan (1) template (1) tombol like (1) top ranking 1 google (1) top ranking di halaman 1 Google (1) twitter (1) unfriend (1) upload template (1)

attribut