-
-
-
-
-
-
MYMOVIESONE
-
-
TROVASTREAMING
-
-

{titolo}
{descrizione}
{adv}
';
function TrackClicRicerca(dati) {
var Titolo = dati.getElementsByTagName('h3')[0].innerHTML;
var AdvOnOff = dati.getElementsByTagName('p')[1].innerHTML;
if (TimerAnalyticsRicerca != null) {
clearTimeout(TimerAnalyticsRicerca);
pageViewRicerca();
TimerAnalyticsRicerca = null;
}
if (AdvOnOff != '') {
AdvOnOff = 'sponsor';
} else {
AdvOnOff = 'organic';
}
if(typeof(gtag) != "undefined") {
//gtag('event', Titolo, { 'event_category': 'ricerca', 'event_label': AdvOnOff });
gtag('event', 'Ricerca', {
'eventCategory' : 'MYmovies.it',
'eventAction' : AdvOnOff + ' - ' + Titolo
});
console.log('********* ' + AdvOnOff + ' - ' + Titolo);
}else if(typeof _gaq != "undefined"){
_gaq.push(['_trackEvent', 'ricerca', Titolo, AdvOnOff]);
}else if(typeof ga != "undefined"){
ga('send', 'event', 'ricerca', Titolo, AdvOnOff, 0);
}
}
function parseTemplate(tmpl, data) {
var regexp;
for (placeholder in data) {
if(Array.isArray(data[placeholder])){
regexp = new RegExp('\\[' + placeholder + '\\]', 'g');
tmpl = tmpl.replace(regexp, data[placeholder].join(', '));
}else{
regexp = new RegExp('{' + placeholder + '}', 'g');
tmpl = tmpl.replace(regexp, data[placeholder]);
}
}
return tmpl;
}
function ricerca(valore) {
parolaDaCercare = valore.toLowerCase();
if(valore.trim().length > 1) {
if(!ricercaInCorso && parolaCercata != parolaDaCercare) {
ricercaInCorso = true;
document.getElementById('search-loader').innerHTML = 'Caricamento in corso...';
document.getElementById('search-loader').style.display = 'block';
document.getElementById('search-loader').parentNode.style.display = 'block';
parolaCercata = parolaDaCercare;
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("get", "https://www.mymovies.it/ricerca/ricerca.php?limit=true&q=" + encodeURIComponent(parolaCercata));
xmlHttp.onreadystatechange = function() {
if(xmlHttp.readyState == 4) {
ricercaInCorso = false;
ricerca(parolaDaCercare);
if(xmlHttp.status == 200) {
var risposta = JSON.parse(xmlHttp.responseText);
var tipo = '';
var risultati = document.getElementById('search-results');
risultati.innerHTML = '';
if(risposta.esito == 'SUCCESS' && parolaDaCercare.length > 0){
for(var i = 0; i ' + tipo.replace('_', ' ').toUpperCase() + '
');
//risultati.insertAdjacentHTML('beforeend', '
' + tipo.replace('_', ' ').toUpperCase() + '
');
//risultati.insertAdjacentHTML('beforeend', '
');
for(var j = 0; j Vai alla ricerca avanzata »');
}
}
if(risposta.risultati.tipi.length > 0) {
document.getElementById('search-loader').style.display = 'none';
document.getElementById('search-results').parentNode.style.display = 'block';
document.getElementById('search-results').style.display = 'block';
document.getElementsByClassName('search-container-default')[0].style.borderBottomLeftRadius = "0px";
document.getElementsByClassName('search-container-default')[0].style.borderBottomRightRadius = "0px";
}
if(risposta.extremis) {
parolaNonTrovata = risposta.ricerca;
}
} else {
document.getElementById('search-loader').innerHTML = risposta.descrizione;
if(risposta.esito == 'WARNING') {
parolaNonTrovata = risposta.ricerca;
}
document.getElementById('search-results').style.display = 'none';
document.getElementsByClassName('search-container-default')[0].style.borderBottomLeftRadius = null;
document.getElementsByClassName('search-container-default')[0].style.borderBottomRightRadius = null;
}
}
}
}
xmlHttp.send();
// START google pageview seacrh
if (TimerAnalyticsRicerca != null) { clearTimeout(TimerAnalyticsRicerca); }
TimerAnalyticsRicerca = setTimeout(function(){
pageViewRicerca();
TimerAnalyticsRicerca = null;
}, 2000);
// END google pageview seacrh
}
}else{
document.getElementById('search-loader').style.display = 'none';
var risultati = document.getElementById('search-results');
risultati.innerHTML = '';
document.getElementById('search-results').parentNode.style.display = 'none';
document.getElementsByClassName('search-container-default')[0].style.borderBottomLeftRadius = null;
document.getElementsByClassName('search-container-default')[0].style.borderBottomRightRadius = null;
}
}
function pageViewRicerca(){
if(typeof(gtag) != "undefined") {
gtag('config', 'UA-259522-1', {
'page_title' : 'Ricerca',
'page_path': '/ricerca/ricerca.php?limit=true&q=' + encodeURIComponent(parolaCercata)
});
}else if(typeof _gaq != "undefined"){
_gaq.push(["_set", "title", "Ricerca"]);
_gaq.push(['_trackPageview', '/ricerca/ricerca.php?limit=true&q=' + encodeURIComponent(parolaCercata)]);
_gaq.push(["_set", "title", document.title]);
}else if(typeof ga != "undefined"){
ga('send', 'pageview', {'page': '/ricerca/ricerca.php?limit=true&q=' + encodeURIComponent(parolaCercata), 'title': 'Ricerca'});
}
if(parolaNonTrovata != '') {
var xmlHttpAnalytics = new XMLHttpRequest();
xmlHttpAnalytics.open("get", "https://analytics.mymovies.tools/ricerca/ajax/aggiorna-no-risultati.php?q=" + encodeURIComponent(parolaNonTrovata));
xmlHttpAnalytics.send();
parolaNonTrovata = '';
}
}
function focusSearchInput(input) {
input.closest('.search-container').classList.add('search-active');
document.getElementById('search-results').parentNode.style.display = 'block';
if(document.getElementById('search-results').innerHTML.length > 0){
document.getElementsByClassName('search-container-default')[0].style.borderBottomLeftRadius = '0px';
document.getElementsByClassName('search-container-default')[0].style.borderBottomRightRadius = '0px';
}
}
function blurSearchInput(input) {
if(!focusSullaRicerca) {
input.closest('.search-container').classList.remove('search-active');
document.getElementById('search-results').parentNode.style.display = 'none';
document.getElementsByClassName('search-container-default')[0].style.borderBottomLeftRadius = null;
document.getElementsByClassName('search-container-default')[0].style.borderBottomRightRadius = null;
}
}
function keydownSearchInput(e) {
var elementoAttivo = document.getElementById('search-results').getElementsByClassName('active')[0];
var elementi = document.getElementById('search-results').getElementsByTagName('li');
if(elementi.length > 0) {
var trovato = false;
if(!elementoAttivo) {
trovato = true;
}
var numeroElementoAttivo = null;
for(var i = 0; i