bbcode embe jsfiddle in website forumotion
bbcode embe jsfiddle thích hợp cho những website thảo luận về code. cần thiết khi nêu 1 ví dụ cho người đọc dễ hiểu và hình dung hơn. :)
khi cho vào code thì bài hiện sẽ hiện hình dưới
Không dài dòng nữa chỉ thế này thôi
Code:
$(window).load(function() {
$('.sceditor-group:last').append('<a title="jsfiddle bbcode" class="sceditor-button sceditor-button-jsfiddle" style="text-indent: 0px;"><img src="http://i.imgur.com/YKo9kd5.png" ></a>');
$('body').append('<div id="bbcodejsfiddle" style="display:none;position:absolute;z-index:50000;-moz-background-clip:padding;-moz-border-radius:2px;-moz-box-shadow:1px 2px 4px rgba(0,0,0,.2);-webkit-background-clip:padding-box;-webkit-border-radius:2px;-webkit-box-shadow:1px 2px 4px rgba(0,0,0,.2);background:#fff;background-clip:padding-box;border:1px solid #ccc;border-radius:2px;box-shadow:1px 2px 4px rgba(0,0,0,.2);color:#333;line-height:1;padding:10px;position:absolute;z-index:4000"><input id="inputFieldjsfiddle" type="text"><br><input id="enterContentjsfiddle" type="submit" value="enter" style="margin-top: 5px;"></div><style>.jsfiddlehotro {width: 100%;}</style>');
$('.sceditor-button-jsfiddle').click(function() {
if ($('#bbcodejsfiddle').css('display') == 'none') {
var y = $('.sceditor-button-jsfiddle').offset().top +25;
var x = $('.sceditor-button-jsfiddle').offset().left;
$('#bbcodejsfiddle').show().css('top',y + 'px').css('left',x + 'px');
}
else $('#bbcodejsfiddle').hide();
});
$('#enterContentjsfiddle').click(function() {
if ($('#inputFieldjsfiddle').val().length > 0) $('#text_editor_textarea').sceditor('instance').insertText('[table class=jsfiddlehotro][tr][td]' + $('#inputFieldjsfiddle').val(),'[/td][/tr][/table]');
else $('#text_editor_textarea').sceditor('instance').insertText("[table class=jsfiddlehotro][tr][td]", "[/td][/tr][/table]");
$('#inputFieldjsfiddle').val('');
$('#bbcodejsfiddle').hide();
});
$('.sceditor-button:not(.sceditor-button-jsfiddle), .sceditor-container textarea, .sceditor-container jsfiddle').click(function() { $('#bbcodejsfiddle').hide() });
});
$(document).on('ready', function() {
$(".jsfiddlehotro a[href*='http://jsfiddle.net/'], .jsfiddlehotro a[href*='https://jsfiddle.net/']").replaceWith(function() {
return '<iframe width="100%" height="300" src="' + this.href + 'show/" allowfullscreen="allowfullscreen" frameborder="0"></iframe>'
});
});
Mẫu bạn chỉ cần copy nguyên đường dẫn vào ví dụ như :
Code:
https://jsfiddle.net/kgtohgs3/
copy vào cho vảo bbcode là nó hiện thôi
Tags: #code #forumotion #bbcode