gpt4 book ai didi

javascript - 不支持E4x后转换greasemonkey脚本

转载 作者:行者123 更新时间:2023-11-28 02:06:50 25 4
gpt4 key购买 nike

如何转换使用已弃用的 E4X 的脚本?

Flickr Functional Suite .

我不是程序员,但如果你向我解释我需要从哪里开始,我会尽力而为。

首先,这似乎不是CDATA的问题...

这是 Buggzilla 中的链接,我在其中描述了我的问题: Firefox 17 breaks a Greasemonkey script that relies on E4X (New : Firefox 21 delete totally its support)

我在这里获得了使用 E4x 的第一个索引(在代码“ricCB”中搜索):

requestImageComments: function( id ) {
if (!id) return;
var tkey = 'getComments';
// Set up ticket status queue if needed
if (!this.ticketStatus[tkey]) this.ticketStatus[tkey] = new Object();
return this.flickrApi
( { method: 'flickr.photos.comments.getList', photo_id: id },
'ricCB', {ticktype: tkey} );
},
ricCB: function(rsp) {
var hash = this.objects.comments;
for each (comments in rsp.comments) {
// for (var cs = 0; cs < rsp.comments.length; cs++) {
// var comments = rsp.comments[cs];
var pid = comments.@photo_id;
for each (com in comments.comment) {
var uname = com.@authorname;
var nsid = com.@author;
this.setTranslation( { uname: uname, nsid: nsid } );
// var create = new Date( com.@datecreate );
var ctxt = com + '';
// Strip out HTML tags:
ctxt = ctxt.replace(/(\<|\&lt\;).+?(\>|\&gt\;)/g,'');
// Collapse all whitespace runs to single spaces:
ctxt = ctxt.replace(/[\s\n\r\t]+/g, ' ');
// Store data under both authorname and photo ID (hash
// will collide only if someone is using a pure
// integer as a name AND a photo has same integer).
var info = { txt: ctxt, uname: uname, photo: pid };
if (!hash[uname]) hash[uname] = new Array();
if (!hash[pid]) hash[pid] = new Array();
hash[uname].push(info);
hash[pid].push(info);
}
}

最初发布在这里: My Greasemonkey script stopped working after something updated

最佳答案

如果存在对 e4x 的依赖,请尝试包含 JavaScript 实现:

作为替代方案,以下是涉及将 e4x 语法映射到 XPath 或将 XML 映射到 JSON 的其他问题:

此外,您可以通过yql访问数据来继续使用e4x:

引用文献

关于javascript - 不支持E4x后转换greasemonkey脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17651655/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com