[Pkg-javascript-commits] [mathjax] 01/01: Install accessibility-menu.js into the main extensions directory.

Dmitry Shachnev mitya57 at moszumanska.debian.org
Thu Mar 2 08:11:32 UTC 2017


This is an automated email from the git hooks/post-receive script.

mitya57 pushed a commit to branch master
in repository mathjax.

commit 43540e490c31e3cb4ac81eaa3c75b147b35d7f59
Author: Dmitry Shachnev <mitya57 at gmail.com>
Date:   Thu Mar 2 11:11:02 2017 +0300

    Install accessibility-menu.js into the main extensions directory.
    
    And make all configurations load it from there.
    Closes: #854399.
---
 debian/README.source                         |   1 +
 debian/changelog                             |   7 +
 debian/combiner/combineMJlist                |   2 +-
 debian/combiner/combineMJlist-unpacked       |   2 +-
 debian/patches/local_accessibility_menu.diff | 199 +++++++++++++++++++++++++++
 debian/patches/series                        |   1 +
 6 files changed, 210 insertions(+), 2 deletions(-)

diff --git a/debian/README.source b/debian/README.source
index 3076d77..d27c541 100644
--- a/debian/README.source
+++ b/debian/README.source
@@ -7,6 +7,7 @@ The Debian modifications are:
 
 * Use Debian yui-compressor path (`/usr/share/yui-compressor/yui-compressor.jar`)
   in `packer/packMJfile`;
+* Use local version of accessibility-menu extension in the combiner lists;
 * Replace current working directory in MathJax with `MathJax` string;
 * Do not require the configuration script.
 
diff --git a/debian/changelog b/debian/changelog
index 0fb32fb..2c107c1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+mathjax (2.7.0-2) UNRELEASED; urgency=medium
+
+  * Install accessibility-menu.js into the main extensions directory,
+    and make all configurations load it from there (closes: #854399).
+
+ -- Dmitry Shachnev <mitya57 at debian.org>  Thu, 02 Mar 2017 11:10:34 +0300
+
 mathjax (2.7.0-1) unstable; urgency=medium
 
   * New upstream release.
diff --git a/debian/combiner/combineMJlist b/debian/combiner/combineMJlist
index 94205cc..8e73331 100755
--- a/debian/combiner/combineMJlist
+++ b/debian/combiner/combineMJlist
@@ -55,7 +55,7 @@ open(CONFIG,">","$MJX/$outfile") || die "Can't write $MJX/$outfile: $!\n";
 print CONFIG $config;
 
 print CONFIG "MathJax.Hub.Config({\n";
-print CONFIG "  extensions: ['[Contrib]/a11y/accessibility-menu.js']";
+print CONFIG "  extensions: ['accessibility-menu.js']";
 print CONFIG ",\n  ",join("\n  ", at config) if scalar(@config);
 print CONFIG "\n});\n\n";
 
diff --git a/debian/combiner/combineMJlist-unpacked b/debian/combiner/combineMJlist-unpacked
index dc307b8..09dd1a0 100755
--- a/debian/combiner/combineMJlist-unpacked
+++ b/debian/combiner/combineMJlist-unpacked
@@ -42,7 +42,7 @@ foreach $file (@files) {
   if ($file =~ m!^config/(.*)!) {push(@CONFIG,"\"$1\"")}
 }
 
-push(@EXTENSIONS,'"[Contrib]/a11y/accessibility-menu.js"');
+push(@EXTENSIONS,'"accessibility-menu.js"');
 
 @HUB = ();
 push(@HUB,"config: [".join(",", at CONFIG)."]") if scalar(@CONFIG);
diff --git a/debian/patches/local_accessibility_menu.diff b/debian/patches/local_accessibility_menu.diff
new file mode 100644
index 0000000..fd16a93
--- /dev/null
+++ b/debian/patches/local_accessibility_menu.diff
@@ -0,0 +1,199 @@
+Description: load accessibility-menu.js from local extensions directory
+ This extension was loaded from external source, which is considered a privacy
+ breach. Instead we can install it and load from a local path.
+ .
+ This file is copied from MathJax-a11y repository, the changes are:
+ - replacing the file path in loadComplete call;
+ - using *['default'] instead of *.default to make yui-compressor happy.
+Author: Dmitry Shachnev <mitya57 at debian.org>
+Forwarded: not-needed
+Last-Update: 2017-02-28
+
+--- /dev/null
++++ b/unpacked/extensions/accessibility-menu.js
+@@ -0,0 +1,185 @@
++/*************************************************************
++ *
++ *  [Contrib]/a11y/accessibility-menu.js
++ *  
++ *  A thin extension to add opt-in menu items for the accessibility
++ *  extensions in the a11y contributed directory.
++ *
++ *  ---------------------------------------------------------------------
++ *  
++ *  Copyright (c) 2016 The MathJax Consortium
++ * 
++ *  Licensed under the Apache License, Version 2.0 (the "License");
++ *  you may not use this file except in compliance with the License.
++ *  You may obtain a copy of the License at
++ * 
++ *      http://www.apache.org/licenses/LICENSE-2.0
++ * 
++ *  Unless required by applicable law or agreed to in writing, software
++ *  distributed under the License is distributed on an "AS IS" BASIS,
++ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ *  See the License for the specific language governing permissions and
++ *  limitations under the License.
++ */
++
++(function(HUB,EXTENSIONS) {
++  var SETTINGS = HUB.config.menuSettings;
++  var ITEM, MENU; // filled in when MathMenu extension loads
++  
++  var BIND = (Function.prototype.bind ? function (f,t) {return f.bind(t)} :
++              function (f,t) {return function () {f.apply(t,arguments)}});
++  var KEYS = Object.keys || function (obj) {
++    var keys = [];
++    for (var id in obj) {if (obj.hasOwnProperty(id)) keys.push(id)}
++    return keys;
++  };
++  
++  //
++  //  Set up the a11y path,if it isn't already in place
++  //
++  var PATH = MathJax.Ajax.config.path;
++  if (!PATH.a11y) PATH.a11y =
++      (PATH.Contrib ? PATH.Contrib + "/a11y" : 
++      (String(location.protocol).match(/^https?:/) ? "" : "http:") + 
++        "//cdn.mathjax.org/mathjax/contrib/a11y");
++
++  var Accessibility = EXTENSIONS["accessibility-menu"] = {
++    version: '1.1',
++    prefix: '', //'Accessibility-',
++    'default': {},
++    modules: [],
++    MakeOption: function(name) {
++      return Accessibility.prefix + name;
++    },
++    GetOption: function(option) {
++      return SETTINGS[Accessibility.MakeOption(option)];
++    },
++    AddDefaults: function() {
++      var keys = KEYS(Accessibility['default']);
++      for (var i = 0, key; key = keys[i]; i++) {
++        var option = Accessibility.MakeOption(key);
++        if (typeof(SETTINGS[option]) === 'undefined') {
++          SETTINGS[option] = Accessibility['default'][key];
++        }
++      }
++    },
++    // Attaches the menu items;
++    AddMenu: function() {
++      var items = Array(this.modules.length);
++      for (var i = 0, module; module = this.modules[i]; i++) items[i] = module.placeHolder;
++      var menu = MENU.FindId('Accessibility');
++      if (menu) {
++        items.unshift(ITEM.RULE());
++        menu.submenu.items.push.apply(menu.submenu.items,items);
++      } else {
++        var renderer = (MENU.FindId("Settings","Renderer")||{}).submenu;
++        if (renderer) {
++          // move AssitiveMML and InTabOrder from Renderer to Accessibility menu
++          items.unshift(ITEM.RULE());
++          items.unshift(renderer.items.pop());
++          items.unshift(renderer.items.pop());
++        }
++        items.unshift("Accessibility");
++        var menu = ITEM.SUBMENU.apply(ITEM.SUBMENU,items);
++        var locale = MENU.IndexOfId('Locale');
++        if (locale) {
++          MENU.items.splice(locale,0,menu);
++        } else {
++          MENU.items.push(ITEM.RULE(), menu);
++        }
++      }
++    },
++    Register: function(module) {
++      Accessibility['default'][module.option] = false;
++      Accessibility.modules.push(module);
++    },
++    Startup: function() {
++      ITEM = MathJax.Menu.ITEM;
++      MENU = MathJax.Menu.menu;
++      for (var i = 0, module; module = this.modules[i]; i++) module.CreateMenu();
++      this.AddMenu();
++    },
++    LoadExtensions: function () {
++      var extensions = [];
++      for (var i = 0, module; module = this.modules[i]; i++) {
++        if (SETTINGS[module.option]) extensions.push(module.module);
++      }
++      return (extensions.length ? HUB.Startup.loadArray(extensions) : null);
++    }
++  };
++
++  var ModuleLoader = MathJax.Extension.ModuleLoader = MathJax.Object.Subclass({
++    option: '',
++    name: ['',''],
++    module: '',
++    placeHolder: null,
++    submenu: false,
++    extension: null,
++    Init: function(option, name, module, extension, submenu) {
++      this.option = option;
++      this.name = [name.replace(/ /g,''),name];
++      this.module = module;
++      this.extension = extension;
++      this.submenu = (submenu || false);
++    },
++    CreateMenu: function() {
++      var load = BIND(this.Load,this);
++      if (this.submenu) {
++        this.placeHolder =
++          ITEM.SUBMENU(this.name,
++            ITEM.CHECKBOX(["Activate","Activate"],
++                          Accessibility.MakeOption(this.option), {action: load}),
++            ITEM.RULE(),
++            ITEM.COMMAND(["OptionsWhenActive","(Options when Active)"],null,{disabled:true})
++          );
++      } else {
++        this.placeHolder = ITEM.CHECKBOX(
++          this.name, Accessibility.MakeOption(this.option), {action: load}
++        );
++      }
++    },
++    Load: function() {
++      HUB.Queue(["Require",MathJax.Ajax,this.module,["Enable",this]]);
++    },
++    Enable: function(menu) {
++      var extension = MathJax.Extension[this.extension];
++      if (extension) {
++        extension.Enable(true,true);
++        MathJax.Menu.saveCookie();
++      }
++    }
++  });
++
++  Accessibility.Register(
++    ModuleLoader(
++      'collapsible', 'Collapsible Math', '[a11y]/collapsible.js', 'collapsible'
++    )
++  );
++  Accessibility.Register(
++    ModuleLoader(
++      'autocollapse', 'Auto Collapse', '[a11y]/auto-collapse.js', 'auto-collapse'
++    )
++  );
++  Accessibility.Register(
++    ModuleLoader(
++      'explorer', 'Explorer', '[a11y]/explorer.js', 'explorer', true
++    )
++  );
++
++  Accessibility.AddDefaults();
++  
++  HUB.Register.StartupHook('End Extensions', function () {
++    HUB.Register.StartupHook('MathMenu Ready', function () {
++      Accessibility.Startup();
++      HUB.Startup.signal.Post('Accessibility Menu Ready');
++    },5);   // run before other extensions' menu hooks even if they are loaded first
++  },5);
++  
++  MathJax.Callback.Queue(
++    ["LoadExtensions",Accessibility],
++    ["loadComplete",MathJax.Ajax,"[MathJax]/extensions/accessibility-menu.js"]
++  );
++
++})(MathJax.Hub,MathJax.Extension);
++
++
diff --git a/debian/patches/series b/debian/patches/series
index a51cfdb..401b012 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 no_extra_fonts.diff
 update_url.diff
+local_accessibility_menu.diff

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/mathjax.git



More information about the Pkg-javascript-commits mailing list