Dotclear

Changeset 3851:21fc9983c334


Ignore:
Timestamp:
09/02/18 10:31:48 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Allow folding of blog (standard) parameters (+es6)

Location:
admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • admin/blog_pref.php

    r3731 r3851  
    345345    echo 
    346346    '<div class="multi-part" id="params" title="' . __('Parameters') . '">' . 
    347     '<h3 class="out-of-screen-if-js">' . __('Parameters') . '</h3>' . 
     347    '<div id="standard-pref"><h3>' . __('Blog parameters') . '</h3>' . 
    348348        '<form action="' . $action . '" method="post" id="blog-form">'; 
    349349 
     
    615615    '<br class="clear" />' . //Opera sucks 
    616616 
     617    '</div>' . 
    617618    '</div>'; 
    618619 
  • admin/js/_auth.js

    r3725 r3851  
    33 
    44$(window).load(function() { 
    5   var uid = $('input[name=user_id]'); 
    6   var upw = $('input[name=user_pwd]'); 
     5  let uid = $('input[name=user_id]'); 
     6  let upw = $('input[name=user_pwd]'); 
    77  uid.focus(); 
    88 
     
    1010    return; 
    1111  } 
    12  
    13   uid.keypress(processKey); 
    14  
    15   function processKey(evt) { 
     12  uid.keypress(evt => { 
    1613    if (evt.which == 13 && upw.val() == '') { 
    1714      upw.focus(); 
     
    1916    } 
    2017    return true; 
    21   } 
     18  }); 
     19 
    2220  $.cookie('dc_admin_test_cookie', true); 
    2321  if ($.cookie('dc_admin_test_cookie')) { 
  • admin/js/_blog_pref.js

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

Sites map