MediaWiki:Gadget-GrAnnotations.js: Difference between revisions
No edit summary |
No edit summary |
||
| Line 442: | Line 442: | ||
var pageDisplay = pageTitle.replace( /_/g, ' ' ); | var pageDisplay = pageTitle.replace( /_/g, ' ' ); | ||
var subject = '[Grantha] New comment on "' + pageDisplay + '"'; | var subject = '[Grantha] New comment on "' + pageDisplay + '"'; | ||
var body = 'A new comment has been posted on ' + pageDisplay + '. | var body = 'A new comment has been posted on ' + pageDisplay + '.\n\n' | ||
+ 'Posted by : ' + ( currentUser || 'Anonymous' ) + '\n' | |||
' | + 'Time : ' + ts + '\n' | ||
+ 'Posted by : ' + ( currentUser || 'Anonymous' ) + ' | + 'Passage : "' + quote + '"\n\n' | ||
' | + 'Comment :\n' + commentText + '\n\n' | ||
+ 'Time : ' + ts + ' | + '\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n' | ||
' | + 'Jump to passage:\n' + anchorLink + '\n\n' | ||
+ 'Passage : "' + quote + '" | + 'View all comments:\n' | ||
' | |||
+ 'Comment : | |||
' + commentText + ' | |||
' | |||
+ ' | |||
' | |||
+ 'Jump to passage: | |||
' + anchorLink + ' | |||
' | |||
+ 'View all comments: | |||
' | |||
+ window.location.origin | + window.location.origin | ||
+ ( mw.config.get('wgArticlePath') || '/wiki/$1' ) | + ( mw.config.get('wgArticlePath') || '/wiki/$1' ) | ||
.replace( '$1', 'Talk:' + pageTitle + '/GrComments' ) | .replace( '$1', 'Talk:' + pageTitle + '/GrComments' ) | ||
+ ' | + '\n'; | ||
'; | |||
new mw.Api().post({ | new mw.Api().post({ | ||
| Line 481: | Line 466: | ||
if ( !currentUser ) return; | if ( !currentUser ) return; | ||
var adminTalk = 'User_talk:' + ADMIN_USER; | var adminTalk = 'User_talk:' + ADMIN_USER; | ||
var wikimsg = '== New comment on [[' + pageDisplay + ']] == | var wikimsg = '== New comment on [[' + pageDisplay + ']] ==\n' | ||
' | + '; By: ' + ( currentUser || 'Anonymous' ) + '\n' | ||
+ '; By: ' + ( currentUser || 'Anonymous' ) + ' | + '; Passage: //' + quote + '//\n' | ||
' | + '; Link: ' + anchorLink + '\n\n' | ||
+ '; Passage: //' + quote + '// | |||
' | |||
+ '; Link: ' + anchorLink + ' | |||
' | |||
+ commentText.slice(0,500) | + commentText.slice(0,500) | ||
+ ( commentText.length > 500 ? ' | + ( commentText.length > 500 ? '\n…' : '' ) | ||
+ '\n\n[[User:Chandrashekars|Chandrashekars]] ([[User talk:Chandrashekars|talk]]) 17:47, 25 April 2026 (UTC)'; | |||
+ ' | |||
[[User:Chandrashekars|Chandrashekars]] ([[User talk:Chandrashekars|talk]]) 17: | |||
new mw.Api().postWithEditToken({ | new mw.Api().postWithEditToken({ | ||
action:'edit', title:adminTalk, section:'new', | action:'edit', title:adminTalk, section:'new', | ||