diff options
Diffstat (limited to 'view/js')
-rw-r--r-- | view/js/acl.js | 24 | ||||
-rw-r--r-- | view/js/autocomplete.js | 13 | ||||
-rw-r--r-- | view/js/main.js | 8 | ||||
-rw-r--r-- | view/js/mod_network.js | 2 | ||||
-rw-r--r-- | view/js/mod_settings.js | 22 |
5 files changed, 43 insertions, 26 deletions
diff --git a/view/js/acl.js b/view/js/acl.js index eb7b7f523..c11997c43 100644 --- a/view/js/acl.js +++ b/view/js/acl.js @@ -68,7 +68,7 @@ function ACL(backend_url) { } -ACL.prototype.get_form_data = function(event) { +ACL.prototype.get_form_data = function(event) { form_id = $(this).data('form_id'); that.form_id = $('#' + form_id); @@ -100,13 +100,6 @@ ACL.prototype.on_submit = function() { $(that.deny_cid).each(function(i,v) { that.form_id.append("<input class='acl-field' type='hidden' name='contact_deny[]' value='"+v+"'>"); }); - - var formfields = $('.profile-jot-net input').serializeArray(); - - $.each(formfields, function(i, field) { - that.form_id.append("<input class='acl-field' type='hidden' name='"+field.name+"' value='"+field.value+"'>"); - }); - }; ACL.prototype.search = function() { @@ -282,7 +275,8 @@ ACL.prototype.update_view = function(value) { that.update_select('public'); /* jot acl */ - $('#jot-perms-icon, #dialog-perms-icon').removeClass('fa-lock').addClass('fa-unlock'); + $('#jot-perms-icon, #dialog-perms-icon, #' + that.form_id[0].id + ' .jot-perms-icon').removeClass('fa-lock').addClass('fa-unlock'); + $('#dbtn-jotnets').show(); $('.profile-jot-net input').attr('disabled', false); } @@ -294,7 +288,8 @@ ACL.prototype.update_view = function(value) { that.update_select(that.selected_id); /* jot acl */ - $('#jot-perms-icon, #dialog-perms-icon').removeClass('fa-unlock').addClass('fa-lock'); + $('#jot-perms-icon, #dialog-perms-icon, #' + that.form_id[0].id + ' .jot-perms-icon').removeClass('fa-unlock').addClass('fa-lock'); + $('#dbtn-jotnets').hide(); $('.profile-jot-net input').attr('disabled', 'disabled'); } @@ -305,7 +300,8 @@ ACL.prototype.update_view = function(value) { that.update_select('onlyme'); /* jot acl */ - $('#jot-perms-icon, #dialog-perms-icon').removeClass('fa-unlock').addClass('fa-lock'); + $('#jot-perms-icon, #dialog-perms-icon, #' + that.form_id[0].id + ' .jot-perms-icon').removeClass('fa-unlock').addClass('fa-lock'); + $('#dbtn-jotnets').hide(); $('.profile-jot-net input').attr('disabled', 'disabled'); } @@ -316,11 +312,13 @@ ACL.prototype.update_view = function(value) { /* jot acl */ if(that.allow_gid.length === 0 && that.allow_cid.length === 0 && that.deny_gid.length === 0 && that.deny_cid.length === 0 && value === 'custom') { - $('#jot-perms-icon, #dialog-perms-icon').removeClass('fa-lock').addClass('fa-unlock'); + $('#jot-perms-icon, #dialog-perms-icon, #' + that.form_id[0].id + ' .jot-perms-icon').removeClass('fa-lock').addClass('fa-unlock'); + $('#dbtn-jotnets').show(); $('.profile-jot-net input').attr('disabled', false); } else { - $('#jot-perms-icon, #dialog-perms-icon').removeClass('fa-unlock').addClass('fa-lock'); + $('#jot-perms-icon, #dialog-perms-icon, #' + that.form_id[0].id + ' .jot-perms-icon').removeClass('fa-unlock').addClass('fa-lock'); + $('#dbtn-jotnets').hide(); $('.profile-jot-net input').attr('disabled', 'disabled'); } } diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index 63f1e9a13..62a3b6f06 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -102,8 +102,8 @@ function submit_form(e) { function getWord(text, caretPos) { var index = text.indexOf(caretPos); - var postText = text.substring(caretPos, caretPos+8); - if ((postText.indexOf('[/list]') > 0) || postText.indexOf('[/ul]') > 0 || postText.indexOf('[/ol]') > 0 || postText.indexOf('[/dl]') > 0) { + var postText = text.substring(caretPos, caretPos+13); + if (postText.indexOf('[/list]') > 0 || postText.indexOf('[/checklist]') > 0 || postText.indexOf('[/ul]') > 0 || postText.indexOf('[/ol]') > 0 || postText.indexOf('[/dl]') > 0) { return postText; } } @@ -140,10 +140,11 @@ function listNewLineAutocomplete(id) { var text = document.getElementById(id); var caretPos = getCaretPosition(text) var word = getWord(text.value, caretPos); + if (word != null) { var textBefore = text.value.substring(0, caretPos); var textAfter = text.value.substring(caretPos, text.length); - var textInsert = (word.indexOf('[/dl]') > 0) ? '\r\n[*=] ' : '\r\n[*] '; + var textInsert = (word.indexOf('[/dl]') > 0) ? '\r\n[*=] ' : (word.indexOf('[/checklist]') > 0) ? '\r\n[] ' : '\r\n[*] '; var caretPositionDiff = (word.indexOf('[/dl]') > 0) ? 3 : 1; $('#' + id).val(textBefore + textInsert + textAfter); @@ -268,7 +269,7 @@ function string2bb(element) { $.fn.bbco_autocomplete = function(type) { if(type=='bbcode') { - var open_close_elements = ['bold', 'italic', 'underline', 'overline', 'strike', 'superscript', 'subscript', 'quote', 'code', 'open', 'spoiler', 'map', 'nobb', 'list', 'ul', 'ol', 'dl', 'li', 'table', 'tr', 'th', 'td', 'center', 'color', 'font', 'size', 'zrl', 'zmg', 'rpost', 'qr', 'observer']; + var open_close_elements = ['bold', 'italic', 'underline', 'overline', 'strike', 'superscript', 'subscript', 'quote', 'code', 'open', 'spoiler', 'map', 'nobb', 'list', 'checklist', 'ul', 'ol', 'dl', 'li', 'table', 'tr', 'th', 'td', 'center', 'color', 'font', 'size', 'zrl', 'zmg', 'rpost', 'qr', 'observer']; var open_elements = ['observer.baseurl', 'observer.address', 'observer.photo', 'observer.name', 'observer.webname', 'observer.url', '*', 'hr', ]; var elements = open_close_elements.concat(open_elements); @@ -300,7 +301,9 @@ function string2bb(element) { element = string2bb(element); if(open_elements.indexOf(element) < 0) { if(element === 'list' || element === 'ol' || element === 'ul') { - return ['\[' + element + '\]' + '\n\[*\] ', '\n\[/' + element + '\]']; + return ['\[' + element + '\]' + '\n\[*\] ', '\n\[/' + element + '\]']; + } else if(element === 'checklist') { + return ['\[' + element + '\]' + '\n\[\] ', '\n\[/' + element + '\]']; } else if (element === 'dl') { return ['\[' + element + '\]' + '\n\[*=Item name\] ', '\n\[/' + element + '\]']; } else if(element === 'table') { diff --git a/view/js/main.js b/view/js/main.js index 21157bdfe..f415637bd 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -847,7 +847,7 @@ function pageUpdate() { function justifyPhotos(id) { justifiedGalleryActive = true; $('#' + id).justifiedGallery({ - selector: '> a, > div:not(.spinner, #page-end)', + selector: 'a, div:not(.spinner, #page-end)', margins: 3, border: 0, sizeRangeSuffixes: { @@ -1247,12 +1247,6 @@ Array.prototype.remove = function(item) { return this.push.apply(this, rest); }; -function previewTheme(elm) { - theme = $(elm).val(); - $.getJSON('pretheme?f=&theme=' + theme,function(data) { - $('#theme-preview').html('<div id="theme-desc">' + data.desc + '</div><div id="theme-version">' + data.version + '</div><div id="theme-credits">' + data.credits + '</div><a href="' + data.img + '"><img src="' + data.img + '" style="max-width:100%; max-height:300px" alt="' + theme + '"></a>'); - }); -} $(document).ready(function() { diff --git a/view/js/mod_network.js b/view/js/mod_network.js index cbdb82c75..cd36786df 100644 --- a/view/js/mod_network.js +++ b/view/js/mod_network.js @@ -1,5 +1,5 @@ $(document).ready(function() { - $("#search-text").contact_autocomplete(baseurl + '/search_ac'); + $("#search-text").contact_autocomplete(baseurl + '/search_ac','',true); $('.jslider-scale ins').addClass('hidden-xs'); }); diff --git a/view/js/mod_settings.js b/view/js/mod_settings.js index 4ff702b22..db321ae70 100644 --- a/view/js/mod_settings.js +++ b/view/js/mod_settings.js @@ -8,6 +8,8 @@ $(document).ready(function() { $('.token-mirror').html($('#id_token').val()); $('#id_token').keyup( function() { $('.token-mirror').html($('#id_token').val()); }); + previewTheme($('#id_theme')[0]); + $("#id_permissions_role").change(function() { var role = $("#id_permissions_role").val(); if(role == 'custom') @@ -17,6 +19,26 @@ $(document).ready(function() { }); }); + +function setTheme(elm) { + $('#settings-form').submit(); +} + + +function previewTheme(elm) { + theme = $(elm).val(); + $.getJSON('theme_info/' + theme,function(data) { + $('#theme-preview').html('<div id="theme-desc">' + data.desc + '</div><div id="theme-version">' + data.version + '</div><div id="theme-credits">' + data.credits + '</div><a href="' + data.img + '"><img src="' + data.img + '" style="max-width:100%; max-height:300px" alt="' + theme + '"></a>'); + $('#id_schema').empty(); + $(data.schemas).each(function(index,item) { + $('<option/>',{value:item['key'],text:item['val']}).appendTo('#id_schema'); + }); + $('#custom-settings-content .section-content-tools-wrapper').html(data.config); + }); +} + + + /** * 0 nobody * 1 perms_specific |