1 2function ds24wp_initTextareaCodeHandler() 3{ 4 jQuery( 'textarea.digistore_code' ).off( 'focus' ).on( 'focus', function() { this.select(); }); 5 jQuery( 'textarea.digistore_code' ).off( 'click' ).on( 'click', function() { this.select(); }); 6 jQuery( 'textarea.digistore_code' ).off( 'keyup' ).on( 'keyup', function() { this.select(); }); 7 jQuery( 'textarea.digistore_code' ).off( 'mouseup' ).on( 'mouseup', function() { this.select(); }); 8} 9 10function ds24wp_api( callback, apikey, language, method, arg_or_args_or_empty ) 11{ 12 var fixed_param_count = 4; 13 14 var api_url = 'https://www.digistore24.com/api/call/' + method + '/?'; 15 16 var i = 1; 17 var offset = fixed_param_count-1; 18 var finished = false; 19 20 while (i+offset < arguments.length) 21 { 22 var value = arguments[i+offset]; 23 var type = typeof value; 24 switch (type) 25 { 26 case 'object': 27 var is_array = value instanceof Array; 28 if (!is_array) { 29 throw "The Digistore24 Api Javascript connector does not accept objects (except array) as arguments."; 30 } 31 32 for (key in value) 33 { 34 api_url += 'arg'+i+'['+encodeURIComponent(key)+']='+encodeURIComponent(value[key]) + '&'; 35 } 36 break; 37 38 case 'undefined': 39 case null: 40 api_url += 'arg'+i+'='+ '&'; 41 break; 42 43 default: 44 api_url += 'arg'+i+'='+encodeURIComponent(value) + '&'; 45 } 46 i++; 47 } 48 49 if (typeof language == 'string' && language) { 50 api_url += 'language=' + language; 51 } 52 53 var callback_wrapper = function () { 54 if (http.readyState==4) { 55 if (http.status==200) { 56 var response = JSON.parse( http.responseText ); 57 58 if (response.result=='success') 59 { 60 callback( response.data ); 61 } 62 else 63 { 64 throw response.message; 65 } 66 } 67 else 68 { 69 throw "Digistore24 api: invalid HTTP status " + http.statusText; 70 } 71 } 72 }; 73 74 http = new XMLHttpRequest(); 75 http.open( 'GET', api_url, true ); 76 http.setRequestHeader( 'X-DS-API-KEY', apikey ); 77 http.setRequestHeader( 'Accept', 'application/json' ); 78 http.onreadystatechange = callback_wrapper; 79 http.send(); 80} 81
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.