PageSourceSearch

https://fitradio.com/js/2016/sample.js

js fitradio.com collected 2026-10-01 11:29:40 UTC 3,262 bytes, 105 lines download raw bytes

1/**
2 * Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
3 * For licensing, see LICENSE.md or http://ckeditor.com/license
4 */
5
6/* exported initSample */
7
8if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )
9	CKEDITOR.tools.enableHtml5Elements( document );
10
11// The trick to keep the editor in the sample quite small
12// unless user specified own height.
13CKEDITOR.config.height = 450;
14CKEDITOR.config.width = 'auto';
15
16var initSample = ( function(html) {
17	var wysiwygareaAvailable = isWysiwygareaAvailable(),
18		isBBCodeBuiltIn = !!CKEDITOR.plugins.get( 'bbcode' );
19
20	return function() {
21		var editorElement = CKEDITOR.document.getById( 'editor' );
22
23		// :(((
24		if ( isBBCodeBuiltIn ) {
25			editorElement.setHtml($("#text_html").val());
26		}
27
28		// Depending on the wysiwygare plugin availability initialize classic or inline editor.
29		if ( wysiwygareaAvailable ) {
30			CKEDITOR.replace( 'editor' );
31		} else {
32			editorElement.setAttribute( 'contenteditable', 'true' );
33			CKEDITOR.inline( 'editor' );
34
35			// TODO we can consider displaying some info box that
36			// without wysiwygarea the classic editor may not work.
37		}
38	};
39
40	function isWysiwygareaAvailable() {
41		// If in development mode, then the wysiwygarea must be available.
42		// Split REV into two strings so builder does not replace it :D.
43		if ( CKEDITOR.revision == ( '%RE' + 'V%' ) ) {
44			return true;
45		}
46
47		return !!CKEDITOR.plugins.get( 'wysiwygarea' );
48	}
49} )();
50
51function copyToClipboard() {
52	  // create hidden text element, if it doesn't already exist
53    var targetId = "_hiddenCopyText_";
54	$("#text_to_copy").val("");
55	$("#text_to_copy").show();
56	$("#text_to_copy").val($("#tags").val());
57	var elem=document.getElementById("text_to_copy");
58    var isInput = elem.tagName === "INPUT" || elem.tagName === "TEXTAREA";
59    var origSelectionStart, origSelectionEnd;
60    if (isInput) {
61        // can just use the original source element for the selection and copy
62        target = elem;
63        origSelectionStart = elem.selectionStart;
64        origSelectionEnd = elem.selectionEnd;
65    } else {
66        // must use a temporary form element for the selection and copy
67        target = document.getElementById(targetId);
68        if (!target) {
69            var target = document.createElement("textarea");
70            target.style.position = "absolute";
71            target.style.left = "-9999px";
72            target.style.top = "0";
73            target.id = targetId;
74            document.body.appendChild(target);
75        }
76        target.textContent = elem.textContent;
77    }
78    // select the content
79    var currentFocus = document.activeElement;
80    target.focus();
81    target.setSelectionRange(0, target.value.length);
82    
83    // copy the selection
84    var succeed;
85    try {
86    	  succeed = document.execCommand("copy");
87    } catch(e) {
88        succeed = false;
89    }
90    // restore original focus
91    if (currentFocus && typeof currentFocus.focus === "function") {
92        currentFocus.focus();
93    }
94    
95    if (isInput) {
96        // restore prior selection
97        elem.setSelectionRange(origSelectionStart, origSelectionEnd);
98    } else {
99        // clear temporary content
100        target.textContent = "";
101    }
102	$("#text_to_copy").hide();
103    return succeed;
104}
105

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.