1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2025-01-31 12:23:48 +01:00

Merge /root/8chan

This commit is contained in:
8chan 2014-09-27 20:06:27 +00:00
commit 4c3f48c021
9 changed files with 796 additions and 354 deletions

View File

@ -113,7 +113,7 @@ class Api {
$apiPost['ext'] = substr($file->file, $dotPos);
$dotPos = strrpos($file->file, '.');
$apiPost['tim'] = substr($file->file, 0, $dotPos);
//$apiPost['md5'] = base64_encode(md5_file($file->file_path, true));
$apiPost['md5'] = base64_encode(hex2bin($post->filehash));
}
return $apiPost;

View File

@ -1136,6 +1136,8 @@
// This is a particularly advanced feature - contact ctrlcctrlv or rails unless you
// really know what you're doing
$config['dir']['img_root'] = '';
// DO NOT COMMENT OUT, LEAVE BLANK AND OVERRIDE IN INSTANCE CONFIG
// Though, you shouldnt be editing this file, so what do I know?
// For load balancing, having a seperate server (and domain/subdomain) for serving static content is

View File

@ -120,6 +120,7 @@
$config['additional_javascript'][] = 'js/toggle-locked-threads.js';
$config['additional_javascript'][] = 'js/toggle-images.js';
$config['additional_javascript'][] = 'js/mobile-style.js';
$config['additional_javascript'][] = 'js/id_highlighter.js'
$config['font_awesome_css'] = '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css';

View File

@ -15,13 +15,8 @@
function catalog() {
var board = $("input[name='board']");
if (board.length>0) {
if (window.location.pathname.indexOf("/res/")>0){ //if we are inside a thread
var catalog_url = '../catalog.html';
}
else {
var catalog_url = 'catalog.html';
}
var catalog_url = configRoot + board.first().val() + "/catalog.html";
var pages = document.getElementsByClassName('pages')[0];
var bottom = document.getElementsByClassName('boardlist bottom')[0]
var subtitle = document.getElementsByClassName('subtitle')[0];
@ -57,7 +52,6 @@ if (subtitle) {
subtitle.appendChild(link2);
}
}
}
if (active_page == 'thread' || active_page == 'index') {
$(document).ready(catalog);

37
js/id_colors.js Normal file
View File

@ -0,0 +1,37 @@
if (active_page == 'thread' || active_page == 'index') {
$(document).ready(function(){
$.hash = function(str) {
var i, j, msg = 0;
for (i = 0, j = str.length; i < j; ++i) {
msg = ((msg << 5) - msg) + str.charCodeAt(i);
}
return msg;
};
function stringToRGB(str){
var rgb, hash;
rgb = [];
hash = $.hash(str);
rgb[0] = (hash >> 24) & 0xFF;
rgb[1] = (hash >> 16) & 0xFF;
rgb[2] = (hash >> 8) & 0xFF;
return rgb;
}
$(".poster_id").each(function(){
var rgb = stringToRGB($(this).text());
$(this).css({
"background-color": "rgb("+rgb[0]+", "+rgb[1]+", "+rgb[2]+")",
"padding": "3px 5px",
"border-radius": "8px",
"color": "white"
});
});
});
}

44
js/id_highlighter.js Normal file
View File

@ -0,0 +1,44 @@
if (active_page == 'thread' || active_page == 'index') {
$(document).ready(function(){
function arrayRemove(a, v) { a.splice(a.indexOf(v) == -1 ? a.length : a.indexOf(v), 1); }
var idshighlighted = [];
function getPostsById(id){
return $(".poster_id").filter(function(i){
return $(this).text() == id;
});
}
function getMasterPosts(parents){
if(!parents.hasClass("post")) return;
var toRet = [];
$(parents).each(function(){
if($(this).hasClass("post"))
toRet.push($(this));
});
return toRet;
}
$(".poster_id").click(function(){
var id = $(this).text();
if($.inArray(id, idshighlighted) !== -1){
arrayRemove(idshighlighted, id);
$(getMasterPosts(getPostsById(id).parents())).each(function(i){
$(this).removeClass("highlighted");
});
}else{
idshighlighted.push(id);
$(getMasterPosts(getPostsById(id).parents())).each(function(i){
$(this).addClass("highlighted");
});
}
});
});
}

View File

@ -21,7 +21,9 @@ function multi_image() {
var new_file = '<br class="file_separator"/><input type="file" name="file'+(images_len+1)+'" id="upload_file'+(images_len+1)+'">';
$('[type=file]:last').after(new_file);
$('form:not([id="quick-reply"]) [type=file]:last').after(new_file);
if ($("#quick-reply").length) {
$('form:not(#quick-reply) [type=file]:last').after(new_file);
}
if (typeof setup_form !== 'undefined') setup_form($('form[name="post"]'));
}
})

File diff suppressed because it is too large Load Diff

191
stylesheets/v8ch.css Normal file
View File

@ -0,0 +1,191 @@
@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro);
body{
background: #eee !important;
font-family: 'Source Sans Pro', Arial, Helvetica, sans-serif !important;
}
a{
text-decoration: none;
}
.boardlist{
width: 100% !important;
position: fixed !important;
z-index: 99999 !important;
top: 0 !important;
left: 0 !important;
color: #222 !important;
background: #fff !important;
padding: 1em !important;
box-sizing: border-box !important;
margin-top: 0 !important;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}
img.banner,
img.board_image{
border: none !important;
}
.board_image,
.board_image + header{
margin-top: 3.75em !important;
margin-bottom: 1em !important;
float: left !important;
}
.board_image + header{
margin-left: 1em !important;
}
header,
header h1,
header .subtitle{
text-align: left !important;
}
.board_image + header + .banner{
width: 100% !important;
float: left !important;
margin-top: 0 !important;
margin-left: 0 !important;
padding: 0.5em 0 !important;
background-color: #666 !important;
}
form[name=post]{
box-sizing: border-box !important;
position: fixed !important;
bottom: 0 !important;
right: 0 !important;
background: #fff !important;
margin-bottom: 0 !important;
padding: 1em !important;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3) !important;
}
form[name=post] input[type="text"],
form[name=post] textarea{
width: 100% !important;
padding: 0.5em !important;
box-sizing: border-box !important;
}
form table tr th{
color: #fff !important;
background: #222 !important;
}
#expand-all-images,
#shrink-all-images,
#treeview{
right: 1em !important;
position: absolute !important;
}
#expand-all-images{
margin-top: 4em !important;
}
#treeview{
margin-top: 5em !important;
}
#shrink-all-images{
margin-top: 6em !important;
}
#expand-all-images + hr,
#shrink-all-images + hr{
opacity: 0 !important;
margin: 0 !important;
}
#treeview + hr{
opacity: 0 !important;
clear: both !important;
}
#options_handler{
margin-top: 3em !important;
}
[id^=thread]{
background: #f8f8f8 !important;
margin-bottom: 1em !important;
padding: 1em 1em 0 1em !important;
border: none !important;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2) !important;
}
[id^=thread] hr{
display: none !important;
}
[id^=thread] div.post.reply {
margin: 0.5em 1em !important;
padding: 0.5em !important;
color: #222 !important;
background: #fff !important;
border: none !important;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}
[id^=thread] div.post.reply.highlighted {
background: #fec !important;
}
p.intro.thread-hidden{
padding-bottom: 1em !important;
}
#vechan-reply,
#update_thread{
float: right;
margin-right: 0.25em !important;
cursor: pointer !important;
}
#update_thread{
padding-left: 0 !important;
}
#update_secs{
color: #900 !important;
}
.theme-catalog header{
margin-top: 4em !important;
}
.theme-catalog div.threads{
text-align: left !important;
}
.theme-catalog div.thread{
color: #222 !important;
word-break: break-all !important;
background: #fff !important;
border: none !important;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}
.boardlist.bottom,
.sub[data-description='1'],
.sub[data-description='2'],
.sub[data-description='3'],
#quick-reply{
display: none !important;
}
#favorite-star{
text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) !important;
}
pre.prettyprint.prettyprinted{
display: block !important;
overflow-x: scroll !important;
}
/* If you want to make a redistributable style, be sure to have a Yotsuba B theme selected. */