Dotclear

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

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

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

Line 
1/*global $, dotclear */
2'use strict';
3
4dotclear.viewPostContent = function(line, action) {
5  action = action || 'toggle';
6  var postId = $(line).attr('id').substr(1);
7  var tr = document.getElementById('pe' + postId);
8
9  if (!tr && (action == 'toggle' || action == 'open')) {
10    tr = document.createElement('tr');
11    tr.id = 'pe' + postId;
12    var td = document.createElement('td');
13    td.colSpan = 8;
14    td.className = 'expand';
15    tr.appendChild(td);
16
17    // Get post content
18    $.get('services.php', {
19      f: 'getPostById',
20      id: postId,
21      post_type: ''
22    }, function(data) {
23      var rsp = $(data).children('rsp')[0];
24
25      if (rsp.attributes[0].value == 'ok') {
26        var post = $(rsp).find('post_display_content').text();
27        var post_excerpt = $(rsp).find('post_display_excerpt').text();
28        var res = '';
29
30        if (post) {
31          if (post_excerpt) {
32            res += post_excerpt + '<hr />';
33          }
34          res += post;
35          $(td).append(res);
36        }
37      } else {
38        window.alert($(rsp).find('message').text());
39      }
40    });
41
42    $(line).addClass('expand');
43    line.parentNode.insertBefore(tr, line.nextSibling);
44  } else if (tr && tr.style.display == 'none' && (action == 'toggle' || action == 'open')) {
45    $(tr).css('display', 'table-row');
46    $(line).addClass('expand');
47  } else if (tr && tr.style.display != 'none' && (action == 'toggle' || action == 'close')) {
48    $(tr).css('display', 'none');
49    $(line).removeClass('expand');
50  }
51};
52
53$(function() {
54  // Entry type switcher
55  $('#type').change(function() {
56    this.form.submit();
57  });
58
59  $.expandContent({
60    line: $('#form-entries tr:not(.line)'),
61    lines: $('#form-entries tr.line'),
62    callback: dotclear.viewPostContent
63  });
64  $('.checkboxes-helpers').each(function() {
65    dotclear.checkboxesHelpers(this, undefined, '#form-entries td input[type=checkbox]', '#form-entries #do-action');
66  });
67  $('#form-entries td input[type=checkbox]').enableShiftClick();
68  dotclear.condSubmit('#form-entries td input[type=checkbox]', '#form-entries #do-action');
69  dotclear.postsActionsHelper();
70});
Note: See TracBrowser for help on using the repository browser.

Sites map