forked from NYANDEV/forgejo
* Cleaning up public/ and documenting js/css libs. This commit mostly addresses #1484 by moving vendor'ed plugins into a vendor/ directory and documenting their upstream source and license in vendor/librejs.html. This also proves gitea is using only open source js/css libraries which helps toward reaching #1524. * Removing unused css file. The version of this file in use is located at: vendor/plugins/highlight/github.css * Cleaned up librejs.html and added javascript header A SafeJS function was added to templates/helper.go to allow keeping comments inside of javascript. A javascript comment was added in the header of templates/base/head.tmpl to mark all non-inline source as free. The librejs.html file was updated to meet the current librejs spec. I have now verified that the librejs plugin detects most of the scripts included in gitea and suspect the non-free detections are the result of a bug in the plugin. I believe this commit is enough to meet the C0.0 requirement of #1534. * Updating SafeJS function per lint suggestion * Added VERSIONS file, per request
This commit is contained in:
parent
64b7068846
commit
a915a09e4f
1339 changed files with 813 additions and 126 deletions
160
public/vendor/plugins/codemirror/mode/mirc/index.html
vendored
Normal file
160
public/vendor/plugins/codemirror/mode/mirc/index.html
vendored
Normal file
|
@ -0,0 +1,160 @@
|
|||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: mIRC mode</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel=stylesheet href="../../doc/docs.css">
|
||||
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<link rel="stylesheet" href="../../theme/twilight.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="mirc.js"></script>
|
||||
<style>.CodeMirror {border: 1px solid black;}</style>
|
||||
<div id=nav>
|
||||
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
|
||||
|
||||
<ul>
|
||||
<li><a href="../../index.html">Home</a>
|
||||
<li><a href="../../doc/manual.html">Manual</a>
|
||||
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="../index.html">Language modes</a>
|
||||
<li><a class=active href="#">mIRC</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<h2>mIRC mode</h2>
|
||||
<form><textarea id="code" name="code">
|
||||
;AKA Nick Tracker by Ford_Lawnmower irc.GeekShed.net #Script-Help
|
||||
;*****************************************************************************;
|
||||
;**Start Setup
|
||||
;Change JoinDisplay, below, for On Join AKA Display. On = 1 - Off = 0
|
||||
alias -l JoinDisplay { return 1 }
|
||||
;Change MaxNicks, below, to the number of nicknames you want to store for each hostmask. I wouldn't go over 400 with this ;/
|
||||
alias -l MaxNicks { return 20 }
|
||||
;Change AKALogo, below, To the text you want displayed before each AKA result.
|
||||
alias -l AKALogo { return 06 05A06K07A 06 }
|
||||
;**End Setup
|
||||
;*****************************************************************************;
|
||||
On *:Join:#: {
|
||||
if ($nick == $me) { .timer 1 1 ialupdateCheck $chan }
|
||||
NickNamesAdd $nick $+($network,$wildsite)
|
||||
if ($JoinDisplay) { .timerNickNames $+ $nick 1 2 NickNames.display $nick $chan $network $wildsite }
|
||||
}
|
||||
on *:Nick: { NickNamesAdd $newnick $+($network,$wildsite) $nick }
|
||||
alias -l NickNames.display {
|
||||
if ($gettok($hget(NickNames,$+($3,$4)),0,126) > 1) {
|
||||
echo -g $2 $AKALogo $+(09,$1) $AKALogo 07 $mid($replace($hget(NickNames,$+($3,$4)),$chr(126),$chr(44)),2,-1)
|
||||
}
|
||||
}
|
||||
alias -l NickNamesAdd {
|
||||
if ($hget(NickNames,$2)) {
|
||||
if (!$regex($hget(NickNames,$2),/~\Q $+ $replacecs($1,\E,\E\\E\Q) $+ \E~/i)) {
|
||||
if ($gettok($hget(NickNames,$2),0,126) <= $MaxNicks) {
|
||||
hadd NickNames $2 $+($hget(NickNames,$2),$1,~)
|
||||
}
|
||||
else {
|
||||
hadd NickNames $2 $+($mid($hget(NickNames,$2),$pos($hget(NickNames,$2),~,2)),$1,~)
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
hadd -m NickNames $2 $+(~,$1,~,$iif($3,$+($3,~)))
|
||||
}
|
||||
}
|
||||
alias -l Fix.All.MindUser {
|
||||
var %Fix.Count = $hfind(NickNames,/[^~]+[0-9]{4}~/,0,r).data
|
||||
while (%Fix.Count) {
|
||||
if ($Fix.MindUser($hget(NickNames,$hfind(NickNames,/[^~]+[0-9]{4}~/,%Fix.Count,r).data))) {
|
||||
echo -ag Record %Fix.Count - $v1 - Was Cleaned
|
||||
hadd NickNames $hfind(NickNames,/[^~]+[0-9]{4}~/,%Fix.Count,r).data $v1
|
||||
}
|
||||
dec %Fix.Count
|
||||
}
|
||||
}
|
||||
alias -l Fix.MindUser { return $regsubex($1,/[^~]+[0-9]{4}~/g,$null) }
|
||||
menu nicklist,query {
|
||||
-
|
||||
.AKA
|
||||
..Check $$1: {
|
||||
if ($gettok($hget(NickNames,$+($network,$address($1,2))),0,126) > 1) {
|
||||
NickNames.display $1 $active $network $address($1,2)
|
||||
}
|
||||
else { echo -ag $AKALogo $+(09,$1) 07has not been known by any other nicknames while I have been watching. }
|
||||
}
|
||||
..Cleanup $$1:hadd NickNames $+($network,$address($1,2)) $fix.minduser($hget(NickNames,$+($network,$address($1,2))))
|
||||
..Clear $$1:hadd NickNames $+($network,$address($1,2)) $+(~,$1,~)
|
||||
..AKA Search Dialog:dialog $iif($dialog(AKA_Search),-v,-m) AKA_Search AKA_Search
|
||||
-
|
||||
}
|
||||
menu status,channel {
|
||||
-
|
||||
.AKA
|
||||
..AKA Search Dialog:dialog $iif($dialog(AKA_Search),-v,-m) AKA_Search AKA_Search
|
||||
..Clean All Records:Fix.All.Minduser
|
||||
-
|
||||
}
|
||||
dialog AKA_Search {
|
||||
title "AKA Search Engine"
|
||||
size -1 -1 206 221
|
||||
option dbu
|
||||
edit "", 1, 8 5 149 10, autohs
|
||||
button "Search", 2, 163 4 32 12
|
||||
radio "Search HostMask", 4, 61 22 55 10
|
||||
radio "Search Nicknames", 5, 123 22 56 10
|
||||
list 6, 8 38 190 169, sort extsel vsbar
|
||||
button "Check Selected", 7, 67 206 40 12
|
||||
button "Close", 8, 160 206 38 12, cancel
|
||||
box "Search Type", 3, 11 17 183 18
|
||||
button "Copy to Clipboard", 9, 111 206 46 12
|
||||
}
|
||||
On *:Dialog:Aka_Search:init:*: { did -c $dname 5 }
|
||||
On *:Dialog:Aka_Search:Sclick:2,7,9: {
|
||||
if ($did == 2) && ($did($dname,1)) {
|
||||
did -r $dname 6
|
||||
var %search $+(*,$v1,*), %type $iif($did($dname,5).state,data,item), %matches = $hfind(NickNames,%search,0,w). [ $+ [ %type ] ]
|
||||
while (%matches) {
|
||||
did -a $dname 6 $hfind(NickNames,%search,%matches,w). [ $+ [ %type ] ]
|
||||
dec %matches
|
||||
}
|
||||
did -c $dname 6 1
|
||||
}
|
||||
elseif ($did == 7) && ($did($dname,6).seltext) { echo -ga $AKALogo 07 $mid($replace($hget(NickNames,$v1),$chr(126),$chr(44)),2,-1) }
|
||||
elseif ($did == 9) && ($did($dname,6).seltext) { clipboard $mid($v1,$pos($v1,*,1)) }
|
||||
}
|
||||
On *:Start:{
|
||||
if (!$hget(NickNames)) { hmake NickNames 10 }
|
||||
if ($isfile(NickNames.hsh)) { hload NickNames NickNames.hsh }
|
||||
}
|
||||
On *:Exit: { if ($hget(NickNames)) { hsave NickNames NickNames.hsh } }
|
||||
On *:Disconnect: { if ($hget(NickNames)) { hsave NickNames NickNames.hsh } }
|
||||
On *:Unload: { hfree NickNames }
|
||||
alias -l ialupdateCheck {
|
||||
inc -z $+(%,ialupdateCheck,$network) $calc($nick($1,0) / 4)
|
||||
;If your ial is already being updated on join .who $1 out.
|
||||
;If you are using /names to update ial you will still need this line.
|
||||
.who $1
|
||||
}
|
||||
Raw 352:*: {
|
||||
if ($($+(%,ialupdateCheck,$network),2)) haltdef
|
||||
NickNamesAdd $6 $+($network,$address($6,2))
|
||||
}
|
||||
Raw 315:*: {
|
||||
if ($($+(%,ialupdateCheck,$network),2)) haltdef
|
||||
}
|
||||
|
||||
</textarea></form>
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
theme: "twilight",
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
indentUnit: 4,
|
||||
mode: "text/mirc"
|
||||
});
|
||||
</script>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>text/mirc</code>.</p>
|
||||
|
||||
</article>
|
193
public/vendor/plugins/codemirror/mode/mirc/mirc.js
vendored
Normal file
193
public/vendor/plugins/codemirror/mode/mirc/mirc.js
vendored
Normal file
|
@ -0,0 +1,193 @@
|
|||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
//mIRC mode by Ford_Lawnmower :: Based on Velocity mode by Steve O'Hara
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
CodeMirror.defineMIME("text/mirc", "mirc");
|
||||
CodeMirror.defineMode("mirc", function() {
|
||||
function parseWords(str) {
|
||||
var obj = {}, words = str.split(" ");
|
||||
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
||||
return obj;
|
||||
}
|
||||
var specials = parseWords("$! $$ $& $? $+ $abook $abs $active $activecid " +
|
||||
"$activewid $address $addtok $agent $agentname $agentstat $agentver " +
|
||||
"$alias $and $anick $ansi2mirc $aop $appactive $appstate $asc $asctime " +
|
||||
"$asin $atan $avoice $away $awaymsg $awaytime $banmask $base $bfind " +
|
||||
"$binoff $biton $bnick $bvar $bytes $calc $cb $cd $ceil $chan $chanmodes " +
|
||||
"$chantypes $chat $chr $cid $clevel $click $cmdbox $cmdline $cnick $color " +
|
||||
"$com $comcall $comchan $comerr $compact $compress $comval $cos $count " +
|
||||
"$cr $crc $creq $crlf $ctime $ctimer $ctrlenter $date $day $daylight " +
|
||||
"$dbuh $dbuw $dccignore $dccport $dde $ddename $debug $decode $decompress " +
|
||||
"$deltok $devent $dialog $did $didreg $didtok $didwm $disk $dlevel $dll " +
|
||||
"$dllcall $dname $dns $duration $ebeeps $editbox $emailaddr $encode $error " +
|
||||
"$eval $event $exist $feof $ferr $fgetc $file $filename $filtered $finddir " +
|
||||
"$finddirn $findfile $findfilen $findtok $fline $floor $fopen $fread $fserve " +
|
||||
"$fulladdress $fulldate $fullname $fullscreen $get $getdir $getdot $gettok $gmt " +
|
||||
"$group $halted $hash $height $hfind $hget $highlight $hnick $hotline " +
|
||||
"$hotlinepos $ial $ialchan $ibl $idle $iel $ifmatch $ignore $iif $iil " +
|
||||
"$inelipse $ini $inmidi $inpaste $inpoly $input $inrect $inroundrect " +
|
||||
"$insong $instok $int $inwave $ip $isalias $isbit $isdde $isdir $isfile " +
|
||||
"$isid $islower $istok $isupper $keychar $keyrpt $keyval $knick $lactive " +
|
||||
"$lactivecid $lactivewid $left $len $level $lf $line $lines $link $lock " +
|
||||
"$lock $locked $log $logstamp $logstampfmt $longfn $longip $lower $ltimer " +
|
||||
"$maddress $mask $matchkey $matchtok $md5 $me $menu $menubar $menucontext " +
|
||||
"$menutype $mid $middir $mircdir $mircexe $mircini $mklogfn $mnick $mode " +
|
||||
"$modefirst $modelast $modespl $mouse $msfile $network $newnick $nick $nofile " +
|
||||
"$nopath $noqt $not $notags $notify $null $numeric $numok $oline $onpoly " +
|
||||
"$opnick $or $ord $os $passivedcc $pic $play $pnick $port $portable $portfree " +
|
||||
"$pos $prefix $prop $protect $puttok $qt $query $rand $r $rawmsg $read $readomo " +
|
||||
"$readn $regex $regml $regsub $regsubex $remove $remtok $replace $replacex " +
|
||||
"$reptok $result $rgb $right $round $scid $scon $script $scriptdir $scriptline " +
|
||||
"$sdir $send $server $serverip $sfile $sha1 $shortfn $show $signal $sin " +
|
||||
"$site $sline $snick $snicks $snotify $sock $sockbr $sockerr $sockname " +
|
||||
"$sorttok $sound $sqrt $ssl $sreq $sslready $status $strip $str $stripped " +
|
||||
"$syle $submenu $switchbar $tan $target $ticks $time $timer $timestamp " +
|
||||
"$timestampfmt $timezone $tip $titlebar $toolbar $treebar $trust $ulevel " +
|
||||
"$ulist $upper $uptime $url $usermode $v1 $v2 $var $vcmd $vcmdstat $vcmdver " +
|
||||
"$version $vnick $vol $wid $width $wildsite $wildtok $window $wrap $xor");
|
||||
var keywords = parseWords("abook ajinvite alias aline ame amsg anick aop auser autojoin avoice " +
|
||||
"away background ban bcopy beep bread break breplace bset btrunc bunset bwrite " +
|
||||
"channel clear clearall cline clipboard close cnick color comclose comopen " +
|
||||
"comreg continue copy creq ctcpreply ctcps dcc dccserver dde ddeserver " +
|
||||
"debug dec describe dialog did didtok disable disconnect dlevel dline dll " +
|
||||
"dns dqwindow drawcopy drawdot drawfill drawline drawpic drawrect drawreplace " +
|
||||
"drawrot drawsave drawscroll drawtext ebeeps echo editbox emailaddr enable " +
|
||||
"events exit fclose filter findtext finger firewall flash flist flood flush " +
|
||||
"flushini font fopen fseek fsend fserve fullname fwrite ghide gload gmove " +
|
||||
"gopts goto gplay gpoint gqreq groups gshow gsize gstop gtalk gunload hadd " +
|
||||
"halt haltdef hdec hdel help hfree hinc hload hmake hop hsave ial ialclear " +
|
||||
"ialmark identd if ignore iline inc invite iuser join kick linesep links list " +
|
||||
"load loadbuf localinfo log mdi me menubar mkdir mnick mode msg nick noop notice " +
|
||||
"notify omsg onotice part partall pdcc perform play playctrl pop protect pvoice " +
|
||||
"qme qmsg query queryn quit raw reload remini remote remove rename renwin " +
|
||||
"reseterror resetidle return rlevel rline rmdir run ruser save savebuf saveini " +
|
||||
"say scid scon server set showmirc signam sline sockaccept sockclose socklist " +
|
||||
"socklisten sockmark sockopen sockpause sockread sockrename sockudp sockwrite " +
|
||||
"sound speak splay sreq strip switchbar timer timestamp titlebar tnick tokenize " +
|
||||
"toolbar topic tray treebar ulist unload unset unsetall updatenl url uwho " +
|
||||
"var vcadd vcmd vcrem vol while whois window winhelp write writeint if isalnum " +
|
||||
"isalpha isaop isavoice isban ischan ishop isignore isin isincs isletter islower " +
|
||||
"isnotify isnum ison isop isprotect isreg isupper isvoice iswm iswmcs " +
|
||||
"elseif else goto menu nicklist status title icon size option text edit " +
|
||||
"button check radio box scroll list combo link tab item");
|
||||
var functions = parseWords("if elseif else and not or eq ne in ni for foreach while switch");
|
||||
var isOperatorChar = /[+\-*&%=<>!?^\/\|]/;
|
||||
function chain(stream, state, f) {
|
||||
state.tokenize = f;
|
||||
return f(stream, state);
|
||||
}
|
||||
function tokenBase(stream, state) {
|
||||
var beforeParams = state.beforeParams;
|
||||
state.beforeParams = false;
|
||||
var ch = stream.next();
|
||||
if (/[\[\]{}\(\),\.]/.test(ch)) {
|
||||
if (ch == "(" && beforeParams) state.inParams = true;
|
||||
else if (ch == ")") state.inParams = false;
|
||||
return null;
|
||||
}
|
||||
else if (/\d/.test(ch)) {
|
||||
stream.eatWhile(/[\w\.]/);
|
||||
return "number";
|
||||
}
|
||||
else if (ch == "\\") {
|
||||
stream.eat("\\");
|
||||
stream.eat(/./);
|
||||
return "number";
|
||||
}
|
||||
else if (ch == "/" && stream.eat("*")) {
|
||||
return chain(stream, state, tokenComment);
|
||||
}
|
||||
else if (ch == ";" && stream.match(/ *\( *\(/)) {
|
||||
return chain(stream, state, tokenUnparsed);
|
||||
}
|
||||
else if (ch == ";" && !state.inParams) {
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
else if (ch == '"') {
|
||||
stream.eat(/"/);
|
||||
return "keyword";
|
||||
}
|
||||
else if (ch == "$") {
|
||||
stream.eatWhile(/[$_a-z0-9A-Z\.:]/);
|
||||
if (specials && specials.propertyIsEnumerable(stream.current().toLowerCase())) {
|
||||
return "keyword";
|
||||
}
|
||||
else {
|
||||
state.beforeParams = true;
|
||||
return "builtin";
|
||||
}
|
||||
}
|
||||
else if (ch == "%") {
|
||||
stream.eatWhile(/[^,^\s^\(^\)]/);
|
||||
state.beforeParams = true;
|
||||
return "string";
|
||||
}
|
||||
else if (isOperatorChar.test(ch)) {
|
||||
stream.eatWhile(isOperatorChar);
|
||||
return "operator";
|
||||
}
|
||||
else {
|
||||
stream.eatWhile(/[\w\$_{}]/);
|
||||
var word = stream.current().toLowerCase();
|
||||
if (keywords && keywords.propertyIsEnumerable(word))
|
||||
return "keyword";
|
||||
if (functions && functions.propertyIsEnumerable(word)) {
|
||||
state.beforeParams = true;
|
||||
return "keyword";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
function tokenComment(stream, state) {
|
||||
var maybeEnd = false, ch;
|
||||
while (ch = stream.next()) {
|
||||
if (ch == "/" && maybeEnd) {
|
||||
state.tokenize = tokenBase;
|
||||
break;
|
||||
}
|
||||
maybeEnd = (ch == "*");
|
||||
}
|
||||
return "comment";
|
||||
}
|
||||
function tokenUnparsed(stream, state) {
|
||||
var maybeEnd = 0, ch;
|
||||
while (ch = stream.next()) {
|
||||
if (ch == ";" && maybeEnd == 2) {
|
||||
state.tokenize = tokenBase;
|
||||
break;
|
||||
}
|
||||
if (ch == ")")
|
||||
maybeEnd++;
|
||||
else if (ch != " ")
|
||||
maybeEnd = 0;
|
||||
}
|
||||
return "meta";
|
||||
}
|
||||
return {
|
||||
startState: function() {
|
||||
return {
|
||||
tokenize: tokenBase,
|
||||
beforeParams: false,
|
||||
inParams: false
|
||||
};
|
||||
},
|
||||
token: function(stream, state) {
|
||||
if (stream.eatSpace()) return null;
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue