Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
MajsoulPlusMods
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
森野さくら
MajsoulPlusMods
Commits
bd5a69fc
Commit
bd5a69fc
authored
Jun 08, 2021
by
Tachibana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
0
parent
dbacb2b6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
0 deletions
+95
-0
extension/partytime/extension.json
extension/partytime/extension.json
+9
-0
extension/partytime/preview.png
extension/partytime/preview.png
+0
-0
extension/partytime/script.js
extension/partytime/script.js
+86
-0
No files found.
extension/partytime/extension.json
0 → 100644
View file @
bd5a69fc
{
"id"
:
"partytime"
,
"version"
:
"0.9.0"
,
"name"
:
"Ctrl+C复制观战链接"
,
"author"
:
"Nyagger Squad"
,
"description"
:
"迷迭迷迭福姬桑,tetoki(手被打断)
\n
(对方如要通过链接观战,也需要启用此插件)"
,
"preview"
:
"preview.png"
,
"entry"
:
"script.js"
}
extension/partytime/preview.png
0 → 100644
View file @
bd5a69fc
55.9 KB
extension/partytime/script.js
0 → 100644
View file @
bd5a69fc
// ==UserScript==
// @name Party Time
// @namespace NyaggerSquad
// @icon https://i.imgur.com/CXj6fxh.png
// @version 0.9
// @description Everyone's invited. Press Ctrl+C during a match to get a link to the game. Anyone with the script can use that url to spectate.
// @author anon
// @include https://mahjongsoul.game.yo-star.com/
// @include https://game.mahjongsoul.com/
// @include https://game.maj-soul.com/1/
// ==/UserScript==
(
function
()
{
'
use strict
'
;
let
spec
=
localStorage
.
getItem
(
"
_pre_spec
"
);
document
.
addEventListener
(
'
keydown
'
,
e
=>
{
if
(
e
.
code
===
'
KeyC
'
&&
e
.
ctrlKey
){
let
uuid
=
GameMgr
.
Inst
.
mj_game_uuid
;
if
(
!
uuid
)
return
;
//window.location is https://localhost:8887/ on my mjs+ (which should actually work if mjs+ is running)
//GameMgr.Inst.link_url is https://mahjongsoul.game.yo-star.com/ for the US servers but should work for the others
//navigator.clipboard.writeText(window.location + "?spec="+uuid);
navigator
.
clipboard
.
writeText
(
GameMgr
.
Inst
.
link_url
+
"
?spec=
"
+
uuid
);
uiscript
.
UI_Popout
.
PopOutNoTitle
(
"
观战链接已复制。
"
,
null
);
}
});
function
spectateUUID
(
uuid
){
localStorage
.
removeItem
(
"
_pre_spec
"
);
uiscript
.
UI_Live_Broadcast
.
fetchInfo
(
uuid
,
Laya
.
Handler
.
create
(
uiscript
.
UI_Friend
.
Inst
,
function
(
e
)
{
e
.
success
&&
uiscript
.
UI_Friend
.
Inst
.
close
(
Laya
.
Handler
.
create
(
uiscript
.
UI_Friend
.
Inst
,
function
()
{
let
plist
=
e
.
data
.
live_head
.
players
;
uiscript
.
UI_Live_Broadcast
.
goToWatch
(
uuid
,
e
.
data
,
plist
[
Math
.
floor
(
Math
.
random
()
*
plist
.
length
)].
account_id
)
}))
},
null
,
!
1
))
}
function
read_otherpaipu
(){
let
link
=
uiscript
.
UI_PaiPu
.
Inst
.
pop_otherpaipu
.
input
.
text
.
split
(
'
?spec=
'
);
if
(
!
link
||
!
(
link
=
link
[
link
.
length
-
1
]))
return
;
spec
=
link
;
return
;
}
function
check_helper
(
u
){
return
u
&&
u
.
UI_Lobby
&&
u
.
UI_Lobby
.
Inst
&&
u
.
UI_Lobby
.
Inst
.
pending_lobby_jump
;
}
var
LazyCheck
=
setInterval
(
function
(){
if
(
check_helper
(
uiscript
)){
uiscript
.
UI_Lobby
.
Inst
.
pending_lobby_jump
=
(
function
(){
var
cacheF
=
uiscript
.
UI_Lobby
.
Inst
.
pending_lobby_jump
;
return
function
(){
var
result
=
cacheF
.
apply
(
this
,
arguments
);
if
(
typeof
spec
!==
'
undefined
'
&&
spec
!==
null
){
spectateUUID
(
spec
);
}
return
result
;
};
})();
clearInterval
(
LazyCheck
);
}
},
2000
);
var
PaipuCheck
=
setInterval
(
function
(){
if
(
uiscript
&&
uiscript
.
UI_PaiPu
&&
uiscript
.
UI_PaiPu
.
Inst
&&
uiscript
.
UI_PaiPu
.
Inst
.
pop_otherpaipu
&&
uiscript
.
UI_PaiPu
.
Inst
.
pop_otherpaipu
){
uiscript
.
UI_PaiPu
.
Inst
.
pop_otherpaipu
.
hide
=
(
function
(){
var
cacheF
=
uiscript
.
UI_PaiPu
.
Inst
.
pop_otherpaipu
.
hide
;
return
function
(){
var
result
=
cacheF
.
apply
(
this
,
arguments
);
read_otherpaipu
();
if
(
typeof
spec
!==
'
undefined
'
&&
spec
!==
null
){
spectateUUID
(
spec
);
}
return
result
;
};
})();
clearInterval
(
PaipuCheck
);
}
},
4000
);
})();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment