跳转到内容

MediaWiki讨论:Gadget-AdvancedSiteNotices.js

页面内容不支持其他语言。
添加话题
维基百科,自由的百科全书
AnYiLin在话题“编辑请求 2025-04-12”中的最新留言:20小时前

Gadget throwing JS errors on the mobile site

[编辑]

This gadget is throwing errors on mobile site e.g. https://zh.m.wikipedia.org/wiki/%E7%AC%AC%E4%BA%8C%E6%AC%A1%E4%B8%96%E7%95%8C%E5%A4%A7%E6%88%98:

Uncaught SyntaxError: Unexpected token )
    at testCriteria (<anonymous>:235:177)
    at matchCriteria (<anonymous>:235:195)
    at loadNotices (<anonymous>:235:451)
    at Object.success (<anonymous>:236:699)
    at fire (load.php?lang=zh-hk&modules=jquery&skin=minerva&version=0hmxo20:45)
    at Object.fireWith [as resolveWith] (load.php?lang=zh-hk&modules=jquery&skin=minerva&version=0hmxo20:47)
    at done (load.php?lang=zh-hk&modules=jquery&skin=minerva&version=0hmxo20:126)
    at XMLHttpRequest.<anonymous> (load.php?lang=zh-hk&modules=jquery&skin=minerva&version=0hmxo20:130)

Jdlrobson留言2019年8月7日 (三) 17:26 (UTC)回复

Fixed in Special:Diff/55559839. --Xiplus#Talk 2019年8月8日 (四) 00:14 (UTC)回复

在上方的消息“跑马灯”

[编辑]

以前在上面的消息“跑马灯”只要按 [关闭] 之后,在维基百科的页面之间就不会再出现了(直到下次),但现在按下 [关闭] 却只有单次有效,转到其他页面仍然出现?是强迫收看吗?--Tp0910留言2020年10月3日 (六) 20:46 (UTC)回复

too much recursion

[编辑]

This error is thrown on https://zh.wikipedia.org/wiki/%E5%A4%A7%E9%B1%BC%E6%B5%B7%E6%A3%A0 Anoymized stack trace:

at html/< URL1:222:664
at access URL1:193:243
at html URL1:222:504
at loadNotices/< URL2:4:168
at jQuery.speed/opt.complete URL1:242:22
at fire URL1:186:191
at fireWith URL1:187:402
at tick URL1:239:241
at jQuery.fx.tick URL1:244:750
at schedule URL1:234:991

Jon (WMF)留言2020年10月20日 (二) 21:09 (UTC)回复

编辑请求 2021-08-18

[编辑]

请求已处理。--安忆Talk 2021年8月18日 (三) 02:59 (UTC)回复

第71行jQuery.trim改成String.prototype.trim,控制台一堆deprecate警告-- Sunny00217  2021年8月18日 (三) 02:52 (UTC)回复

The gadget is not in real time when using with numbers

[编辑]

Hello, in ckb:Template:AdvancedSiteNotices, we used if expression with two deletion categories (for admins only). It is obvious that category members increase and decrease. The problem here is that the AdvancedSiteNotices does not update at all and is not real time. I just investigated the problem a little bit and went to the ckb:Template:AdvancedSiteNotices/ajax. I cleaned it's cache up and it updated in the AdvancedSiteNotices, but I wasn't sure if it was updated only for me or for other administrators and it will updated for all admins. Can you fix this problem?--Aram留言2023年1月10日 (二) 19:29 (UTC)回复

编辑请求 2025-01-26

[编辑]

请求已处理

  1. 优化外观及移动版布局,关闭操作使用真按钮;
  2. 去屎山代码。

部署方法:

  1. 小工具定义加上AdvancedSiteNotices.css
  2. https://zh.wikipedia.beta.wmflabs.org/wiki/MediaWiki:Gadget-AdvancedSiteNotices.css => MediaWiki:Gadget-AdvancedSiteNotices.css
  3. https://zh.wikipedia.beta.wmflabs.org/wiki/MediaWiki:Gadget-AdvancedSiteNotices.js => MediaWiki:Gadget-AdvancedSiteNotices.js

以上。--碟之舞📀💿 2025年1月26日 (日) 08:59 (UTC)回复

完成--百無一用是書生 () 2025年1月27日 (一) 11:00 (UTC)回复

编辑请求 2025-03-21

[编辑]

请求已处理。--安忆Talk 2025年3月24日 (一) 06:32 (UTC)回复

初步解决phab:T384827,修改内容:

  1. https://zh.wikipedia.beta.wmflabs.org/wiki/MediaWiki:Gadget-AdvancedSiteNotices.js => MediaWiki:Gadget-AdvancedSiteNotices.js
  2. https://zh.wikipedia.beta.wmflabs.org/wiki/MediaWiki:Gadget-AdvancedSiteNotices.css => MediaWiki:Gadget-AdvancedSiteNotices.css

附知@SunAfterRain。--碟之舞📀💿 2025年3月21日 (五) 14:10 (UTC)回复

这个工单大体是什么内容?我这边无权查看。--安忆Talk 2025年3月22日 (六) 08:11 (UTC)回复
I reviewed the email. I believe that if we operate on zhwiki with a clear usage method, established expressions, controllable pages, and trusted administrators, using eval() for execution does not present a security risk. While eval() can raise security concerns in uncontrolled environments where arbitrary expressions may be executed, this is not the case under the conditions mentioned. Like "Setting aside the facts, is there really no problem with XXX?", is unreasonable and disregards these facts.--安忆Talk 2025年3月24日 (一) 05:52 (UTC)回复
@AnYiLin:见Telegram私信。--碟之舞📀💿 2025年3月24日 (一) 06:07 (UTC)回复
Given the assumption that "administrators are not entirely trustworthy," I agree to adopt a more controllable parsing method.--安忆Talk 2025年3月24日 (一) 06:36 (UTC)回复

编辑请求 2025-04-12

[编辑]

请求已处理。--安忆Talk 2025年4月12日 (六) 07:12 (UTC)回复

新JS位于[1],CSS无变更。

变化:

  1. 确保先处理&&再处理||
  2. 加入文档中缺失的测试方法(主要为了兼容临时账号)。
  3. 修正Cookie有效时间为正确的30天而非1800天。
  4. 顶部加入警告消息要求其他wiki的导入者保护相关页面。

以上。--碟之舞📀💿 2025年4月12日 (六) 07:00 (UTC)回复

@Diskdance:其实我觉得Cookie时间那里直接用本地存储也可以。除非有新公告,用户选择不显示就一直保持不显示,不然关都关了某段时间之后又自己显示了感觉上有些奇怪。--安忆Talk 2025年4月12日 (六) 07:19 (UTC)回复
我也觉得是,但是考虑到先前的代码已经生成很多遗留Cookie了,所以当时就没改。--碟之舞📀💿 2025年4月12日 (六) 07:21 (UTC)回复
@DiskdanceAnYiLinParse error: Unexpected: ) on line 556 in MediaWiki:Gadget-AdvancedSiteNotices.js,在beta站和这里都出错。那个位置看似没有syntax错误但都还是fry了。--西 2025年4月15日 (二) 06:03 (UTC)回复
@LuciferianThomasAnYiLin因为555行的函数参数尾随逗号要ES2017才支援 囧rz……--RainBeforeSun留言2025年4月15日 (二) 10:43 (UTC)回复
是的,很抱歉一时大意没有在Beta站检查出这个问题 囧rz……--碟之舞📀💿 2025年4月15日 (二) 10:47 (UTC)回复
e04,对耶,那个是函数内的尾随逗号 囧rz……印象中尾随逗号本来就是一回事,但我自己没在函数内用过尾随逗号,难怪我不知道这回事(--西 2025年4月15日 (二) 11:03 (UTC)回复
看到了邮件,改掉了。我的建议是推广Prettier的使用,我本地看了下它会把那个逗号格式化掉。--安忆Talk 2025年4月15日 (二) 17:06 (UTC)回复
看到了个ESLint的规则,能指定可用的最高ES版本的语法,https://eslint-community.github.io/eslint-plugin-es-x/--安忆Talk 2025年4月15日 (二) 17:29 (UTC)回复