This program server to appear a website and autoplay of some songs, the code has worked without problems in windows and android, and tested browsers IE, Firefox, Chrome and Opera. However, I've been trying to run it through a raspberry pi with Pipplware OS and with Chromium and Iceweasel browsers. So far I've never been able to get it to work. The following errors appear:
"Uncaught TypeError: Can not call method" playFlash "of undefined"
"Failed to load resource: the server responded with a status of 404 (not found)"
Will it be incompatible with browsers? I'm trying to modify the code to make it functional but I do not have much experience. Thanks, if anyone can help. Thank you. The code giving the error is below, at line 127. If any more editing is needed, I'll make it available.
$.fn.simulateClick = function() {
return this.each(function() {
if('createEvent' in document) {
var doc = this.ownerDocument,
evt = doc.createEvent('MouseEvents');
evt.initMouseEvent('click', true, true, doc.defaultView,
1, 0, 0, 0, 0, false, false, false, false, 0, null);
this.dispatchEvent(evt); // line 127
} else {
this.click(); // IE
}
});
}
To help you figure out what the problem is, I'll post the full index (already with the changes).
function centrar(caixa){
//Centra uma caixa
$(caixa).css("position","relative");
$(caixa).css("top", ($(window).height() - $(caixa).height()) / 2+$(window).scrollTop() + "px");
if($(caixa).position().top < 0){
$(caixa).css("top",5);
}
}
window.onload = function WindowLoad(event) {
$("#caixa_central").show();
centrar("#caixa_central");
//posicionar_caixa("#caixa_central");
}
//Posiciona a caixa ao fazer rezise
$(window).resize(function() {
centrar("#caixa_central");
//posicionar_caixa("#caixa_central");
});
function radio_janela(id_ambiente){
var dataString = 'id_ambiente=' + id_ambiente;
$.ajax({
type: "POST",
url: "radio.php",
data: dataString,
success: function(data){
$("#pesquisa_resultado").html(data);
}
});
}
/*------------------- Fun��o para pesquisar ------------- */
function pesquisar(){
$.ajax({
type: "POST",
url: "pesquisar.php",
success: function(data){
$("#pesquisa_resultado").html("");
$("#pesquisa_resultado").html(data);
centrar("#caixa_central");
//posicionar_caixa("#caixa_central");
}
});
}
<?php
if(empty($_GET["ambiente"])){
echo "pesquisar();";
} else {
echo "radio_janela(".$_GET["ambiente"].");";
}
?>
var simulateClick = function(controle) {
if (controle) {
if (control.click !== undefined)
controle.click();
else {
if('createEvent' in document) {
var doc = this.ownerDocument,
evt = doc.createEvent('MouseEvents');
evt.initMouseEvent('click', true, true, doc.defaultView,1,0,0,0,0, false, false, false, false, 0, null);
this.dispatchEvent(evt);
} else {
this.click(); // IE
}
}
}
else alert("Controle não localizado!");
}
window.setInterval(function(){
$('.edithost').simulateClick();
}, 1000);
simulate.Click update
$ (document) .ready (function () {
simulateClick (document.getElementById ("environment_id")); simulateClick ($ (".btn btn green") [0]) $ ("button btn green"). each (function () {simulateClick (this)}) var simulateClick = function (control) { if (control) { if (control.click! == undefined) control.click (); else { if ('createEvent' in document) { var doc = this.ownerDocument, evt = doc.createEvent ('MouseEvents'); evt.initMouseEvent ('click', true, true, doc.defaultView, 1,0,0,0,0, false, false, false, false, 0, null); this.dispatchEvent (evt); } else { this.click (); // IE } } } else alert ("Control not found!"); }
window.setInterval(function(){
simulateClick($(".edithost")[0]);
}, 1000);
});