forked from newthuhole/hole_thu_frontend
add kyoani highlight easter egg
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.easter-egg-dmm-disable {
|
||||
cursor: not-allowed;
|
||||
user-select: none !important;
|
||||
.easter-egg-kyoani {
|
||||
background-color: black;
|
||||
color: white;
|
||||
}
|
||||
@@ -32,7 +32,7 @@ export class HighlightedText extends PureComponent {
|
||||
rule==='pid' ? <a href={'##'+p} onClick={(e)=>{e.preventDefault(); this.props.show_pid(p);}}>{p}</a> :
|
||||
rule==='nickname' ? <span style={{backgroundColor: this.props.color_picker.get(p)}}>{p}</span> :
|
||||
rule==='search' ? <span className="search-query-highlight">{p}</span> :
|
||||
rule==='disable' ? <span className="easter-egg-dmm-disable">{p}</span> :
|
||||
rule==='easter_egg_kyoani' ? <span className="easter-egg-kyoani">{p}</span> :
|
||||
p
|
||||
}</span>
|
||||
);
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
export const PID_RE=/(^|[^\d])([1-9]\d{4,5})(?!\d|\u20e3|\ufe0e|\ufe0f)/g;
|
||||
export const NICKNAME_RE=/(^|[^A-Za-z])((?:(?:Angry|Baby|Crazy|Diligent|Excited|Fat|Greedy|Hungry|Interesting|Japanese|Kind|Little|Magic|Naïve|Old|Powerful|Quiet|Rich|Superman|THU|Undefined|Valuable|Wifeless|Xiangbuchulai|Young|Zombie)\s)?(?:Alice|Bob|Carol|Dave|Eve|Francis|Grace|Hans|Isabella|Jason|Kate|Louis|Margaret|Nathan|Olivia|Paul|Queen|Richard|Susan|Thomas|Uma|Vivian|Winnie|Xander|Yasmine|Zach)|You Win(?: \d+)?|洞主)(?![A-Za-z])/gi;
|
||||
export const URL_RE=/(^|[^.@a-zA-Z0-9_])((?:https?:\/\/)?(?:(?:[\w-]+\.)+[a-zA-Z]{2,3}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(?::\d{1,5})?(?:\/[\w~!@#$%^&*()\-_=+[\];,./?]*)?)(?![a-zA-Z0-9])/gi;
|
||||
export const EASTER_EGG_KYOANI_RE=/(京都动画|京阿尼|京アニ)/g;
|
||||
|
||||
export function split_text(txt,rules) {
|
||||
// rules: [['name',/regex/],...]
|
||||
// return: [['name','part'],[null,'part'],...]
|
||||
|
||||
if(window.config.easter_egg && txt.indexOf('浏览器咑閞')!==-1)
|
||||
return [['disable',txt]];
|
||||
if(window.config.easter_egg)
|
||||
rules=[...rules,['easter_egg_kyoani',EASTER_EGG_KYOANI_RE]];
|
||||
|
||||
txt=[[null,txt]];
|
||||
rules.forEach((rule)=>{
|
||||
|
||||
Reference in New Issue
Block a user