1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-25 07:50:23 +01:00
This commit is contained in:
8chan 2015-03-15 05:03:35 -07:00
commit b087c3db34
5 changed files with 81 additions and 4 deletions

View File

@ -116,6 +116,7 @@
$config['additional_javascript'][] = 'js/auto-reload.js';
$config['additional_javascript'][] = 'js/options/user-css.js';
$config['additional_javascript'][] = 'js/options/user-js.js';
$config['additional_javascript'][] = 'js/options/fav.js';
$config['additional_javascript'][] = 'js/forced-anon.js';
$config['additional_javascript'][] = 'js/toggle-locked-threads.js';
$config['additional_javascript'][] = 'js/toggle-images.js';
@ -152,7 +153,7 @@
$config['additional_javascript'][] = 'js/wPaint/plugins/file/wPaint.menu.main.file.min.js';
$config['additional_javascript'][] = 'js/wpaint.js';
// Code tags (fix because we no longer have different scripts for each board)
$config['additional_javascript'][] = 'js/code_tags/run_prettify.js';
//$config['additional_javascript'][] = 'js/code_tags/run_prettify.js';
//$config['font_awesome_css'] = '/netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css';

View File

@ -38,7 +38,7 @@ $(document).ready(function(){
localStorage.auto_thread_update = 'true'; //default value
}
if (window.Options && Options.get_tab('general')) {
Options.extend_tab("general", "<fieldset><legend>"+_("Auto update")+"</legend>"
Options.extend_tab("general", "<fieldset id='auto-update-fs'><legend>"+_("Auto update")+"</legend>"
+ ('<label id="auto-thread-update"><input type="checkbox">' + _('Auto update thread') + '</label>')
+ ('<label id="auto_thread_desktop_notifications"><input type="checkbox">' + _('Show desktop notifications when users quote me') + '</label>')
+ ('<label id="auto_thread_desktop_notifications_all"><input type="checkbox">' + _('Show desktop notifications on all replies') + '</label>')

View File

@ -1,7 +1,7 @@
$('document').ready(function () {
var autoScroll = localStorage['autoScroll'] ? true : false;
if (window.Options && Options.get_tab('general')){
Options.extend_tab('general','<label id=\'autoScroll\'><input type=\'checkbox\' />' + ' Scroll to new posts' + '</label>');
$('#auto-update-fs').append('<label id=\'autoScroll\'><input type=\'checkbox\' />' + _('Scroll to new posts') + '</label>');
$('#autoScroll').find('input').prop('checked', autoScroll);
}
$('#autoScroll').on('change', function() {
@ -15,7 +15,7 @@ $('document').ready(function () {
$('input.auto-scroll').prop('checked', autoScroll);
});
if (active_page == 'thread') {
$('span[id="updater"]').children('a').after(' (<input class="auto-scroll" type="checkbox"></input> Scroll to New posts)');
$('span[id="updater"]').children('a').after(' (<input class="auto-scroll" type="checkbox"></input> '+_('Scroll to new posts')+')');
$('input.auto-scroll').prop('checked', autoScroll);
$(document).on('new_post', function (e, post) {
if ($('input.auto-scroll').prop('checked'))

72
js/options/fav.js Normal file
View File

@ -0,0 +1,72 @@
$(document).ready(function(){
//Creating functions
var generateList = function(){
var favStor = [];
for(var i=1; i<favorites.length+1; i++){
favStor.push($("#sortable > div:nth-child("+i+")").html());
}
return favStor;
} //This will generate a list of boards based off of the list on the screen
function removeBoard(boardNumber){
favorites.splice(boardNumber, 1);
localStorage.favorites = JSON.stringify(favorites);
$("#sortable > div:nth-child("+(boardNumber+1)+")").remove();
$("#minusList > div:nth-child("+(favorites.length+1)+")").remove();
add_favorites();
} //This removes a board from favorites, localStorage.favorites and the page
function addBoard(){
$("#sortable").append("<div>"+($("#plusBox").val())+"</div>");
$("#minusList").append( $('<div data-board="'+favorites.length+'" style="cursor: pointer; margin-right: 5px">-</div>').on('click', function(e){removeBoard($(this).data('board'));}) );
favorites.push($("#plusBox").val());
localStorage.favorites = JSON.stringify(favorites);
$("#plusBox").val(""); //Removing text from textbox
add_favorites();
} //This adds the text inside the textbox to favorites, localStorage.favorites and the page
var favorites = JSON.parse(localStorage.favorites);
Options.add_tab('fav-tab','star',_("Favorites"));
//Pregenerating list of boards
var favList = $('<div id="sortable" style="cursor: pointer; display: inline-block">');
for(var i=0; i<favorites.length; i++){
favList.append( $('<div>'+favorites[i]+'</div>') );
}
//Creating list of minus symbols to remove unwanted boards
var minusList = $('<div id="minusList" style="color: #0000FF; display: inline-block">');
for(var i=0; i<favorites.length; i++){
minusList.append( $('<div data-board="'+i+'" style="cursor: pointer; margin-right: 5px">-</div>').on('click', function(e){removeBoard($(this).data('board'));}) );
}
//Help message so people understand how sorting boards works
$("<span>"+_("Drag the boards to sort them.")+"</span><br><br>").appendTo(Options.get_tab('fav-tab').content);
//Adding list of boards and minus symbols to remove boards with
$(minusList).appendTo(Options.get_tab('fav-tab').content); //Adding the list of minus symbols to the tab
$(favList).appendTo(Options.get_tab('fav-tab').content); //Adding the list of favorite boards to the tab
//Adding spacing and text box to right boards into
var addDiv = $("<div id='favs-add-board'>");
var plusBox = $("<input id=\"plusBox\" type=\"text\">").appendTo(addDiv);
plusBox.keydown(function( event ) {
if(event.keyCode == 13){
$("#plus").click();
}
});
//Adding plus symbol to use to add board
$("<div id=\"plus\">+</div>").css({
cursor: "pointer",
color: "#0000FF"
}).on('click', function(e){addBoard()}).appendTo(addDiv);
addDiv.appendTo(Options.get_tab('fav-tab').content); //Adding the plus button
favList.sortable(); //Making boards with sortable id use the sortable jquery function
favList.on('sortstop', function() {
favorites = generateList();
localStorage.favorites = JSON.stringify(favorites);
add_favorites();
});
});

View File

@ -1177,3 +1177,7 @@ div.mix {
display: none !important;
}
}
#youtube-size input {
width: 50px;
}