Last active
September 15, 2017 01:13
-
-
Save tnraro/a74dad40c84febe59367 to your computer and use it in GitHub Desktop.
new ncc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
'use strict'; | |
let script = document.createElement('script'); | |
script.type = "text/javascript;version=1.7"; | |
script.src = "https://rawgit.com/tnRaro/a74dad40c84febe59367/raw/ncc.js"; | |
document.body.appendChild(script); | |
script.onload = function(e){ | |
api.overwriteCss(); | |
setInterval(()=>{ | |
let height = boardContainer.scrollHeight - boardContainer.offsetHeight; | |
if(boardContainer.scrollTop == height) | |
api.clear(); | |
}, 10000); | |
} | |
}).call(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
const api = (function(){ | |
'use strict'; | |
const preset = { | |
irc: "/tnRaro/45dc7187884129594cf03542145c765a/raw/ncc-irc-theme.css", | |
grid: "/tnRaro/45dc7187884129594cf03542145c765a/raw/ncc-grid-theme.css", | |
"little-picture": "/tnRaro/45dc7187884129594cf03542145c765a/raw/ncc-little-picture.css" | |
}; | |
const clear = (num = 10) => { | |
let children = Array.from(document.getElementById('boardBody').children); | |
while(children.length > num){ | |
children.shift().remove(); | |
} | |
}; | |
const overwriteCss = () => { | |
let sheet = document.createElement('style'); | |
sheet.type = "text/css"; | |
sheet.innerHTML = `.chat_type_inr{ | |
margin: 0; | |
} | |
.chat_room{ | |
padding-bottom: 20px; | |
} | |
.chat_msgs .bl_pcs .blm > span { | |
padding: 0px 9px; | |
} | |
.chat_msgs .say{ | |
padding-right: 60px; | |
} | |
.chat_ft { | |
height: 20px; | |
} | |
.txt_area { | |
margin: 0; | |
} | |
#msgInputArea { | |
height: 20px; | |
} | |
.chat_type .hitwp { | |
/*display: none;*/ | |
}`; | |
document.head.appendChild(sheet); | |
}; | |
const add = (id) => { | |
let theme = document.createElement("link"); | |
theme.type = "text/css"; | |
theme.rel = "stylesheet"; | |
theme.href = "https://rawgit.com" + (typeof preset[id] !== "undefined" ? preset[id] : id); | |
document.head.appendChild(theme); | |
}; | |
overwriteCss(); | |
return { | |
clear, | |
add: (ids) => { | |
for(let id of ids) | |
add(id); | |
}, | |
active: () => { | |
for(let id of Object.keys(preset)) | |
add(id); | |
} | |
} | |
}).call(this); | |
window.api = api; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment