<commit_before>const ErrorMessageUtil = require("../ErrorMessageUtil");

describe("ErrorMessageUtil", function() {
  describe("#translateErrorMessages", function() {
    it("should pass-through if there is no translation", function() {
      const errorInput = [
        {
          message: "message1",
          type: "TYPE1",
          path: [],
          variables: {}
        }
      ];
      const translationRules = [];

      expect(
        ErrorMessageUtil.translateErrorMessages(errorInput, translationRules)
      ).toEqual([
        {
          message: "message1",
          type: "TYPE1",
          path: [],
          variables: {}
        }
      ]);
    });

    it("should pass-through if no path matches", function() {
      const errorInput = [
        {
          message: "message1",
          type: "TYPE1",
          path: [],
          variables: {}
        }
      ];
      const translationRules = [
        {
          type: "TYPE1",
          path: /^E/,
          message: "message2"
        }
      ];

      expect(
        ErrorMessageUtil.translateErrorMessages(errorInput, translationRules)
      ).toEqual([
        {
          message: "message1",
          type: "TYPE1",
          path: [],
          variables: {}
        }
      ]);
    });

    it("should pass-through if no type matches", function() {
      const errorInput = [
        {
          message: "message1",
          type: "TYPE1",
          path: [],
          variables: {}
        }
      ];
      const translationRules = [
        {
          type: "TYPE2",
          path: /.*/,
          message: "message2"
        }
      ];

      expect(
        ErrorMessageUtil.translateErrorMessages(errorInput, translationRules)
      ).toEqual([
        {
          message: "message1",
          type: "TYPE1",
          path: [],
          variables: {}
        }
      ]);
    });

    it("should translate if path and type matches", function() {
      const errorInput = [
        {
          message: "message1",
          type: "TYPE1",
          path: [],
          variables: {}
        }
      ];
      const translationRules = [
        {
          type: "TYPE1",
          path: /.*/,
          message: "message2"
        }
      ];

      expect(
        ErrorMessageUtil.translateErrorMessages(errorInput, translationRules)
      ).toEqual([
        {
          message: "message2",
          type: "TYPE1",
          path: [],
          variables: {}
        }
      ]);
    });

    it("should not modify path if a rule matches", function() {
      const errorInput = [
        {
          message: "message1",
          type: "TYPE1",
          path: ["foo", 0, "bar"],
          variables: {}
        }
      ];
      const translationRules = [
        {
          type: "TYPE1",
          path: /.*/,
          message: "message2"
        }
      ];

      expect(
        ErrorMessageUtil.translateErrorMessages(errorInput, translationRules)
      ).toEqual([
        {
          message: "message2",
          type: "TYPE1",
          path: ["foo", 0, "bar"],
          variables: {}
        }
      ]);
    });

    it("should pick the first translation that passes", function() {
      const errorInput = [
        {
          message: "message1",
          type: "TYPE1",
          path: [],
          variables: {}
        }
      ];
      const translationRules = [
        {
          type: "TYPE1",
          path: /.*/,
          message: "message3"
        },
        {
          type: "TYPE1",
          path: /.*/,
          message: "message2"
        }
      ];

      expect(
        ErrorMessageUtil.translateErrorMessages(errorInput, translationRules)
      ).toEqual([
        {
          message: "message3",
          type: "TYPE1",
          path: [],
          variables: {}
        }
      ]);
    });

    it("should correctly replace variables", function() {
      const errorInput = [
        {
          message: "message1 is 3",
          type: "TYPE1",
          path: [],
          variables: {
            value: 3
          }
        }
      ];
      const translationRules = [
        {
          type: "TYPE1",
          path: /.*/,
          message: "message2 is {{value}}"
        }
      ];

      expect(
        ErrorMessageUtil.translateErrorMessages(errorInput, translationRules)
      ).toEqual([
        {
          message: "message2 is 3",
          type: "TYPE1",
          path: [],
          variables: {
            value: 3
          }
        }
      ]);
    });

    it("should be able to handle errors with no path", function() {
      const errorInput = [{ message: "message" }];
      const translationRules = [];

      const translatedErrors = ErrorMessageUtil.translateErrorMessages(
        errorInput,
        translationRules
      );
      expect(translatedErrors).toEqual([{ message: "message" }]);
    });

    it("should be able to handle errors with null messages", function() {
      const errorInput = [{ message: null }];
      const translationRules = [];

      const translatedErrors = ErrorMessageUtil.translateErrorMessages(
        errorInput,
        translationRules
      );
      expect(translatedErrors).toEqual([{ message: null }]);
    });
  });
});
<commit_msg>refactor(ErrorMessageUtil): adjust test descriptions<commit_after>const ErrorMessageUtil = require("../ErrorMessageUtil");

describe("ErrorMessageUtil", function() {
  describe("#translateErrorMessages", function() {
    it("passes through if there is no translation", function() {
      const errorInput = [
        {
          message: "message1",
          type: "TYPE1",
          path: [],
          variables: {}
        }
      ];
      const translationRules = [];

      expect(
        ErrorMessageUtil.translateErrorMessages(errorInput, translationRules)
      ).toEqual([
        {
          message: "message1",
          type: "TYPE1",
          path: [],
          variables: {}
        }
      ]);
    });

    it("passes through if no path matches", function() {
      const errorInput = [
        {
          message: "message1",
          type: "TYPE1",
          path: [],
          variables: {}
        }
      ];
      const translationRules = [
        {
          type: "TYPE1",
          path: /^E/,
          message: "message2"
        }
      ];

      expect(
        ErrorMessageUtil.translateErrorMessages(errorInput, translationRules)
      ).toEqual([
        {
          message: "message1",
          type: "TYPE1",
          path: [],
          variables: {}
        }
      ]);
    });

    it("passes through if no type matches", function() {
      const errorInput = [
        {
          message: "message1",
          type: "TYPE1",
          path: [],
          variables: {}
        }
      ];
      const translationRules = [
        {
          type: "TYPE2",
          path: /.*/,
          message: "message2"
        }
      ];

      expect(
        ErrorMessageUtil.translateErrorMessages(errorInput, translationRules)
      ).toEqual([
        {
          message: "message1",
          type: "TYPE1",
          path: [],
          variables: {}
        }
      ]);
    });

    it("translates if path and type matches", function() {
      const errorInput = [
        {
          message: "message1",
          type: "TYPE1",
          path: [],
          variables: {}
        }
      ];
      const translationRules = [
        {
          type: "TYPE1",
          path: /.*/,
          message: "message2"
        }
      ];

      expect(
        ErrorMessageUtil.translateErrorMessages(errorInput, translationRules)
      ).toEqual([
        {
          message: "message2",
          type: "TYPE1",
          path: [],
          variables: {}
        }
      ]);
    });

    it("does not modify path if a rule matches", function() {
      const errorInput = [
        {
          message: "message1",
          type: "TYPE1",
          path: ["foo", 0, "bar"],
          variables: {}
        }
      ];
      const translationRules = [
        {
          type: "TYPE1",
          path: /.*/,
          message: "message2"
        }
      ];

      expect(
        ErrorMessageUtil.translateErrorMessages(errorInput, translationRules)
      ).toEqual([
        {
          message: "message2",
          type: "TYPE1",
          path: ["foo", 0, "bar"],
          variables: {}
        }
      ]);
    });

    it("picks the first translation that passes", function() {
      const errorInput = [
        {
          message: "message1",
          type: "TYPE1",
          path: [],
          variables: {}
        }
      ];
      const translationRules = [
        {
          type: "TYPE1",
          path: /.*/,
          message: "message3"
        },
        {
          type: "TYPE1",
          path: /.*/,
          message: "message2"
        }
      ];

      expect(
        ErrorMessageUtil.translateErrorMessages(errorInput, translationRules)
      ).toEqual([
        {
          message: "message3",
          type: "TYPE1",
          path: [],
          variables: {}
        }
      ]);
    });

    it("replaces variables", function() {
      const errorInput = [
        {
          message: "message1 is 3",
          type: "TYPE1",
          path: [],
          variables: {
            value: 3
          }
        }
      ];
      const translationRules = [
        {
          type: "TYPE1",
          path: /.*/,
          message: "message2 is {{value}}"
        }
      ];

      expect(
        ErrorMessageUtil.translateErrorMessages(errorInput, translationRules)
      ).toEqual([
        {
          message: "message2 is 3",
          type: "TYPE1",
          path: [],
          variables: {
            value: 3
          }
        }
      ]);
    });

    it("is able to handle errors with no path", function() {
      const errorInput = [{ message: "message" }];
      const translationRules = [];

      const translatedErrors = ErrorMessageUtil.translateErrorMessages(
        errorInput,
        translationRules
      );
      expect(translatedErrors).toEqual([{ message: "message" }]);
    });

    it("is able to handle errors with null messages", function() {
      const errorInput = [{ message: null }];
      const translationRules = [];

      const translatedErrors = ErrorMessageUtil.translateErrorMessages(
        errorInput,
        translationRules
      );
      expect(translatedErrors).toEqual([{ message: null }]);
    });
  });
});
<|endoftext|>


<commit_before>module.exports = function (grunt) {
	'use strict';

	var options = {
		pkg: require('./package'), // <%%=pkg.name%>

		<% if (statix == true) {%>site: grunt.file.readYAML('statix/src/data/site.yml'),<% } %>

		// Global Grunt vars. Edit this file to change vars
		config : require('./_grunt-configs/config.js')
	};

	// Load grunt tasks automatically
	require('load-grunt-tasks')(grunt);

	// Load grunt configurations automatically
	var configs = require('load-grunt-configs')(grunt, options);
	<% if (statix === true) {%>grunt.loadNpmTasks('assemble');<% } %>

	// Define the configuration for all the tasks
	grunt.initConfig(configs);

	/* ==========================================================================
		Available tasks:
		* grunt            : run jshint, uglify and sass:kickoff
		* grunt watch      : run sass:kickoff, uglify and livereload
		* grunt dev        : run jshint, uglify and sass:kickoff
		* grunt deploy     : run jshint, uglify, sass:kickoff and csso
		* grunt serve      : watch js & scss and run a local server
		* grunt start      : run this before starting development
		* grunt icons      : generate the icons. uses svgmin and grunticon
		* grunt checks     : run jshint
		* grunt styleguide : watch js & scss, run a local server for editing the styleguide
		 ========================================================================== */

	/**
	 * GRUNT * Default task
	 * run jshint, uglify and sass:kickoff
	 */
	// Default task
	grunt.registerTask('default', [
		<% if (shims === true) {%>'shimly',<% } %>
		<% if (statix === true) {%>'clean:all',<% } %>
		<% if (browserify === true) {%>
		'newer:browserify:prod',
		<% } else { %>
		'dofilesexist:js',
		'uglify',
		<% } %>
		'sass:kickoff',
		'autoprefixer:kickoff'
		<% if (statix === true) {%>
		,'copy',
		'assemble'
		<% } %>
	]);

	/**
	 * GRUNT DEV * A task for development
	 * run jshint, uglify and sass:kickoff
	 */
	grunt.registerTask('dev', [
		<% if (shims === true) {%>'shimly',<% } %>
		<% if (statix === true) {%>'clean:all',<% } %>
		<% if (browserify === true) {%>
		'newer:browserify:dev',
		<% } else { %>
		'dofilesexist:js',
		'uglify',
		<% } %>
		'sass:kickoff',
		'autoprefixer:kickoff'
		<% if (statix === true) {%>
		,'copy',
		'assemble'
		<% } %>
	]);

	/**
	 * GRUNT DEPLOY * A task for your production environment
	 * run jshint, uglify and sass:production
	 */
	grunt.registerTask('deploy', [
		<% if (shims === true) {%>'shimly',<% } %>
		<% if (statix === true) {%>'clean:all',<% } %>
		<% if (browserify === true) {%>
		'newer:browserify:prod',
		<% } else { %>
		'dofilesexist:js',
		'uglify',
		<% } %>
		'sass:kickoff',
		'autoprefixer:kickoff',
		'csso'
		<% if (statix === true) {%>
		,'copy',
		'assemble'
		<% } %>
	]);

	/**
	 * GRUNT SERVE * A task for for a static server with a watch
	 * run connect and watch
	 */
	grunt.registerTask("serve", [
		<% if (shims === true) {%>'shimly',<% } %>
		<% if (statix === true) {%>'clean:all',<% } %>
		<% if (browserify === true) {%>
		'newer:browserify:prod',
		<% } else { %>
		'dofilesexist:js',
		'uglify',
		<% } %>
		'sass:kickoff',
		'autoprefixer:kickoff',
		<% if (statix === true) {%>
		'copy',
		'assemble',
		<% } %>
		'browserSync:serve',
		'watch'
	]);

	/**
	 * GRUNT START * Run this to
	 * run jquery builder, uglify, sass and autoprefixer
	 */
	grunt.registerTask('start', [
		<% if (shims === true) {%>'shimly',<% } %>
		<% if (statix === true) {%>'clean:all',<% } %>
		<% if (browserify === true) {%>
		'newer:browserify:prod',
		<% } else { %>
		'dofilesexist:js',
		'uglify',
		<% } %>
		'sass:kickoff',
		'sass:styleguide',
		'autoprefixer:kickoff',
		'autoprefixer:styleguide',
		<% if (statix === true) {%>
		'copy',
		'assemble',
		<% } %>
		'connect:start',
		'watch'
	]);

	/**
	 * GRUNT STYLEGUIDE * A task for the styleguide
	 * run uglify, sass:kickoff, sass:styleguide, autoprefixer:kickoff, autoprefixer:styleguide, connect:styleguide & watch
	 */
	grunt.registerTask('styleguide', [
		<% if (shims === true) {%>'shimly',<% } %>
		'dofilesexist:js',
		<% if (browserify === true) {%>
		'newer:browserify:prod',
		<% } else { %>
		'uglify',
		<% } %>
		'sass:styleguide',
		'autoprefixer:styleguide',
		<% if (statix === true) {%>
		'copy',
		'assemble',
		<% } %>
		'connect:styleguide',
		'watch'
	]);

	/**
	 * GRUNT ICONS * A task to create all icons using grunticon
	 * run clean, svgmin and grunticon
	 */
	grunt.registerTask('icons', [
		'clean:icons',
		'svgmin',
		'grunticon'
	]);

	/**
	 * GRUNT CHECKS * Check code for errors
	 * run jshint
	 */
	grunt.registerTask('checks', [
		'jshint:project',
		'scsslint'
	]);

	/**
	 * GRUNT DOFILESEXIST * Check for the existence of specific files and fail if not found
	 */
	grunt.registerMultiTask('dofilesexist', function () {

		var filePaths = this.data;
		var numFailedFiles = 0;

		if (Array.isArray(filePaths)) {

			filePaths.forEach(function(path) {

				if (!grunt.file.exists(path))
				{
					grunt.log.warn("Source file: '" + path + "' not found.");
					numFailedFiles++;
				}
			});

			if (numFailedFiles > 0) grunt.fail.warn("Please add the missing files.");
		}
	});

};
<commit_msg>improve loading of grunt tasks and config<commit_after>module.exports = function (grunt) {
	'use strict';

	var options = {
		pkg: require('./package'), // <%%=pkg.name%>

		<% if (statix == true) {%>site: grunt.file.readYAML('statix/src/data/site.yml'),<% } %>

		// Global Grunt vars. Edit this file to change vars
		config : require('./_grunt-configs/config.js')
	};

	// Load grunt tasks automatically
	require('load-grunt-tasks')(grunt, {pattern: ["grunt-*", "chotto"<% if (statix === true) {%>, "assemble"<% } %>]});

	// Load grunt configurations automatically
	var configs = require('load-grunt-configs')(grunt, options);

	// Define the configuration for all the tasks
	grunt.initConfig(configs);

	/* ==========================================================================
		Available tasks:
		* grunt            : run jshint, uglify and sass:kickoff
		* grunt watch      : run sass:kickoff, uglify and livereload
		* grunt dev        : run jshint, uglify and sass:kickoff
		* grunt deploy     : run jshint, uglify, sass:kickoff and csso
		* grunt serve      : watch js & scss and run a local server
		* grunt start      : run this before starting development
		* grunt icons      : generate the icons. uses svgmin and grunticon
		* grunt checks     : run jshint
		* grunt styleguide : watch js & scss, run a local server for editing the styleguide
		 ========================================================================== */

	/**
	 * GRUNT * Default task
	 * run jshint, uglify and sass:kickoff
	 */
	// Default task
	grunt.registerTask('default', [
		<% if (shims === true) {%>'shimly',<% } %>
		<% if (statix === true) {%>'clean:all',<% } %>
		<% if (browserify === true) {%>
		'newer:browserify:prod',
		<% } else { %>
		'dofilesexist:js',
		'uglify',
		<% } %>
		'sass:kickoff',
		'autoprefixer:kickoff'
		<% if (statix === true) {%>
		,'copy',
		'assemble'
		<% } %>
	]);

	/**
	 * GRUNT DEV * A task for development
	 * run jshint, uglify and sass:kickoff
	 */
	grunt.registerTask('dev', [
		<% if (shims === true) {%>'shimly',<% } %>
		<% if (statix === true) {%>'clean:all',<% } %>
		<% if (browserify === true) {%>
		'newer:browserify:dev',
		<% } else { %>
		'dofilesexist:js',
		'uglify',
		<% } %>
		'sass:kickoff',
		'autoprefixer:kickoff'
		<% if (statix === true) {%>
		,'copy',
		'assemble'
		<% } %>
	]);

	/**
	 * GRUNT DEPLOY * A task for your production environment
	 * run jshint, uglify and sass:production
	 */
	grunt.registerTask('deploy', [
		<% if (shims === true) {%>'shimly',<% } %>
		<% if (statix === true) {%>'clean:all',<% } %>
		<% if (browserify === true) {%>
		'newer:browserify:prod',
		<% } else { %>
		'dofilesexist:js',
		'uglify',
		<% } %>
		'sass:kickoff',
		'autoprefixer:kickoff',
		'csso'
		<% if (statix === true) {%>
		,'copy',
		'assemble'
		<% } %>
	]);

	/**
	 * GRUNT SERVE * A task for for a static server with a watch
	 * run connect and watch
	 */
	grunt.registerTask("serve", [
		<% if (shims === true) {%>'shimly',<% } %>
		<% if (statix === true) {%>'clean:all',<% } %>
		<% if (browserify === true) {%>
		'newer:browserify:prod',
		<% } else { %>
		'dofilesexist:js',
		'uglify',
		<% } %>
		'sass:kickoff',
		'autoprefixer:kickoff',
		<% if (statix === true) {%>
		'copy',
		'assemble',
		<% } %>
		'browserSync:serve',
		'watch'
	]);

	/**
	 * GRUNT START * Run this to
	 * run jquery builder, uglify, sass and autoprefixer
	 */
	grunt.registerTask('start', [
		<% if (shims === true) {%>'shimly',<% } %>
		<% if (statix === true) {%>'clean:all',<% } %>
		<% if (browserify === true) {%>
		'newer:browserify:prod',
		<% } else { %>
		'dofilesexist:js',
		'uglify',
		<% } %>
		'sass:kickoff',
		'sass:styleguide',
		'autoprefixer:kickoff',
		'autoprefixer:styleguide',
		<% if (statix === true) {%>
		'copy',
		'assemble',
		<% } %>
		'connect:start',
		'watch'
	]);

	/**
	 * GRUNT STYLEGUIDE * A task for the styleguide
	 * run uglify, sass:kickoff, sass:styleguide, autoprefixer:kickoff, autoprefixer:styleguide, connect:styleguide & watch
	 */
	grunt.registerTask('styleguide', [
		<% if (shims === true) {%>'shimly',<% } %>
		'dofilesexist:js',
		<% if (browserify === true) {%>
		'newer:browserify:prod',
		<% } else { %>
		'uglify',
		<% } %>
		'sass:styleguide',
		'autoprefixer:styleguide',
		<% if (statix === true) {%>
		'copy',
		'assemble',
		<% } %>
		'connect:styleguide',
		'watch'
	]);

	/**
	 * GRUNT ICONS * A task to create all icons using grunticon
	 * run clean, svgmin and grunticon
	 */
	grunt.registerTask('icons', [
		'clean:icons',
		'svgmin',
		'grunticon'
	]);

	/**
	 * GRUNT CHECKS * Check code for errors
	 * run jshint
	 */
	grunt.registerTask('checks', [
		'jshint:project',
		'scsslint'
	]);

	/**
	 * GRUNT DOFILESEXIST * Check for the existence of specific files and fail if not found
	 */
	grunt.registerMultiTask('dofilesexist', function () {

		var filePaths = this.data;
		var numFailedFiles = 0;

		if (Array.isArray(filePaths)) {

			filePaths.forEach(function(path) {

				if (!grunt.file.exists(path))
				{
					grunt.log.warn("Source file: '" + path + "' not found.");
					numFailedFiles++;
				}
			});

			if (numFailedFiles > 0) grunt.fail.warn("Please add the missing files.");
		}
	});

};
<|endoftext|>


<commit_before>/*
 * jQuery Address Plugin v${version}
 * http://www.asual.com/jquery/address/
 *
 * Copyright (c) 2009 Rostislav Hristov
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 *
 * Date: ${timestamp}
 */
(function ($) {

    $.address = (function () {

        var _trigger = function(name) {
            $(this).trigger(
                $.extend($.Event(name),
                    (function() {
                        var event = {
                            value: this.value(),
                            path: this.path(),
                            pathNames: this.pathNames(),
                            parameterNames: this.parameterNames(),
                            parameters: {},
                            queryString: this.queryString()
                        };
                        for (var i = 0, l = event.parameterNames.length; i < l; i++)
                            event.parameters[event.parameterNames[i]] = this.parameter(event.parameterNames[i]);
                        return event;
                    }).call(this)
                )
            );
        };

        var _init = function() {
            _trigger.call($.address, 'init');
        };

        var _change = function() {
            _trigger.call($.address, 'change');
        };

        var _getHash = function() {
            var index = _l.href.indexOf('#');
            return index != -1 ? _ec(_dc(_l.href.substr(index + 1))) : '';
        };

    	var _getWindow = function() {
    		try {
    			return top.document != undefined ? top : window;
    		} catch (e) {
    			return window;
    		}
    	};

        var _strictCheck = function(value, force) {
            if (_opts.strict)
                value = force ? (value.substr(0, 1) != '/' ? '/' + value : value) : (value == '' ? '/' : value);
            return value;
        };

        var _ieLocal = function(value, direction) {
            return (_msie && _l.protocol == 'file:') ?
                (direction ? _value.replace(/\?/, '%3F') : _value.replace(/%253F/, '?')) : value;
        };

        var _searchScript = function(el) {
            for (var i = 0, l = el.childNodes.length, s; i < l; i++) {
                if (el.childNodes[i].src)
                    _url = String(el.childNodes[i].src);
                if (s = _searchScript(el.childNodes[i]))
                    return s;
            }
        };

        var _listen = function() {
            if (!_silent) {
                var hash = _getHash();
                var diff = !(_value == hash);
                if (_safari && _version < 523) {
                    if (_length != _h.length) {
                        _length = _h.length;
                        if (typeof _stack[_length - 1] != UNDEFINED)
                            _value = _stack[_length - 1];
                        _update(false);
                    }
                } else if (_msie && _version < 7 && diff) {
                    _l.reload();
                } else if (diff) {
                    _value = hash;
                    _update(false);
                }
            }
        };

        var _update = function(internal) {
            _change();
            if (internal) {
            	_trigger.call($.address, 'internalChange');
            } else {
            	_trigger.call($.address, 'externalChange');
            }
            _st(_track, 10);
        };

        var _track = function() {
            var value = (_l.pathname + (/\/$/.test(_l.pathname) ? '' : '/') + _getters.value()).replace(/\/\//, '/').replace(/^\/$/, '');
            var fn = window[_opts.tracker];
            if (typeof fn == FUNCTION)
                fn(value);
            else if (typeof pageTracker != UNDEFINED && typeof pageTracker._trackPageview == FUNCTION)
                pageTracker._trackPageview(value);
            else if (typeof urchinTracker == FUNCTION)
                urchinTracker(value);
        };

        var _htmlWrite = function() {
            var doc = _frame.contentWindow.document;
            doc.open();
            doc.write('<title>' + _d.title + '</title>');
            doc.close();
        };

        var _load = function() {
            if (!_loaded) {
                _loaded = TRUE;
                if (_msie && _version < 8) {
                    var frameset = _d.getElementsByTagName('frameset')[0];
                    _frame = _d.createElement((frameset ? '' : 'i') + 'frame');
                    if (frameset) {
                        frameset.insertAdjacentElement('beforeEnd', _frame);
                        frameset[frameset.cols ? 'cols' : 'rows'] += ',0';
                        _frame.src = 'javascript:false';
                        _frame.noResize = true;
                        _frame.frameBorder = _frame.frameSpacing = 0;
                    } else {
                        _frame.src = 'javascript:false';
                        _frame.style.display = 'none';
                        _d.body.insertAdjacentElement('afterBegin', _frame);
                    }
                    _st(function() {
                        $(_frame).bind('load', function() {
                            var win = _frame.contentWindow;
                            var src = win.location.href;
                            _value = (typeof win[ID] != UNDEFINED ? win[ID] : '');
                            if (_value != _getHash()) {
                                _update(false);
                                _l.hash = _ieLocal(_value, TRUE);
                            }
                        });
                        if (typeof _frame.contentWindow[ID] == UNDEFINED)
                            _htmlWrite();
                    }, 50);
                } else if (_safari) {
                    if (_version < 418) {
                        $(_d.body).append('<form id="' + ID + '" style="position:absolute;top:-9999px;" method="get"></form>');
                        _form = _d.getElementById(ID);
                    }
                    if (typeof _l[ID] == UNDEFINED) _l[ID] = {};
                    if (typeof _l[ID][_l.pathname] != UNDEFINED) _stack = _l[ID][_l.pathname].split(',');
                }

                _st(function() {
                    _init();
                    _update(false);
                }, 1);

                if (_msie && _version >= 8)
                    _d.body.onhashchange = _listen;
                else
                    _si(_listen, 50);
                $('a[rel*=address:]').address();
            }
        };

        var _getters = {
            baseURL: function() {
                var url = _l.href;
                if (url.indexOf('#') != -1)
                    url = url.substr(0, url.indexOf('#'));
                if (url.substr(url.length - 1) == '/')
                    url = url.substr(0, url.length - 1);
                return url;
            },
            strict: function() {
                return _opts.strict;
            },
            history: function() {
                return _opts.history;
            },
            tracker: function() {
                return _opts.tracker;
            },
            title: function() {
                return _d.title;
            },
            value: function() {
                if (!_supported) return null;
                return _dc(_strictCheck(_ieLocal(_value, FALSE), FALSE));
            },
            path: function() {
                var value = this.value();
                return (value.indexOf('?') != -1) ? value.split('?')[0] : value;
            },
            pathNames: function() {
                var path = this.path();
                var names = path.split('/');
                if (path.substr(0, 1) == '/' || path.length == 0)
                    names.splice(0, 1);
                if (path.substr(path.length - 1, 1) == '/')
                    names.splice(names.length - 1, 1);
                return names;
            },
            queryString: function() {
                var value = this.value();
                var index = value.indexOf('?');
                if (index != -1 && index < value.length)
                	return value.substr(index + 1);
            },
            parameter: function(param) {
                var value = this.value();
                var index = value.indexOf('?');
                if (index != -1) {
                    value = value.substr(index + 1);
                    var params = value.split('&');
                    var p, i = params.length, r = [];
                    while(i--) {
                        p = params[i].split('=');
                        if (p[0] == param)
                            r.push(p[1]);
                    }
                    if (r.length != 0)
                    	return r.length != 1 ? r : r[0];
                }
            },
            parameterNames: function() {
                var value = this.value();
                var index = value.indexOf('?');
                var names = [];
                if (index != -1) {
                    value = value.substr(index + 1);
                    if (value != '' && value.indexOf('=') != -1) {
                        var params = value.split('&');
                        var i = 0;
                        while(i < params.length) {
                            names.push(params[i].split('=')[0]);
                            i++;
                        }
                    }
                }
                return names;
            }
        };

        var _setters = {
            strict: function(strict) {
                _opts.strict = strict;
            },
            history: function(history) {
                _opts.history = history;
            },
            tracker: function(tracker) {
                _opts.tracker = tracker;
            },
            title: function(title) {
                title = _dc(title);
                _st(function() {
                    _title = _d.title = title;
                    if (_juststart && _frame && _frame.contentWindow && _frame.contentWindow.document) {
                        _frame.contentWindow.document.title = title;
                        _juststart = FALSE;
                    }
                    if (!_justset && _mozilla)
                        _l.replace(_l.href.indexOf('#') != -1 ? _l.href : _l.href + '#');
                    _justset = FALSE;
                }, 50);
            },
            value: function(value) {
                value = _ec(_dc(_strictCheck(value, TRUE)));
                if (value == '/') value = '';
                if (_value == value) return;
                _justset = TRUE;
                _value = value;
                _silent = TRUE;
                _update(true);
                _stack[_h.length] = _value;
                if (_safari) {
                    if (_opts.history) {
                        _l[ID][_l.pathname] = _stack.toString();
                        _length = _h.length + 1;
                        if (_version < 418) {
                            if (_l.search == '') {
                                _form.action = '#' + _value;
                                _form.submit();
                            }
                        } else if (_version < 523 || _value == '') {
                            var evt = _d.createEvent('MouseEvents');
                            evt.initEvent('click', TRUE, TRUE);
                            var anchor = _d.createElement('a');
                            anchor.href = '#' + _value;
                            anchor.dispatchEvent(evt);
                        } else {
                            _l.hash = '#' + _value;
                        }
                    } else {
                        _l.replace('#' + _value);
                    }
                } else if (_value != _getHash()) {
                    if (_opts.history)
                        _l.hash = '#' + _ieLocal(_value, TRUE);
                    else
                        _l.replace('#' + _value);
                }
                if ((_msie && _version < 8) && _opts.history) {
                    _st(_htmlWrite, 50);
                }
                if (_safari)
                    _st(function(){ _silent = FALSE; }, 1);
                else
                    _silent = FALSE;
            }
        };

        var ID = 'jQueryAddress',
            FUNCTION = 'function',
            UNDEFINED = 'undefined',
            TRUE = true,
            FALSE = false,
            _browser = $.browser,
            _version = parseFloat($.browser.version),
            _mozilla = _browser.mozilla,
            _msie = _browser.msie,
            _opera = _browser.opera,
            _safari = _browser.safari,
            _supported = FALSE,
            _t = _getWindow(),
            _d = _t.document,
            _h = _t.history,
            _l = _t.location,
            _si = setInterval,
            _st = setTimeout,
            _dc = decodeURI,
            _ec = encodeURI,
            _agent = navigator.userAgent,
            _frame,
            _form,
            _url,
            _title = _d.title,
            _length = _h.length,
            _silent = FALSE,
            _loaded = FALSE,
            _justset = TRUE,
            _juststart = TRUE,
            _stack = [],
            _listeners = {},
            _value = _getHash(),
            _api = {},
            _opts = {history: TRUE, strict: TRUE};

        if (_msie) {
            _version = parseFloat(_agent.substr(_agent.indexOf('MSIE') + 4));
            if (_d.documentMode && _d.documentMode != _version)
            	_version = _d.documentMode != 8 ? 7 : 8;
        }

        _supported =
            (_mozilla && _version >= 1) ||
            (_msie && _version >= 6) ||
            (_opera && _version >= 9.5) ||
            (_safari && _version >= 312);

        if (_supported) {

            for (var i = 1; i < _length; i++)
                _stack.push('');

            _stack.push(_getHash());

            if (_msie && _l.hash != _getHash())
                _l.hash = '#' + _ieLocal(_getHash(), TRUE);

            if (_opera)
                history.navigationMode = 'compatible';

            _searchScript(document);
            var _qi = _url.indexOf('?');
            if (_url && _qi > -1) {
                var param, params = _url.substr(_qi + 1).split('&');
                for (var i = 0, p; p = params[i]; i++) {
                    param = p.split('=');
                    if (/^(history|strict)$/.test(param[0])) {
                        _opts[param[0]] = (isNaN(param[1]) ? /^(true|yes)$/i.test(param[1]) : (parseInt(param[1]) != 0));
                    }
                    if (/^tracker$/.test(param[0]))
                        _opts[param[0]] = param[1];
                }
            }

            $(_load);

        } else if ((!_supported && _l.href.indexOf('#') != -1) ||
            (_safari && _version < 418 && _l.href.indexOf('#') != -1 && _l.search != '')){
            _d.open();
            _d.write('<meta http-equiv="refresh" content="0;url=' +
                _l.href.substr(0, _l.href.indexOf('#')) + '" />');
            _d.close();
        } else {
            _track();
        }

        $.each(('init,change,internalChange,externalChange').split(','), function(i, name){
            _api[name] = function(data, fn){
                $($.address).bind(name, fn || data, fn && data);
                return this;
            };
        });

        $.each(('strict,history,tracker,title,value').split(','), function(i, name){
            _api[name] = function(value){
                if (typeof value != 'undefined') {
                    if (_supported)
                        _setters[name](value);
                    return $.address;
                } else {
                    return _getters[name]();
                }
            };
        });

        $.each(('baseURL,path,pathNames,queryString,parameter,parameterNames').split(','), function(i, name){
            _api[name] = function(value){
                return _getters[name](value);
            };
        });

        return _api;

    })();

    $.fn.address = function (fn) {
        $(this).click(function() {
            var value = fn ? fn.call(this) :
                /address:/.test($(this).attr('rel')) ? $(this).attr('rel').split('address:')[1].split(' ')[0] :
                $(this).attr('href').replace(/^#/, '');
            $.address.value(value);
            return false;
        });
    };

}(jQuery));<commit_msg>Refactoring and implementation of new setters.<commit_after>/*
 * jQuery Address Plugin v${version}
 * http://www.asual.com/jquery/address/
 *
 * Copyright (c) 2009 Rostislav Hristov
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 *
 * Date: ${timestamp}
 */
(function ($) {

    $.address = (function () {

        var _trigger = function(name) {
            $($.address).trigger(
                $.extend($.Event(name),
                    (function() {
                        var event = {
                            value: $.address.value(),
                            path: $.address.path(),
                            pathNames: $.address.pathNames(),
                            parameterNames: $.address.parameterNames(),
                            parameters: {},
                            queryString: $.address.queryString()
                        };
                        for (var i = 0, l = event.parameterNames.length; i < l; i++)
                            event.parameters[event.parameterNames[i]] = $.address.parameter(event.parameterNames[i]);
                        return event;
                    }).call($.address)
                )
            );
        };

        var _bind = function(value, data, fn) {
        	$($.address).bind(value, fn || data, fn && data);
        	return $.address;
        };

        var _init = function() {
            _trigger('init');
        };

        var _change = function() {
            _trigger('change');
        };

        var _getHash = function() {
            var index = _l.href.indexOf('#');
            return index != -1 ? _ec(_dc(_l.href.substr(index + 1))) : '';
        };

    	var _getWindow = function() {
    		try {
    			return top.document != undefined ? top : window;
    		} catch (e) {
    			return window;
    		}
    	};

        var _strictCheck = function(value, force) {
            if (_opts.strict)
                value = force ? (value.substr(0, 1) != '/' ? '/' + value : value) : (value == '' ? '/' : value);
            return value;
        };

        var _ieLocal = function(value, direction) {
            return (_msie && _l.protocol == 'file:') ?
                (direction ? _value.replace(/\?/, '%3F') : _value.replace(/%253F/, '?')) : value;
        };

        var _searchScript = function(el) {
            for (var i = 0, l = el.childNodes.length, s; i < l; i++) {
                if (el.childNodes[i].src)
                    _url = String(el.childNodes[i].src);
                if (s = _searchScript(el.childNodes[i]))
                    return s;
            }
        };

        var _listen = function() {
            if (!_silent) {
                var hash = _getHash(),
                	diff = !(_value == hash);
                if (_safari && _version < 523) {
                    if (_length != _h.length) {
                        _length = _h.length;
                        if (typeof _stack[_length - 1] != UNDEFINED)
                            _value = _stack[_length - 1];
                        _update(false);
                    }
                } else if (_msie && _version < 7 && diff) {
                    _l.reload();
                } else if (diff) {
                    _value = hash;
                    _update(false);
                }
            }
        };

        var _update = function(internal) {
            _change();
            if (internal) {
            	_trigger('internalChange');
            } else {
            	_trigger('externalChange');
            }
            _st(_track, 10);
        };

        var _track = function() {
            var value = (_l.pathname + (/\/$/.test(_l.pathname) ? '' : '/') + $.address.value()).replace(/\/\//, '/').replace(/^\/$/, ''),
            	fn = window[_opts.tracker];
            if (typeof fn == FUNCTION)
                fn(value);
            else if (typeof pageTracker != UNDEFINED && typeof pageTracker._trackPageview == FUNCTION)
                pageTracker._trackPageview(value);
            else if (typeof urchinTracker == FUNCTION)
                urchinTracker(value);
        };

        var _htmlWrite = function() {
            var doc = _frame.contentWindow.document;
            doc.open();
            doc.write('<title>' + _d.title + '</title>');
            doc.close();
        };

        var _load = function() {
            if (!_loaded) {
                _loaded = TRUE;
                if (_msie && _version < 8) {
                    var frameset = _d.getElementsByTagName('frameset')[0];
                    _frame = _d.createElement((frameset ? '' : 'i') + 'frame');
                    if (frameset) {
                        frameset.insertAdjacentElement('beforeEnd', _frame);
                        frameset[frameset.cols ? 'cols' : 'rows'] += ',0';
                        _frame.src = 'javascript:false';
                        _frame.noResize = true;
                        _frame.frameBorder = _frame.frameSpacing = 0;
                    } else {
                        _frame.src = 'javascript:false';
                        _frame.style.display = 'none';
                        _d.body.insertAdjacentElement('afterBegin', _frame);
                    }
                    _st(function() {
                        $(_frame).bind('load', function() {
                            var win = _frame.contentWindow;
                            var src = win.location.href;
                            _value = (typeof win[ID] != UNDEFINED ? win[ID] : '');
                            if (_value != _getHash()) {
                                _update(false);
                                _l.hash = _ieLocal(_value, TRUE);
                            }
                        });
                        if (typeof _frame.contentWindow[ID] == UNDEFINED)
                            _htmlWrite();
                    }, 50);
                } else if (_safari) {
                    if (_version < 418) {
                        $(_d.body).append('<form id="' + ID + '" style="position:absolute;top:-9999px;" method="get"></form>');
                        _form = _d.getElementById(ID);
                    }
                    if (typeof _l[ID] == UNDEFINED) _l[ID] = {};
                    if (typeof _l[ID][_l.pathname] != UNDEFINED) _stack = _l[ID][_l.pathname].split(',');
                }

                _st(function() {
                    _init();
                    _update(false);
                }, 1);

                if (_msie && _version >= 8)
                    _d.body.onhashchange = _listen;
                else
                    _si(_listen, 50);
                $('a[rel*=address:]').address();
            }
        };

        var ID = 'jQueryAddress',
            FUNCTION = 'function',
            UNDEFINED = 'undefined',
            TRUE = true,
            FALSE = false,
            _browser = $.browser,
            _version = parseFloat($.browser.version),
            _mozilla = _browser.mozilla,
            _msie = _browser.msie,
            _opera = _browser.opera,
            _safari = _browser.safari,
            _supported = FALSE,
            _t = _getWindow(),
            _d = _t.document,
            _h = _t.history,
            _l = _t.location,
            _si = setInterval,
            _st = setTimeout,
            _dc = decodeURI,
            _ec = encodeURI,
            _agent = navigator.userAgent,
            _frame,
            _form,
            _url,
            _title = _d.title,
            _length = _h.length,
            _silent = FALSE,
            _loaded = FALSE,
            _justset = TRUE,
            _juststart = TRUE,
            _stack = [],
            _listeners = {},
            _value = _getHash(),
            _api = {},
            _opts = {history: TRUE, strict: TRUE};

        if (_msie) {
            _version = parseFloat(_agent.substr(_agent.indexOf('MSIE') + 4));
            if (_d.documentMode && _d.documentMode != _version)
            	_version = _d.documentMode != 8 ? 7 : 8;
        }

        _supported =
            (_mozilla && _version >= 1) ||
            (_msie && _version >= 6) ||
            (_opera && _version >= 9.5) ||
            (_safari && _version >= 312);

        if (_supported) {

            for (var i = 1; i < _length; i++)
                _stack.push('');

            _stack.push(_getHash());

            if (_msie && _l.hash != _getHash())
                _l.hash = '#' + _ieLocal(_getHash(), TRUE);

            if (_opera)
                history.navigationMode = 'compatible';

            _searchScript(document);
            var _qi = _url.indexOf('?');
            if (_url && _qi > -1) {
                var param, params = _url.substr(_qi + 1).split('&');
                for (var i = 0, p; p = params[i]; i++) {
                    param = p.split('=');
                    if (/^(history|strict)$/.test(param[0])) {
                        _opts[param[0]] = (isNaN(param[1]) ? /^(true|yes)$/i.test(param[1]) : (parseInt(param[1]) != 0));
                    }
                    if (/^tracker$/.test(param[0]))
                        _opts[param[0]] = param[1];
                }
            }

            $(_load);

        } else if ((!_supported && _l.href.indexOf('#') != -1) ||
            (_safari && _version < 418 && _l.href.indexOf('#') != -1 && _l.search != '')){
            _d.open();
            _d.write('<meta http-equiv="refresh" content="0;url=' +
                _l.href.substr(0, _l.href.indexOf('#')) + '" />');
            _d.close();
        } else {
            _track();
        }

        return {
        	init: function(data, fn){
            	$(this).bind('init', fn || data, fn && data);
            	return this;
        	},
        	change: function(data, fn){
            	$(this).bind('change', fn || data, fn && data);
            	return this;
        	},
        	internalChange: function(data, fn){
            	$(this).bind('internalChange', fn || data, fn && data);
            	return this;
        	},
        	externalChange: function(data, fn){
            	$(this).bind('externalChange', fn || data, fn && data);
            	return this;
        	},
        	baseURL: function() {
                var url = _l.href;
                if (url.indexOf('#') != -1)
                    url = url.substr(0, url.indexOf('#'));
                if (url.substr(url.length - 1) == '/')
                    url = url.substr(0, url.length - 1);
                return url;
        	},
        	strict: function(value) {
        		if (value) {
        			_opts.strict = value;
        			return this;
        		}
    			return _opts.strict;
            },
            history: function(value) {
        		if (value) {
        			_opts.history = value;
        			return this;
        		}
    			return _opts.history;
            },
            tracker: function(value) {
        		if (value) {
        			_opts.tracker = value;
        			return this;
        		}
    			return _opts.tracker;
            },
            title: function(value) {
            	if (value) {
            		value = _dc(value);
                    _st(function() {
                        _title = _d.title = value;
                        if (_juststart && _frame && _frame.contentWindow && _frame.contentWindow.document) {
                            _frame.contentWindow.document.title = value;
                            _juststart = FALSE;
                        }
                        if (!_justset && _mozilla)
                            _l.replace(_l.href.indexOf('#') != -1 ? _l.href : _l.href + '#');
                        _justset = FALSE;
                    }, 50);
                    return this;
            	}
                return _d.title;
        	},
            value: function(value) {
        		if (value) {
                    value = _ec(_dc(_strictCheck(value, TRUE)));
                    if (value == '/') value = '';
                    if (_value == value) return;
                    _justset = TRUE;
                    _value = value;
                    _silent = TRUE;
                    _update(true);
                    _stack[_h.length] = _value;
                    if (_safari) {
                        if (_opts.history) {
                            _l[ID][_l.pathname] = _stack.toString();
                            _length = _h.length + 1;
                            if (_version < 418) {
                                if (_l.search == '') {
                                    _form.action = '#' + _value;
                                    _form.submit();
                                }
                            } else if (_version < 523 || _value == '') {
                                var evt = _d.createEvent('MouseEvents');
                                evt.initEvent('click', TRUE, TRUE);
                                var anchor = _d.createElement('a');
                                anchor.href = '#' + _value;
                                anchor.dispatchEvent(evt);
                            } else {
                                _l.hash = '#' + _value;
                            }
                        } else {
                            _l.replace('#' + _value);
                        }
                    } else if (_value != _getHash()) {
                        if (_opts.history)
                            _l.hash = '#' + _ieLocal(_value, TRUE);
                        else
                            _l.replace('#' + _value);
                    }
                    if ((_msie && _version < 8) && _opts.history) {
                        _st(_htmlWrite, 50);
                    }
                    if (_safari)
                        _st(function(){ _silent = FALSE; }, 1);
                    else
                        _silent = FALSE;
                    return this;
        		}
                if (!_supported) return null;
                return _dc(_strictCheck(_ieLocal(_value, FALSE), FALSE));
            },
            path: function(value) {
            	if (value) {
                    var qs = this.queryString();
                	this.value(value + (qs ? '?' + qs : ''));
                	return this;
            	}
                var value = this.value();
                return (value.indexOf('?') != -1) ? value.split('?')[0] : value;
            },
            queryString: function(value) {
            	if (value) {
            		this.value(this.path() + (value ? '?' + value : ''));
            		return this;
            	}
                var value = this.value(),
                	index = value.indexOf('?');
                if (index != -1 && index < value.length)
                	return value.substr(index + 1);
            },
            parameter: function(name, value, append) {
            	if (value) {
            		var names = this.parameterNames(),
            			params = [];
            		for (var i = 0; i < names.length; i++) {
            			var n = names[i],
            				v = this.parameter(n);
            			if (typeof v == 'string')
            				v = [v];
            			if (n == name)
            				v = append ? v.concat([value]) : [value];
        				for (var j = 0; j < v.length; j++)
                			params.push(n + '=' + v[j]);
            		}
            		this.queryString(params.join('&'));
            		return this;
            	}
                var value = this.value(),
                	index = value.indexOf('?');
                if (index != -1) {
                    value = value.substr(index + 1);
                    var params = value.split('&'),
                    	r = [];
                    for (var i = 0; i < params.length; i++) {
                        var p = params[i].split('=');
                        if (p[0] == name)
                            r.push(p[1]);
                    }
                    if (r.length != 0)
                    	return r.length != 1 ? r : r[0];
                }
            },
            pathNames: function() {
                var path = this.path(),
                	names = path.split('/');
                if (path.substr(0, 1) == '/' || path.length == 0)
                    names.splice(0, 1);
                if (path.substr(path.length - 1, 1) == '/')
                    names.splice(names.length - 1, 1);
                return names;
            },
            parameterNames: function() {
                var value = this.value(),
	            	index = value.indexOf('?'),
                	names = [];
                if (index != -1) {
                    value = value.substr(index + 1);
                    if (value != '' && value.indexOf('=') != -1) {
                        var params = value.split('&');
                        for (var i = 0; i < params.length; i++) {
                        	var name = params[i].split('=')[0];
                        	if ($.inArray(name, names) == -1)
                        		names.push(name);
                        }
                    }
                }
                return names;
            }
        };

    })();

    $.fn.address = function (fn) {
        $(this).click(function() {
            var value = fn ? fn.call(this) :
                /address:/.test($(this).attr('rel')) ? $(this).attr('rel').split('address:')[1].split(' ')[0] :
                $(this).attr('href').replace(/^#/, '');
            $.address.value(value);
            return false;
        });
    };

}(jQuery));<|endoftext|>


<commit_before>fs = require('fs');
//__________________________________________functions_____________________________________________________________
function setCharAt(str,index,chr) {
    if(index > str.lenarr_idxth-1) return str;
    return str.substring(0,index) + chr + str.substring(index+1);
}

function num_set_Locale(re, str) {
    var midstring;
    if (str.search(re) != -1) {
        return true
    } else {
        return false
    }
    console.log(str + midstring + re);
}

function alghoritm_of_changing_dates_and_numbes(){
    for(let i =0; i<substring_locale_dates.length; i++){
        fs.writeFileSync(inputdata+substring_locale_dates[i], etalon1, function (err) {
            if (err) return console.log(err);
        });
        fs.writeFileSync(inputnum+substring_locale_dates[i], substrinputs, function (err) {
            if (err) return console.log(err);
        });
    };
}
module.exports.alghoritm_of_changing_dates_and_numbes = alghoritm_of_changing_dates_and_numbes;
//____________________________________________readinarr_idxpath___________________________________________________
let inputnum = "../numbers/"
let inputdata = "../data/"
let inputDec = "../DecSep/"
let inputGr = "../GrSep/";
let input = "../numbers";
let etalon1input = "../data/en-US.txt";
let elanon2input = "../numbers/en-US.txt";
let outputdata = "../Outputdata.txt";
let outputnum = "../Outputnum.txt";
let outputetalon1 = "../Outputetalonfordata.txt";
let outputetalon2 = "../Outputetalonfornum.txt";
//_________________________________________input_count______________________________________________________________________

let numbersforDec = fs.readdirSync(inputDec,"utf-8",function(err,data){
    if (err) return console.log(err);
    console.log('err > helloworld.txt');
});
let numbersforGr = fs.readdirSync(inputGr,"utf-8",function(err,data){
    if (err) return console.log(err);
    console.log('err > helloworld.txt');
});
let numbers = fs.readdirSync(input,"utf-8",function(err,data){
    if (err) return console.log(err);
    console.log('err > helloworld.txt');
});
let etalon1 = fs.readFileSync(etalon1input,"utf-8",function(err,data){
    if (err) return console.log(err);
    console.log('err > helloworld.txt');
});
let etalon2 = fs.readFileSync(elanon2input,"utf-8",function(err,data){
    if (err) return console.log(err);
    console.log('err > .txt');
});
//_________________________________________variables_________________________________________________________________________
let string_locale_dates= [];
let string_of_decimal_separators=[];
let string_of_group_separators=[];
let string_locale_numbers_separators= [];
let substring_locale_dates = [];
let substring_locale_numbers_separators =[];
let substrdec1 =[];
let substrdec2 = [];
let substrinputs = [];
let Clasified_array_of_the_no_eng_locales = [];
let repacked_array_of_dates_without_eng_etalon = [];
let repacked_array_of_numbers_without_eng_etalon = [];
let names_of_not_etalon_dates = [];
let names_of_not_etalon_numbers = [];
let arr_idx_decimal_sep = [];
let arr_idx_groups_sep =[];
let splited_repacked_arr_of_dates = [];
let splited_repacked_arr_of_numbers = [];
let k=0;//idx
let o =0;//idx
let repackarr_for_dates = [];
let repackarr_for_numbers = [];
let etalarr_for_dates = etalon1.split(("\r\n"));
let etalarr_for_numbers = etalon2.split(("\r\n"));
let names_of_repacked_dates = [];
let names_of_repacked_numbers = [];//____________________________________________initialisating_____________________________________________________
//_______________________________________readingfromfiles______________________________________
for(let i =0;i<numbersforDec.length;i++){
    string_of_decimal_separators[i] =fs.readFileSync(inputDec + numbersforDec[i],"utf-8",function(err,data){
        if (err) return console.log(err);
        console.log('err > helloworld.txt');
    });
};

for(let i =0;i<numbersforGr.length;i++){
    string_of_group_separators[i] =fs.readFileSync(inputGr + numbersforGr[i],"utf-8",function(err,data){
        if (err) return console.log(err);
        console.log('err > ');
    });

};

for(let i =0;i<numbers.length;i++) {
    string_locale_numbers_separators[i] =fs.readFileSync(inputnum+numbers[i],"utf-8",function(err,data){
        if (err) return console.loarr_idx(err);
        console.log('err > .txt');
    })};

for(let i =0;i<numbers.length;i++) {
    string_locale_dates[i] =fs.readFileSync(inputdata+numbers[i],"utf-8",function(err,data){
        if (err) return console.loarr_idx(err);
        console.log('err > .txt');
    })};
//_______________________________________readingfromfilesend___________________________________
for(let i =0; i<numbers.length; i++){
    if (num_set_Locale("-",numbers[i])==true) {} else{
        substring_locale_dates.push(numbers[i]);
        substring_locale_numbers_separators.push(numbers[i-1]);
    }
};

for(let i =0; i<numbers.length; i++){
    if (num_set_Locale("-",numbers[i])==true) {} else{
        substrdec1.push(numbers[i]);
        substrdec2.push(numbers[i-1]);
    }
};

let substrdateinputs = [];
//_______________________________________writingtothefile_and_specialinput_______________________
for(let i =0; i<substring_locale_dates.length; i++){
    substrinputs[i] = fs.readFileSync(inputnum+substring_locale_numbers_separators[i],"utf-8",function(err,data){
        if (err) return console.log(err);
        console.log('err > .txt');
    })
    substrdateinputs[i] = fs.readFileSync(inputdata+substring_locale_numbers_separators[i],"utf-8",function(err,data){
        if (err) return console.log(err);
        console.log('err > .txt');
    })

};

//__________________________________________proof__________________________________________________________________
for(let i =0;i<etalon2.length;i++){

    if(etalon2[i]==="."){
        arr_idx_decimal_sep.push(i);
    }
};

for(let i =0;i<etalon2.length;i++){
    if(etalon2[i]===","){
        arr_idx_groups_sep.push(i);
    }
};

for(let i = 0;i<string_of_group_separators.length;i++){
    if(num_set_Locale('\u00A0', string_of_group_separators[i])==true)
        string_of_group_separators[i] =  string_of_group_separators[i].replace('\u00A0','\u0020' );}

for(let i =0;i<string_locale_numbers_separators.length;i++){
    k=0;
    while(k<arr_idx_decimal_sep.length) {
        if (string_locale_numbers_separators[i][arr_idx_decimal_sep[k]] == string_of_decimal_separators[i][0]) {
            string_locale_numbers_separators[i] = setCharAt(string_locale_numbers_separators[i],arr_idx_decimal_sep[k],'.');;
        }
        k++;
    }
};

for(let i =0;i<string_locale_numbers_separators.length;i++){
    o=0;
    while(o<arr_idx_groups_sep.length) {

        if (string_locale_numbers_separators[i][arr_idx_groups_sep[o]] == string_of_group_separators[i][1]) {
            string_locale_numbers_separators[i] = setCharAt(string_locale_numbers_separators[i],arr_idx_groups_sep[o],',');;
        }

        o++;
    }
};
//___________________________________________repacking__________________________________________________________________
for(let i =0;i<numbers.length;i++){

    if(string_locale_dates[i]===etalon1){}else{

        repacked_array_of_dates_without_eng_etalon.push(string_locale_dates[i]);
        names_of_not_etalon_dates.push(numbers[i]);
    }
    if(string_locale_numbers_separators[i]===etalon2){}else{

        repacked_array_of_numbers_without_eng_etalon.push(string_locale_numbers_separators[i]);
        names_of_not_etalon_numbers.push(numbers[i]);
    }
};

for(let i = 0; i<repacked_array_of_dates_without_eng_etalon.length;i++){

    splited_repacked_arr_of_dates[i] = (repacked_array_of_dates_without_eng_etalon[i]).split("\r\n")
};

for(let i = 0; i<repacked_array_of_numbers_without_eng_etalon.length;i++){

    splited_repacked_arr_of_numbers[i] = (repacked_array_of_numbers_without_eng_etalon[i]).split("\r\n")
};

for(let i = 0; i < splited_repacked_arr_of_dates.length; i++) {
    for (let j = 0; j < etalarr_for_dates.length; j++) {

        if (splited_repacked_arr_of_dates[i][j] === etalarr_for_dates[j]) {
        } else {
            repackarr_for_dates.push(splited_repacked_arr_of_dates[i][j])
            names_of_repacked_dates.push(names_of_not_etalon_dates[i])

        }
    }
};

for(let i = 0; i < splited_repacked_arr_of_numbers.length; i++) {
    for (let j = 0; j < etalarr_for_numbers.length; j++) {

        if (splited_repacked_arr_of_numbers[i][j] === etalarr_for_numbers[j]) {
        } else {

            repackarr_for_numbers.push(splited_repacked_arr_of_numbers[i][j])
            names_of_repacked_numbers.push(names_of_not_etalon_numbers[i])

        }
    }
};
//_______________________________________________________proofcheck________________________________________________________
for(let i =0 ; i< string_locale_numbers_separators.length;i++) if (string_locale_numbers_separators[i]==etalon2) { }else{ console.log("F "+ i);};
//__________________________________________________output_________________________________________________________________

for(let i=0;i<repackarr_for_dates.length;i++){

    outputarr1[i] = repackarr_for_dates[i]+" "+ names_of_repacked_dates[i]+"\r\n";
}

fs.writeFileSync(outputdata, Clasified_array_of_the_no_eng_locales, "utf-8");

fs.writeFileSync(outputnum, repackarr_for_numbers+names_of_repacked_numbers,"utf-8");

fs.writeFileSync(outputetalon1, etalarr_for_dates, "utf-8");

fs.writeFileSync(outputetalon2, etalarr_for_numbers, "utf-8");
<commit_msg>[se] changed output<commit_after>fs = require('fs');
//__________________________________________functions_____________________________________________________________
function setCharAt(str,index,chr) {
    if(index > str.lenarr_idxth-1) return str;
    return str.substring(0,index) + chr + str.substring(index+1);
}

function num_set_Locale(re, str) {
    var midstring;
    if (str.search(re) != -1) {
        return true
    } else {
        return false
    }
    console.log(str + midstring + re);
}

function alghoritm_of_changing_dates_and_numbes(){
    for(let i =0; i<substring_locale_dates.length; i++){
        fs.writeFileSync(inputdata+substring_locale_dates[i], etalon1, function (err) {
            if (err) return console.log(err);
        });
        fs.writeFileSync(inputnum+substring_locale_dates[i], substrinputs, function (err) {
            if (err) return console.log(err);
        });
    };
}
module.exports.alghoritm_of_changing_dates_and_numbes = alghoritm_of_changing_dates_and_numbes;
//____________________________________________readinarr_idxpath___________________________________________________
let inputnum = "../numbers/"
let inputdata = "../data/"
let inputDec = "../DecSep/"
let inputGr = "../GrSep/";
let input = "../numbers";
let etalon1input = "../data/en-US.txt";
let elanon2input = "../numbers/en-US.txt";
let outputdata = "../output/Outputdata.txt";
let outputnum = "../output/Outputnum.txt";
let outputetalon1 = "../output/Outputetalonfordata.txt";
let outputetalon2 = "../output/Outputetalonfornum.txt";
//_________________________________________input_count______________________________________________________________________

let numbersforDec = fs.readdirSync(inputDec,"utf-8",function(err,data){
    if (err) return console.log(err);
    console.log('err > helloworld.txt');
});
let numbersforGr = fs.readdirSync(inputGr,"utf-8",function(err,data){
    if (err) return console.log(err);
    console.log('err > helloworld.txt');
});
let numbers = fs.readdirSync(input,"utf-8",function(err,data){
    if (err) return console.log(err);
    console.log('err > helloworld.txt');
});
let etalon1 = fs.readFileSync(etalon1input,"utf-8",function(err,data){
    if (err) return console.log(err);
    console.log('err > helloworld.txt');
});
let etalon2 = fs.readFileSync(elanon2input,"utf-8",function(err,data){
    if (err) return console.log(err);
    console.log('err > .txt');
});
//_________________________________________variables_________________________________________________________________________
let string_locale_dates= [];
let string_of_decimal_separators=[];
let string_of_group_separators=[];
let string_locale_numbers_separators= [];
let substring_locale_dates = [];
let substring_locale_numbers_separators =[];
let substrdec1 =[];
let substrdec2 = [];
let substrinputs = [];
let Clasified_array_of_the_no_eng_locales = [];
let repacked_array_of_dates_without_eng_etalon = [];
let repacked_array_of_numbers_without_eng_etalon = [];
let names_of_not_etalon_dates = [];
let names_of_not_etalon_numbers = [];
let arr_idx_decimal_sep = [];
let arr_idx_groups_sep =[];
let splited_repacked_arr_of_dates = [];
let splited_repacked_arr_of_numbers = [];
let k=0;//idx
let o =0;//idx
let repackarr_for_dates = [];
let repackarr_for_numbers = [];
let etalarr_for_dates = etalon1.split(("\r\n"));
let etalarr_for_numbers = etalon2.split(("\r\n"));
let names_of_repacked_dates = [];
let names_of_repacked_numbers = [];//____________________________________________initialisating_____________________________________________________
//_______________________________________readingfromfiles______________________________________
for(let i =0;i<numbersforDec.length;i++){
    string_of_decimal_separators[i] =fs.readFileSync(inputDec + numbersforDec[i],"utf-8",function(err,data){
        if (err) return console.log(err);
        console.log('err > helloworld.txt');
    });
};

for(let i =0;i<numbersforGr.length;i++){
    string_of_group_separators[i] =fs.readFileSync(inputGr + numbersforGr[i],"utf-8",function(err,data){
        if (err) return console.log(err);
        console.log('err > ');
    });

};

for(let i =0;i<numbers.length;i++) {
    string_locale_numbers_separators[i] =fs.readFileSync(inputnum+numbers[i],"utf-8",function(err,data){
        if (err) return console.loarr_idx(err);
        console.log('err > .txt');
    })};

for(let i =0;i<numbers.length;i++) {
    string_locale_dates[i] =fs.readFileSync(inputdata+numbers[i],"utf-8",function(err,data){
        if (err) return console.loarr_idx(err);
        console.log('err > .txt');
    })};
//_______________________________________readingfromfilesend___________________________________
for(let i =0; i<numbers.length; i++){
    if (num_set_Locale("-",numbers[i])==true) {} else{
        substring_locale_dates.push(numbers[i]);
        substring_locale_numbers_separators.push(numbers[i-1]);
    }
};

for(let i =0; i<numbers.length; i++){
    if (num_set_Locale("-",numbers[i])==true) {} else{
        substrdec1.push(numbers[i]);
        substrdec2.push(numbers[i-1]);
    }
};

let substrdateinputs = [];
//_______________________________________writingtothefile_and_specialinput_______________________
for(let i =0; i<substring_locale_dates.length; i++){
    substrinputs[i] = fs.readFileSync(inputnum+substring_locale_numbers_separators[i],"utf-8",function(err,data){
        if (err) return console.log(err);
        console.log('err > .txt');
    })
    substrdateinputs[i] = fs.readFileSync(inputdata+substring_locale_numbers_separators[i],"utf-8",function(err,data){
        if (err) return console.log(err);
        console.log('err > .txt');
    })

};

//__________________________________________proof__________________________________________________________________
for(let i =0;i<etalon2.length;i++){

    if(etalon2[i]==="."){
        arr_idx_decimal_sep.push(i);
    }
};

for(let i =0;i<etalon2.length;i++){
    if(etalon2[i]===","){
        arr_idx_groups_sep.push(i);
    }
};

for(let i = 0;i<string_of_group_separators.length;i++){
    if(num_set_Locale('\u00A0', string_of_group_separators[i])==true)
        string_of_group_separators[i] =  string_of_group_separators[i].replace('\u00A0','\u0020' );}

for(let i =0;i<string_locale_numbers_separators.length;i++){
    k=0;
    while(k<arr_idx_decimal_sep.length) {
        if (string_locale_numbers_separators[i][arr_idx_decimal_sep[k]] == string_of_decimal_separators[i][0]) {
            string_locale_numbers_separators[i] = setCharAt(string_locale_numbers_separators[i],arr_idx_decimal_sep[k],'.');;
        }
        k++;
    }
};

for(let i =0;i<string_locale_numbers_separators.length;i++){
    o=0;
    while(o<arr_idx_groups_sep.length) {

        if (string_locale_numbers_separators[i][arr_idx_groups_sep[o]] == string_of_group_separators[i][1]) {
            string_locale_numbers_separators[i] = setCharAt(string_locale_numbers_separators[i],arr_idx_groups_sep[o],',');;
        }

        o++;
    }
};
//___________________________________________repacking__________________________________________________________________
for(let i =0;i<numbers.length;i++){

    if(string_locale_dates[i]===etalon1){}else{

        repacked_array_of_dates_without_eng_etalon.push(string_locale_dates[i]);
        names_of_not_etalon_dates.push(numbers[i]);
    }
    if(string_locale_numbers_separators[i]===etalon2){}else{

        repacked_array_of_numbers_without_eng_etalon.push(string_locale_numbers_separators[i]);
        names_of_not_etalon_numbers.push(numbers[i]);
    }
};

for(let i = 0; i<repacked_array_of_dates_without_eng_etalon.length;i++){

    splited_repacked_arr_of_dates[i] = (repacked_array_of_dates_without_eng_etalon[i]).split("\r\n")
};

for(let i = 0; i<repacked_array_of_numbers_without_eng_etalon.length;i++){

    splited_repacked_arr_of_numbers[i] = (repacked_array_of_numbers_without_eng_etalon[i]).split("\r\n")
};

for(let i = 0; i < splited_repacked_arr_of_dates.length; i++) {
    for (let j = 0; j < etalarr_for_dates.length; j++) {

        if (splited_repacked_arr_of_dates[i][j] === etalarr_for_dates[j]) {
        } else {
            repackarr_for_dates.push(splited_repacked_arr_of_dates[i][j])
            names_of_repacked_dates.push(names_of_not_etalon_dates[i])

        }
    }
};

for(let i = 0; i < splited_repacked_arr_of_numbers.length; i++) {
    for (let j = 0; j < etalarr_for_numbers.length; j++) {

        if (splited_repacked_arr_of_numbers[i][j] === etalarr_for_numbers[j]) {
        } else {

            repackarr_for_numbers.push(splited_repacked_arr_of_numbers[i][j])
            names_of_repacked_numbers.push(names_of_not_etalon_numbers[i])

        }
    }
};
//_______________________________________________________proofcheck________________________________________________________
for(let i =0 ; i< string_locale_numbers_separators.length;i++) if (string_locale_numbers_separators[i]==etalon2) { }else{ console.log("F "+ i);};
//__________________________________________________output_________________________________________________________________

for(let i=0;i<repackarr_for_dates.length;i++){

    outputarr1[i] = repackarr_for_dates[i]+" "+ names_of_repacked_dates[i]+"\r\n";
}

fs.writeFileSync(outputdata, Clasified_array_of_the_no_eng_locales, "utf-8");

fs.writeFileSync(outputnum, repackarr_for_numbers+names_of_repacked_numbers,"utf-8");

fs.writeFileSync(outputetalon1, etalarr_for_dates, "utf-8");

fs.writeFileSync(outputetalon2, etalarr_for_numbers, "utf-8");
<|endoftext|>


<commit_before>/*
 * jQuery Shorten plugin 1.0.0
 *
 * Copyright (c) 2013 Viral Patel
 * http://viralpatel.net
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 */

 /*
 ** updated by Jeff Richardson
 ** Updated to use strict,
 ** IE 7 has a "bug" It is returning underfined when trying to reference string characters in this format
 ** content[i]. IE 7 allows content.charAt(i) This works fine in all modern browsers.
 ** I've also added brackets where they werent added just for readability (mostly for me).
 */

 (function($) {
    $.fn.shorten = function (settings) {

    "use strict";

        var config = {
            showChars: 100,
            ellipsesText: "...",
            moreText: "more",
            lessText: "less",
            errMsg: null
        };

        if (settings) {
            $.extend(config, settings);
        }

        $(document).off("click", '.morelink');

        $(document).on({click: function () {

                var $this = $(this);
                if ($this.hasClass('less')) {
                    $this.removeClass('less');
                    $this.html(config.moreText);
                    $this.parent().prev().prev().show(); // shortcontent
                    $this.parent().prev().hide(); // allcontent

                } else {
                    $this.addClass('less');
                    $this.html(config.lessText);
                    $this.parent().prev().prev().hide(); // shortcontent
                    $this.parent().prev().show(); // allcontent
                }
                return false;
            }
        }, '.morelink');

    return this.each(function () {
        var $this = $(this);

        var content = $this.html();
        var contentlen = $this.text().length;
        if (contentlen > config.showChars) {
            var c = content.substr(0, config.showChars);
            if (c.indexOf('<') >= 0) // If there's HTML don't want to cut it
            {
                var inTag = false; // I'm in a tag?
                var bag = ''; // Put the characters to be shown here
                var countChars = 0; // Current bag size
                var openTags = []; // Stack for opened tags, so I can close them later
                var tagName = null;

                for (var i = 0, r=0; r <= config.showChars; i++) {
                    if (content[i] == '<' && !inTag) {
                        inTag = true;

                        // This could be "tag" or "/tag"
                        tagName = content.substring(i + 1, content.indexOf('>', i));

                        // If its a closing tag
                        if (tagName[0] == '/') {

                            if (tagName != '/' + openTags[0]) {
                                config.errMsg = 'ERROR en HTML: the top of the stack should be the tag that closes';
                            } else {
                                openTags.shift(); // Pops the last tag from the open tag stack (the tag is closed in the retult HTML!)
                            }

                        } else {
                            // There are some nasty tags that don't have a close tag like

                            if (tagName.toLowerCase() != 'br') {
                                openTags.unshift(tagName); // Add to start the name of the tag that opens
                            }
                        }
                    }
                    if (inTag && content[i] == '>') {
                        inTag = false;
                    }

                    if (inTag) { bag += content.charAt(i); } // Add tag name chars to the result
                    else {
                        r++;
                        if (countChars <= config.showChars) {
                           bag += content.charAt(i); // Fix to ie 7 not allowing you to reference string characters using the []
                            countChars++;
                        } else // Now I have the characters needed
                        {
                            if (openTags.length > 0) // I have unclosed tags
                            {
                                //console.log('They were open tags');
                                //console.log(openTags);
                                for (j = 0; j < openTags.length; j++) {
                                    //console.log('Cierro tag ' + openTags[j]);
                                    bag += '</' + openTags[j] + '>'; // Close all tags that were opened

                                    // You could shift the tag from the stack to check if you end with an empty stack, that means you have closed all open tags
                                }
                                break;
                            }
                        }
                    }
                }
                c = bag;
            }

            var html = '' + c + ' ' + config.ellipsesText +
                '' + content +
                '  ' + config.moreText + '';

            $this.html(html);
            $this.find(".allcontent").hide(); // Esconde el contenido completo para todos los textos
        }
    });

    };

 })(jQuery);
<commit_msg>Prevent the plugin to be attached more than once to an element.<commit_after>/*
 * jQuery Shorten plugin 1.0.0
 *
 * Copyright (c) 2013 Viral Patel
 * http://viralpatel.net
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 */

 /*
 ** updated by Jeff Richardson
 ** Updated to use strict,
 ** IE 7 has a "bug" It is returning underfined when trying to reference string characters in this format
 ** content[i]. IE 7 allows content.charAt(i) This works fine in all modern browsers.
 ** I've also added brackets where they werent added just for readability (mostly for me).
 */

 (function($) {
    $.fn.shorten = function (settings) {

    "use strict";
	    if ($(this).data('jquery.shorten')){
	    	return false;
		}
		$(this).data('jquery.shorten', true);

        var config = {
            showChars: 100,
            ellipsesText: "...",
            moreText: "more",
            lessText: "less",
            errMsg: null
        };

        if (settings) {
            $.extend(config, settings);
        }

        $(document).off("click", '.morelink');

        $(document).on({click: function () {

                var $this = $(this);
                if ($this.hasClass('less')) {
                    $this.removeClass('less');
                    $this.html(config.moreText);
                    $this.parent().prev().prev().show(); // shortcontent
                    $this.parent().prev().hide(); // allcontent

                } else {
                    $this.addClass('less');
                    $this.html(config.lessText);
                    $this.parent().prev().prev().hide(); // shortcontent
                    $this.parent().prev().show(); // allcontent
                }
                return false;
            }
        }, '.morelink');

    return this.each(function () {
        var $this = $(this);

        var content = $this.html();
        var contentlen = $this.text().length;
        if (contentlen > config.showChars) {
            var c = content.substr(0, config.showChars);
            if (c.indexOf('<') >= 0) // If there's HTML don't want to cut it
            {
                var inTag = false; // I'm in a tag?
                var bag = ''; // Put the characters to be shown here
                var countChars = 0; // Current bag size
                var openTags = []; // Stack for opened tags, so I can close them later
                var tagName = null;

                for (var i = 0, r=0; r <= config.showChars; i++) {
                    if (content[i] == '<' && !inTag) {
                        inTag = true;

                        // This could be "tag" or "/tag"
                        tagName = content.substring(i + 1, content.indexOf('>', i));

                        // If its a closing tag
                        if (tagName[0] == '/') {

                            if (tagName != '/' + openTags[0]) {
                                config.errMsg = 'ERROR en HTML: the top of the stack should be the tag that closes';
                            } else {
                                openTags.shift(); // Pops the last tag from the open tag stack (the tag is closed in the retult HTML!)
                            }

                        } else {
                            // There are some nasty tags that don't have a close tag like

                            if (tagName.toLowerCase() != 'br') {
                                openTags.unshift(tagName); // Add to start the name of the tag that opens
                            }
                        }
                    }
                    if (inTag && content[i] == '>') {
                        inTag = false;
                    }

                    if (inTag) { bag += content.charAt(i); } // Add tag name chars to the result
                    else {
                        r++;
                        if (countChars <= config.showChars) {
                           bag += content.charAt(i); // Fix to ie 7 not allowing you to reference string characters using the []
                            countChars++;
                        } else // Now I have the characters needed
                        {
                            if (openTags.length > 0) // I have unclosed tags
                            {
                                //console.log('They were open tags');
                                //console.log(openTags);
                                for (j = 0; j < openTags.length; j++) {
                                    //console.log('Cierro tag ' + openTags[j]);
                                    bag += '</' + openTags[j] + '>'; // Close all tags that were opened

                                    // You could shift the tag from the stack to check if you end with an empty stack, that means you have closed all open tags
                                }
                                break;
                            }
                        }
                    }
                }
                c = bag;
            }

            var html = '' + c + ' ' + config.ellipsesText +
                '' + content +
                '  ' + config.moreText + '';

            $this.html(html);
            $this.find(".allcontent").hide(); // Esconde el contenido completo para todos los textos
        }
    });

    };

 })(jQuery);
<|endoftext|>


<commit_before>import throwIfMissing from './util/throwIfMissing';

export default class BoundingBox {
  constructor() {
    this.isShowing = false;

    let {
      namespace = null,
    } = options;

    this.settings = { namespace };

    this.openClasses = this._buildClasses('open');

    this._buildElement();
  }

  _buildClasses(suffix) {
    let classes = [`drift-${suffix}`];

    let ns = this.settings.namespace;
    if (ns) {
      classes.push(`${ns}-${suffix}`);
    }

    return classes;
  }

  _buildElement() {
    this.el = document.createElement('div');
    addClasses(this.el, this._buildClasses('bounding-box'));
  }

  show(zoomPaneWidth, zoomPaneHeight) {
    this.isShowing = true;

    // TODO set aspect ratio based on zoomPaneWidth and zoomPaneHeight. The
    // default size of BoundingBox should come from CSS, and we'll only change
    // the _height_ in order to match the ZoomPane aspect ratio.

    addClasses(this.el, this.openClasses);
  }

  hide() {
    e.preventDefault();

    this.isShowing = false;

    removeClasses(this.el, this.openClasses);
  }

  setPosition(percentageOffsetX, percentageOffsetY, triggerRect) {
    // TODO this logic should be similar to ZoomPane when it's inline
  }
}
<commit_msg>Update BoundingBox.js<commit_after>import throwIfMissing from './util/throwIfMissing';

export default class BoundingBox {
  constructor() {
    this.isShowing = false;

    let {
      namespace = null,
      zoomFactor = throwIfMissing()
    } = options;

    this.settings = { namespace, zoomFactor };

    this.openClasses = this._buildClasses('open');

    this._buildElement();
  }

  _buildClasses(suffix) {
    let classes = [`drift-${suffix}`];

    let ns = this.settings.namespace;
    if (ns) {
      classes.push(`${ns}-${suffix}`);
    }

    return classes;
  }

  _buildElement() {
    this.el = document.createElement('div');
    addClasses(this.el, this._buildClasses('bounding-box'));
  }

  show(zoomPaneWidth, zoomPaneHeight) {
    this.isShowing = true;

    // TODO set size here (zoomPaneWidth / this.settings.zoomFactor,
    // zoomPaneHeight / this.settings.zoomFactor). The

    addClasses(this.el, this.openClasses);
  }

  hide() {
    e.preventDefault();

    this.isShowing = false;

    removeClasses(this.el, this.openClasses);
  }

  setPosition(percentageOffsetX, percentageOffsetY, triggerRect) {
    // TODO this logic should be similar to ZoomPane when it's inline
  }
}
<|endoftext|>