Changeset 3915:a57821ba9ef1
- Timestamp:
- 11/05/18 16:40:40 (7 years ago)
- Branch:
- default
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/_charte.php
r3776 r3915 23 23 <link rel="icon" type="image/png" href="images/favicon96-login.png" /> 24 24 <?php 25 $js = []; 25 26 if ($core->auth->user_prefs->interface->darkmode) { 26 27 echo dcPage::cssLoad('style/default-dark.css'); … … 29 30 } 30 31 if ($core->auth->user_prefs->interface->htmlfontsize) { 31 echo 32 '<script type="text/javascript">' . "\n" . 33 dcPage::jsVar('dotclear_htmlFontSize', $core->auth->user_prefs->interface->htmlfontsize) . 34 "</script>\n"; 32 $js['htmlFontSize'] = $core->auth->user_prefs->interface->htmlfontsize; 35 33 } 34 // Set some JSON data 35 echo dcUtils::jsJson('dotclear_init', $js); 36 echo dcPage::jsUtil(); 36 37 ?> 37 38 <script type="text/javascript" src="js/jquery/jquery.js"></script> -
admin/js/_index.js
r3908 r3915 206 206 } 207 207 208 if (!dotclear. noDragDrop) {208 if (!dotclear.data.noDragDrop) { 209 209 // Dashboard boxes and their children are sortable 210 210 const set_positions = function(sel, id) { -
admin/js/common.js
r3882 r3915 1 /*global $, jQuery, dotclear_htmlFontSize*/1 /*global $, jQuery, getData */ 2 2 /*exported chainHandler */ 3 3 'use strict'; 4 5 /* Get PreInit JSON data */ 6 const dotclear_init = getData('dotclear_init'); 4 7 5 8 /* Set some CSS variables here 6 9 -------------------------------------------------------- */ 7 10 // set base font-size of body (62.5% default, usually : 50% to 75%) 8 if (typeof dotclear_ htmlFontSize !== 'undefined') {9 document.documentElement.style.setProperty('--html-font-size', dotclear_ htmlFontSize);11 if (typeof dotclear_init.htmlFontSize !== 'undefined') { 12 document.documentElement.style.setProperty('--html-font-size', dotclear_init.htmlFontSize); 10 13 } 11 14 /* ChainHandler, py Peter van der Beken … … 549 552 -------------------------------------------------------- */ 550 553 $(function() { 554 // Store preinit DATA in dotclear object 555 dotclear.data = dotclear_init; 556 // Get other DATA 557 Object.assign(dotclear.data, getData('dotclear')); 558 551 559 // remove class no-js from html tag; cf style/default.css for examples 552 560 $('body').removeClass('no-js').addClass('with-js'); … … 629 637 }); 630 638 // Advanced users 631 if (dotclear. hideMoreInfo) {639 if (dotclear.data.hideMoreInfo) { 632 640 $('.more-info,.form-note:not(.warn,.warning,.info)').addClass('no-more-info'); 633 641 } 634 642 // Ajax loader activity indicator 635 if (dotclear. showAjaxLoader) {643 if (dotclear.data.showAjaxLoader) { 636 644 $(document).ajaxStart(function() { 637 645 $('body').addClass('ajax-loader'); -
inc/admin/lib.dc.page.php
r3913 r3915 24 24 "static" => "static-msg"]; 25 25 26 private static function getCore() 27 { 28 return $GLOBALS['core']; 29 } 30 26 31 # Auth check 27 32 public static function check($permissions) 28 33 { 29 global $core;34 $core = self::getCore(); 30 35 31 36 if ($core->blog && $core->auth->check($permissions, $core->blog->id)) { … … 42 47 public static function checkSuper() 43 48 { 44 global $core;49 $core = self::getCore(); 45 50 46 51 if (!$core->auth->isSuperAdmin()) { … … 55 60 public static function open($title = '', $head = '', $breadcrumb = '', $options = []) 56 61 { 57 global $core; 62 $core = self::getCore(); 63 $js = []; 58 64 59 65 # List of user's blogs … … 170 176 171 177 if ($core->auth->user_prefs->interface->darkmode) { 172 echo self::jsVars(['dotclear_darkMode' => 1]);178 $js['darkMode'] = 1; 173 179 echo self::cssLoad('style/default-dark.css'); 174 180 } else { 175 echo self::jsVars(['dotclear_darkMode' => 0]);181 $js['darkMode'] = 0; 176 182 echo self::cssLoad('style/default.css'); 177 183 } … … 186 192 '<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />' . "\n"; 187 193 } 188 189 194 if ($core->auth->user_prefs->interface->htmlfontsize) { 190 echo 191 '<script type="text/javascript">' . "\n" . 192 self::jsVar('dotclear_htmlFontSize', $core->auth->user_prefs->interface->htmlfontsize) . "\n" . 193 "</script>\n"; 194 } 195 $js['htmlFontSize'] = $core->auth->user_prefs->interface->htmlfontsize; 196 } 197 $js['hideMoreInfo'] = (boolean) $core->auth->user_prefs->interface->hidemoreinfo; 198 $js['showAjaxLoader'] = (boolean) $core->auth->user_prefs->interface->showajaxloader; 199 200 $core->auth->user_prefs->addWorkspace('accessibility'); 201 $js['noDragDrop'] = (boolean) $core->auth->user_prefs->accessibility->nodragdrop; 202 203 // Set some JSON data 204 echo dcUtils::jsJson('dotclear_init', $js); 195 205 196 206 echo … … 198 208 self::jsToggles() . 199 209 $head; 200 201 $core->auth->user_prefs->addWorkspace('accessibility');202 echo203 '<script type="text/javascript">' . "\n" .204 'dotclear.noDragDrop = '.($core->auth->user_prefs->accessibility->nodragdrop ? 'true' : 'false').';' . "\n" .205 "</script>\n";206 207 if ($core->auth->user_prefs->interface->hidemoreinfo) {208 echo209 '<script type="text/javascript">' . "\n" .210 'dotclear.hideMoreInfo = true;' . "\n" .211 "</script>\n";212 }213 if ($core->auth->user_prefs->interface->showajaxloader) {214 echo215 '<script type="text/javascript">' . "\n" .216 'dotclear.showAjaxLoader = true;' . "\n" .217 "</script>\n";218 }219 210 220 211 # --BEHAVIOR-- adminPageHTMLHead … … 276 267 public static function notices() 277 268 { 278 global $core;269 $core = self::getCore(); 279 270 static $error_displayed = false; 280 271 … … 350 341 protected static function getNotification($n) 351 342 { 352 global $core;343 $core = self::getCore(); 353 344 354 345 $tag = (isset($n['divtag']) && $n['divtag']) ? 'div' : 'p'; … … 363 354 public static function close() 364 355 { 365 global $core;356 $core = self::getCore(); 366 357 367 358 if (!$GLOBALS['__resources']['ctxhelp']) { … … 436 427 public static function openPopup($title = '', $head = '', $breadcrumb = '') 437 428 { 438 global $core; 429 $core = self::getCore(); 430 $js = []; 439 431 440 432 # Display … … 460 452 461 453 if ($core->auth->user_prefs->interface->darkmode) { 462 echo self::jsVars(['dotclear_darkMode' => 1]);454 $js['darkMode'] = 1; 463 455 echo self::cssLoad('style/default-dark.css'); 464 456 } else { 465 echo self::jsVars(['dotclear_darkMode' => 0]);457 $js['darkMode'] = 0; 466 458 echo self::cssLoad('style/default.css'); 467 459 } … … 472 464 $core->auth->user_prefs->addWorkspace('interface'); 473 465 if ($core->auth->user_prefs->interface->htmlfontsize) { 474 echo 475 '<script type="text/javascript">' . "\n" . 476 self::jsVar('dotclear_htmlFontSize', $core->auth->user_prefs->interface->htmlfontsize) . "\n" . 477 "</script>\n"; 478 } 466 $js['htmlFontSize'] = $core->auth->user_prefs->interface->htmlfontsize; 467 } 468 $js['hideMoreInfo'] = (boolean) $core->auth->user_prefs->interface->hidemoreinfo; 469 $js['showAjaxLoader'] = (boolean) $core->auth->user_prefs->interface->showajaxloader; 470 471 $core->auth->user_prefs->addWorkspace('accessibility'); 472 $js['noDragDrop'] = (boolean) $core->auth->user_prefs->accessibility->nodragdrop; 473 474 // Set JSON data 475 echo dcUtils::jsJson('dotclear_init', $js); 479 476 480 477 echo … … 483 480 $head; 484 481 485 $core->auth->user_prefs->addWorkspace('accessibility');486 echo487 '<script type="text/javascript">' . "\n" .488 'dotclear.noDragDrop = '.($core->auth->user_prefs->accessibility->nodragdrop ? 'true' : 'false').';' . "\n" .489 "</script>\n";490 491 if ($core->auth->user_prefs->interface->hidemoreinfo) {492 echo493 '<script type="text/javascript">' . "\n" .494 'dotclear.hideMoreInfo = true;' . "\n" .495 "</script>\n";496 }497 if ($core->auth->user_prefs->interface->showajaxloader) {498 echo499 '<script type="text/javascript">' . "\n" .500 'dotclear.showAjaxLoader = true;' . "\n" .501 "</script>\n";502 }503 504 482 # --BEHAVIOR-- adminPageHTMLHead 505 483 $core->callBehavior('adminPageHTMLHead'); … … 539 517 public static function breadcrumb($elements = null, $options = []) 540 518 { 541 global $core;519 $core = self::getCore(); 542 520 543 521 $with_home_link = isset($options['home_link']) ? $options['home_link'] : true; … … 566 544 public static function message($msg, $timestamp = true, $div = false, $echo = true, $class = 'message') 567 545 { 568 global $core;546 $core = self::getCore(); 569 547 570 548 $res = ''; … … 639 617 public static function helpBlock(...$params) 640 618 { 641 global $core;619 $core = self::getCore(); 642 620 643 621 if ($core->auth->user_prefs->interface->hidehelpbutton) { … … 648 626 649 627 # --BEHAVIOR-- adminPageHelpBlock 650 $ GLOBALS['core']->callBehavior('adminPageHelpBlock', $args);628 $core->callBehavior('adminPageHelpBlock', $args); 651 629 652 630 if (empty($args)) { … … 750 728 public static function jsUtil() 751 729 { 752 return self::jsLoad($GLOBALS['core']->blog->getPF('util.js')); 730 $core = self::getCore(); 731 return self::jsLoad($core->blog->getPF('util.js')); 753 732 } 754 733 755 734 public static function jsToggles() 756 735 { 757 if ($GLOBALS['core']->auth->user_prefs->toggles) { 758 $unfolded_sections = explode(',', $GLOBALS['core']->auth->user_prefs->toggles->unfolded_sections); 736 $core = self::getCore(); 737 738 if ($core->auth->user_prefs->toggles) { 739 $unfolded_sections = explode(',', $core->auth->user_prefs->toggles->unfolded_sections); 759 740 foreach ($unfolded_sections as $k => &$v) { 760 741 if ($v == '') { … … 774 755 public static function jsCommon() 775 756 { 757 $core = self::getCore(); 758 776 759 $mute_or_no = ''; 777 if (empty($ GLOBALS['core']->blog) || $GLOBALS['core']->blog->settings->system->jquery_migrate_mute) {760 if (empty($core->blog) || $core->blog->settings->system->jquery_migrate_mute) { 778 761 $mute_or_no .= 779 762 '<script type="text/javascript">' . "\n" . … … 794 777 'jsToolBar = {}, jsToolBar.prototype = { elements : {} };' . "\n" . 795 778 796 self::jsVar('dotclear.nonce', $ GLOBALS['core']->getNonce()) .779 self::jsVar('dotclear.nonce', $core->getNonce()) . 797 780 798 781 self::jsVar('dotclear.img_plus_src', 'images/expand.png') . … … 1029 1012 public static function jsUpload($params = [], $base_url = null) 1030 1013 { 1014 $core = self::getCore(); 1015 1031 1016 if (!$base_url) { 1032 1017 $base_url = path::clean(dirname(preg_replace('/(\?.*$)?/', '', $_SERVER['REQUEST_URI']))) . '/'; … … 1036 1021 'sess_id=' . session_id(), 1037 1022 'sess_uid=' . $_SESSION['sess_browser_uid'], 1038 'xd_check=' . $ GLOBALS['core']->getNonce()1023 'xd_check=' . $core->getNonce() 1039 1024 ]); 1040 1025 … … 1156 1141 public static function getPF($file) 1157 1142 { 1158 return $GLOBALS['core']->adminurl->get('load.plugin.file', ['pf' => $file]); 1143 $core = self::getCore(); 1144 return $core->adminurl->get('load.plugin.file', ['pf' => $file]); 1159 1145 } 1160 1146 1161 1147 public static function getVF($file) 1162 1148 { 1163 return $GLOBALS['core']->adminurl->get('load.var.file', ['vf' => $file]); 1149 $core = self::getCore(); 1150 return $core->adminurl->get('load.var.file', ['vf' => $file]); 1164 1151 } 1165 1152 -
inc/js/util.js
r3912 r3915 2 2 'use strict'; 3 3 4 const getData = function(id) { 4 var getData = getData || function(id, clear = true) { 5 let data = {}; 5 6 // Read the JSON-formatted data from the DOM. (from https://mathiasbynens.be/notes/json-dom-csp) 6 7 // To be use with: <script type="application/json" id="myid-data">{"key":value, …}</script> 7 8 const element = document.getElementById(`${id}-data`); 8 const string = element.textContent; 9 const data = JSON.parse(string); 10 // Clear the element’s contents now that we have a copy of the data. 11 element.innerHTML = ''; 9 if (element) { 10 try { 11 data = JSON.parse(element.textContent); 12 if (clear) { 13 // Clear the element’s contents 14 element.innerHTML = ''; 15 } 16 } catch (e) {} 17 } 12 18 return data; 13 19 }; -
plugins/dcCKEditor/_post_config.php
r3897 r3915 256 256 257 257 CKEDITOR.on('instanceReady',function(e) { 258 if ( typeof dotclear_htmlFontSize !== 'undefined') {259 e.editor.document.$.documentElement.style.setProperty('--html-font-size',dotclear _htmlFontSize);258 if (dotclear && dotclear.data && dotclear.data.htmlFontSize) { 259 e.editor.document.$.documentElement.style.setProperty('--html-font-size',dotclear.data.htmlFontSize); 260 260 } 261 261 -
plugins/dcCKEditor/inc/dc.ckeditor.behaviors.php
r3897 r3915 60 60 dcPage::jsLoad($config_js); 61 61 62 if ($GLOBALS['core']->auth->user_prefs->interface->htmlfontsize) {63 $res .=64 '<script type="text/javascript">' . "\n" .65 dcPage::jsVar('dotclear_htmlFontSize', $GLOBALS['core']->auth->user_prefs->interface->htmlfontsize) . "\n" .66 "</script>\n";67 }68 69 62 return $res; 70 63 } -
plugins/dcLegacyEditor/inc/dc.legacy.editor.behaviors.php
r3874 r3915 139 139 "</script>\n"; 140 140 141 if ($GLOBALS['core']->auth->user_prefs->interface->htmlfontsize) {142 $res .=143 '<script type="text/javascript">' . "\n" .144 dcPage::jsVar('dotclear_htmlFontSize', $GLOBALS['core']->auth->user_prefs->interface->htmlfontsize) . "\n" .145 "</script>\n";146 }147 148 141 return $res; 149 142 } -
plugins/dcLegacyEditor/js/jsToolBar/jsToolBar.wysiwyg.js
r3897 r3915 1 /*global jsToolBar, dotclear _htmlFontSize, chainHandler */1 /*global jsToolBar, dotclear, chainHandler */ 2 2 'use strict'; 3 3 … … 184 184 } 185 185 186 if ( typeof dotclear_htmlFontSize !== 'undefined') {187 doc.documentElement.style.setProperty('--html-font-size', dotclear _htmlFontSize);186 if (dotclear && dotclear.data && dotclear.data.htmlFontSize) { 187 doc.documentElement.style.setProperty('--html-font-size', dotclear.data.htmlFontSize); 188 188 } 189 189 -
themes/berlin/_define.php
r3874 r3915 16 16 "Dotclear 2.7+ default theme", // Description 17 17 "Dotclear Team", // Author 18 '1. 2', // Version18 '1.3', // Version 19 19 [ // Properties 20 20 'type' => 'theme', -
themes/berlin/_public.php
r3874 r3915 23 23 public static function publicHeadContent() 24 24 { 25 echo \dcUtils::jsVars([ 26 'dotclear_berlin_show_menu' => __('Show menu'), 27 'dotclear_berlin_hide_menu' => __('Hide menu'), 28 'dotclear_berlin_navigation' => __('Navigation') 25 echo 26 \dcUtils::jsLoad($GLOBALS['core']->blog->getPF('util.js')) . 27 \dcUtils::jsJson('dotclear_berlin', [ 28 'show_menu' => __('Show menu'), 29 'hide_menu' => __('Hide menu'), 30 'navigation' => __('Navigation') 29 31 ]); 30 32 } -
themes/berlin/js/berlin.js
r3880 r3915 1 /*global $, dotclear_berlin_navigation, dotclear_berlin_show_menu, dotclear_berlin_hide_menu*/1 /*global $, getData */ 2 2 'use strict'; 3 4 const dotclear_berlin = getData('dotclear_berlin'); 3 5 4 6 $('html').addClass('js'); 5 7 // Show/Hide main menu 6 8 $('.header__nav'). 7 before(`<button id="hamburger" type="button"><span class="visually-hidden">${dotclear_berlin _navigation}</span></button>`).9 before(`<button id="hamburger" type="button"><span class="visually-hidden">${dotclear_berlin.navigation}</span></button>`). 8 10 toggle(); 9 11 $('#hamburger').click(function() { … … 12 14 }); 13 15 // Show/Hide sidebar on small screens 14 $('#main').prepend(`<button id="offcanvas-on" type="button"><span class="visually-hidden">${dotclear_berlin _show_menu}</span></button>`);16 $('#main').prepend(`<button id="offcanvas-on" type="button"><span class="visually-hidden">${dotclear_berlin.show_menu}</span></button>`); 15 17 $('#offcanvas-on').click(function() { 16 const btn = $(`<button id="offcanvas-off" type="button"><span class="visually-hidden">${dotclear_berlin _hide_menu}</span></button>`);18 const btn = $(`<button id="offcanvas-off" type="button"><span class="visually-hidden">${dotclear_berlin.hide_menu}</span></button>`); 17 19 $('#wrapper').addClass('off-canvas'); 18 20 $('#footer').addClass('off-canvas'); -
themes/berlin/style.css
r3899 r3915 165 165 article, aside, details, figcaption, figure, footer, 166 166 header, hgroup, main, nav, section, summary { 167 display: block; } 167 display: block; 168 } 168 169 169 170 audio, canvas, video { … … 644 645 padding: 0; 645 646 position: absolute; 646 width: 1px; } 647 width: 1px; 648 } 647 649 648 650 .footer__widgets .widget {
Note: See TracChangeset
for help on using the changeset viewer.