The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

add clipboard button to code box

3 posters

Go down

Solved add clipboard button to code box

Post by alla13 May 26th 2018, 7:15 pm

i use the box code made by js script may his soul rest in peace

Code:
(function() {
   var style = document.createElement("style");
   style.type = "text/css";
   style.innerHTML =
      'code.jsCode_block, pre.jsCode_block {' +
      '  text-align: left !important;' +
      '  background-color: #FAFAFA !important;' +
      '  border: 1px solid #C9C9C9 !important;' +
      '  color: #000000;' +
      '  font-family: monospace,"Bitstream Vera Sans Mono","Andale Mono",Monaco,"DejaVu Sans Mono","Lucida Console",monospace !important;' +
      '  font-size: 20px !important;' +
      '  line-height: 110% !important;' +
      '  margin-top: 0 !important;' +
      '  max-height: 250px !important;' +
      '  overflow: auto !important;' +
      '  padding: 5px !important;' +
      '  white-space: pre-wrap !important;' +
      '  width: auto !important;' +
      '}' +
      '.jsCodetop {' +
      '  background-color: #0077aa !important;' +
      '  color: #1D3652;' +
      '  font-size: 14px;' +
      '  font-family: jazeera;' +
      '  font-weight: bold;' +
      '  line-height: 100%;' +
      '  margin-top: 5px;' +
      '  padding: 2px 1px 2px 3px;' +
      '}' +
      '.jsCodetop button {' +
      '  background: -moz-linear-gradient(center top , #EDEDED 5%, #DFDFDF 100%) repeat scroll 0 0 #EDEDED;' +
      '  border: 1px solid #BBBBBB;' +
      '  border-radius: 3px 3px 3px 3px;' +
      '  color: #1D3652;' +
      '  font-family: jazeera;' +
      '  cursor: pointer;' +
      '  display: inline-block;' +
      '  font-size: 13px;' +
      '  padding: 0 6px;' +
      '  text-decoration: none;' +
      '}' +
      '.jsCodetop button:hover {' +
      '  background: -moz-linear-gradient(center top , #DFDFDF 5%, #EDEDED 100%) repeat scroll 0 0 #DFDFDF;' +
      '  border-color: #9A9A9A;' +
      '  color: #3D70A3;' +
      '  font-family: jazeera;' +
      '}' +
      '.jsCodetop button:active {' +
      '  position: relative;' +
      '  top: 1px;' +
      '}' +
      'pre.jsCode_block.expand, code.jsCode_block.expand {' +
      '  max-height: 100% !important;' +
      '}' +
      'pre ol.linenums {' +
      '  color: #afafaf !important;' +
      '  font-size: 12px !important;' +
      '  list-style: outside none decimal !important;' +
      '  padding: 5px 0 5px 42px !important !important;' +
      '  margin: -16px 0 0 !important;' +
      '  width: auto !important;' +
      '}' +
      'pre ol.linenums li > span {' +
      '  color: #000000 !important;' +
      '}' +
      'pre ol.linenums li {' +
      '  border-left: 3px solid #6ce26c !important;' +
      '  padding-left: 15px !important;' +
      '  list-style: inherit !important;' +
      '  font-size: inherit !important;' +
      '}';
   document.getElementsByTagName("head")[0].appendChild(style);
})();
 
jQuery(function() {
   var tagCode = jQuery('.cont_code, code'),
      codebox = null;
 
   for (var i = 0, len = tagCode.length; i < len; i++) {
      codebox = jQuery(tagCode[i]).closest('.codebox');
      codebox.before(
         '<div class="jsCodetop">Code &nbsp; &nbsp; &nbsp; &nbsp;<button onclick="jsCodeExpand(this); return false;">توسيع</button>' +
         '  <button style="display: none" onclick="jsCodeCollapse(this); return false;">تقليص</button>&nbsp; ' +
         '  <button onclick="jsCodeSelect(this); return false;">تحديد الكود</button>&nbsp; ' +
         '  <button onclick="jsCodePopup(this); return false;">نافذة منبثقة</button>&nbsp; ' +
         '  <button onclick="jsCodecopy(this); return false;">نسخ</button>&nbsp; ' +
         '  <button style="margin-right: 50px; float: right;" onclick="jsCodeAbout(this); return false;">?</button>' +
         '</div>' +
         '<pre class="jsCode_block">' +
         '  <ol class="linenums">' + tagCode[i].innerHTML.replace(/<br>/mg, '<li class="L1"><span>') + '</ol>' +
         '</pre>'
      );
      codebox.remove();
   }
});
 
function jsCodeExpand(oThis) {
   jQuery(oThis).css('display', 'none');
   jQuery(oThis).next().css('display', '');
   jQuery(oThis).parent().next('pre.jsCode_block').addClass('expand');
}
 
function jsCodeCollapse(oThis) {
   jQuery(oThis).css('display', 'none');
   jQuery(oThis).prev().css('display', '');
   jQuery(oThis).parent().next('pre.jsCode_block').removeClass('expand');
}
 
function jsCodePopup(oThis) {
   var content = jQuery(oThis).parent().next('pre.jsCode_block').html();
   var my_window = window.open("", "To select the code: [Ctrl] + [A]", "scrollbars=1toolbar=no,menubar=no,personalbar=no,status=0,left=0,location=0,menubar=0,top=0,width=640,height=480");
   my_window.document.write('<pre>' + content + '</pre>');
}
 
function jsCodeAbout(oThis) {
   alert('جميع الحقوق محفوظة لصاحبها\n\nBy JScript FROM Brazil - 2015/04/10\n');
}

function jsCodecopy(oThis) {
  
 }
function jsCodeSelect(oThis) {
   var doc = document;
   var text = jQuery(oThis).parent().next('pre.jsCode_block')[0];
   if (doc.body.createTextRange) {
      var range = doc.body.createTextRange();
      range.moveToElementText(text);
      range.select();
   } else if (window.getSelection) {
      var selection = window.getSelection();
      var range = doc.createRange();
      range.selectNodeContents(text);
      selection.removeAllRanges();
      selection.addRange(range);
   }
}

i want to add clipboard button to it


Last edited by alla13 on May 29th 2018, 12:55 am; edited 1 time in total
alla13
alla13
Forumember

Posts : 91
Reputation : 6
Language : Arab5/5 Eng3/5 Fr2/5

http://alla-omar.mo-rpg.com

Back to top Go down

Solved Re: add clipboard button to code box

Post by alla13 May 27th 2018, 3:06 pm

up
alla13
alla13
Forumember

Posts : 91
Reputation : 6
Language : Arab5/5 Eng3/5 Fr2/5

http://alla-omar.mo-rpg.com

Back to top Go down

Solved Re: add clipboard button to code box

Post by SarkZKalie May 27th 2018, 3:31 pm

Have you ever tried this? Copy Code


Last edited by SarkZKalie on May 27th 2018, 3:51 pm; edited 1 time in total
SarkZKalie
SarkZKalie
Support Moderator
Support Moderator

Male Posts : 1418
Reputation : 220
Language : English

https://rotavn.forumotion.com/

Back to top Go down

Solved Re: add clipboard button to code box

Post by alla13 May 27th 2018, 3:45 pm

yes i did even i made the change in class so it works and 
it didn't work on this specific code box
alla13
alla13
Forumember

Posts : 91
Reputation : 6
Language : Arab5/5 Eng3/5 Fr2/5

http://alla-omar.mo-rpg.com

Back to top Go down

Solved Re: add clipboard button to code box

Post by SarkZKalie May 27th 2018, 4:01 pm

Link to the post that guest can see?


add clipboard button to code box Sarkzk10
SarkZKalie
SarkZKalie
Support Moderator
Support Moderator

Male Posts : 1418
Reputation : 220
Language : English

https://rotavn.forumotion.com/

Back to top Go down

Solved Re: add clipboard button to code box

Post by alla13 May 27th 2018, 4:03 pm

alla13
alla13
Forumember

Posts : 91
Reputation : 6
Language : Arab5/5 Eng3/5 Fr2/5

http://alla-omar.mo-rpg.com

Back to top Go down

Solved Re: add clipboard button to code box

Post by SarkZKalie May 27th 2018, 5:01 pm

First, I can't understand Arabic so if possible please post a question topic to http://help.ahlamontada.com
Second, you've already using another copy code script, right? It could conflict to the one you just applied.
SarkZKalie
SarkZKalie
Support Moderator
Support Moderator

Male Posts : 1418
Reputation : 220
Language : English

https://rotavn.forumotion.com/

Back to top Go down

Solved Re: add clipboard button to code box

Post by alla13 May 27th 2018, 6:21 pm

the irony is i am the one ho is given help to people there
the forum is deserted from coders
i just want a clipboard to be added to posted java codebox in the topic here
so can you help me
alla13
alla13
Forumember

Posts : 91
Reputation : 6
Language : Arab5/5 Eng3/5 Fr2/5

http://alla-omar.mo-rpg.com

Back to top Go down

Solved Re: add clipboard button to code box

Post by alla13 May 28th 2018, 5:23 pm

up
alla13
alla13
Forumember

Posts : 91
Reputation : 6
Language : Arab5/5 Eng3/5 Fr2/5

http://alla-omar.mo-rpg.com

Back to top Go down

Solved Re: add clipboard button to code box

Post by alla13 May 29th 2018, 12:37 am

alla13
alla13
Forumember

Posts : 91
Reputation : 6
Language : Arab5/5 Eng3/5 Fr2/5

http://alla-omar.mo-rpg.com

Back to top Go down

Solved Re: add clipboard button to code box

Post by SLGray May 29th 2018, 3:48 am

Thanks for posting the solution.

Problem solved & topic archived.
Please read our forum rules:  ESF General Rules


add clipboard button to code box Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51489
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum