ELProf المدير
الجنس : عدد المساهمات : 443 المستوي العام : 4756 التقييم : 0 تاريخ التسجيل : 18/12/2010 العمر : 34 الموقع : profawy.yoo7.com
| موضوع: كود جافا سكربت لتظليل المحتوى الخميس مايو 18, 2017 11:32 am | |
| مكان وضع الكود
لوحة التحكم /عناصر اضافيه /إدارة صفحات HTML و JAVASCRIPT
إدارة أكواد Javascript
أنشاء كود جديد
ضع الكود / اختار اسم كما تريد / مكان وضع الكود المواضيع /سجل
صورة للكود - الكود:
-
/***[size=14][/size] * Syntax Highlighter funtionality for Forumotion![size=14][/size] * (c) hamsahaq[size=14][/size] * Version: 1.28082013-jq1.9.1[size=14][/size] * Made by JScript - 2013/12/16[size=14][/size] */[size=14][/size] jQuery(function () {[size=14][/size] var sCSS = '<style>' +[size=14][/size] '/***' +[size=14][/size] '* Syntax Highlighter funtionality for Forumotion!' +[size=14][/size] '* CSS: .codebox dd.cont_code' +[size=14][/size] '* (c) hamsahaqo' +[size=14][/size] '* Version: 1.28082013-jq1.9.1' +[size=14][/size] '* Made by JScript - 2013/12/16' +[size=14][/size] '*/' +[size=14][/size] 'code.punbb_block, pre.punbb_block {' +[size=14][/size] ' background-color: #FAFAFA !important;' +[size=14][/size] ' border: 1px solid #C9C9C9 !important;' +[size=14][/size] ' color: #000000;' +[size=14][/size] ' font-family: Consolas,"Bitstream Vera Sans Mono","Andale Mono",Monaco,"DejaVu Sans Mono","Lucida Console",monospace !important;' +[size=14][/size] ' font-size: 11px !important;' +[size=14][/size] ' line-height: 110% !important;' +[size=14][/size] ' max-height: 250px !important;' +[size=14][/size] ' overflow: auto !important;' +[size=14][/size] ' padding: 5px !important;' +[size=14][/size] ' white-space: pre-wrap !important;' +[size=14][/size] ' width: auto !important;' +[size=14][/size] '}' +[size=14][/size] '.punbbtop {' +[size=14][/size] ' background-color: #FFDEAD !important;' +[size=14][/size] ' color: #1D3652;' +[size=14][/size] ' font-size: 10px;' +[size=14][/size] ' font-weight: bold;' +[size=14][/size] ' line-height: 100%;' +[size=14][/size] ' margin-top: 5px;' +[size=14][/size] ' padding: 2px 1px 2px 3px;' +[size=14][/size] '}' +[size=14][/size] '.punbbtop button {' +[size=14][/size] ' background: -moz-linear-gradient(center top , #EDEDED 5%, #DFDFDF 100%) repeat scroll 0 0 #EDEDED;' +[size=14][/size] ' border: 1px solid #BBBBBB;' +[size=14][/size] ' border-radius: 3px 3px 3px 3px;' +[size=14][/size] ' color: #1D3652;' +[size=14][/size] ' cursor: pointer;' +[size=14][/size] ' display: inline-block;' +[size=14][/size] ' font-size: 10px;' +[size=14][/size] ' padding: 0 6px;' +[size=14][/size] ' text-decoration: none;' +[size=14][/size] '}' +[size=14][/size] '.punbbtop button:hover {' +[size=14][/size] ' background: -moz-linear-gradient(center top , #DFDFDF 5%, #EDEDED 100%) repeat scroll 0 0 #DFDFDF;' +[size=14][/size] ' border-color: #9A9A9A;' +[size=14][/size] ' color: #3D70A3;' +[size=14][/size] '}' +[size=14][/size] '.punbbtop button:active {' +[size=14][/size] ' position: relative;' +[size=14][/size] ' top: 1px;' +[size=14][/size] '}' +[size=14][/size] 'pre.punbb_block.expand, code.punbb_block.expand {' +[size=14][/size] ' max-height: 100% !important;' +[size=14][/size] '}' +[size=14][/size] '.prettyprint ol.linenums {' +[size=14][/size] ' padding-left: 15px !important;' +[size=14][/size] '}' +[size=14][/size] '</style>';[size=14][/size] jQuery(sCSS).insertBefore('#page-body');[size=14][/size] [size=14][/size] if (jQuery('.cont_code').length) {[size=14][/size] var tagCode = jQuery('.cont_code');[size=14][/size] } else {[size=14][/size] if (jQuery('.cont_code').length) {[size=14][/size] var tagCode = jQuery('.code');[size=14][/size] } else {[size=14][/size] var tagCode = jQuery('code'); [size=14][/size] }[size=14][/size] }[size=14][/size] tagCode.each(function () {[size=14][/size] var sContent = jQuery(this).html();[size=14][/size] var codebox = jQuery(this).parent().parent();[size=14][/size] codebox.before('<div class="punbbtop"> تظليل المحتوى <button onclick="punbbExpand(this); return false;">تكبير</button><button style="display: none" onclick="punbbCollapse(this); return false;">تصغير</button> <button onclick="punbbSelect(this); return false;">انسخ</button> <button onclick="punbbPopup(this); return false;">نافذة</button> <button style="margin-right: 50px; float: right;" onclick="punbbAbout(this); return false;"></button></div><pre class="highlight punbb_block">' + sContent + '</pre>');[size=14][/size] codebox.remove();[size=14][/size] });[size=14][/size] jQuery.getScript('http://balupton.github.io/jquery-syntaxhighlighter/scripts/jquery.syntaxhighlighter.min.js', function () {[size=14][/size] jQuery.SyntaxHighlighter.init({[size=14][/size] 'wrapLines': false[size=14][/size] })[size=14][/size] })[size=14][/size] });[size=14][/size] function punbbExpand(oThis) {[size=14][/size] jQuery(oThis).css('display', 'none');[size=14][/size] jQuery(oThis).next().css('display', '');[size=14][/size] jQuery(oThis).parent().next('pre.punbb_block').addClass('expand');[size=14][/size] }[size=14][/size] function punbbCollapse(oThis) {[size=14][/size] jQuery(oThis).css('display', 'none');[size=14][/size] jQuery(oThis).prev().css('display', '');[size=14][/size] jQuery(oThis).parent().next('pre.punbb_block').removeClass('expand');[size=14][/size] }[size=14][/size] function punbbPopup(oThis) {[size=14][/size] var content = jQuery(oThis).parent().next('pre.punbb_block').html();[size=14][/size] var my_window = window.open("","PunBB_Code","scrollbars=1,toolbar=no,menubar=no,personalbar=no,status=0,left=0,location=0,menubar=0,top=0,width=640,height=480");[size=14][/size] [size=14][/size] my_window.document.write('<pre>'+content+'</pre>');[size=14][/size] }[size=14][/size] function punbbAbout(oThis) {[size=14][/size] alert('Simple code to add Syntax Highlighter fuctionality for Forumotion\n\hamsahaq - 2013/12/16\n');[size=14][/size] }[size=14][/size] function punbbSelect(oThis) {[size=14][/size] var doc = document;[size=14][/size] var text = jQuery(oThis).parent().next('pre.punbb_block')[0];[size=14][/size] if (doc.body.createTextRange) {[size=14][/size] var range = doc.body.createTextRange();[size=14][/size] range.moveToElementText(text);[size=14][/size] range.select();[size=14][/size] } else if (window.getSelection) {[size=14][/size] var selection = window.getSelection();[size=14][/size] var range = doc.createRange();[size=14][/size] range.selectNodeContents(text);[size=14][/size] selection.removeAllRanges();[size=14][/size] selection.addRange(range); [size=14][/size] }[size=14][/size] } | |
|