Diff -- /var/www/vhosts/3dshawn.com/site1/assets/javascript/scripts.js

O Operator
Diff

/var/www/vhosts/3dshawn.com/site1/assets/javascript/scripts.js

added on local at 2026-07-10 18:57:28

Added
+141
lines
Removed
-0
lines
Context
0
unchanged
Blobs
from
to 265d58fb7630
Restore this content →
Unified diff
Naive LCS-based line diff. Additions in emerald, deletions in rose. Both sides decompressed live from BLOB_STORE.
1// ---------------- Toggle to hide and un-hide div areas ---------- //
2function toggleMessage(messageId) {
3 var disp = document.getElementById(messageId).style.display;
4 if ( disp == 'none' ) {
5 this.ShowContent(messageId);
6 } else {
7 this.HideContent(messageId);
8 }
9 return false;
10}
11
12function HideContent(d) {
13 if(d.length < 1) { return; }
14 document.getElementById(d).style.display = "none";
15}
16function ShowContent(d) {
17 if(d.length < 1) { return; }
18 document.getElementById(d).style.display = "block";
19}
20// ---------------- Toggle to hide and un-hide div areas ---------- //
21
22
23
24// ---------------- Check and un-check all functions -------------- //
25//Set the default to not checked when a page first loads
26var setting_checkall = 'no';
27
28function toggleCheckAll(field,checked){
29 //Verify if the checkbox was checked or not just in case the entire page wasn't reloaded after the last mass checkbox change
30 if(checked == true){setting_checkall = 'no';}
31
32 if(setting_checkall == 'no'){setting_checkall='yes';checkAll(field);}
33 else{setting_checkall='no';uncheckAll(field);}
34}
35
36function checkAll(field) {
37 if(field.length){
38 for (i = 0; i < field.length; i++) field[i].checked = true ;
39 }else{
40 if(!field.checked) field.checked = true;
41 }
42}
43
44function uncheckAll(field){
45 if(field.length){
46 for (i = 0; i < field.length; i++) field[i].checked = false ;
47 }else{
48 if(field.checked) field.checked = false;
49 }
50}
51// ---------------- Check and un-check all functions -------------- //s
52
53
54
55// ---------------- Searchable drop down functions ---------------- //
56function dropdown_toggle(divname) {
57 document.getElementById(divname).classList.toggle("show");
58}
59
60function dropdown_search(divname,input) {
61 var input, filter, ul, li, a, i;
62 input = document.getElementById(input);
63 filter = input.value.toUpperCase();
64 div = document.getElementById(divname);
65 a = div.getElementsByTagName('a');
66 for (i = 0; i < a.length; i++) {
67 if (a[i].innerHTML.toUpperCase().indexOf(filter) > -1) {
68 a[i].style.display = '';
69 } else {
70 a[i].style.display = 'none';
71 }
72 }
73}
74// ---------------- Searchable drop down functions ---------------- //
75
76
77function auto_grow(element) {
78 element.style.height = "5px";
79 element.style.height = (element.scrollHeight)+"px";
80}
81
82
83//Pass along the query string ---------------------------------------------
84function ajax_request(url, div_id){
85 //console.log('url:'+url);
86 $.ajax({
87 url: url,
88 data:{},
89 context: document.body,
90 success: function(){
91 $(this).addClass("done")
92 },
93 dataType: "html",
94 success: function(data) {
95 data = $.trim(data);
96
97 //console.log("Data returned: '" + data + "'");
98
99 //Callback function
100 update_result(data, div_id);
101
102 //return data;
103 },
104 error: function() {
105 console.log('No data returned');
106 }
107 });
108}
109
110//Callback function to avoid the async problem
111function update_result(data, div_id){
112 //console.log('div: ' + div_id + ' data: ' + data);
113
114 if(data == 'passed'){
115 document.getElementById(div_id).className = 'status_true';
116 }else if(data == 'failed'){
117 document.getElementById(div_id).className = 'status_false';
118 }else if(div_id){
119 //console.log("Writing the data base to div: " + div_id);
120 document.getElementById(div_id).innerHTML = data;
121 }else{
122
123 }
124}
125//-------------------------------------------------------------------------
126
127
128//Feature to hide or show parts of the form -------------------------------
129function hide_divs(div){
130 var elms = document.getElementsByName(div);
131 for(var i = 0; i < elms.length; i++){
132 elms[i].style.display='none';
133 }
134}
135function show_divs(div){
136 var elms = document.getElementsByName(div);
137 for(var i = 0; i < elms.length; i++){
138 elms[i].style.display='block';
139 }
140}
141//-------------------------------------------------------------------------