Userscript Manager Detection

A Code Snippet for detecting if the script is being ran in an Userscript Manager.

สคริปต์นี้ไม่ควรถูกติดตั้งโดยตรง มันเป็นคลังสำหรับสคริปต์อื่น ๆ เพื่อบรรจุด้วยคำสั่งเมทา // @require https://updategreasyfork.deno.dev/scripts/453189/1106477/Userscript%20Manager%20Detection.js

ผู้เขียน
Taureon
เวอร์ชัน
1
สร้างเมื่อ
16-10-2022
อัปเดตเมื่อ
18-10-2022
Size
787 ไบต์
สัญญาอนุญาต
Unlicense

A Code Snippet for detecting if the script is being ran in an Userscript Manager. Made by Taureon.

How to use:

  • Add var isInUserscriptContext = typeof GM === 'object' || typeof GM_info === 'object'; to the beginning of your script.
  • Get isInUserscriptContext anytime when required.