mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Major additions. Only updates if has changes
This commit is contained in:
304
static/css/view.css
Executable file
304
static/css/view.css
Executable file
@ -0,0 +1,304 @@
|
||||
/**
|
||||
* yue.css
|
||||
*
|
||||
* yue.css is designed for readable content.
|
||||
*
|
||||
* Copyright (c) 2013 - 2014 by Hsiaoming Yang.
|
||||
*/
|
||||
|
||||
.yue {
|
||||
font: 400 18px/1.62 "Georgia", "Xin Gothic", "Hiragino Sans GB", "Droid Sans Fallback", "Microsoft YaHei", sans-serif;
|
||||
color: #444443;
|
||||
}
|
||||
|
||||
.windows .yue {
|
||||
font-size: 16px;
|
||||
font-family: "Georgia", "SimSun", sans-serif;
|
||||
}
|
||||
|
||||
.yue ::-moz-selection {
|
||||
background-color: rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
.yue ::selection {
|
||||
background-color: rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
.yue h1,
|
||||
.yue h2,
|
||||
.yue h3,
|
||||
.yue h4,
|
||||
.yue h5,
|
||||
.yue h6 {
|
||||
font-family: "Georgia", "Xin Gothic", "Hiragino Sans GB", "Droid Sans Fallback", "Microsoft YaHei", "SimSun", sans-serif;
|
||||
color: #222223;
|
||||
}
|
||||
|
||||
.yue h1 {
|
||||
font-size: 1.8em;
|
||||
margin: 0.67em 0;
|
||||
}
|
||||
|
||||
.yue > h1 {
|
||||
margin-top: 0;
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
.yue h2 {
|
||||
font-size: 1.5em;
|
||||
margin: 0.83em 0;
|
||||
}
|
||||
|
||||
.yue h3 {
|
||||
font-size: 1.17em;
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
.yue h4,
|
||||
.yue h5,
|
||||
.yue h6 {
|
||||
font-size: 1em;
|
||||
margin: 1.6em 0 1em 0;
|
||||
}
|
||||
|
||||
.yue h6 {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.yue p {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1.46em;
|
||||
}
|
||||
|
||||
.yue a {
|
||||
color: #111;
|
||||
word-wrap: break-word;
|
||||
-moz-text-decoration-color: rgba(0, 0, 0, 0.4);
|
||||
text-decoration-color: rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
.yue a:hover {
|
||||
color: #555;
|
||||
-moz-text-decoration-color: rgba(0, 0, 0, 0.6);
|
||||
text-decoration-color: rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
|
||||
.yue h1 a,
|
||||
.yue h2 a,
|
||||
.yue h3 a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.yue strong,
|
||||
.yue b {
|
||||
font-weight: 700;
|
||||
color: #222223;
|
||||
}
|
||||
|
||||
.yue em,
|
||||
.yue i {
|
||||
font-style: italic;
|
||||
color: #222223;
|
||||
}
|
||||
|
||||
.yue img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
margin: 0.2em 0;
|
||||
}
|
||||
|
||||
.yue a img {
|
||||
/* Remove border on IE */
|
||||
border: none;
|
||||
}
|
||||
|
||||
.yue figure {
|
||||
position: relative;
|
||||
clear: both;
|
||||
outline: 0;
|
||||
margin: 10px 0 30px;
|
||||
padding: 0;
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
.yue figure img {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
margin: auto auto 4px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.yue figure figcaption {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
left: 0;
|
||||
margin-top: 10px;
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
color: #666665;
|
||||
}
|
||||
|
||||
.yue figure figcaption a {
|
||||
text-decoration: none;
|
||||
color: #666665;
|
||||
}
|
||||
|
||||
.yue hr {
|
||||
display: block;
|
||||
width: 14%;
|
||||
margin: 40px auto 34px;
|
||||
border: 0 none;
|
||||
border-top: 3px solid #dededc;
|
||||
}
|
||||
|
||||
.yue blockquote {
|
||||
margin: 0 0 1.64em 0;
|
||||
border-left: 3px solid #dadada;
|
||||
padding-left: 12px;
|
||||
color: #666664;
|
||||
}
|
||||
|
||||
.yue blockquote a {
|
||||
color: #666664;
|
||||
}
|
||||
|
||||
.yue ul,
|
||||
.yue ol {
|
||||
margin: 0 0 24px 6px;
|
||||
padding-left: 16px;
|
||||
}
|
||||
|
||||
.yue ul {
|
||||
list-style-type: square;
|
||||
}
|
||||
|
||||
.yue ol {
|
||||
list-style-type: decimal;
|
||||
}
|
||||
|
||||
.yue li {
|
||||
margin-bottom: 0.2em;
|
||||
}
|
||||
|
||||
.yue li ul,
|
||||
.yue li ol {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
margin-left: 14px;
|
||||
}
|
||||
|
||||
.yue li ul {
|
||||
list-style-type: disc;
|
||||
}
|
||||
|
||||
.yue li ul ul {
|
||||
list-style-type: circle;
|
||||
}
|
||||
|
||||
.yue li p {
|
||||
margin: 0.4em 0 0.6em;
|
||||
}
|
||||
|
||||
.yue .unstyled {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.yue code,
|
||||
.yue tt {
|
||||
color: #808080;
|
||||
font-size: 0.96em;
|
||||
background-color: #f9f9f7;
|
||||
padding: 1px 2px;
|
||||
border: 1px solid #dadada;
|
||||
border-radius: 3px;
|
||||
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.yue pre {
|
||||
margin: 1.64em 0;
|
||||
padding: 7px;
|
||||
border: none;
|
||||
border-left: 3px solid #dadada;
|
||||
padding-left: 10px;
|
||||
overflow: auto;
|
||||
line-height: 1.5;
|
||||
font-size: 0.96em;
|
||||
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
|
||||
color: #4c4c4c;
|
||||
background-color: #f9f9f7;
|
||||
}
|
||||
|
||||
.yue pre code,
|
||||
.yue pre tt {
|
||||
color: #4c4c4c;
|
||||
border: none;
|
||||
background: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.yue table {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
margin-bottom: 1.5em;
|
||||
font-size: 0.96em;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.yue th,
|
||||
.yue td {
|
||||
text-align: left;
|
||||
padding: 4px 8px 4px 10px;
|
||||
border: 1px solid #dadada;
|
||||
}
|
||||
|
||||
.yue td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.yue tr:nth-child(even) {
|
||||
background-color: #efefee;
|
||||
}
|
||||
|
||||
.yue iframe {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.yue figure iframe {
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.yue table pre {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: none;
|
||||
background: none;
|
||||
}
|
||||
|
||||
@media (min-width: 1100px) {
|
||||
.yue blockquote {
|
||||
margin-left: -24px;
|
||||
padding-left: 20px;
|
||||
border-width: 4px;
|
||||
}
|
||||
|
||||
.yue blockquote blockquote {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0.4em 1em 6em;
|
||||
background: #fff;
|
||||
}
|
||||
.yue {
|
||||
max-width: 650px;
|
||||
margin: 0 auto;
|
||||
}
|
60
static/js/cowyo.js
Executable file
60
static/js/cowyo.js
Executable file
@ -0,0 +1,60 @@
|
||||
$(document).ready(function() {
|
||||
var isTyping = false;
|
||||
var typingTimer; //timer identifier
|
||||
var updateInterval;
|
||||
var doneTypingInterval = 1000; //time in ms, 5 second for example
|
||||
|
||||
//on keyup, start the countdown
|
||||
$('#emit').keyup(function() {
|
||||
clearTimeout(typingTimer);
|
||||
clearInterval(updateInterval);
|
||||
typingTimer = setTimeout(doneTyping, doneTypingInterval);
|
||||
});
|
||||
|
||||
//on keydown, clear the countdown
|
||||
$('#emit').keydown(function() {
|
||||
clearTimeout(typingTimer);
|
||||
clearInterval(updateInterval);
|
||||
document.title = "[UNSAVED] " + title_name;
|
||||
});
|
||||
|
||||
//user is "finished typing," do something
|
||||
function doneTyping() {
|
||||
payload = JSON.stringify({ TextData: $('#emit_data').val(), Title: title_name, UpdateServer: true, UpdateClient: false })
|
||||
send(payload)
|
||||
console.log("Done typing")
|
||||
updateInterval = setInterval(updateText, doneTypingInterval);
|
||||
document.title = "[SAVED] " + title_name;
|
||||
}
|
||||
|
||||
function updateText() {
|
||||
console.log("Getting server's latest copy")
|
||||
payload = JSON.stringify({ TextData: $('#emit_data').val(), Title: title_name, UpdateServer: false, UpdateClient: true })
|
||||
send(payload)
|
||||
}
|
||||
|
||||
// websockets
|
||||
url = 'ws://'+external_ip+'/ws';
|
||||
c = new WebSocket(url);
|
||||
|
||||
send = function(data){
|
||||
console.log("Sending: " + data)
|
||||
c.send(data)
|
||||
}
|
||||
|
||||
c.onmessage = function(msg){
|
||||
console.log(msg)
|
||||
data = JSON.parse(msg.data);
|
||||
if (data.UpdateClient == true) {
|
||||
console.log("Updating...")
|
||||
$('#emit_data').val(data.TextData)
|
||||
document.title = "[LOADED] " + title_name;
|
||||
}
|
||||
console.log(data)
|
||||
}
|
||||
|
||||
c.onopen = function(){
|
||||
updateText();
|
||||
updateInterval = setInterval(updateText, doneTypingInterval);
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user