באג | אין לחצן העתקת קוד מאז שדרוג גרסת ה-nodebb של הפורום
באגים/הצעות ייעול
2
פוסטים
2
כותבים
130
צפיות
2
עוקבים
-
@צדיק-תמים
הקוד העדכני:// הוספת לחצן להעתקת קטעי קוד // ==UserScript== // @name Nodebb copy code // @namespace http://tampermonkey.net/ // @version 0.1 // @description Add a copy button to code areas // @author yossizahn // @match https://tchumim.com/* // @match http://forum.netfree.link/* // @match https://xn--9dbazrsfz.com/* // @grant none // ==/UserScript== (function() { /* globals require, $ */ 'use strict'; require(['clipboard'], clipboard => { new clipboard('.copy-code', { target: trigger => trigger.previousElementSibling }) .on('success', e => { e.clearSelection(); $(e.trigger).attr('data-original-title', 'הועתק!').tooltip('fixTitle').tooltip('show'); setTimeout(() => $(e.trigger).attr('data-original-title', 'העתק').tooltip('fixTitle').tooltip('hide'), 1000); }); }); $(window).on('action:posts.loaded action:topic.loaded action:posts.edited', () => { $('[component="post/content"]>pre').wrap('<div class="pre-wrapper"><div>').after('<i class="copy-code fa fa-copy"></i>'); $('.copy-code').attr('title', 'העתק').tooltip({ container: 'body' }); }); })(); // הוספת לחצן "קוד" ליצירת קוד - inline. (function () { 'use strict'; /* globals require, $ */ require(['composer/formatting'], function (formatting) { require(['composer/controls'], function (controls) { formatting.addButton('fa fa-terminal', function (textarea, selectionStart, selectionEnd) { if (selectionStart === selectionEnd) { var block = controls.getBlockData(textarea, '`', selectionStart); if (block.in && block.atEnd) { controls.updateTextareaSelection(textarea, selectionStart + 1, selectionStart + 1); } else { controls.insertIntoTextarea(textarea, `\`code\``); controls.updateTextareaSelection(textarea, selectionStart + 1, selectionStart + 'code'.length + 1); } } else { var wrapDelta = controls.wrapSelectionInTextareaWith(textarea, '`'); controls.updateTextareaSelection(textarea, selectionStart + 1 + wrapDelta[0], selectionEnd + 1 - wrapDelta[1]); } }, 'code', 'inlineCode'); }); }); })();
שלום! נראה שהשיחה הזו מעניינת אותך, אבל עדיין אין לך חשבון.
נמאס לכם לגלול בין אותם הפוסטים בכל ביקור? כשנרשמים לחשבון, תמיד תחזרו בדיוק למקום שבו הייתם קודם, ותוכלו לבחור לקבל התראות על תגובות חדשות (בין אם במייל, ובין אם בהתראת פוש). תוכלו גם לשמור סימניות ולפרגן ב-upvote לפוסטים כדי להביע הערכה לחברי קהילה אחרים.
בעזרת התרומה שלך, הפוסט הזה יכול להיות אפילו טוב יותר 💗
הרשמה התחברות