PageSourceSearch

https://www.gk-graphite.com/media/regularlabs/js/script.min.js?8475fd

js gk-graphite.com collected 2026-09-26 02:11:19 UTC 16,830 bytes, 90 lines download raw bytes

1/*
2 * Copyright © 2026 Regular Labs - All Rights Reserved
3 * GNU General Public License version 2 or later
4 */
5(function(){'use strict';window.RegularLabs=window.RegularLabs||{};window.RegularLabs.Scripts=window.RegularLabs.Scripts||{version:'26.9.10756',ajax_list:[],started_ajax_list:false,ajax_list_timer:null,editor_api:null,editor_api_loading:null,legacy_editors:null,editor_selections:{},escapeHtml:function(value){return String(value).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');},escapeAttributeValue:function(value){return this.escapeHtml(value).replace(/"/g,'&quot;');},escapeTagAttributeValue:function(value,use_backslash_quotes=false){const quote=use_backslash_quotes?'\\"':'&quot;';return this.escapeHtml(value).replace(/"/g,quote);},getOptions:function(key,default_value={}){if(typeof Joomla!=='undefined'&&typeof Joomla.getOptions!=='undefined'){return Joomla.getOptions(key,default_value);}
6if(typeof Joomla==='undefined'||typeof Joomla.optionsStorage==='undefined'){return default_value;}
7return typeof Joomla.optionsStorage[key]==='undefined'?default_value:Joomla.optionsStorage[key];},parseJson:function(value,default_value=null){if(typeof value!=='string'||value===''){return default_value;}
8try{return JSON.parse(value);}catch(error){return default_value;}},parseJsonObject:function(value,default_value={}){const parsed=this.parseJson(value,default_value);if(!parsed||typeof parsed!=='object'||Array.isArray(parsed)){return default_value;}
9return parsed;},getEditor:function(editor){if(typeof editor!=='string'){return editor;}
10if(this.editor_api){const api_editor=this.editor_api.get(editor);if(api_editor){return api_editor;}}
11if(this.legacy_editors){return this.legacy_editors[editor]||null;}
12return typeof Joomla!=='undefined'?Joomla.editors?.instances?.[editor]||null:null;},getEditors:function(){if(!this.editor_api){return this.legacy_editors||{};}
13const editors={};document.querySelectorAll('textarea[id]').forEach((element)=>{const editor=this.editor_api.get(element.id);if(editor){editors[element.id]=editor;}});const active_editor=this.editor_api.getActive();if(active_editor){editors[this.getEditorId(active_editor)]=active_editor;}
14return editors;},initEditorApi:function(){if(this.editor_api_loading||typeof Joomla==='undefined'){return;}
15this.editor_api_loading=import('editor-api').then(({JoomlaEditor})=>{this.editor_api=JoomlaEditor;}).catch(()=>{this.legacy_editors=Joomla.editors&&Joomla.editors.instances?Joomla.editors.instances:{};});},getEditorValue:function(editor){return this.getEditor(editor)?.getValue();},getEditorFieldValue:function(element){const editor_value=this.getEditorValue(element.name||element.id);if(typeof editor_value!=='undefined'){return editor_value;}
16const code_mirror=element.closest('joomla-editor-codemirror')?.querySelector('.CodeMirror');return code_mirror?.CodeMirror?.getValue();},setEditorValue:function(editor,value){this.getEditor(editor)?.setValue(value);},isEditorSourceMode:function(editor){editor=this.getEditor(editor);if(!editor){return false;}
17const source_instance=editor.instance?.plugins?.source;return Boolean(source_instance&&typeof source_instance.isHidden==='function'&&!source_instance.isHidden());},isJceEditor:function(editor){editor=this.getEditor(editor);if(!editor){return false;}
18const source_instance=editor.instance?.plugins?.source;return Boolean(source_instance&&typeof source_instance.isHidden==='function');},getEditorId:function(editor){editor=this.getEditor(editor);if(!editor){return'';}
19if(typeof editor.id==='function'){return editor.id();}
20return editor.id||editor.instance?.id||editor.instance?.editor?.id||'';},getEditorSourceElement:function(editor){editor=this.getEditor(editor);if(!this.isEditorSourceMode(editor)){return null;}
21return editor.instance.getElement().ownerDocument.getElementById(editor.instance.id+'_editor_source_textarea');},getEditorTextarea:function(editor){editor=this.getEditor(editor);if(!editor){return null;}
22const source_element=this.getEditorSourceElement(editor);if(source_element){return source_element;}
23const instance_element=editor.instance?.editor;if(instance_element&&typeof instance_element.selectionStart!=='undefined'){return instance_element;}
24if(typeof editor.instance?.getElement!=='function'){return null;}
25const editor_element=editor.instance.getElement();return editor_element?.classList?.contains('wf-no-editor')?editor_element:null;},captureEditorSelection:function(editor){const editor_name=typeof editor==='string'?editor:this.getEditorId(editor);editor=this.getEditor(editor);if(!editor){return;}
26const editor_id=this.getEditorId(editor)||editor_name;if(!editor_id){return;}
27if(this.editor_selections[editor_id]?.preserve){return;}
28const textarea=this.getEditorTextarea(editor);if(textarea){this.editor_selections[editor_id]={end:textarea.selectionEnd,start:textarea.selectionStart,value:textarea.value.substring(textarea.selectionStart,textarea.selectionEnd),};return;}
29if(typeof editor.instance?.selection!=='undefined'){this.editor_selections[editor_id]={bookmark:editor.instance.selection.getBookmark(2,true),html:editor.instance.selection.getContent(),range:editor.instance.selection.getRng().cloneRange(),value:editor.instance.selection.getContent({format:'text'}),};return;}
30const fallback_textarea=document.getElementById(editor_name);if(fallback_textarea&&typeof fallback_textarea.selectionStart!=='undefined'){this.editor_selections[editor_id]={end:fallback_textarea.selectionEnd,start:fallback_textarea.selectionStart,value:fallback_textarea.value.substring(fallback_textarea.selectionStart,fallback_textarea.selectionEnd),};}},selectEditorText:function(editor,text){const editor_name=typeof editor==='string'?editor:this.getEditorId(editor);editor=this.getEditor(editor);if(!editor){return'';}
31const body=editor.instance?.getBody?.();const selection_element=this.getEditorTextarea(editor)||(body?null:document.getElementById(editor_name));if(selection_element&&typeof selection_element.selectionStart!=='undefined'){const start=selection_element.value.indexOf(text);if(start===-1){return'';}
32selection_element.focus();selection_element.setSelectionRange(start,start+text.length);this.editor_selections[this.getEditorId(editor)||editor_name]={end:start+text.length,preserve:true,start:start,value:text,};return selection_element.value.substring(selection_element.selectionStart,selection_element.selectionEnd);}
33if(!body||typeof editor.instance?.selection==='undefined'){return'';}
34const editor_document=body.ownerDocument;const walker=editor_document.createTreeWalker(body,editor_document.defaultView.NodeFilter.SHOW_TEXT);let text_node=null;while(walker.nextNode()){if(walker.currentNode.data.includes(text)){text_node=walker.currentNode;break;}}
35if(!text_node){return'';}
36const start=text_node.data.indexOf(text);const range=editor_document.createRange();range.setStart(text_node,start);range.setEnd(text_node,start+text.length);editor.instance.focus();editor.instance.selection.setRng(range);const html_container=editor_document.createElement('div');html_container.appendChild(range.cloneContents());this.editor_selections[this.getEditorId(editor)||editor_name]={html:html_container.innerHTML,preserve:true,range:range.cloneRange(),value:text,};return text;},isEditorActive:function(editor){editor=this.getEditor(editor);if(!editor){return false;}
37const textarea=this.getEditorTextarea(editor);if(textarea){return textarea.ownerDocument.activeElement===textarea;}
38if(typeof editor.instance?.hasFocus==='function'){if(editor.instance.hasFocus()){return true;}}
39if(editor.instance?.focused){return true;}
40if(typeof editor.instance?.getDoc==='function'&&editor.instance.getDoc()?.hasFocus()){return true;}
41if(typeof editor.instance?.getContentAreaContainer==='function'){const iframe=editor.instance.getContentAreaContainer()?.querySelector('iframe');if(iframe&&iframe.ownerDocument.activeElement===iframe){return true;}}
42const fallback_textarea=editor.instance?.editor;return Boolean(fallback_textarea&&fallback_textarea.ownerDocument.activeElement===fallback_textarea);},captureActiveEditorSelections:function(){if(document.querySelector('.joomla-modal.show iframe[src*="Plugin.EditorButton."], '+'dialog[open] iframe[src*="Plugin.EditorButton."]')){return;}
43if(this.editor_api){const editor=this.editor_api.getActive();if(editor){this.captureEditorSelection(editor);}
44return;}
45Object.values(this.legacy_editors||{}).forEach((editor)=>{if(this.isEditorActive(editor)){this.captureEditorSelection(editor);}});},captureEditorSelections:function(only_untracked=false){Object.values(this.getEditors()).forEach((editor)=>{if(only_untracked&&this.editor_selections[this.getEditorId(editor)]){return;}
46this.captureEditorSelection(editor);});},initEditorSelectionTracking:function(){if(document.documentElement.dataset.rlEditorSelectionTracking==='true'){return;}
47document.documentElement.dataset.rlEditorSelectionTracking='true';this.initEditorApi();document.addEventListener('pointerdown',(event)=>{this.captureEditorSelectionFromEvent(event);},true);document.addEventListener('keydown',(event)=>{if(event.key!=='Enter'&&event.key!==' '){return;}
48this.captureEditorSelectionFromEvent(event);},true);},captureEditorSelectionFromEvent:function(event){if(!this.isEditorButtonElement(event.target)){return;}
49this.captureActiveEditorSelections();this.captureEditorSelections(true);},isEditorButtonElement:function(target){const element=target instanceof Element?target.closest('button, [role="menuitem"]'):null;if(!element){return false;}
50const is_regular_labs_button=element.matches('[data-joomla-editor-button-options*="Plugin.EditorButton."]');const is_marked_editor_button=element.matches('[data-rl-editor-button]');const is_legacy_editor_button=Boolean(element.closest('.editor-xtd-buttons'));const is_editor_button_menu=element.getAttribute('data-mce-name')==='jxtdbuttons'||element.getAttribute('aria-label')==='CMS Content';if(!is_regular_labs_button&&!is_marked_editor_button&&!is_legacy_editor_button&&!is_editor_button_menu){return false;}
51return true;},getEditorSelection:function(editor,preserve_html=false){editor=this.getEditor(editor);if(!editor){return'';}
52const textarea=this.getEditorTextarea(editor);if(this.isEditorActive(editor)){if(textarea){return textarea.value.substring(textarea.selectionStart,textarea.selectionEnd);}
53if(preserve_html&&typeof editor.instance?.selection!=='undefined'){return editor.instance.selection.getContent();}
54return editor.getSelection();}
55const selection=this.editor_selections[this.getEditorId(editor)];if(selection){if(preserve_html&&typeof selection.html!=='undefined'){return selection.html;}
56if(typeof selection.value!=='undefined'){return selection.value;}}
57if(textarea){return textarea.value.substring(textarea.selectionStart,textarea.selectionEnd);}
58if(preserve_html&&typeof editor.instance?.selection!=='undefined'){return editor.instance.selection.getContent();}
59return editor.getSelection();},replaceEditorSelection:function(editor,value){editor=this.getEditor(editor);if(!editor){return;}
60const editor_id=this.getEditorId(editor);const selection=this.editor_selections[editor_id];const selection_element=this.getEditorTextarea(editor);if(selection?.range&&!selection_element&&typeof editor.instance?.selection!=='undefined'){editor.instance.focus();editor.instance.selection.setRng(selection.range);}else if(selection?.bookmark&&!selection_element&&typeof editor.instance?.selection!=='undefined'){editor.instance.focus();editor.instance.selection.moveToBookmark(selection.bookmark);}else if(typeof selection?.start!=='undefined'){if(selection_element){selection_element.focus();selection_element.setSelectionRange(selection.start,selection.end);}}
61if(selection?.range&&!selection_element&&this.isJceEditor(editor)&&!this.isEditorSourceMode(editor)){editor.instance.execCommand('mceInsertContent',false,value);delete this.editor_selections[editor_id];return;}
62editor.replaceSelection(value);delete this.editor_selections[editor_id];},isEditorReady:function(editor){editor=this.getEditor(editor);if(!editor||typeof editor.getValue!=='function'){return false;}
63if(typeof editor.instance?.initialized==='boolean'&&!editor.instance.initialized){return false;}
64try{editor.getValue();return true;}catch(error){return false;}},normalizeEditorInsertionValue:function(editor,value){editor=this.getEditor(editor);if(!editor){return value;}
65if(editor.className!=='mce_editable'||value.substring(0,3)!=='<p>'||value.substring(value.length-4)!=='</p>'){return value;}
66return value.substring(3,value.length-4);},applyEditorFormatting:function(editor_name){if(typeof tinyMCE==='undefined'){return;}
67tinyMCE.get(editor_name)?.formatter?.apply();},prepareOutputForEditor:function(string,editor,remove_all_p_tags=false){editor=this.getEditor(editor);if(!editor){return string;}
68const editor_content=editor.getValue();const editor_selection=this.getEditorSelection(editor);if(editor_content===''||editor_content[0]!=='<'){return remove_all_p_tags?string.replace(/<\/?p>/g,''):string;}
69if(editor_selection.indexOf('<')!==0){return string.replace(/^<p>(.*)<\/p>$/g,'$1');}
70return string;},getFormValue:function(form,id,default_value='',getEditorContent=null){let elements=form.querySelectorAll('[name="'+id+'"]');if(!elements.length){elements=form.querySelectorAll('[name="'+id+'[]"]');}
71if(!elements.length){return default_value;}
72const element=elements[0];if(element.type==='textarea'){const value=getEditorContent?getEditorContent(element):element.value;return this.fixValueType(value);}
73let value=element.value?element.value:default_value;if(element.type==='select-one'){if(element.type==='checkbox'&&!element.checked){return default_value;}
74return this.fixValueType(value);}
75if(element.type==='select-multiple'){value=[];for(let i=0;i<element.options.length;i++){if(element.options[i].selected&&element.options[i].value!==''){value.push(element.options[i].value);}}
76return this.fixValueType(value);}
77if(elements.length>1){value=[];for(let i=0;i<elements.length;i++){if((elements[i].selected||elements[i].checked)&&elements[i].value!==''){value.push(elements[i].value);}}
78if(element.type==='radio'){return this.fixValueType(value[0]);}
79return this.fixValueType(value);}
80return this.fixValueType(value);},fixValueType:function(value){if(Array.isArray(value)){return value.map((val)=>this.fixValueType(val));}
81if(isNaN(value)||isNaN(parseInt(value))){return value;}
82return Number(value);},loadAjax:function(url,success,fail,query,timeout,dataType,cache){if(url.indexOf('index.php')!==0&&url.indexOf('administrator/index.php')!==0){url=url.replace('http://','');url=`index.php?rl_qp=1&url=${encodeURIComponent(url)}`;if(timeout){url+=`&timeout=${timeout}`;}
83if(cache){url+=`&cache=${cache}`;}}
84let base=window.location.pathname;base=base.substring(0,base.lastIndexOf('/'));if(typeof Joomla!=='undefined'&&typeof Joomla.getOptions!=='undefined'&&Joomla.getOptions('system.paths')){base=Joomla.getOptions('system.paths').base;}
85const token=typeof Joomla!=='undefined'&&typeof Joomla.getOptions==='function'?Joomla.getOptions('csrf.token',''):'';const headers=token?{'X-CSRF-Token':token}:{};this.loadUrl(`${base}/${url}`,query,(function(data){if(success){success=`data=data?data:'';${success};`.replace(/;\s*;/g,';');eval(success);}}),(function(data){if(fail){fail=`data=data?data:'';${fail};`.replace(/;\s*;/g,';');eval(fail);}}),headers);},loadUrl:function(url,data,success,fail,headers={}){return new Promise((resolve)=>{const request=new XMLHttpRequest();request.open("POST",url,true);request.setRequestHeader('Content-type','application/x-www-form-urlencoded');for(const[headerName,headerValue]of Object.entries(headers)){request.setRequestHeader(headerName,headerValue);}
86request.onreadystatechange=function(){if(this.readyState!==4){return;}
87if(this.status!==200){fail&&fail.call(null,this.responseText,this.status,this);resolve(this);return;}
88success&&success.call(null,this.responseText,this.status,this);resolve(this);};request.send(data);});},addToLoadAjaxList:function(url,success,error,query=''){url=url.replace(/'/g,"\\'");success=success.replace(/'/g,"\\'");error=error.replace(/'/g,"\\'");query=query.replace(/'/g,"\\'");const action=`RegularLabs.Scripts.loadAjax('${url}','${success};RegularLabs.Scripts.ajaxRun();','${error};RegularLabs.Scripts.ajaxRun();','${query}')`;this.addToAjaxList(action);},addToAjaxList:function(action){this.ajax_list.push(action);if(!this.started_ajax_list){this.ajaxRun();}},ajaxRun:function(){if(!this.ajax_list.length){return;}
89clearTimeout(this.ajax_list_timer);this.started_ajax_list=true;const action=this.ajax_list.shift();eval(`${action};`);if(!this.ajax_list.length){this.started_ajax_list=false;return;}
90this.ajax_list_timer=setTimeout(function(){RegularLabs.Scripts.ajaxRun();},5000);},};RegularLabs.Scripts.initEditorSelectionTracking();})();

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.