PageSourceSearch

https://sharedalliance.com/wp-content/plugins/portfolio-wp/js/crp-helper.js?ver=7.1.3

js sharedalliance.com collected 2026-10-10 01:23:45 UTC 5,804 bytes, 238 lines download raw bytes

1var _CRP_LAST_GENERATED_ID = 100000;
2function crp_generateId(){
3    return "tmpid_" + (++_CRP_LAST_GENERATED_ID).toString();
4}
5
6function crp_showSpinner() {
7    jQuery("#crp-spinner").css('display', 'block');
8    jQuery("#crp-spinner-background").css('display', 'block');
9}
10
11function crp_hideSpinner() {
12    setTimeout(function(){
13        jQuery("#crp-spinner").css('display', 'none');
14        jQuery("#crp-spinner-background").css('display', 'none');
15    }, 1000);
16}
17
18function crp_openMediaUploader( callback, multipleSelection ) {
19    'use strict';
20
21    multipleSelection = typeof multipleSelection !== 'undefined' ? multipleSelection : false;
22    var uploader, imgData, json;
23
24    if ( undefined !== uploader ) {
25        uploader.open();
26        return;
27    }
28
29    uploader = wp.media.frames.file_frame = wp.media({
30        frame:    'post',
31        state:    'insert',
32        multiple: multipleSelection
33    });
34
35    uploader.on( 'insert', function() {
36        var selections = uploader.state().get( 'selection').toJSON();
37        var picInfos = [];
38
39        for(var sIdx = 0; sIdx < selections.length; sIdx++){
40            var json = selections[sIdx];
41            if ( 0 > jQuery.trim( json.url.length ) ) {
42                continue;
43            }
44
45            var picInfo = {};
46            picInfo.id = json.id;
47            picInfo.src = json.sizes.full.url;
48
49            if(json.sizes.medium){
50                picInfo.src = json.sizes.medium.url;
51            }
52
53            picInfos.push(picInfo);
54        }
55
56        if(multipleSelection){
57            callback(picInfos);
58        }else{
59            callback(picInfos.length > 0 ? picInfos[0] : null);
60        }
61    });
62
63    uploader.open();
64}
65
66function crp_isJSArray(obj){
67    return (Object.prototype.toString.call( obj ) === '[object Array]')
68}
69
70function crp_truncate(text, maxLength){
71    if(text){
72        if(text.length > 3 && text.length > maxLength - 3){
73            text = text.substring(0,maxLength - 3);
74            text += "..."
75        }
76    }
77    return text;
78}
79
80function crp_loadHref(href, blank){
81    if(!blank){
82        window.location.href = href;
83    }else{
84        window.open(href, '_blank');
85    }
86}
87
88function crp_mgfCloseButtonMarkup(){
89
90    var html = "";
91    html += "<button class='mfp-close'>";
92    html +=     "x"; //"<img class='mfp-close-img'/>";
93    html += "</button>"
94
95    return html;
96}
97
98function crp_esc(str){
99    return jQuery('<div>').text(str).html();
100}
101
102
103var CrpBase64 = {
104
105// private property
106_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
107
108// public method for encoding
109encode : function (input) {
110    var output = "";
111    var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
112    var i = 0;
113
114    if(!input) return output;
115    input = CrpBase64._utf8_encode(input);
116
117    while (i < input.length) {
118
119        chr1 = input.charCodeAt(i++);
120        chr2 = input.charCodeAt(i++);
121        chr3 = input.charCodeAt(i++);
122
123        enc1 = chr1 >> 2;
124        enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
125        enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
126        enc4 = chr3 & 63;
127
128        if (isNaN(chr2)) {
129            enc3 = enc4 = 64;
130        } else if (isNaN(chr3)) {
131            enc4 = 64;
132        }
133
134        output = output +
135        this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
136        this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
137
138    }
139
140    return output;
141},
142
143// public method for decoding
144decode : function (input) {
145    var output = "";
146    var chr1, chr2, chr3;
147    var enc1, enc2, enc3, enc4;
148    var i = 0;
149
150    if(!input) return output;
151    input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
152
153    while (i < input.length) {
154
155        enc1 = this._keyStr.indexOf(input.charAt(i++));
156        enc2 = this._keyStr.indexOf(input.charAt(i++));
157        enc3 = this._keyStr.indexOf(input.charAt(i++));
158        enc4 = this._keyStr.indexOf(input.charAt(i++));
159
160        chr1 = (enc1 << 2) | (enc2 >> 4);
161        chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
162        chr3 = ((enc3 & 3) << 6) | enc4;
163
164        output = output + String.fromCharCode(chr1);
165
166        if (enc3 != 64) {
167            output = output + String.fromCharCode(chr2);
168        }
169        if (enc4 != 64) {
170            output = output + String.fromCharCode(chr3);
171        }
172
173    }
174
175    output = CrpBase64._utf8_decode(output);
176
177    return output;
178
179},
180
181// private method for UTF-8 encoding
182_utf8_encode : function (string) {
183    string = string.replace(/\r\n/g,"\n");
184    var utftext = "";
185
186    for (var n = 0; n < string.length; n++) {
187
188        var c = string.charCodeAt(n);
189
190        if (c < 128) {
191            utftext += String.fromCharCode(c);
192        }
193        else if((c > 127) && (c < 2048)) {
194            utftext += String.fromCharCode((c >> 6) | 192);
195            utftext += String.fromCharCode((c & 63) | 128);
196        }
197        else {
198            utftext += String.fromCharCode((c >> 12) | 224);
199            utftext += String.fromCharCode(((c >> 6) & 63) | 128);
200            utftext += String.fromCharCode((c & 63) | 128);
201        }
202
203    }
204
205    return utftext;
206},
207
208// private method for UTF-8 decoding
209_utf8_decode : function (utftext) {
210    var string = "";
211    var i = 0;
212    var c = c1 = c2 = 0;
213
214    while ( i < utftext.length ) {
215
216        c = utftext.charCodeAt(i);
217
218        if (c < 128) {
219            string += String.fromCharCode(c);
220            i++;
221        }
222        else if((c > 191) && (c < 224)) {
223            c2 = utftext.charCodeAt(i+1);
224            string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
225            i += 2;
226        }
227        else {
228            c2 = utftext.charCodeAt(i+1);
229            c3 = utftext.charCodeAt(i+2);
230            string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
231            i += 3;
232        }
233
234    }
235
236    return string;
237}
238}

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.