var initPostViewsCounter = function() { PostViewsCounter = { promise: null, args: {}, /** * Initialize counter. * * @param {object} args * * @return {void} */ init: function( args ) { this.args = args; // default parameters let params = {}; // set cookie/storage name let name = 'pvc_visits' + ( args.multisite !== false ? '_' + parseInt( args.multisite ) : '' ); // cookieless data storage? if ( args.dataStorage === 'cookieless' && this.isLocalStorageAvailable() ) { params.storage_type = 'cookieless'; params.storage_data = this.readStorageData( name ); /* COUNT_POST_AS_AUTHOR_VIEW | removed parameter from request if ( 'countAuthor' in args && args.countAuthor === true ) { params.storage_data_author = this.readStorageData( 'pvc_visits_user' + ( args.multisite !== false ? '_' + parseInt( args.multisite ) : '' ) ); } */ } else { params.storage_type = 'cookies'; params.storage_data = this.readCookieData( name ); /* COUNT_POST_AS_AUTHOR_VIEW | removed parameter from request if ( 'countAuthor' in args && args.countAuthor === true ) { params.storage_data_author = this.readCookieData( 'pvc_visits_user' + ( args.multisite !== false ? '_' + parseInt( args.multisite ) : '' ) ); } */ } // rest api request if ( args.mode === 'rest_api' ) { this.promise = this.request( args.requestURL, params, 'POST', { 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8', 'X-WP-Nonce': args.nonce }, name ); // admin ajax request } else { params.action = 'pvc-check-post'; params.pvc_nonce = args.nonce; params.id = args.postID; this.promise = this.request( args.requestURL, params, 'POST', { 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8' }, name ); } }, /** * Handle fetch request. * * @param {string} url * @param {object} params * @param {string} method * @param {object} headers * @param {string} name * * @return {object} */ request: function( url, params, method, headers, name = '' ) { let options = { method: method, mode: 'cors', cache: 'no-cache', credentials: 'same-origin', headers: headers, body: this.prepareRequestData( params ) }; const _this = this; return fetch( url, options ).then( function( response ) { // invalid response? if ( ! response.ok ) throw Error( response.statusText ); return response.json(); } ).then( function( response ) { try { if ( typeof response === 'object' && response !== null ) { if ( 'success' in response && response.success === false ) { console.log( 'Request error' ); console.log( response.data ); } else { if ( _this.args.dataStorage === 'cookieless' ) _this.saveStorageData.call( _this, name, response.storage, response.type ); else _this.saveCookieData( name, response.storage ); _this.triggerEvent( 'pvcCheckPost', response ); } } else { console.log( 'Invalid object' ); console.log( response ); } } catch( error ) { console.log( 'Invalid JSON data' ); console.log( error ); } } ).catch( function( error ) { console.log( 'Invalid response' ); console.log( error ); } ); }, /** * Prepare the data to be sent with the request. * * @param {object} data * * @return {string} */ prepareRequestData: function( data ) { return Object.keys( data ).map( function( el ) { // add extra "data" array return encodeURIComponent( el ) + '=' + encodeURIComponent( data[el] ); } ).join( '&' ).replace( /%20/g, '+' ); }, /** * Prepare the data to be sent with the request. * * @param {string} eventName * @param {object} data * * @return {void} */ triggerEvent: function( eventName, data ) { const newEvent = new CustomEvent( eventName, { bubbles: true, detail: data } ); // trigger event document.dispatchEvent( newEvent ); }, /** * Save localStorage data. * * @param {string} name * @param {object} data * @param {string} type * * @return {void} */ saveStorageData: function( name, data, type ) { /* COUNT_POST_AS_AUTHOR_VIEW | removed setting localStorage user data if ( 'countAuthor' in this.args && this.args.countAuthor === true && 'user' in data ) window.localStorage.setItem( 'pvc_visits_user' + ( this.args.multisite !== false ? '_' + parseInt( this.args.multisite ) : '' ), JSON.stringify( data['user'] ) ); */ window.localStorage.setItem( name, JSON.stringify( data[type] ) ); }, /** * Read localStorage data. * * @param {string} name * * @return {string} */ readStorageData: function( name ) { let data = null; // get data data = window.localStorage.getItem( name ); // no data? if ( data === null ) data = ''; return data; }, /** * Save cookies. * * @param {string} name * @param {object} data * * @return {void} */ saveCookieData: function( name, data ) { var cookieSecure = ''; // ssl? if ( document.location.protocol === 'https:' ) cookieSecure = ';secure'; for ( let i = 0; i < data.name.length; i++ ) { var cookieDate = new Date(); var expiration = parseInt( data.expiry[i] ); // valid expiration timestamp? if ( expiration ) expiration = expiration * 1000; // add default 24 hours else expiration = cookieDate.getTime() + 86400000; // set cookie date expiry cookieDate.setTime( expiration ); // set cookie document.cookie = data.name[i] + '=' + data.value[i] + ';expires=' + cookieDate.toUTCString() + ';path=/' + ( this.args.path === '/' ? '' : this.args.path ) + ';domain=' + this.args.domain + cookieSecure + ';SameSite=Lax'; } }, /** * Read cookies. * * @param {string} name * * @return {string} */ readCookieData: function( name ) { var cookies = []; document.cookie.split( ';' ).forEach( function( el ) { var [key, value] = el.split( '=' ); var trimmedKey = key.trim(); var regex = new RegExp( name + '\\[\\d+\\]' ); // look all cookies starts with name parameter if ( regex.test( trimmedKey ) ) cookies.push( value ); } ); return cookies.join( 'a' ); }, /** * Check whether localStorage is available. * * @return {bool} */ isLocalStorageAvailable: function() { var storage; try { storage = window['localStorage']; storage.setItem( '__pvcStorageTest', 0 ); storage.removeItem( '__pvcStorageTest' ); return true; } catch( e ) { return e instanceof DOMException && ( e.code === 22 || e.code === 1014 || e.name === 'QuotaExceededError' || e.name === 'NS_ERROR_DOM_QUOTA_REACHED' ) && ( storage && storage.length !== 0 ); } } } PostViewsCounter.init( pvcArgsFrontend ); } document.addEventListener( 'DOMContentLoaded', initPostViewsCounter );{"id":9439,"date":"2019-06-10T11:17:38","date_gmt":"2019-06-10T11:17:38","guid":{"rendered":"https:\/\/masterhellas.alexas.gr\/index.php\/product\/nsm-zr132lb-avr-1500rpm-30-kva-380v\/"},"modified":"2023-09-06T08:34:08","modified_gmt":"2023-09-06T08:34:08","slug":"nsm-zr132lb-avr-1500rpm-30-kva-380v","status":"publish","type":"product","link":"https:\/\/masterhellas.com.gr\/product\/nsm-zr132lb-avr-1500rpm-30-kva-380v\/","title":{"rendered":"\u0393\u0395\u039d\u039d\u0397\u03a4\u03a1\u0399\u0391 NSM ZR132LB \u039c\u0395 \u03a3\u03a4\u0391\u0398\u0395\u03a1\u039f\u03a0\u039f\u0399\u0397\u03a4\u0397 \u03a4\u0391\u03a3\u0397\u03a3 AVR 1500RPM 30 KVA 380V \u0399\u03a4\u0391\u039b\u0399\u039a\u0397\u03a3 \u03a4\u0395\u03a7\u039d\u039f\u039b\u039f\u0393\u0399\u0391\u03a3"},"content":{"rendered":"

\u039c\u039f\u039d\u03a4\u0395\u039b\u039f: ZR132LB<\/p>\n

\u039c\u0391\u03a1\u039a\u0391:\"\"<\/p>\n<\/p>\n

\u03a0\u0399\u03a3\u03a4\u039f\u03a0\u039f\u0399\u0397\u03a4\u0399\u039a\u0391:\"\"<\/p>\n

\u0393\u0395\u039d\u039d\u0397\u03a4\u03a1\u0399\u0391 \u039c\u0395\u00a0\u03a3\u03a4\u0391\u0398\u0395\u03a1\u039f\u03a0\u039f\u0399\u0397\u03a4\u0397 \u03a4\u0391\u03a3\u0397\u03a3 AVR 1500RPM \u039a\u0391\u0399 4 \u03a0\u039f\u039b\u039f\u03a5\u03a3<\/p>\n

\u03a7\u0391\u03a1\u0391\u039a\u03a4\u0397\u03a1\u0399\u03a3\u03a4\u0399\u039a\u0391:<\/p>\n

\u03a6\u0391\u03a3\u0397:TPI\u03a6\u0391\u03a3\u0399\u039a\u0397<\/p>\n

\u0399\u03a3\u03a7\u03a5\u03a3 \u0395\u039e\u039f\u0394\u039f\u03a5(KVA):30<\/p>\n

\u039a\u0399\u039d\u0397\u03a4\u0397\u03a1\u0399\u0391 \u0399\u03a3\u03a7\u03a5\u03a3(KW):27,6<\/p>\n

\u03a4\u0391\u03a3\u0397(V):380V<\/p>\n

\u03a0\u03a1\u039f\u03a3\u03a4\u0391\u03a3\u0399\u0391:\u0399\u03a123<\/p>\n

\u039a\u039b\u0391\u03a3\u0397 \u039c\u039f\u039d\u03a9\u03a3\u0397\u03a3:\u0397<\/p>\n

\u03a3\u03a4\u03a1\u039f\u03a6\u0395\u03a3(RPM):1500<\/p>\n","protected":false},"excerpt":{"rendered":"

\u03a4\u03a1\u0399\u03a6\u0391\u03a3\u0399\u039a\u0397 \u0393\u0395\u039d\u039d\u0397\u03a4\u03a1\u0399\u0391 \u0396R132LB 30 KVA \u039c\u0395 \u03a3\u03a4\u0391\u0398\u0395\u03a1\u039f\u03a0\u039f\u0399\u0397\u03a4\u0397 \u03a4\u0391\u03a3\u0397\u03a3 AVR 1500RPM KAI 4 \u03a0\u039f\u039b\u039f\u03a5\u03a3,\u0399\u03a4\u0391\u039b\u0399\u039a\u0397\u03a3 \u03a4\u0395\u03a7\u039d\u039f\u039b\u039f\u0393\u0399\u0391\u03a3.<\/p>\n","protected":false},"featured_media":9436,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"yoast_head":"\n\u0393\u0395\u039d\u039d\u0397\u03a4\u03a1\u0399\u0391 NSM ZR132LB \u039c\u0395 \u03a3\u03a4\u0391\u0398\u0395\u03a1\u039f\u03a0\u039f\u0399\u0397\u03a4\u0397 \u03a4\u0391\u03a3\u0397\u03a3 AVR 1500RPM 30 KVA 380V \u0399\u03a4\u0391\u039b\u0399\u039a\u0397\u03a3 \u03a4\u0395\u03a7\u039d\u039f\u039b\u039f\u0393\u0399\u0391\u03a3 - Master Hellas<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/masterhellas.com.gr\/product\/nsm-zr132lb-avr-1500rpm-30-kva-380v\/\" \/>\n<meta property=\"og:locale\" content=\"el_GR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u0393\u0395\u039d\u039d\u0397\u03a4\u03a1\u0399\u0391 NSM ZR132LB \u039c\u0395 \u03a3\u03a4\u0391\u0398\u0395\u03a1\u039f\u03a0\u039f\u0399\u0397\u03a4\u0397 \u03a4\u0391\u03a3\u0397\u03a3 AVR 1500RPM 30 KVA 380V \u0399\u03a4\u0391\u039b\u0399\u039a\u0397\u03a3 \u03a4\u0395\u03a7\u039d\u039f\u039b\u039f\u0393\u0399\u0391\u03a3 - Master Hellas\" \/>\n<meta property=\"og:description\" content=\"\u03a4\u03a1\u0399\u03a6\u0391\u03a3\u0399\u039a\u0397 \u0393\u0395\u039d\u039d\u0397\u03a4\u03a1\u0399\u0391 \u0396R132LB 30 KVA \u039c\u0395 \u03a3\u03a4\u0391\u0398\u0395\u03a1\u039f\u03a0\u039f\u0399\u0397\u03a4\u0397 \u03a4\u0391\u03a3\u0397\u03a3 AVR 1500RPM KAI 4 \u03a0\u039f\u039b\u039f\u03a5\u03a3,\u0399\u03a4\u0391\u039b\u0399\u039a\u0397\u03a3 \u03a4\u0395\u03a7\u039d\u039f\u039b\u039f\u0393\u0399\u0391\u03a3.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/masterhellas.com.gr\/product\/nsm-zr132lb-avr-1500rpm-30-kva-380v\/\" \/>\n<meta property=\"og:site_name\" content=\"Master Hellas\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-06T08:34:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/masterhellas.com.gr\/wp-content\/uploads\/2019\/06\/3992-thickbox_default-GENNITRIA-NSM-ZR132LB-ME-STATHEROPOIITI-TASIS-AVR-1500RPM-30-KVA-380V-ITALIKIS-TECHNOLOGIAS.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"800\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/masterhellas.com.gr\/#website\",\"url\":\"https:\/\/masterhellas.com.gr\/\",\"name\":\"Master Hellas\",\"description\":\"MasterHellas\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/masterhellas.com.gr\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"el\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/masterhellas.com.gr\/product\/nsm-zr132lb-avr-1500rpm-30-kva-380v\/#primaryimage\",\"inLanguage\":\"el\",\"url\":\"https:\/\/masterhellas.com.gr\/wp-content\/uploads\/2019\/06\/3992-thickbox_default-GENNITRIA-NSM-ZR132LB-ME-STATHEROPOIITI-TASIS-AVR-1500RPM-30-KVA-380V-ITALIKIS-TECHNOLOGIAS.jpg\",\"width\":800,\"height\":800,\"caption\":\"\\u0393\\u0395\\u039d\\u039d\\u0397\\u03a4\\u03a1\\u0399\\u0391 NSM ZR132LB \\u039c\\u0395 \\u03a3\\u03a4\\u0391\\u0398\\u0395\\u03a1\\u039f\\u03a0\\u039f\\u0399\\u0397\\u03a4\\u0397 \\u03a4\\u0391\\u03a3\\u0397\\u03a3 AVR 1500RPM 30 KVA 380V \\u0399\\u03a4\\u0391\\u039b\\u0399\\u039a\\u0397\\u03a3 \\u03a4\\u0395\\u03a7\\u039d\\u039f\\u039b\\u039f\\u0393\\u0399\\u0391\\u03a3\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/masterhellas.com.gr\/product\/nsm-zr132lb-avr-1500rpm-30-kva-380v\/#webpage\",\"url\":\"https:\/\/masterhellas.com.gr\/product\/nsm-zr132lb-avr-1500rpm-30-kva-380v\/\",\"name\":\"\\u0393\\u0395\\u039d\\u039d\\u0397\\u03a4\\u03a1\\u0399\\u0391 NSM ZR132LB \\u039c\\u0395 \\u03a3\\u03a4\\u0391\\u0398\\u0395\\u03a1\\u039f\\u03a0\\u039f\\u0399\\u0397\\u03a4\\u0397 \\u03a4\\u0391\\u03a3\\u0397\\u03a3 AVR 1500RPM 30 KVA 380V \\u0399\\u03a4\\u0391\\u039b\\u0399\\u039a\\u0397\\u03a3 \\u03a4\\u0395\\u03a7\\u039d\\u039f\\u039b\\u039f\\u0393\\u0399\\u0391\\u03a3 - Master Hellas\",\"isPartOf\":{\"@id\":\"https:\/\/masterhellas.com.gr\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/masterhellas.com.gr\/product\/nsm-zr132lb-avr-1500rpm-30-kva-380v\/#primaryimage\"},\"datePublished\":\"2019-06-10T11:17:38+00:00\",\"dateModified\":\"2023-09-06T08:34:08+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/masterhellas.com.gr\/product\/nsm-zr132lb-avr-1500rpm-30-kva-380v\/#breadcrumb\"},\"inLanguage\":\"el\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/masterhellas.com.gr\/product\/nsm-zr132lb-avr-1500rpm-30-kva-380v\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/masterhellas.com.gr\/product\/nsm-zr132lb-avr-1500rpm-30-kva-380v\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/masterhellas.com.gr\/\",\"url\":\"https:\/\/masterhellas.com.gr\/\",\"name\":\"\\u0391\\u03c1\\u03c7\\u03b9\\u03ba\\u03ae\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/masterhellas.com.gr\/shop\/\",\"url\":\"https:\/\/masterhellas.com.gr\/shop\/\",\"name\":\"Shop\"}},{\"@type\":\"ListItem\",\"position\":3,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/masterhellas.com.gr\/product\/nsm-zr132lb-avr-1500rpm-30-kva-380v\/\",\"url\":\"https:\/\/masterhellas.com.gr\/product\/nsm-zr132lb-avr-1500rpm-30-kva-380v\/\",\"name\":\"\\u0393\\u0395\\u039d\\u039d\\u0397\\u03a4\\u03a1\\u0399\\u0391 NSM ZR132LB \\u039c\\u0395 \\u03a3\\u03a4\\u0391\\u0398\\u0395\\u03a1\\u039f\\u03a0\\u039f\\u0399\\u0397\\u03a4\\u0397 \\u03a4\\u0391\\u03a3\\u0397\\u03a3 AVR 1500RPM 30 KVA 380V \\u0399\\u03a4\\u0391\\u039b\\u0399\\u039a\\u0397\\u03a3 \\u03a4\\u0395\\u03a7\\u039d\\u039f\\u039b\\u039f\\u0393\\u0399\\u0391\\u03a3\"}}]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/masterhellas.com.gr\/wp-json\/wp\/v2\/product\/9439"}],"collection":[{"href":"https:\/\/masterhellas.com.gr\/wp-json\/wp\/v2\/product"}],"about":[{"href":"https:\/\/masterhellas.com.gr\/wp-json\/wp\/v2\/types\/product"}],"replies":[{"embeddable":true,"href":"https:\/\/masterhellas.com.gr\/wp-json\/wp\/v2\/comments?post=9439"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/masterhellas.com.gr\/wp-json\/wp\/v2\/media\/9436"}],"wp:attachment":[{"href":"https:\/\/masterhellas.com.gr\/wp-json\/wp\/v2\/media?parent=9439"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}