GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/nginx/html/js/ |
Upload File : |
// js/CST.js // Contains common CST site javascript functions. // BEGIN variable settings. var DEBUG_hPosition = false; var DEBUG_vPosition = false; var form; // Form object. var ie = document.all; var mvDiv = 'movementDiv'; // The id of the div that is to follow the mouse. var mvOffsetX = 5; // X offset from mouse position. var mvOffsetY = 20; // Y offset from mouse position. var mx; // mouse x pixel position. var my; // mouse y pixel position. var ns6 = document.getElementById && !document.all; var statusId; // Used to show/hide events. let DEBUG_OFF = false; let DEBUG_ON = true; /** / var ttClasses = []; // Hold old tooltip classNames. var ttContent = ''; // Content created and shown by ttDisplay(). var ttDebugMessage = ''; var ttDiv = 'tooltipDiv'; // The id of the div that will contain the tooltip. var ttEnable=false; // Hide the tooltip. var ttInitializeCount = 0; var ttinnerHTML = ''; var ttMoveOffsetY = 0; // Move menu y offset. var ttObj; var ttOffsetX = 15; // Customize x offset of the tooltip. var ttOffsetY = -25; // Customize y offset of the tooltip. var trStatusId; /**/ var DEBUG_doc_on = false; // DEBUG set of document.onclick, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, and onselectstart. // END variable settings. // _Initialize() var InitializeCount = 0; // Count of initialization attempts. function _Initialize(by='') { var DEBUG = true; if ( DEBUG ) { console.groupCollapsed(`_Initialize[${InitializeCount}] by = ${by}`); }//Collapsed if ( !_Initialize.done ) { InitializeCount++; // Wait for the ttContentsContainer to be part of the DOM. if ( typeof ttContentsContainer !== 'undefined' ) { if ( document.getElementById(ttContentsContainer) ) { // Is the ttContentsContainer part of the DOM yet? InitializeCount = false; _Initialize_debug(); _Initialize_Tooltip(); _Initialize_CopyToClipboard(); if ( typeof _Initialize_Page !== 'undefined' ) { _Initialize_Page(); } else { console.log('_Initialize_Page not found.'); } _Initialize.done = true; } else { // Is the ttContentsContainer part of the DOM yet? console.warn('_Initialize['+InitializeCount+'] '+ttContentsContainer+' not found.'); } // Is the ttContentsContainer part of the DOM yet? } else { console.warn('_Initialize['+InitializeCount+'] ttContentsContainer undefined'); } if ( InitializeCount !== false && InitializeCount < 10 ) { if ( DEBUG ) { console.log('setTimeout(_Initialize,200);'); } setTimeout(_Initialize,200); } } else { if ( DEBUG ) { console.groupCollapsed(PC+`Skipped _Initialize[${InitializeCount}] by = ${by}`,CW); } } if ( DEBUG ) { console.groupEnd(); } } // END _Initialize. _Initialize.done = false; // _Initialize_CopyToClipboard() // Add event listeners to all class 'copyText' elements. function _Initialize_CopyToClipboard() { console.log(`${PC}_Initialize_CopyToClipboard[]`,CH); //console.warn('_Initialize_CopyToClipboard[]'); var copyTexts = document.getElementsByClassName('copyText'); //console.log('copyTexts.length='+copyTexts.length); for ( var i=0; i<copyTexts.length; i++ ) { let copyText = copyTexts[i]; let title = copyText.getAttribute("title"); if (!title) { title = 'Click to copy text to the clipboard.'; } else { title = `Click to copy ${title} to the clipboard.`; } copyText.addEventListener('click', function(){ CopyToClipboard(this); }); copyText.addEventListener('mouseover', function(){ ttShow(title); this.style.outline = 'solid silver'; }); copyText.addEventListener('mouseout', function(){ ttHide(); this.style.outline = ''; }); } } // END _Initialize_CopyToClipboard. // CopyToClipboard(eId, ShowCopy) // Copy the text from the element to the clipboard. // eId = id of the element to copy the text from. // CopyType = The type of copy to do. // . function CopyToClipboard(e, CopyType) { //ttHide(); e.style.outline = '' if ( e ) { //var CopyTextElement = document.getElementById(eId); var copied = false; var element_type = e.tagName.toLowerCase(); var textArea; var range; console.log(e.id+' is element type: '+element_type); switch (element_type) { case 'input': e.select(); e.setSelectionRange(0, 99999); document.execCommand("copy"); copied = true; break; case 'div': if (document.selection) { range = document.body.createTextRange(); range.moveToElementText(e); range.select().createTextRange(); document.execCommand("copy"); copied = true; console.log("selection Text has been copied, now paste in the text-area"); } else if (window.getSelection) { range = document.createRange(); range.selectNode(e); window.getSelection().removeAllRanges(); // clear current selection window.getSelection().addRange(range); // to select text document.execCommand("copy"); window.getSelection().removeAllRanges();// to deselect copied = true; console.log("getSelection Text has been copied, now paste in the text-area"); } break; default: textArea = document.createElement("textarea"); textArea.value = e.textContent; document.body.appendChild(textArea); textArea.select(); document.execCommand("Copy"); textArea.remove(); } var ttinnerHTML = 'Unable to copy.'; if ( copied ) { ttinnerHTML = 'Copied.'; } ttObj.innerHTML = ttinnerHTML; ttObj.className = 'attention'; //setTimeout(ttHide,500); } else { console.warn(eId+' does not exist.'); } } // ElementBounds(eId) // Return left, top, right, bottom, width, height, border, margin, and padding of an element. // eId = element.id or element to check. // { left, top, right, bottom, width, height, border{ left, top, right, bottom }, margin{left, top, right, bottom }, padding{ left, top, right, bottom } }. function ElementBounds(eId,by) { var DEBUG_ElementBounds = false; var e; var left = 0; var top = 0; var right = 0; var bottom = 0; var width = 0; var height = 0; var border = { left:0, top:0, right:0, bottom:0 }; var margin = { left:0, top:0, right:0, bottom:0 }; var padding = { left:0, top:0, right:0, bottom:0 }; // Get element and element.id. if ( typeof eId === 'string' ) { // eId is the element.id. if ( DEBUG_ElementBounds ) { console.warn('ElementBounds[eId='+eId+', by='+by+']'); } e = document.getElementById(eId); } else if ( typeof eId === 'object' ) { // eId is the element. e = eId; if ( eId.id ) { eId = e.id; if ( DEBUG_ElementBounds ) { console.warn('ElementBounds[eId='+eId+', by='+by+']'); } } else { eId = ''; if ( DEBUG_ElementBounds ) { console.warn('ElementBounds[tagName='+e.tagName+', by='+by+']'); } } } else { e = false; if ( DEBUG_ElementBounds ) { console.warn('ElementBounds[e is not string or object, by='+by+']'); } } if ( e ) { width = parseFloat(e.offsetWidth); height = parseFloat(e.offsetHeight); var style = e.currentStyle || window.getComputedStyle(e); border.left = parseFloat(style.borderLeftWidth.replace('px','')); border.top = parseFloat(style.borderTopWidth.replace('px','')); border.right = parseFloat(style.borderRightWidth.replace('px','')); border.bottom = parseFloat(style.borderBottomWidth.replace('px','')); margin.left = parseFloat(style.marginLeft.replace('px','')); margin.top = parseFloat(style.marginTop.replace('px','')); margin.right = parseFloat(style.marginRight.replace('px','')); margin.bottom = parseFloat(style.marginBottom.replace('px','')); padding.left = parseFloat(style.paddingLeft.replace('px','')); padding.top = parseFloat(style.paddingTop.replace('px','')); padding.right = parseFloat(style.paddingRight.replace('px','')); padding.bottom = parseFloat(style.paddingBottom.replace('px','')); // Get the left and top by walking up the parent elements. var eWalk = e; while( eWalk && eWalk.tagName && eWalk.tagName !== "BODY" && eWalk.id !== 'sectionId_1' ) { left += parseFloat(eWalk.offsetLeft); top += parseFloat(eWalk.offsetTop); if ( DEBUG_ElementBounds ) { console.log(TB+'eWalk.id='+eWalk.id+' tagName='+eWalk.tagName+' left='+left+' top='+top); } eWalk = eWalk.offsetParent; } right = left + width; bottom = top + height; } else { console.info('No element with id '+eId+' found. by='+by); } if ( DEBUG_ElementBounds ) { console.log(TB+eId+' left='+left+' top='+top+' right='+right+' bottom='+bottom+' width='+width+' height='+height); } if ( DEBUG_ElementBounds ) { console.log(TB+eId+' border='+JSON.stringify(border)); console.log(TB+eId+' margin='+JSON.stringify(margin)); console.log(TB+eId+' padding='+JSON.stringify(padding)); } return { left:left, top:top, right:right, bottom:bottom, width:width, height:height, border:{ left:border.left, top:border.top, right:border.right, bottom:border.bottom }, margin:{ left:margin.left, top:margin.top, right:margin.right, bottom:margin.bottom }, padding:{ left:padding.left, top:padding.top, right:padding.right, bottom:padding.bottom } }; } // END ElementBounds. // exampleHide(e) // Hide the example div. function exampleHide(e) { exampleShowHide(e,false); return false; } // END exampleHide. // exampleShow(e) // Display the example div. function exampleShow(e) { exampleShowHide(e,true); return false; } // END exampleShow. // exampleShowHide(e) // Display or hide the example div. function exampleShowHide(e,ShowHide) { console.warn('exampleShowHide[e.id='+e.id+', ShowHide='+ShowHide+']'); var eIdParts = e.id.split('_'); console.log('eIdParts='+eIdParts); var OpenId = 'a_Show_'+eIdParts[2]; console.log('OpenId='+OpenId); var ExampleId = 'div_'+eIdParts[2]; console.log('ExampleId='+ExampleId); if ( ShowHide ) { // Display the example div. console.log('document.getElementById('+ExampleId+')='+document.getElementById(ExampleId)); console.log('document.getElementById('+OpenId+')='+document.getElementById(OpenId)); if ( document.getElementById(ExampleId) ) { document.getElementById(ExampleId).style.display = 'block'; } if ( document.getElementById(OpenId) ) { document.getElementById(OpenId).style.display = 'none'; } } else { // Hide the example div. if ( document.getElementById(OpenId) ) { document.getElementById(OpenId).style.display = 'inline'; } if ( document.getElementById(ExampleId) ) { document.getElementById(ExampleId).style.display = 'none'; } } } // END exampleShowHide. // mouseXY(evt) // Set mx and my to the mouse position. function mouseXY(evt) { var DEBUG = false; //if ( DEBUG ) { console.groupCollapsed(PC+'mouseXY[evt.target.id='+evt.target.id+']',CG); } //console.warn('evt='+evt+']'); //console.warn('mouseXY[evt.target.id='+evt.target.id+']'); evt = evt || window.event; // Get the event. if ( typeof evt !== 'undefined' ) { if (evt.pageX) { mx = evt.pageX; } else if (evt.clientX) { mx = evt.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft); } else { mx = 0; } if (evt.pageY) { my = evt.pageY; } else if (evt.clientY) { my = evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); } else { my = 0; } } //console.log('mx='+mx+' my='+my); //if ( DEBUG ) { console.groupEnd(); } } // END mouseXY. // Submit_Task_Subtask(this) // Sets the hidden values id_task and id_subtask based on e.id of calling element. // The element id must be of the form: task_subtask. // e.g. An e.id of test_me would set the value of id_task to 'test' and the value of id_subtask to 'me'; // If there is no subtask value it is set to 0 (zero). // e.g. An e.id of test would set the value of id_task to 'test' and the value of id_subtask to '0'; function Submit_Task_Subtask(e) { var taskPart = e.id.split('_'); if ( !taskPart[1] ) { taskPart[1] = 0; } //alert('e.id = '+e.id+' e.form.name = '+e.form.name+' taskPart[0] = '+taskPart[0]+' taskPart[1] = '+taskPart[1]); var form = document.forms[e.form.name]; form.id_task.value = taskPart[0]; form.id_subtask.value = taskPart[1]; form.submit(); }