Commit f69f6e76 authored by yPhil's avatar yPhil

merging

parents c0407195 0b827321
......@@ -15,11 +15,7 @@ app.engine('html', require('ejs').renderFile);
app.set('view engine', 'html');
app.use('/static', express.static(__dirname + '/public'));
app.use('/dist', express.static(__dirname + '/dist'));
app.use('/tmp', express.static(__dirname + '/tmp'));
app.use('/bower', express.static(__dirname + '/bower_components'));
app.use('/', index);
module.exports = app;
......@@ -1552,7 +1552,7 @@
},
"gkt": {
"version": "https://tgz.pm2.io/gkt-1.0.0.tgz",
"integrity": "sha1-QFUCsAfzGcP0cXXER0UnMA8qta0=",
"integrity": "sha512-zr6QQnzLt3Ja0t0XI8gws2kn7zV2p0l/D3kreNvS6hFZhVU5g+uY/30l42jbgt0XGcNBEmBDGJR71J692V92tA==",
"optional": true
},
"glob": {
......
......@@ -15,7 +15,7 @@
"start": "pm2 start -f bin/www --watch --log-date-format='YYYY-MM-DD HH:mm Z' --name PTL",
"stop": "pm2 stop PTL",
"build:pre": "uglifyjs public/js/PTL.main.js public/js/PTL.prefs.js public/js/PTL.i18n.js -m -o dist/js/PTL.pre.min.js",
"build:post": "uglifyjs public/js/PTL.utilities.js public/js/PTL.tab.js public/js/PTL.feed.js public/js/PTL.dialog.js public/js/PTL.sync.js public/js/PTL.menu.js -m -o dist/js/PTL.post.min.js",
"build:post": "uglifyjs public/js/PTL.util.js public/js/PTL.tab.js public/js/PTL.src.js public/js/PTL.dialog.js public/js/PTL.sync.js -m -o dist/js/PTL.post.min.js",
"build:js": "mkdir -p dist/js cache-favicons && npm run build:pre && npm run build:post",
"watch:js": "onchange 'public/js/*.js' -- npm run build:js",
"postinstall": "npm run build:js && bower install"
......@@ -28,9 +28,9 @@
"bower": "1.8.2",
"ejs": "2.5.7",
"express": "4.16.2",
"favicon": "0.0.2",
"feedparser": "2.2.9",
"feedrat": "latest",
"favicon": "0.0.2",
"pm2": "2.8.0"
},
"cacheDirName": "favicon-cache"
......
@font-face {
font-family: 'fontello';
src: url('../font/fontello.eot?81897662');
src: url('../font/fontello.eot?81897662#iefix') format('embedded-opentype'),
url('../font/fontello.woff2?81897662') format('woff2'),
url('../font/fontello.woff?81897662') format('woff'),
url('../font/fontello.ttf?81897662') format('truetype'),
url('../font/fontello.svg?81897662#fontello') format('svg');
src: url('../font/fontello.eot?83680137');
src: url('../font/fontello.eot?83680137#iefix') format('embedded-opentype'),
url('../font/fontello.woff2?83680137') format('woff2'),
url('../font/fontello.woff?83680137') format('woff'),
url('../font/fontello.ttf?83680137') format('truetype'),
url('../font/fontello.svg?83680137#fontello') format('svg');
font-weight: normal;
font-style: normal;
}
......@@ -15,7 +15,7 @@
@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
font-family: 'fontello';
src: url('../font/fontello.svg?81897662#fontello') format('svg');
src: url('../font/fontello.svg?83680137#fontello') format('svg');
}
}
*/
......@@ -71,10 +71,10 @@
.icon-down-1:before { content: '\e80d'; } /* '' */
.icon-down-big:before { content: '\e80e'; } /* '' */
.icon-cancel:before { content: '\e80f'; } /* '' */
.icon-rss-alt:before { content: '\e810'; } /* '' */
.icon-flashlight:before { content: '\e812'; } /* '' */
.icon-plus-1:before { content: '\e813'; } /* '' */
.icon-plus:before { content: '\e813'; } /* '' */
.icon-cog:before { content: '\e814'; } /* '' */
.icon-minus:before { content: '\e815'; } /* '' */
.icon-petrolette:before { content: '\e816'; } /* '' */
.icon-help-1:before { content: '\e817'; } /* '' */
.icon-menu:before { content: '\e819'; } /* '' */
......@@ -82,5 +82,5 @@
.icon-left-open:before { content: '\f007'; } /* '' */
.icon-export:before { content: '\f02e'; } /* '' */
.icon-uncheck:before { content: '\f096'; } /* '' */
.icon-rss-squared:before { content: '\f143'; } /* '' */
.icon-rss:before { content: '\f143'; } /* '' */
.icon-bomb:before { content: '\f1e2'; } /* '' */
\ No newline at end of file
This diff is collapsed.
No preview for this file type
......@@ -38,14 +38,14 @@
<glyph glyph-name="cancel" unicode="&#xe80f;" d="M0 90q0 36 26 62l195 195-195 196q-26 25-26 61t26 61 61 25 61-25l196-196 195 196q25 25 61 25t61-25 25-61-25-61l-195-196 195-195q25-26 25-62t-25-61q-25-25-61-25t-61 25l-195 195-196-195q-25-25-61-25t-61 25q-26 26-26 61z" horiz-adv-x="686.5" />
<glyph glyph-name="rss-alt" unicode="&#xe810;" d="M1000 761v-824q0-36-26-62t-62-26h-824q-36 0-62 26t-26 62v824q0 36 26 62t62 26h824q36 0 62-26t26-62z m-283-765h136q0 143-56 274t-150 226-226 150-274 56v-135q154 0 286-76t208-208 76-287z m-240 0h136q0 126-62 234t-170 170-234 62v-135q136 0 233-97 97-95 97-234z m-153 88q0 37-26 63t-63 26q-36 0-62-26t-26-63q0-36 26-62t62-26q37 0 63 26t26 62z" horiz-adv-x="1000" />
<glyph glyph-name="flashlight" unicode="&#xe812;" d="M807 706q62-62 85-130t-5-92l-134-134q-16-16-62-26t-96-4l-408-408q-18-18-57-6t-75 50q-36 36-49 74t5 56l408 408q-6 50 4 96t26 62l136 136q24 28 92 4t130-86z m-448-408q32-32 80 14 46 46 14 82-14 14-38 10t-44-24-23-43 11-39z m336 298q30-30 68-50t62-25 28-1q2 4-4 27t-26 60-50 67-66 50-59 26-27 2 1-28 25-62 48-66z" horiz-adv-x="902" />
<glyph glyph-name="plus-1" unicode="&#xe813;" d="M550 400q30 0 30-50t-30-50l-210 0 0-210q0-30-50-30t-50 30l0 210-210 0q-30 0-30 50t30 50l210 0 0 210q0 30 50 30t50-30l0-210 210 0z" horiz-adv-x="580" />
<glyph glyph-name="plus" unicode="&#xe813;" d="M550 400q30 0 30-50t-30-50l-210 0 0-210q0-30-50-30t-50 30l0 210-210 0q-30 0-30 50t30 50l210 0 0 210q0 30 50 30t50-30l0-210 210 0z" horiz-adv-x="580" />
<glyph glyph-name="cog" unicode="&#xe814;" d="M0 352q0 38 7 83 50-4 95 19t70 68q25 45 23 95t-30 91q64 56 150 86 23-41 64-66t90-24 89 24 64 66q85-30 150-86-21-39-21-85t23-86q24-41 65-64t87-23q11-49 11-98 0-32-7-74-45-1-84-25t-63-63q-25-44-23-92t26-89q-66-60-145-93-23 42-64 67t-90 25q-53 0-96-28t-64-74q-82 26-153 82 28 41 30 91t-23 95q-27 46-74 70t-98 17q-9 41-9 91z m293 0q0-73 51-124t125-51 124 51 51 124-51 124-124 52-125-52-51-124z" horiz-adv-x="937.5" />
<glyph glyph-name="minus" unicode="&#xe815;" d="M550 400q30 0 30-50t-30-50l-520 0q-30 0-30 50t30 50l520 0z" horiz-adv-x="580" />
<glyph glyph-name="petrolette" unicode="&#xe816;" d="M54 850c-18 0-36-10-46-27l0 0c-16-26-7-60 19-75l252-149 0-432c0-30 24-55 55-55 30 0 55 25 55 55l0 463c0 17-8 32-21 42-3 3-5 5-9 7l-276 163c-9 6-19 8-29 8z m892 0c-10 0-20-2-29-8l-276-163c-3-2-6-4-9-7-13-10-20-25-20-42l0-463c0-30 24-55 54-55 31 0 55 25 55 55l0 432 252 149c26 15 35 49 19 75l0 0c-10 17-28 27-46 27z m-446-48c-30 0-55-24-55-55l0-842c0-31 25-55 55-55 30 0 55 24 55 55l0 842c0 31-25 55-55 55z" horiz-adv-x="1000" />
<glyph glyph-name="help-1" unicode="&#xe817;" d="M286-40q0-24-16-40t-40-17q-24 0-40 17t-16 40 16 39 40 17 40-17 16-39z m-153 153q-41 48-41 103 0 61 41 95l187 186q33 32 33 79t-32 79-80 33-79-33-32-79l-112 0q0 93 66 159 64 62 158 62t158-64 64-157-64-158l-188-181q-8-9-8-21t8-19q21-19 40 0 8 8 8 19l112 0q0-55-41-103-41-41-98-41-59 0-100 41z" horiz-adv-x="482" />
......@@ -60,7 +60,7 @@
<glyph glyph-name="uncheck" unicode="&#xf096;" d="M625 707h-464q-37 0-63-26t-27-63v-464q0-37 27-63t63-27h464q37 0 63 27t26 63v464q0 37-26 63t-63 26z m161-89v-464q0-67-47-114t-114-47h-464q-67 0-114 47t-47 114v464q0 66 47 113t114 48h464q66 0 114-48t47-113z" horiz-adv-x="785.7" />
<glyph glyph-name="rss-squared" unicode="&#xf143;" d="M286 136q0 29-21 50t-51 21-50-21-21-50 21-51 50-21 51 21 21 51z m196-53q-8 130-99 222t-221 98q-8 1-14-5t-5-13v-71q0-7 5-12t12-6q86-6 147-68t67-147q1-7 6-12t12-5h72q7 0 13 6t5 13z m214 0q-3 86-31 166t-78 145-115 114-145 78-166 31q-7 1-13-5-5-5-5-13v-71q0-7 5-12t12-6q114-4 211-62t156-155 62-211q0-8 5-13t13-5h71q7 0 13 6 6 5 5 13z m161 535v-536q0-66-47-113t-114-48h-535q-67 0-114 48t-47 113v536q0 66 47 113t114 48h535q67 0 114-48t47-113z" horiz-adv-x="857.1" />
<glyph glyph-name="rss" unicode="&#xf143;" d="M286 136q0 29-21 50t-51 21-50-21-21-50 21-51 50-21 51 21 21 51z m196-53q-8 130-99 222t-221 98q-8 1-14-5t-5-13v-71q0-7 5-12t12-6q86-6 147-68t67-147q1-7 6-12t12-5h72q7 0 13 6t5 13z m214 0q-3 86-31 166t-78 145-115 114-145 78-166 31q-7 1-13-5-5-5-5-13v-71q0-7 5-12t12-6q114-4 211-62t156-155 62-211q0-8 5-13t13-5h71q7 0 13 6 6 5 5 13z m161 535v-536q0-66-47-113t-114-48h-535q-67 0-114 48t-47 113v536q0 66 47 113t114 48h535q67 0 114-48t47-113z" horiz-adv-x="857.1" />
<glyph glyph-name="bomb" unicode="&#xf1e2;" d="M319 521q-6 14-19 20t-28 0q-60-25-106-71t-71-107q-6-14 0-27t19-19q8-3 14-3 23 0 33 23 19 47 55 83t83 54q14 7 20 20t0 27z m525 199l26-26-136-135 38-38q10-11 10-26t-10-25l-36-36q50-90 50-191 0-80-31-153t-84-125-125-84-153-31-153 31-125 84-84 125-31 153 31 153 84 125 125 84 153 31q101 0 191-50l36 36q11 10 25 10t26-10l38-38z m5 31q-6-5-12-5-8 0-13 5l-51 51q-5 5-5 12t5 13q6 5 13 5t13-5l50-51q5-5 5-12t-5-13z m128-128q-6-5-13-5t-12 5l-51 51q-5 5-5 12t5 13q5 5 13 5t12-5l51-50q5-6 5-13t-5-13z m23 102q0-8-5-13t-13-5h-53q-8 0-13 5t-5 13 5 13 13 5h53q8 0 13-5t5-13z m-107 107v-53q0-8-5-13t-13-5-13 5-5 13v53q0 8 5 13t13 5 13-5 5-13z m84-30l-51-51q-5-5-12-5-7 0-13 5-5 5-5 13t5 12l51 51q5 5 12 5t13-5q5-5 5-13t-5-12z" horiz-adv-x="1000" />
</font>
......
No preview for this file type
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later
PTL.col = {
del: function($column) {
var $panel = $column.parent();
var nbOfColumnsInTab = $panel.find('.column').length;
console.log('nbOfColumnsInTab: (%s)', nbOfColumnsInTab);
$column.hide('fast', function() {
if (nbOfColumnsInTab <= 2) {
$panel.find('.col-del').addClass('ui-state-disabled');
}
$(this).remove();
PTL.tab.saveTabs();
});
},
add: function(colIndex, newCol) {
var $colButtons = $('<div>')
.attr('class', 'buttons flex-box');
var $colLegend = $('<legend>')
.attr('class', 'legend legend-col unique')
.text(PTL.tr('Column'));
var $srcLegend = $('<legend>')
.attr('class', 'legend unique')
.text(PTL.tr('Source'));
var $column = $('<ul>')
.attr('class', 'column')
.append($colButtons);
var $srcNewButton = $('<button>')
.attr('title', PTL.tr('Add a source to this column'))
.data('title', 'Add a source to this column')
.attr('class', 'icon-plus unique translate new-source-button button-column last')
.button()
.data('colIndex', colIndex);
var $colNewButton = $('<button>')
.attr('title', PTL.tr('Add a column'))
.data('title', 'Add a column')
.attr('class', 'icon-plus twin translate last')
.button()
.data('colIndex', colIndex);
var $colDelButton = $('<button>')
.attr('title', PTL.tr('Remove this column'))
.data('title', 'Remove this column')
.attr('class', 'col-del icon-minus twin')
.data('colIndex', colIndex)
.button();
$colDelButton.bind('click', function() {
var $column = $(this).parent().parent(),
$sourcesInCol = $column.find('.feed'),
nbOfSourcesInCol = $sourcesInCol.length;
if (nbOfSourcesInCol < 1) {
PTL.col.del($column);
} else {
PTL.dialog.killColumn($(this));
}
});
$colNewButton.bind('click', function() {
var $column = $(this).parent().parent(),
$panel = $column.parent(),
colIndex = $panel.find('.column').index($column);
var $newColumn = PTL.col.add(colIndex, true);
$panel.find('button.col-del').removeClass('ui-state-disabled');
$newColumn.insertAfter($column);
});
$column.sortable({
cursor: 'move',
handle: ".source-handle",
connectWith: ".column",
cursorAt: {top: 10, left: 32},
receive: function(e, ui) {
if (ui.helper)
ui.helper.first().removeAttr('style'); // undo styling set by jqueryUI
},
helper: function (e, item) { //create custom helper
if (!item.hasClass('selected')) item.addClass('selected');
// clone selected items before hiding
var $elements = $('.selected').not('.ui-sortable-placeholder').clone();
//hide selected items
item.siblings('.selected').addClass('hidden');
var $helper = $('<ul class="feedHelper">');
return $helper.append($elements);
},
start: function (e, ui) {
// Drag begins
var $elements = ui.item.siblings('.selected.hidden').not('.ui-sortable-placeholder');
// Store the selected items to item being dragged
ui.item.data('items', $elements);
// Size the placeHolder
$('.ui-sortable-placeholder').css('height', ui.item.height());
},
update: function (e, ui) {
//manually add the selected items before the one actually being dragged
ui.item.before(ui.item.data('items'));
},
stop: function (e, ui) {
//show the selected items after the operation
ui.item.siblings('.selected').removeClass('hidden');
//unselect since the operation is complete
$('.selected').removeClass('selected ui-state-hover');
$(this).find('i.source-select').removeClass('icon-ok').addClass('icon-check-empty-1');
PTL.tab.saveTabs();
}
}).disableSelection();
$colButtons.append($colLegend,
$colDelButton,
$colNewButton,
$srcLegend,
$srcNewButton);
return $column;
}
};
This diff is collapsed.
This diff is collapsed.
......@@ -4,12 +4,244 @@ var PTL = (function() {
return {
// language: Prefs.readConfig('lang'),
sourceTypes: ['text', 'mixed', 'photo'],
language: 'en',
start : function() {
var self = this;
PTL.util.console(PTL.tr('Pétrolette starting up OK'));
var $menu = $('nav#side-menu'),
$overlay = $('#overlay'),
$sourceCodeButton = $('button#sourceCode'),
$importButton = $("button#fileImport"),
$fileImportInput = $("input#fileImport"),
$saveButton = $('#saveTabs'),
$langMenu = $('select#language'),
$slider = $('div#gallerySpeedSlider'),
$spinner = $('#gallerySpeedSpinner');
$('noscript').hide();
$('.js-enabled-only').show();
$('#console').click(function() {
$(this).toggleClass('expanded');
});
PTL.sync.attachWidget();
$('button').button();
$('h3.rs-small-headline, h1.rs-big-headline').text(PTL.tr('Connection to storage'));
$('span.rs-sub-headline').text(PTL.tr('To synchronize the sources across devices'));
$('div.rs-sign-in-error').text(PTL.tr('To synchronize the sources across devices'));
$('input.rs-connect')
.val(PTL.tr('Synchronize'))
.button();
$('a.rs-help').text(PTL.tr('More info'));
$('body').on('click','#menuButton', function() {
PTL.sideMenu('toggle');
});
$('body').on('click','.help-button', function() {
PTL.dialog.help();
});
$('body').on('click','.new-source-button', function() {
var $column;
console.log('this: (%s)', $(this).attr('class'));
if ($(this).hasClass('button-column')) {
$column = $(this).parent().parent();
} else {
$column = $($('.ui-tabs-active')
.find('a')
.attr('href'))
.find('.column').first();
}
PTL.sideMenu('close');
PTL.src.add($column, 'New Feed', 'mixed', 8, true);
});
$sourceCodeButton.click(function(event) {
event.preventDefault();
window.open('https://framagit.org/yphil/petrolette');
});
$overlay.click(function() {
PTL.sideMenu('close');
});
$(document).keydown(function(event) {
if (event.keyCode === $.ui.keyCode.ESCAPE) {
$('.column' ).sortable('cancel');
}
});
var $widget = $('#remotestorage-widget');
var $readMore = $('<a>')
.attr('class', 'rs-help')
.attr('href', 'https:remotestorage.io/')
.text(PTL.tr('Read more.'));
$widget.find('.rs-short-desc').text(PTL.tr('Pétrolette allows you to sync data with a storage of your choice ; '))
.append($readMore);
var $fuckingButton = $widget.find('.rs-choose-rs');
$fuckingButton.css('border-color', '#f00');
$fuckingButton.click(function (event) {
event.preventDefault();
});
PTL.util.translate();
$langMenu.val(PTL.prefs.readConfig('lang')).prop('selected', true);
$langMenu.change(function() {
var selectedLang = $(this).val();
PTL.language = selectedLang;
PTL.prefs.writeConfig('lang', selectedLang);
PTL.util.translate();
});
$importButton.click(function () {
$("input#fileImport").click();
return false;
});
$saveButton.click(function () {
PTL.prefs.exportConfig(PTL.tab.list(), 'petrolette.conf');
return false;
});
$(".checkboxradio").checkboxradio({
icon: false
});
$(this).find('input#' + PTL.prefs.readConfig('theme')).prop("checked", true)
.checkboxradio('refresh');
$('.themeSwitcher').change(function() {
$("#theme").attr({href : '/static/css/themes/' + $(this).attr('value') + '.css'});
PTL.prefs.writeConfig('theme', $(this).attr('value'));
});
var gallerySlideshowSpeed = PTL.prefs.readConfig('gallerySlideshowSpeed');
var gallerySlideTransition = PTL.prefs.readConfig('gallerySlideTransition');
// $.fancybox.defaults.thumbs.autoStart = true;
$.fancybox.defaults.transitionEffect = gallerySlideTransition;
$.fancybox.defaults.slideShow.speed = gallerySlideshowSpeed;
$menu.find('select#gallerySlideTransition').change(function() {
$.fancybox.defaults.transitionEffect = $(this).val();
PTL.prefs.writeConfig('gallerySlideTransition', $(this).val());
});
$menu.find('select#gallerySlideTransition').val(gallerySlideTransition);
if (PTL.prefs.readConfig('tabDropActivate') === 'true')
$('input#tabDropActivate').prop('checked', true).checkboxradio('refresh');
else
$('input#tabDropActivate').prop('checked', false).checkboxradio('refresh');
$('input#tabDropActivate').change(function() {
PTL.prefs.writeConfig('tabDropActivate', $(this).prop('checked'));
});
$spinner.spinner({
min: 0.5,
max: 10000,
step: 0.5,
classes: {
"ui-spinner": "shrink ui-corner-all",
"ui-spinner-down": "ui-corner-br",
"ui-spinner-up": "ui-corner-tr"
}
});
$spinner.spinner('value', PTL.util.milliToSecs(gallerySlideshowSpeed));
$spinner.on( 'spinstop', function() {
$slider.slider( 'option', 'value', $(this).val() * 1000);
$('.ui-slider-handle').text(PTL.util.milliToSecs($(this).val() * 1000) + 's');
});
$slider.slider({
classes: {
"ui-slider": "grow ui-corner-all",
"ui-slider-handle": "ui-corner-all",
"ui-slider-range": "ui-corner-all ui-widget-header"
},
value: gallerySlideshowSpeed,
min: 500,
max: 10000,
step: 500,
create: function() {
$(this).find('.ui-slider-handle').text(PTL.util.milliToSecs(gallerySlideshowSpeed) + 's');
},
slide: function(event, ui) {
// $('#gallerySlideshowSpeedValue').text(ui.value + 'ms');
$spinner.val(PTL.util.milliToSecs(ui.value));
$(this).find('.ui-slider-handle').text(PTL.util.milliToSecs(ui.value) + 's');
},
change: function(event, ui) {
PTL.prefs.writeConfig('gallerySlideshowSpeed', ui.value);
$('#tabs').find("[data-fancybox]").fancybox({
slideShow: {
speed: ui.value
}
});
}
});
$fileImportInput.change(function(evt) {
var f = evt.target.files[0],
reader = new FileReader();
reader.onload = (function() {
return function(e) {
if (PTL.util.isPTLStruct(e.target.result)) {
PTL.tab.empty();
// PTL.tab.populate(JSON.parse(e.target.result), true);
}
};
})(f);
reader.readAsText(f);
});
},
sideMenu: function(action) {
var $overlay = $('#overlay'),
$sideMenu = $('nav#side-menu');
if (action == 'open') {
$overlay.removeClass('hidden');
$sideMenu.addClass('expanded');
} else if (action == 'close') {
$overlay.addClass('hidden');
$sideMenu.removeClass('expanded');
} else {
$overlay.toggleClass('hidden');
$sideMenu.toggleClass('expanded');
}
},
tr : function( string ) {
tr: function( string ) {
var _trAux,
stringVarRegExp = /(%.)/,
matchData,
......
/*!
* @base: public/js/PTL.menu.js
*
* @Source: PTL.menu.js
*
* @licstart The following is the entire license notice for the
* JavaScript code in this page.
*
* Copyright (C) 2018 Philippe Y Coatmeur
*
* The JavaScript code in this page is free software: you can
* redistribute it and/or modify it under the terms of the GNU
* General Public License (GNU GPL) as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version. The code is distributed WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
*
* As additional permission under GNU GPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
*
* @licend The above is the entire license notice
* for the JavaScript code in this page.
*
*/
PTL.menu = {
top:function() {
$('<div id="topMenu">').appendTo($('header')).load('/static/templates/menu.html nav#topnav', null);
},
side:function() {
$('<div id="sideMenu">').appendTo($('body')).load('/static/templates/menu.html form#sideMenu', function() {
var $menu = $(this),
$overlay = $('#overlay'),
$sourceCodeButton = $('button#sourceCode'),
$importButton = $("button#fileImport"),
$fileImportInput = $("input#fileImport"),
$saveButton = $('#saveTabs'),
$langMenu = $('select#language'),
$slider = $('div#gallerySpeedSlider'),
$spinner = $('#gallerySpeedSpinner');
$('button').button();
PTL.sync.attachWidget();
$('body').on('click','#menuButton', function() {
$overlay.toggleClass('visible');
$menu.toggleClass('expanded');
});
$('body').on('click','#helpButton', function() {
$('#tabs').tabs('option', 'active', 0);
PTL.dialog.help();
});
$('body').on('click','#newSourceButton', function() {
var $openGroupPanel = $($('.ui-tabs-active').find('a').attr('href')).find('.tabSort');
$overlay.removeClass('visible');
$menu.removeClass('expanded');
PTL.feed.make($openGroupPanel, 'New Feed', 'mixed', 8, true);
});
$sourceCodeButton.click(function(event) {
event.preventDefault();
window.open('https://framagit.org/yphil/petrolette');
});
$overlay.click(function() {
$(this).removeClass('visible');
$menu.removeClass('expanded');
});
$(document).keydown(function(event) {
if (event.keyCode === $.ui.keyCode.ESCAPE) {
$('.tabSort' ).sortable('cancel');
}
});
var $widget = $('#remotestorage-widget');
var $readMore = $('<a>')
.attr('class', 'rs-help')
.attr('href', 'https:remotestorage.io/')
.text(PTL.tr('Read more.'));
$widget.find('.rs-short-desc').text(PTL.tr('Pétrolette allows you to sync data with a storage of your choice ; '))
.append($readMore);
var $fuckingButton = $widget.find('.rs-choose-rs');
$fuckingButton.css('border-color', '#f00');
$fuckingButton.click(function (event) {
event.preventDefault();
});
PTL.utilities.translate();
$langMenu.val(PTL.prefs.readConfig('lang')).prop('selected', true);
$langMenu.change(function() {
var selectedLang = $(this).val();
PTL.language = selectedLang;
PTL.prefs.writeConfig('lang', selectedLang);
PTL.utilities.translate();
});
$importButton.click(function () {
$("input#fileImport").click();
return false;
});
$saveButton.click(function () {
PTL.prefs.exportConfig(PTL.tab.list(), 'petrolette.conf');
return false;
});
$(".checkboxradio").checkboxradio({
icon: false
});
$(this).find('input#' + PTL.prefs.readConfig('theme')).prop("checked", true)
.checkboxradio('refresh');
$('.themeSwitcher').change(function() {
$("#mobStyle").attr({href : '/static/css/themes/' + $(this).attr('value') + '.css'});
PTL.prefs.writeConfig('theme', $(this).attr('value'));
});
var gallerySlideshowSpeed = PTL.prefs.readConfig('gallerySlideshowSpeed');
var gallerySlideTransition = PTL.prefs.readConfig('gallerySlideTransition');
// $.fancybox.defaults.thumbs.autoStart = true;
$.fancybox.defaults.transitionEffect = gallerySlideTransition;
$.fancybox.defaults.slideShow.speed = gallerySlideshowSpeed;
$menu.find('select#gallerySlideTransition').change(function() {
$.fancybox.defaults.transitionEffect = $(this).val();
PTL.prefs.writeConfig('gallerySlideTransition', $(this).val());
});
$menu.find('select#gallerySlideTransition').val(gallerySlideTransition);
if (PTL.prefs.readConfig('tabDropActivate') === 'true')
$('input#tabDropActivate').prop('checked', true).checkboxradio('refresh');
else
$('input#tabDropActivate').prop('checked', false).checkboxradio('refresh');
$('input#tabDropActivate').change(function() {
PTL.prefs.writeConfig('tabDropActivate', $(this).prop('checked'));
});
$spinner.spinner({
min: 0.5,
max: 10000,
step: 0.5,
classes: {
"ui-spinner": "shrink ui-corner-all",
"ui-spinner-down": "ui-corner-br",
"ui-spinner-up": "ui-corner-tr"
}
});
$spinner.spinner('value', PTL.utilities.milliToSecs(gallerySlideshowSpeed));
$spinner.on( 'spinstop', function() {
$slider.slider( 'option', 'value', $(this).val() * 1000);
$('.ui-slider-handle').text(PTL.utilities.milliToSecs($(this).val() * 1000) + 's');
});
$slider.slider({
classes: {
"ui-slider": "grow ui-corner-all",
"ui-slider-handle": "ui-corner-all",
"ui-slider-range": "ui-corner-all ui-widget-header"
},
value: gallerySlideshowSpeed,
min: 500,
max: 10000,
step: 500,
create: function() {
$(this).find('.ui-slider-handle').text(PTL.utilities.milliToSecs(gallerySlideshowSpeed) + 's');
},