if ( typeof _snup !== "object" || _snup === null ) { throw new Error( "[snup] no object found" ); } if ( _snup.init ) { throw new Error( "[snup] not initialized" ); } if ( _snup.logged ) { throw new Error( "[snup] already logged" ); } _snup.logged = false; _snup.image = null; _snup.title = null; _snup.desc = null; _snup.engage = 30; _snup.max_engage = 300; var canonical = document.querySelector('link[rel="canonical"]'); var tmp = document.createElement('a'); tmp.href = (canonical && 'href' in canonical) ? canonical.href : document.location; _snup.location = tmp; _snup.image = document.querySelector( "meta[name='twitter:image']" ) || document.querySelector( "meta[property='og:image']" ); _snup.title = document.querySelector( "meta[name='twitter:title']" ) || document.querySelector( "meta[property='og:title']" ); _snup.desc = document.querySelector( "meta[name='twitter:description']" ) ? document.querySelector( "meta[name='twitter:description']" ) : document.querySelector( "meta[property='og:description']" ); _snup.blue_ribbon = "false"; _snup.title = !_snup.title ? document.getElementsByTagName( "title" )[0].text : _snup.title.getAttribute("content"); _snup.desc = !_snup.desc ? document.querySelector( "meta[name='description']" ) : _snup.desc; _snup.desc = _snup.desc ? _snup.desc.getAttribute("content") : _snup.desc; _snup.image = _snup.image ? _snup.image.getAttribute("content") : _snup.image; if ( !_snup.image || !_snup.title || !_snup.desc ) { _snup.init = false; throw new Error( "[snup] untrackable" ); } for (const a of document.querySelectorAll("h2")) { if (a.textContent.includes("Blue Ribbon Recipe")) { //Blue Ribbon, let's save some metadata console.log("ribbon"); _snup.blue_ribbon = "true"; } } (function() { var sn = document.createElement('script'); sn.type = 'text/javascript'; sn.async = true; sn.src = 'https://japfg-trending-content.appspot.com/log.php?s=' + encodeURIComponent( _snup.siteid ) + '&i=' + encodeURIComponent( _snup.image ) + '&t=' + encodeURIComponent( _snup.title ) + '&d=' + encodeURIComponent( _snup.desc ) + '&h=' + encodeURIComponent( _snup.location.hostname ) + '&p=' + encodeURIComponent( _snup.location.pathname ) + '&br=' + _snup.blue_ribbon; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(sn, s); _snup.init = true; })(); _snup.engaged = 0; _snup.seent = 0; _snup.seent_sent = 0; _snup.seent_send = 0; _snup.folded = window.pageYOffset; _snup.pinger = window.setInterval( function() { _snup.folded = document.documentElement.offsetHeight - window.pageYOffset - window.innerHeight; _snup.seent_send = 0; if ( _snup.seent_sent != 100 ) { if ( _snup.folded <= 0 ) { _snup.seent = 100; _snup.seent_sent = 100; } else { var _seent_check = ( 100 - Math.round( _snup.folded / document.documentElement.offsetHeight * 100 )); if ( _snup.seent <= _seent_check ) { _snup.seent_sent = _seent_check - _snup.seent; _snup.seent = _seent_check ; } } _snup.seent_send = _snup.seent_sent; } else { _snup.seent_send = 0; } var sn = document.createElement('script'); sn.type = 'text/javascript'; sn.async = true; sn.src = 'https://japfg-trending-content.appspot.com/ping.php?s=' + encodeURIComponent( _snup.siteid ) + '&h=' + encodeURIComponent( _snup.location.hostname ) + '&e=' + encodeURIComponent( _snup.engage ) + '&g=' + encodeURIComponent( _snup.seent_send ) + '&p=' + encodeURIComponent( _snup.location.pathname ); var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(sn, s); _snup.engaged += _snup.engage; if ( _snup.engaged >= _snup.max_engage ) { window.clearInterval( _snup.pinger ); } }, _snup.engage * 1000 );