/// shohlatech
أخر الاخبار

أضف الأكواد التالية في الوسم لإضافة زر النسخ التلقائي:

<script>
    $(function() {
        $('pre.prettyprint').parent().addClass('code-wrap');
        $('pre.prettyprint').append('<div class="copy-button">نسخ</div>');
        $('pre.prettyprint').hover(function() {
            $(this).find('.copy-button').show();
        }, function() {
            $(this).find('.copy-button').hide();
        });
        $('.copy-button').click(function() {
            var html = $(this).parent().html();
            html = html.replace(/<br>/gi, '\n');
            html = html.replace(/<(?:.|\n)*?>/gm, '');
            html = html.replace(/&gt;/g, '>');
            html = html.replace(/&lt;/g, '<');
            html = html.replace(/&amp;/g, '&');
            html = html.replace(/&nbsp;/g, ' ');
            html = html.replace(/&quot;/g, '"');
            html = html.replace(/&#39;/g, "'");
            var input = document.createElement('textarea');
            document.body.appendChild(input);
            input.value = html;
            input.select();
            document.execCommand('copy');
            input.remove();
            $(this).text('تم النسخ!');
        });
    });
</script>        
Edward Simo
بواسطة : Edward Simo
تعليقات



حجم الخط
+
16
-
تباعد السطور
+
2
-
نص هنا