Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Facebook用户脚本事件_Javascript_Facebook_Userscripts - Fatal编程技术网

Javascript Facebook用户脚本事件

Javascript Facebook用户脚本事件,javascript,facebook,userscripts,Javascript,Facebook,Userscripts,此脚本仅在我移动鼠标时有效。如何安排it始终保持激活状态 // ==UserScript== // @name Corrige Script // @namespace www.Thyago.com/corrigebug // @version 0.1 // @description Corrigir o bug que não permitia marcar codigos // @include https://*.facebook.com/* // @inc

此脚本仅在我移动鼠标时有效。如何安排it始终保持激活状态

// ==UserScript==
// @name       Corrige Script
// @namespace  www.Thyago.com/corrigebug
// @version    0.1
// @description  Corrigir o bug que não permitia marcar codigos
// @include     https://*.facebook.com/*
// @include     https://facebook.com/*
// @include     http://*.facebook.com/*
// @include     http://facebook.com/*
// @author      Thyago RIbeiro (www.fb.com/thyagosr)
// ==/UserScript==

function att(){
var c = document.getElementsByName('xhpc_message_text')[0];
document.getElementsByName('xhpc_message')[0].value = c.value;
console.log(document.getElementsByName('xhpc_message')[0].value);
}

function att2(){
document.getElementsByName('message')[0].value = document.getElementsByName('message_text')[0].value;
}

function corrige(){
if(document.getElementsByName("xhpc_message_text")[0]!== undefined){
     var varDivTexto = document.getElementsByName("xhpc_message_text")[0];
     varDivTexto.addEventListener("keypress",att, false);

var c = document.getElementsByName('xhpc_message_text')[0];
document.getElementsByName('xhpc_message')[0].value = c.value;
}

if(document.getElementsByName('message')[0] !== undefined){
     var varDivTexto = document.getElementsByName('message')[0];
     varDivTexto.addEventListener("keypress",att2, false);
document.getElementsByName('message')[0].value = document.getElementsByName('message_text')[0].value;
}

}

document.addEventListener ("mousemove", corrige, true);
[编辑]固定代码

您的问题不清楚,我也不知道您到底想要什么,请尝试:

//document.addEventListener ("mousemove", corrige, true); --line commented out that only works with the event "timeout"

function autoCorrige(){
  //call the function "correct" - chama a função "corrige"
  corrige();

  //Waiting 1 second to run the code again - 1 segundo de espera para executar novamente o código
  setTimeout(autoCorrige,1000);
}

autoCorrige();//starts the automatic event - inicia o evento automático
[关于如何提出好问题的提示]

如何使用SO stackoverflow:

首先,要有一个清晰易懂的问题,你应该阅读:

当您将comet作为特定用户的目标时,请使用@USERNAME

pt br/pt:Como usar o SO堆栈溢出:

初级教育包括初级教育和初级教育 莱尔:

我们的目标是彗星,我们的目标是地球 特别使用o@NOMEDOUSUARIO


我不会说任何葡萄牙语,但我认为你的代码中说document.addeventlistenermousemove,corrie,true的部分;需要进行更改,使其不只是在mousemove上执行。此脚本的作用是什么?保持活跃是什么意思?你想发生什么?你希望它什么时候发生?你说的始终保持激活是什么意思?此脚本获取的facebook代码不再有效,我希望他在@Include页面时始终处于打开状态。你的问题不够清楚,请尝试设置超时。。。pt:sua questãnãoéclara o suficiente,tente:setTimeout…我忘记了密码,我编辑了我的答案,现在试试。谢谢布朗我爱你,完美工作:D