Dotclear

source: admin/js/_blog_pref.js @ 3706:170617361020

Revision 3706:170617361020, 1.6 KB checked in by franck <carnet.franck.paul@…>, 8 years ago (diff)

use strict and no more linter warnings/errors as far as possible

RevLine 
[3706]1/*global $, dotclear, jsToolBar */
2'use strict';
[175]3function checkQueryString() {
4     var blogUrl = $('#blog_url')[0].value;
5     var urlScan = $('#url_scan')[0].value;
[3706]6     var errorMsg = '';
[175]7     if (/.*[^\/]$/.exec(blogUrl) && urlScan=='path_info') {
8          errorMsg = dotclear.msg.warning_path_info;
9     } else if (/.*[^\?]$/.exec(blogUrl) && urlScan=='query_string') {
10          errorMsg = dotclear.msg.warning_query_string;
11     }
[3706]12     $('p#urlwarning').remove();
[175]13     if (errorMsg != '') {
[3706]14          $('#blog_url').parents('p').after('<p id="urlwarning" class="warning">'+errorMsg+'</p>');
[175]15     }
16}
17
18
19$(function() {
[3005]20     var blog_url = $('#blog_url');
21     if (blog_url.length > 0 && !blog_url.is(':hidden')) {
[2004]22          checkQueryString();
23          $('#blog_url').focusout(checkQueryString);
24          $('body').on('change','#url_scan',checkQueryString);
25     }
[2019]26
27     $('#date_format_select,#time_format_select').change(function() {
28          if ($(this).prop('value') == '') {
29               return;
30          }
31          $('#'+$(this).attr('id').replace('_select','')).prop('value', $(this).prop('value'));
32          $(this).parent().next('.chosen').html($(this).find(':selected').prop('label'));
33     });
[3227]34
35     // HTML text editor
36     if ($.isFunction(jsToolBar)) {
37          $('#blog_desc').each(function() {
38               var tbWidgetText = new jsToolBar(this);
[3524]39               tbWidgetText.context = 'blog_desc';
[3227]40               tbWidgetText.draw('xhtml');
41          });
42     }
43
[3444]44     // Hide advanced and plugins prefs sections
45     $('#advanced-pref h3').toggleWithLegend($('#advanced-pref').children().not('h3'),{
46          legend_click: true,
47          user_pref: 'dcx_blog_pref_adv'
48     });
49     $('#plugins-pref h3').toggleWithLegend($('#plugins-pref').children().not('h3'),{
50          legend_click: true,
51          user_pref: 'dcx_blog_pref_plg'
52     });
[2004]53});
Note: See TracBrowser for help on using the repository browser.

Sites map