Selasa, 06 Agustus 2013

Cara Memasukan Gambar, Youtube, Blockquote dan Kode pada Komentar

By Sajak Petang   Posted at  20.23   Komentar No comments


Pada Tutorial kali ini saya akan membahas Cara Memasukan Gambar, Youtube, Blockquote dan Kode pada Komentar, Sebetulnya tutorial ini milik kangismet. Akan tetapi saya di sini cumang ngeshare agar lebih luas lagi, Mungkin ini postingan terakhir saya karena saya mungkin tidak posting lagi setelah lebaran dikarenakan saya pergi hehe..oke langsung aja caranya sob...
1. Login ke Blogger
2. Pilih Template >> Edit HTML
3. Cari kode ]]></b:skin>, copy kode dibawah ini dan letakkan tepat diatas kode ]]></b:skin>.


#comment-holder .cm-youtube {

  display:block;

  border:none !important;

  background-color:#333;

  width:450px;

  height:240px;

  margin:0 auto 30px;

}

#comment-holder .cm-image {

  display:block;

  margin:0 auto 15px;

  outline:none;

  border:1px solid #ccc;

  background-color:white;

  -webkit-box-shadow:0px 1px 3px rgba(0,0,0,0.2);

  -moz-box-shadow:0px 1px 3px rgba(0,0,0,0.2);

  box-shadow:0px 1px 3px rgba(0,0,0,0.2);

  padding:5px;

  max-width:96%;

  height:auto;

  width:auto;

}

code, #comment-holder code,

#comment-holder i[rel="code"] {

  font:normal 12px Monaco,"Courier New",Monospace;

  color:blue;

}

pre, #comment-holder pre,

#comment-holder i[rel="pre"] {

  display:block;

  font:normal 12px Monaco,"Courier New",Monospace;

  background-color:#333;

  color:white;

  padding:0.5em 1em;

  word-wrap:normal;

  white-space:pre;

  overflow:auto;

  white-space: pre-wrap;

  white-space: -moz-pre-wrap;

  white-space: -pre-wrap;

  white-space: -o-pre-wrap;

  word-wrap: break-word;

}

blockquote, #comment-holder blockquote,

#comment-holder b[rel="quote"] {

  margin:0 2%;

  background-color:#eee;

  padding:1em 1.2em;

  border-left:4px solid #7498AD;

  display:block;

  font-weight:normal;

  font-style:italic;

}

#comment-holder i[rel="image"],

#comment-holder i[rel="youtube"] {

  display:block;

  overflow:hidden;

  border:2px solid black;

  position:relative;

  width:170px;

  height:100px;

  margin:0 auto 30px;

}

#comment-holder i[rel="image"]:before,

#comment-holder i[rel="youtube"]:before {

  content:"Please enable your JavaScript to see this image!";

  position:absolute;

  top:0;

  right:0;

  bottom:0;

  left:0;

  background-color:red;

  color:white;

  font-weight:bold;

  text-align:center;

  padding:15px 0;

}

#comment-holder i[rel="youtube"]:before {

  content:"Please enable your JavaScript to watch this video!";

}

  • Kemudian, simpan kode ini di atas </body>


<script type='text/javascript'>

//<![CDATA[

function repText(id) {

var a = document.getElementById(id),

 b = a.innerHTML,

 b = b.replace(/<i rel="image">(.[^\>]*)<\/i>/ig, "<img class='cm-image' src='$1' alt='loading...' \/>");

 b = b.replace(/\[img\](.[^\]]*)\[\/img\]/ig, "<img class='cm-image' src='$1' alt='loading...' \/>");

 b = b.replace(/<i
rel="youtube">http:\/\/www.youtube.com\/embed\/(.[^>]*)<\/i>/ig,
"<iframe class='cm-youtube'
src='http://www.youtube.com/embed/$1'><\/iframe>");

 b = b.replace(/<i
rel="youtube">(http:\/\/youtu.be|http:\/\/www.youtube.com\/watch\?v=)(.[^>]*)<\/i>/ig,
"<iframe class='cm-youtube'
src='http://www.youtube.com/embed/$2'><\/iframe>");

 b =
b.replace(/\[youtube\]http:\/\/www.youtube.com\/embed\/(.[^\]]*)\[\/youtube\]/ig,
"<iframe class='cm-youtube'
src='http://www.youtube.com/embed/$1'><\/iframe>");

 b =
b.replace(/\[youtube\](http:\/\/youtu.be|http:\/\/www.youtube.com\/watch\?v=)(.[^\]]*)\[\/youtube\]/ig,
"<iframe class='cm-youtube'
src='http://www.youtube.com/embed/$2'><\/iframe>");

 document.getElementById(id).innerHTML = b;

 b = b.replace(/<i rel="code">(.*?)<\/i>/ig, "<code>$1<\/code>");

 b = b.replace(/<i rel="pre">(.*?)<\/i>/ig, "<pre>$1<\/pre>");

 b = b.replace(/<b rel="quote">(.*?)<\/b>/ig, "<blockquote>$1<\/blockquote>");

 b = b.replace(/&amp;feature=[0-9a-zA-Z-_]*/ig, "");

 b = b.replace(/\/s(640|1600)/g, "/s400");

 } repText('comment-holder');

c = document.getElementById('comment-holder');

if (c) {

 b = c.getElementsByTagName("p");

 for (i = 0; i < b.length; i++) {

  if (b.item(i).getAttribute('CLASS') == 'comment-content') {

   ki_comm = b.item(i).innerHTML.replace(/\[code\](.[^\]]*)\[\/code\]/ig, "<code>$1<\/code>");

   ki_comm = ki_comm.replace(/\[pre\](.[^\]]*)\[\/pre\]/ig, "<pre>$1<\/pre>");

   ki_comm = ki_comm.replace(/\[blockquote\](.[^\]]*)\[\/blockquote\]/ig, "<blockquote>$1<\/blockquote>");

   ki_comm = ki_comm.replace(/\[quote\](.[^\]]*)\[\/quote\]/ig, "<blockquote>$1<\/blockquote>");        

   b.item(i).innerHTML = ki_comm;

  }

 }

}

//]]>

</script> 
Simpan Template

Format Penulisan

Menulis Tag <code>
<i rel="code">Tulis kode yang sudah diparse di sini</i>, atau
[code]Tulis kode yang sudah diparse di sini[/code]

Menulis Tag <pre>
<i rel="pre">Tulis kode yang sudah diparse di sini</i>, atau
[pre]Tulis kode yang sudah diparse di sini[/pre]

Menulis Catatan (Blockquote)
<b rel="quote">Tulis catatan di sini</b>, atau
[quote]Tulis catatan di sini[/quote], atau
[blockquote]Tulis catatan di sini[/blockquote]

Memasukan Gambar
<i rel="image">Tulis URL gambar di sini</i>, atau
[img]Tulis URL gambar di sini[/img]

Memasukan Video Youtube
<i rel="youtube">Tulis URL Video Youtube di sini</i>, atau
[youtube]Tulis URL Video Youtube di sini[/youtube]

Oke Mungkin Cukup Sekian, Semoga Bermanfaat ^_^
Henry dan Keluarga mengucapkan minal aidin wal faizin... mohon maaf lahir dan batin

About the Author

Nulla sagittis convallis arcu. Sed sed nunc. Curabitur consequat. Quisque metus enim, venenatis fermentum, mollis in, porta et, nibh. Duis vulputate elit in elit. Mauris dictum libero id justo.
View all posts by: BT9

0 komentar:

Back to top ↑
Connect with Us

What they says

© 2013 Andre B'Genk. WP Mythemeshop Converted by Bloggertheme9
Blogger templates. Proudly Powered by Blogger.