Commit 43a136d2 authored by Evert Prants's avatar Evert Prants

Consistency / some clean-up

parent 6c6aa85b
{
"name": "teemantirc",
"version": "2.0.1",
"version": "2.0.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......
{
"name": "teemantirc",
"version": "2.0.1",
"version": "2.0.2",
"description": "A Web-based IRC client",
"main": "index.js",
"scripts": {
......
......@@ -4,17 +4,16 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>TeemantIRC</title>
<script src="//twemoji.maxcdn.com/2/twemoji.min.js?11.2"></script>
<script src="//twemoji.maxcdn.com/v/latest/twemoji.min.js" crossorigin="anonymous"></script>
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="style/layout.css">
<link rel="stylesheet" type="text/css" href="style/theme_default.css" id="theme_stylesheet">
</head>
<!-- Codepony Diamond -->
<body>
<section class="ircclient">
<div class="coverwindow" id="authdialog">
<div class="wrapper">
<h1 class="grade1">Teemant</h1>
<h1 class="grade1" title="Teemant"><img src="/image/diamond.svg" alt="Teemant"/></h1>
<i class="grade3" id="connmsg">Think of a nickname</i>
<form action="" id="IRCConnector">
<label for="nickname">Nickname</label>
......
This diff is collapsed.
This diff is collapsed.
const imgs = ['.png', '.jpg', '.jpeg', '.svg']
const embeds = [
{
match: /youtu.?be\//is,
exec: function (pgurl) {
let dat = pgurl.match(/(?:be|com)\/([^?&#]+)/i)
if (!dat) {
dat = pgurl.match('[\\?&]v=([^&#]*)')
}
if (!dat) return null
return 'https://www.youtube.com/embed/' + dat[1] + '?autoplay=1'
}
}
]
export function handleUrlElement (elem) {
let cover = null
let ext = elem.href.split('.')
ext = ext[ext.length - 1]
if (ext && imgs.indexOf(ext) !== -1) {
cover = document.createElement('img')
cover.src = elem.href
}
if (!cover) {
for (let a in embeds) {
if (cover) break
let fn = embeds[a]
if (elem.href.match(fn.match)) {
let r = fn.exec(elem.href)
if (r) {
cover = document.createElement('iframe')
cover.src = r
}
}
}
}
if (cover) {
cover.className = 'preview'
let contelem = document.createElement('span')
contelem.className = 'preview-box'
let contbutton = document.createElement('button')
contbutton.className = 'preview-btn'
contbutton.innerHTML = 'Show Preview'
elem.parentNode.appendChild(contelem)
contelem.appendChild(elem)
contelem.appendChild(contbutton)
contbutton.addEventListener('click', function (e) {
e.preventDefault()
if (cover.parentNode) {
cover.remove()
contbutton.innerHTML = 'Show Preview'
} else {
contelem.appendChild(cover)
contbutton.innerHTML = 'Hide Preview'
}
}, false)
return contelem
}
return elem
}
......@@ -37,7 +37,7 @@ window.themes = module.exports = {
}
},
change_theme: function (name) {
changeTheme: function (name) {
if (name in window.themes.available) {
swapSheet(window.themes.available[name].stylesheet)
window.irc.config.theme = name
......
......@@ -19,6 +19,14 @@ body
margin-top: 0
display: block
text-align: center
position: relative
img
max-width: 64px
top: -50px;
position: absolute
left: 0
right: 0
margin: auto
.grade2
margin-bottom: 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment