PageSourceSearch

https://marccscott.com/wp-content/plugins/teachpress/js/frontend.js?ver=6.2.4

js marccscott.com collected 2026-10-08 02:50:52 UTC 3,834 bytes, 110 lines download raw bytes

1// teachPress javascript for the frontend
2
3/**
4 * for jumpmenu
5 * @param {string} targ
6 * @param {string} selObj
7 * @param {string} restore
8 * @since 6.0.4
9 * @version 2
10 */
11function teachpress_jumpMenu(targ, selObj, base){
12    var url = encodeURI(base+selObj.options[selObj.selectedIndex].value);
13    eval(targ+".location='"+ url +"'");
14}
15
16/**
17 * for cleaning input field of tpsearch
18 * @since 4.3.12
19 */
20function teachpress_tp_search_clean() {
21    document.getElementById("tp_search_input_field").value = "";
22}
23
24/**
25 * for show/hide buttons
26 * @param {string} where
27 * @since 0.85
28 */
29function teachpress_showhide(where) {
30    var mode = "block";
31    if (document.getElementById(where).style.display !== mode) {
32        document.getElementById(where).style.display = mode;
33    }
34    else {
35        document.getElementById(where).style.display = "none";
36    }
37}
38
39/**
40 * for show/hide div container in publication lists
41 * @param {string} id
42 * @param {string} button
43 * @since 1.0
44 */
45function teachpress_pub_showhide(id, button) {
46    var mode = "block";
47    var curr = button + "_" + id;
48    var currSh = button + "_sh_" + id;
49    if ( document.getElementById(curr).style.display === mode ) {
50        document.getElementById(curr).style.display = "none";
51        document.getElementById(currSh).setAttribute("class", "tp_show");
52    }
53    else {
54        container = new Array("tp_altmetric_", "tp_abstract_", "tp_bibtex_", "tp_links_");
55        for ( i=0; i < (container.length); i++ ) {
56            if ( document.getElementById(container[i] + id) ) {
57                if ( (container[i] + id) === curr ) {
58                    document.getElementById(container[i] + id).style.display = mode;
59                    document.getElementById(container[i] + "sh_" + id).setAttribute("class", "tp_show_block");
60                    continue;
61                }
62                if ( document.getElementById(container[i] + id).style.display === mode ) {
63                    document.getElementById(container[i] + id).style.display = "none";
64                    document.getElementById(container[i] + "sh_" + id).setAttribute("class", "tp_show");
65                }
66            }
67        }
68    }
69}
70
71/**
72 * validate forms
73 * @since 0.85
74 */
75function teachpress_validateForm() {
76  if (document.getElementById){
77    var i,p,q,nm,test,num,min,max,errors='',args=teachpress_validateForm.arguments;
78    for (i=0; i<(args.length-2); i+=3) { 
79        test=args[i+2]; 
80        val=document.getElementById(args[i]);
81        if (val) {
82            nm=val.name; 
83            if ( (val = val.value)!== "" ) {
84                if (test.indexOf('isEmail')!==-1) { 
85                    p=val.indexOf('@');
86                    if (p<1 || p===(val.length-1)) {
87                        errors+='* '+nm+' must contain an e-mail address.\n';
88                    }
89                } 
90                else if (test!=='R') {
91                    num = parseFloat(val);
92                    if (isNaN(val)) { 
93                        errors+='* '+nm+' must contain a number.\n'; 
94                    }
95                    if (test.indexOf('inRange') !== -1) { 
96                        p=test.indexOf(':');
97                        min=test.substring(8,p); max=test.substring(p+1);
98                        if (num<min || max<num) { 
99                            errors+='* '+nm+' must contain a number between '+min+' and '+max+'.\n'; 
100                        }
101                    }
102                } 
103            } 
104            else if (test.charAt(0) === 'R') errors += '* '+nm+' is required.\n'; 
105        }
106    } 
107    if (errors) alert('Sorry, but you must relieve the following error(s):\n'+errors);
108    document.teachpress_returnValue = (errors === '');
109  } 
110}

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.