<commit_before>//Dont change it
requirejs(['ext_editor_1', 'jquery_190', 'raphael_210'],
    function (ext, $, TableComponent) {

        var cur_slide = {};

        ext.set_start_game(function (this_e) {
        });

        ext.set_process_in(function (this_e, data) {
            cur_slide["in"] = data[0];
        });

        ext.set_process_out(function (this_e, data) {
            cur_slide["out"] = data[0];
        });

        ext.set_process_ext(function (this_e, data) {
            cur_slide.ext = data;
            this_e.addAnimationSlide(cur_slide);
            cur_slide = {};
        });

        ext.set_process_err(function (this_e, data) {
            cur_slide['error'] = data[0];
            this_e.addAnimationSlide(cur_slide);
            cur_slide = {};
        });

        ext.set_animate_success_slide(function (this_e, options) {
            var $h = $(this_e.setHtmlSlide('

'));
            this_e.setAnimationHeight(115);
        });

        ext.set_animate_slide(function (this_e, data, options) {
            var $content = $(this_e.setHtmlSlide(ext.get_template('animation'))).find('.animation-content');
            if (!data) {
                console.log("data is undefined");
                return false;
            }

            //YOUR FUNCTION NAME
            var fname = 'divide_pie';

            if (data.ext && data.ext["show"]) {
                var checkioInputStr = fname + "(" + data.ext["show"] + ")";
            }
            else {
                checkioInputStr = fname + '((2, -1, 3))';
            }

            var checkioInput = data.in;

            var failError = function (dError) {
                $content.find('.call').html('Fail: ' + checkioInputStr);
                $content.find('.output').html(dError.replace(/\n/g, ","));

                $content.find('.output').addClass('error');
                $content.find('.call').addClass('error');
                $content.find('.answer').remove();
                $content.find('.explanation').remove();
                this_e.setAnimationHeight($content.height() + 60);
            };

            if (data.error) {
                failError(data.error);
                return false;
            }

            if (data.ext && data.ext.inspector_fail) {
                failError(data.ext.inspector_result_addon);
                return false;
            }

            var rightResult = data.ext["answer"];
            var rightResultShow = data.ext["show_answer"];
            var userResult = data.out[1];
            var result = data.ext["result"];
            var userResultShow = data.ext["result_addon"];

            //if you need additional info from tests (if exists)
            var explanation = data.ext["explanation"];

            $content.find('.output').html(' Your result: ' + userResultShow);

            if (!result) {
                $content.find('.call').html('Fail: ' + checkioInputStr);
                $content.find('.answer').html('Right result: ' + JSON.stringify(rightResultShow));
                $content.find('.answer').addClass('error');
                $content.find('.output').addClass('error');
                $content.find('.call').addClass('error');
            }
            else {
                $content.find('.call').html('Pass: ' + checkioInputStr);
                $content.find('.answer').remove();
            }

            if (explanation) {
                var canvas = new Canvas($content.find(".explanation")[0]);
                canvas.draw(explanation);
//                canvas.animate(explanation);
            }

            this_e.setAnimationHeight($content.height() + 60);

        });

        //This is for Tryit (but not necessary)
//        var $tryit;
//        ext.set_console_process_ret(function (this_e, ret) {
//            $tryit.find(".checkio-result").html("Result
" + ret);
//        });
//
//        ext.set_generate_animation_panel(function (this_e) {
//            $tryit = $(this_e.setHtmlTryIt(ext.get_template('tryit'))).find('.tryit-content');
//            $tryit.find('.bn-check').click(function (e) {
//                e.preventDefault();
//                this_e.sendToConsoleCheckiO("something");
//            });
//        });
        function Canvas(dom) {

            var colorOrange4 = "#F0801A";
            var colorOrange3 = "#FA8F00";
            var colorOrange2 = "#FAA600";
            var colorOrange1 = "#FABA00";

            var colorBlue4 = "#294270";
            var colorBlue3 = "#006CA9";
            var colorBlue2 = "#65A1CF";
            var colorBlue1 = "#8FC7ED";

            var colorGrey4 = "#737370";
            var colorGrey3 = "#9D9E9E";
            var colorGrey2 = "#C5C6C6";
            var colorGrey1 = "#EBEDED";

            var colorWhite = "#FFFFFF";

            var padding = 10;

            var R = 150;

            var size = padding * 2 + R * 2;

            var center = size / 2;

            var paper = Raphael(dom, size, size);

            var arc;

            var attrShadow = {"stroke": colorBlue4, "fill": colorBlue1, "stroke-width": 3};
            var attrLine = {"stroke": colorBlue4, "stroke-width": 2};
            var attrRem = {"stroke": colorBlue4, "stroke-width": 3, "fill": colorOrange1};

            this.draw = function (parts) {
                paper.circle(size / 2, size / 2, R).attr(attrShadow);
                for (var i = 0; i < parts.length; i++) {
                    var p = parts[i];
                    var angle = 2 * Math.PI * p[0] / p[1];
                    paper.path([
                        ["M", center, center],
                        ["L", center + Math.sin(angle) * R, center - Math.cos(angle) * R]
                    ]).attr(attrLine);
                }
                paper.path([
                    ["M", center, center],
                    ["L", center, padding],
                    ["A", R, R, 0, angle > Math.PI ? 1 : 0, 1, center + Math.sin(angle) * R, center - Math.cos(angle) * R],
                    ["z"]
                ]).attr(attrRem);

            };

//            this.animate = function (parts) {
//                var i = 0;
//                var stepTime = 1000;
//                var delayTime = 300;
//                (function cut() {
//                    i++;
//                    if (i >= parts.length) return false;
//                    setTimeout(function () {
//                        var p = parts[i];
//                        var angle = 2 * Math.PI * p[0] / p[1];
//                        console.log(p, angle);
//                        console.log(arc.attr("path"));
//                        arc.animate({"path": [
//                            ["M", center, center],
//                            ["L", center - 1, padding],
//                            ["A", R, R, 0, angle > Math.PI ? 1 : 0, 1, center + Math.sin(angle) * R, center - Math.cos(angle) * R],
//                            ["z"]
//                        ]}, stepTime, callback = cut);
//                    }, delayTime);
//                })();
//            }
        }

    }
);
<commit_msg>fix big ints<commit_after>//Dont change it
requirejs(['ext_editor_1', 'jquery_190', 'raphael_210'],
    function (ext, $, TableComponent) {

        var cur_slide = {};

        ext.set_start_game(function (this_e) {
        });

        ext.set_process_in(function (this_e, data) {
            cur_slide["in"] = data[0];
        });

        ext.set_process_out(function (this_e, data) {
            cur_slide["out"] = data[0];
        });

        ext.set_process_ext(function (this_e, data) {
            cur_slide.ext = data;
            this_e.addAnimationSlide(cur_slide);
            cur_slide = {};
        });

        ext.set_process_err(function (this_e, data) {
            cur_slide['error'] = data[0];
            this_e.addAnimationSlide(cur_slide);
            cur_slide = {};
        });

        ext.set_animate_success_slide(function (this_e, options) {
            var $h = $(this_e.setHtmlSlide('

'));
            this_e.setAnimationHeight(115);
        });

        ext.set_animate_slide(function (this_e, data, options) {
            var $content = $(this_e.setHtmlSlide(ext.get_template('animation'))).find('.animation-content');
            if (!data) {
                console.log("data is undefined");
                return false;
            }

            //YOUR FUNCTION NAME
            var fname = 'divide_pie';

            if (data.ext && data.ext["show"]) {
                var checkioInputStr = fname + "(" + data.ext["show"] + ")";
            }
            else {
                checkioInputStr = fname + '((2, -1, 3))';
            }

            var checkioInput = data.in;

            var failError = function (dError) {
                $content.find('.call').html('Fail: ' + checkioInputStr);
                $content.find('.output').html(dError.replace(/\n/g, ","));

                $content.find('.output').addClass('error');
                $content.find('.call').addClass('error');
                $content.find('.answer').remove();
                $content.find('.explanation').remove();
                this_e.setAnimationHeight($content.height() + 60);
            };

            if (data.error) {
                failError(data.error);
                return false;
            }

            if (data.ext && data.ext.inspector_fail) {
                failError(data.ext.inspector_result_addon);
                return false;
            }

            var rightResult = data.ext["answer"];
            var rightResultShow = data.ext["show_answer"];
            var userResult = data.out[1];
            var result = data.ext["result"];
            var userResultShow = data.ext["result_addon"];

            //if you need additional info from tests (if exists)
            var explanation = data.ext["explanation"];

            $content.find('.output').html(' Your result: ' + userResultShow);

            if (!result) {
                $content.find('.call').html('Fail: ' + checkioInputStr);
                $content.find('.answer').html('Right result: ' + rightResultShow);
                $content.find('.answer').addClass('error');
                $content.find('.output').addClass('error');
                $content.find('.call').addClass('error');
            }
            else {
                $content.find('.call').html('Pass: ' + checkioInputStr);
                $content.find('.answer').remove();
            }

            if (explanation) {
                var canvas = new Canvas($content.find(".explanation")[0]);
                canvas.draw(explanation);
//                canvas.animate(explanation);
            }

            this_e.setAnimationHeight($content.height() + 60);

        });

        //This is for Tryit (but not necessary)
//        var $tryit;
//        ext.set_console_process_ret(function (this_e, ret) {
//            $tryit.find(".checkio-result").html("Result
" + ret);
//        });
//
//        ext.set_generate_animation_panel(function (this_e) {
//            $tryit = $(this_e.setHtmlTryIt(ext.get_template('tryit'))).find('.tryit-content');
//            $tryit.find('.bn-check').click(function (e) {
//                e.preventDefault();
//                this_e.sendToConsoleCheckiO("something");
//            });
//        });
        function Canvas(dom) {

            var colorOrange4 = "#F0801A";
            var colorOrange3 = "#FA8F00";
            var colorOrange2 = "#FAA600";
            var colorOrange1 = "#FABA00";

            var colorBlue4 = "#294270";
            var colorBlue3 = "#006CA9";
            var colorBlue2 = "#65A1CF";
            var colorBlue1 = "#8FC7ED";

            var colorGrey4 = "#737370";
            var colorGrey3 = "#9D9E9E";
            var colorGrey2 = "#C5C6C6";
            var colorGrey1 = "#EBEDED";

            var colorWhite = "#FFFFFF";

            var padding = 10;

            var R = 150;

            var size = padding * 2 + R * 2;

            var center = size / 2;

            var paper = Raphael(dom, size, size);

            var arc;

            var attrShadow = {"stroke": colorBlue4, "fill": colorBlue1, "stroke-width": 3};
            var attrLine = {"stroke": colorBlue4, "stroke-width": 2};
            var attrRem = {"stroke": colorBlue4, "stroke-width": 3, "fill": colorOrange1};

            this.draw = function (parts) {
                paper.circle(size / 2, size / 2, R).attr(attrShadow);
                for (var i = 0; i < parts.length; i++) {
                    var p = parts[i];
                    var angle = 2 * Math.PI * p[0] / p[1];
                    paper.path([
                        ["M", center, center],
                        ["L", center + Math.sin(angle) * R, center - Math.cos(angle) * R]
                    ]).attr(attrLine);
                }
                paper.path([
                    ["M", center, center],
                    ["L", center, padding],
                    ["A", R, R, 0, angle > Math.PI ? 1 : 0, 1, center + Math.sin(angle) * R, center - Math.cos(angle) * R],
                    ["z"]
                ]).attr(attrRem);

            };

//            this.animate = function (parts) {
//                var i = 0;
//                var stepTime = 1000;
//                var delayTime = 300;
//                (function cut() {
//                    i++;
//                    if (i >= parts.length) return false;
//                    setTimeout(function () {
//                        var p = parts[i];
//                        var angle = 2 * Math.PI * p[0] / p[1];
//                        console.log(p, angle);
//                        console.log(arc.attr("path"));
//                        arc.animate({"path": [
//                            ["M", center, center],
//                            ["L", center - 1, padding],
//                            ["A", R, R, 0, angle > Math.PI ? 1 : 0, 1, center + Math.sin(angle) * R, center - Math.cos(angle) * R],
//                            ["z"]
//                        ]}, stepTime, callback = cut);
//                    }, delayTime);
//                })();
//            }
        }

    }
);
<|endoftext|>


<commit_before>// ==================
// === HELPERS.js ===
// ==================
var TMW = window.TMW || {};
// JS Shims, helpers
// =================
// Consider using one of these libraries to provide support for
// javascript's natives across browsers
//
// * https://github.com/kriskowal/es5-shim
// * http://lodash.com/
// * http://sugarjs.com/

// Array Remove
// ============
// By John Resig (MIT Licensed)
// http://ejohn.org/blog/javascript-array-remove/
Array.prototype.remove = Array.prototype.remove ||  function(from, to) {
	var rest = this.slice((to || from) + 1 || this.length);
	this.length = from < 0 ? this.length + from : from;
	return this.push.apply(this, rest);
};

// Complete cookie reader/writer
// =============================
// From https://developer.mozilla.org/en-US/docs/DOM/document.cookie

// Usage:
// TMW.cookies.setItem(name, value[, end[, path[, domain[, secure]]]])
// TMW.cookies.getItem(name)
// TMW.cookies.removeItem(name[, path])
// TMW.cookies.hasItem(name)
// TMW.cookies.keys()

TMW.cookies = {
	getItem: function(sKey) {
		if (!sKey || !this.hasItem(sKey)) { return null; }
		return unescape(document.cookie.replace(new RegExp('(?:^|.*;\\s*)' + escape(sKey).replace(/[\-\.\+\*]/g, '\\$&') + '\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*'), '$1'));
	},
	setItem: function(sKey, sValue, vEnd, sPath, sDomain, bSecure) {
		if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) { return; }
		var sExpires = '';
		if (vEnd) {
			switch (vEnd.constructor) {
				case Number:
					sExpires = vEnd === Infinity ? '; expires=Tue, 19 Jan 2038 03:14:07 GMT' : '; max-age=' + vEnd;
					break;
				case String:
					sExpires = '; expires=' + vEnd;
					break;
				case Date:
					sExpires = '; expires=' + vEnd.toGMTString();
					break;
			}
		}
		document.cookie = escape(sKey) + '=' + escape(sValue) + sExpires + (sDomain ? '; domain=' + sDomain : '') + (sPath ? '; path=' + sPath : '') + (bSecure ? '; secure' : '');
	},
	removeItem: function(sKey, sPath) {
		if (!sKey || !this.hasItem(sKey)) { return; }
		document.cookie = escape(sKey) + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT' + (sPath ? '; path=' + sPath : '');
	},
	hasItem: function(sKey) {
		return (new RegExp('(?:^|;\\s*)' + escape(sKey).replace(/[\-\.\+\*]/g, '\\$&') + '\\s*\\=')).test(document.cookie);
	},
	// Optional method: you can safely remove it!
	keys: function() {
		var aKeys = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, '').split(/\s*(?:\=[^;]*)?;\s*/);
		for (var nIdx = 0; nIdx < aKeys.length; nIdx++) { aKeys[nIdx] = unescape(aKeys[nIdx]); }
		return aKeys;
	}
};
<commit_msg>Add some useful helper methods<commit_after>// ==================
// === HELPERS.js ===
// ==================
var TMW = window.TMW || {};

// JS Shims, helpers
// =================
// Consider using one of these libraries to provide support for
// javascript's natives across browsers
//
// * https://github.com/kriskowal/es5-shim
// * http://lodash.com/
// * http://sugarjs.com/

// Array Remove
// ============
// By John Resig (MIT Licensed)
// http://ejohn.org/blog/javascript-array-remove/
Array.prototype.remove = Array.prototype.remove ||  function(from, to) {
	var rest = this.slice((to || from) + 1 || this.length);
	this.length = from < 0 ? this.length + from : from;
	return this.push.apply(this, rest);
};

//String substitute, ported from MooTools
String.prototype.substitute = function (object) {
	return this.replace(/\{(.+?)\}/g, function (match, name) {
		return name in object ? object[name] : match;
	});
};

//Array forEach patch
if (!Array.prototype.forEach) {
	Array.prototype.forEach = function (fn, scope) {
		for (var i = 0, len = this.length; i < len; ++i) {
			fn.call(scope, this[i], i, this);
		}
	};
}

//Array filter patch
if (!Array.prototype.filter) {
	Array.prototype.filter = function (fn, scope) {
		var results = [];
		for (var value, i = 0, l = this.length >>> 0; i < l; i++) {
			if (i in this) {
				value = this[i];
				if (fn.call(scope, value, i, this)) {
					results.push(value);
				}
			}
		}
		return results;
	};
}

//Array map patch
if (!Array.prototype.map) {
	Array.prototype.map = function (fn, scope) {
		var length = this.length >>> 0, results = Array(length);
		for (var i = 0; i < length; i++) {
			if (i in this) {
				results[i] = fn.call(scope, this[i], i, this);
			}
		}
		return results;
	};
}

// Complete cookie reader/writer
// =============================
// From https://developer.mozilla.org/en-US/docs/DOM/document.cookie

// Usage:
// TMW.cookies.setItem(name, value[, end[, path[, domain[, secure]]]])
// TMW.cookies.getItem(name)
// TMW.cookies.removeItem(name[, path])
// TMW.cookies.hasItem(name)
// TMW.cookies.keys()

TMW.cookies = {
	getItem: function(sKey) {
		if (!sKey || !this.hasItem(sKey)) { return null; }
		return unescape(document.cookie.replace(new RegExp('(?:^|.*;\\s*)' + escape(sKey).replace(/[\-\.\+\*]/g, '\\$&') + '\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*'), '$1'));
	},
	setItem: function(sKey, sValue, vEnd, sPath, sDomain, bSecure) {
		if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) { return; }
		var sExpires = '';
		if (vEnd) {
			switch (vEnd.constructor) {
				case Number:
					sExpires = vEnd === Infinity ? '; expires=Tue, 19 Jan 2038 03:14:07 GMT' : '; max-age=' + vEnd;
					break;
				case String:
					sExpires = '; expires=' + vEnd;
					break;
				case Date:
					sExpires = '; expires=' + vEnd.toGMTString();
					break;
			}
		}
		document.cookie = escape(sKey) + '=' + escape(sValue) + sExpires + (sDomain ? '; domain=' + sDomain : '') + (sPath ? '; path=' + sPath : '') + (bSecure ? '; secure' : '');
	},
	removeItem: function(sKey, sPath) {
		if (!sKey || !this.hasItem(sKey)) { return; }
		document.cookie = escape(sKey) + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT' + (sPath ? '; path=' + sPath : '');
	},
	hasItem: function(sKey) {
		return (new RegExp('(?:^|;\\s*)' + escape(sKey).replace(/[\-\.\+\*]/g, '\\$&') + '\\s*\\=')).test(document.cookie);
	},
	// Optional method: you can safely remove it!
	keys: function() {
		var aKeys = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, '').split(/\s*(?:\=[^;]*)?;\s*/);
		for (var nIdx = 0; nIdx < aKeys.length; nIdx++) { aKeys[nIdx] = unescape(aKeys[nIdx]); }
		return aKeys;
	}
};
<|endoftext|>


<commit_before>const pckg = require('../../package.json')
const VERSION = process.env.VERSION || pckg.version

const GA_MEASUREMENT_ID = 'UA-82107035-1'
const GOOGLE_SITE_VERIFICATION = '4nm40QLVcDJmEJSAbrMfZ7fpBJZIXL1oSngBAYrZopY'
//const GOOGLE_AD_CLIENT_ID = 'ca-pub-3734944050099256'

module.exports = {
  locales: {
    '/': {
      lang: 'en-US',
      title: 'Fuse.js - JavaScript fuzzy-search library',
      description: 'Lightweight fuzzy-search library, in JavaScript'
    }
  },
  head: getHead(),
  plugins: getPlugins(),
  serviceWorker: true,
  themeConfig: {
    logo: '/assets/img/logo.png',
    // repo: 'krisk/fuse',
    base: 'docs',
    lastUpdated: 'Last Updated',
    docsDir: 'docs',
    docsBranch: 'master',
    editLinks: true,
    version: VERSION,
    GA_MEASUREMENT_ID,
    displayAllHeaders: true,
    locales: {
      '/': {
        label: 'English',
        selectText: 'Languages',
        editLinkText: 'Edit this page on GitHub',
        nav: require('./nav/en'),
        sidebar: {
          // '/blog': getBlogSidebar(),
          '/': getGuideSidebar()
        }
      }
    }
  }
}

function getGuideSidebar() {
  return [
    {
      title: 'Getting Started',
      collapsable: false,
      children: [
        '/getting-started/installation',
        '/getting-started/different-builds'
      ]
    },
    '/demo',
    {
      title: 'API Reference',
      collapsable: false,
      sidebarDepth: 0,
      children: [
        '/api/options',
        '/api/config',
        '/api/methods',
        '/api/indexing',
        '/api/query'
      ]
    },
    '/examples',
    {
      title: 'Concepts',
      collapsable: false,
      children: ['/concepts/scoring-theory']
    }
  ]
}

function getComponent(name) {
  return {
    name,
    path: `${__dirname}/components/${name}/${name}.vue`
  }
}

function getPlugins() {
  return [
    require('./plugins/google-analytics'),
    'vuepress-plugin-smooth-scroll',
    'vuepress-plugin-element-tabs',
    [
      '@vuepress/register-components',
      {
        components: [
          getComponent('Stories'),
          getComponent('Sponsors'),
          getComponent('Demo'),
          getComponent('Team'),
          getComponent('Jobs'),
          getComponent('Donate'),
          getComponent('TwitterFollow')
        ]
      }
    ]
    // [
    //   ('social-share',
    //   {
    //     networks: ['twitter', 'facebook', 'reddit', 'email', 'linkedin'],
    //     extendsNetworks: {
    //       email: {
    //         sharer: 'mailto:?subject=@title&body=@url%0D%0A%0D%0A@description',
    //         type: 'direct',
    //         icon: '/assets/img/email.png'
    //       },
    //       linkedin: {
    //         sharer:
    //           'https://www.linkedin.com/sharing/share-offsite/?mini=true&url=@url&title=@title&summary=@description',
    //         type: 'popup',
    //         color: '#1786b1',
    //         icon: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path d="M910.336 0H113.664A114.005333 114.005333 0 0 0 0 113.664v796.672A114.005333 114.005333 0 0 0 113.664 1024h796.672A114.005333 114.005333 0 0 0 1024 910.336V113.664A114.005333 114.005333 0 0 0 910.336 0zM352.256 796.330667H207.189333V375.466667h145.066667z m-72.021333-477.866667a77.824 77.824 0 0 1-81.237334-74.069333A77.824 77.824 0 0 1 280.234667 170.666667a77.824 77.824 0 0 1 81.237333 73.728 77.824 77.824 0 0 1-81.237333 73.386666z m582.314666 477.866667H716.8v-227.669334c0-46.762667-18.432-93.525333-73.045333-93.525333a84.992 84.992 0 0 0-81.237334 94.549333v226.304h-140.629333V375.466667h141.653333v60.757333a155.989333 155.989333 0 0 1 136.533334-71.338667c60.416 0 163.498667 30.378667 163.498666 194.901334z" /></svg>'
    //       }
    //     },
    //     twitterUser: 'kirorisk',
    //     autoQuote: true,
    //     isPlain: false,
    //     // noGlobalSocialShare: true
    //   })
    // ]
    // [
    //   'vuepress-plugin-google-adsense',
    //   {
    //     ad_client: GOOGLE_AD_CLIENT_ID
    //   }
    // ]
  ]
}

function getHead() {
  const appleTouchIcons = [
    '57x57',
    '60x60',
    '72x72',
    '76x76',
    '114x114',
    '120x120',
    '144x144',
    '152x152',
    '180x180'
  ].map((size) => [
    'link',
    { rel: 'apple-touch-icon', size, href: `/icons/apple-icon-${size}.png` }
  ])

  const sizedIcons = [
    {
      size: '192x192',
      href: 'android-icon-192x192.png'
    },
    { size: '32x32', href: 'favicon-32x32.png' },
    { size: '96x96', href: 'favicon-96x96.png' },
    { size: '16x16', href: 'favicon-16x16.png' }
  ].map(({ size, href }) => [
    'link',
    { rel: 'icon', type: 'image/png', size, href: `/icons/${href}` }
  ])

  const meta = [
    { name: 'msapplication-TileColor', content: '#ffffff' },
    { name: 'msapplication-TileImage', content: '/icons/ms-icon-144x144.png' },
    { name: 'theme-color', content: '#ffffff' },
    {
      name: 'google-site-verification',
      content: GOOGLE_SITE_VERIFICATION
    }
  ].map(({ name, content }) => ['meta', { name, content }])

  const scripts = [
    `
      (function(){
        var bsa_optimize=document.createElement('script');
        bsa_optimize.type='text/javascript';
        bsa_optimize.async=true;
        bsa_optimize.src='https://cdn4.buysellads.net/pub/fusejs.js?'+(new Date()-new Date()%600000);
        (document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(bsa_optimize);
      })();
      `
  ].map((content) => ['script', {}, content])

  return [
    ...appleTouchIcons,
    ...sizedIcons,
    ...meta,
    ['link', { rel: 'manifest', href: '/icons/manifest.json' }],
    ...scripts
  ]
}
<commit_msg>Revert "docs: fix meta title"<commit_after>const pckg = require('../../package.json')
const VERSION = process.env.VERSION || pckg.version

const GA_MEASUREMENT_ID = 'UA-82107035-1'
const GOOGLE_SITE_VERIFICATION = '4nm40QLVcDJmEJSAbrMfZ7fpBJZIXL1oSngBAYrZopY'
//const GOOGLE_AD_CLIENT_ID = 'ca-pub-3734944050099256'

module.exports = {
  locales: {
    '/': {
      lang: 'en-US',
      title: 'Fuse.js',
      description: 'Lightweight fuzzy-search library, in JavaScript'
    }
  },
  head: getHead(),
  plugins: getPlugins(),
  serviceWorker: true,
  themeConfig: {
    logo: '/assets/img/logo.png',
    // repo: 'krisk/fuse',
    base: 'docs',
    lastUpdated: 'Last Updated',
    docsDir: 'docs',
    docsBranch: 'master',
    editLinks: true,
    version: VERSION,
    GA_MEASUREMENT_ID,
    displayAllHeaders: true,
    locales: {
      '/': {
        label: 'English',
        selectText: 'Languages',
        editLinkText: 'Edit this page on GitHub',
        nav: require('./nav/en'),
        sidebar: {
          // '/blog': getBlogSidebar(),
          '/': getGuideSidebar()
        }
      }
    }
  }
}

function getGuideSidebar() {
  return [
    {
      title: 'Getting Started',
      collapsable: false,
      children: [
        '/getting-started/installation',
        '/getting-started/different-builds'
      ]
    },
    '/demo',
    {
      title: 'API Reference',
      collapsable: false,
      sidebarDepth: 0,
      children: [
        '/api/options',
        '/api/config',
        '/api/methods',
        '/api/indexing',
        '/api/query'
      ]
    },
    '/examples',
    {
      title: 'Concepts',
      collapsable: false,
      children: ['/concepts/scoring-theory']
    }
  ]
}

function getComponent(name) {
  return {
    name,
    path: `${__dirname}/components/${name}/${name}.vue`
  }
}

function getPlugins() {
  return [
    require('./plugins/google-analytics'),
    'vuepress-plugin-smooth-scroll',
    'vuepress-plugin-element-tabs',
    [
      '@vuepress/register-components',
      {
        components: [
          getComponent('Stories'),
          getComponent('Sponsors'),
          getComponent('Demo'),
          getComponent('Team'),
          getComponent('Jobs'),
          getComponent('Donate'),
          getComponent('TwitterFollow')
        ]
      }
    ]
    // [
    //   ('social-share',
    //   {
    //     networks: ['twitter', 'facebook', 'reddit', 'email', 'linkedin'],
    //     extendsNetworks: {
    //       email: {
    //         sharer: 'mailto:?subject=@title&body=@url%0D%0A%0D%0A@description',
    //         type: 'direct',
    //         icon: '/assets/img/email.png'
    //       },
    //       linkedin: {
    //         sharer:
    //           'https://www.linkedin.com/sharing/share-offsite/?mini=true&url=@url&title=@title&summary=@description',
    //         type: 'popup',
    //         color: '#1786b1',
    //         icon: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path d="M910.336 0H113.664A114.005333 114.005333 0 0 0 0 113.664v796.672A114.005333 114.005333 0 0 0 113.664 1024h796.672A114.005333 114.005333 0 0 0 1024 910.336V113.664A114.005333 114.005333 0 0 0 910.336 0zM352.256 796.330667H207.189333V375.466667h145.066667z m-72.021333-477.866667a77.824 77.824 0 0 1-81.237334-74.069333A77.824 77.824 0 0 1 280.234667 170.666667a77.824 77.824 0 0 1 81.237333 73.728 77.824 77.824 0 0 1-81.237333 73.386666z m582.314666 477.866667H716.8v-227.669334c0-46.762667-18.432-93.525333-73.045333-93.525333a84.992 84.992 0 0 0-81.237334 94.549333v226.304h-140.629333V375.466667h141.653333v60.757333a155.989333 155.989333 0 0 1 136.533334-71.338667c60.416 0 163.498667 30.378667 163.498666 194.901334z" /></svg>'
    //       }
    //     },
    //     twitterUser: 'kirorisk',
    //     autoQuote: true,
    //     isPlain: false,
    //     // noGlobalSocialShare: true
    //   })
    // ]
    // [
    //   'vuepress-plugin-google-adsense',
    //   {
    //     ad_client: GOOGLE_AD_CLIENT_ID
    //   }
    // ]
  ]
}

function getHead() {
  const appleTouchIcons = [
    '57x57',
    '60x60',
    '72x72',
    '76x76',
    '114x114',
    '120x120',
    '144x144',
    '152x152',
    '180x180'
  ].map((size) => [
    'link',
    { rel: 'apple-touch-icon', size, href: `/icons/apple-icon-${size}.png` }
  ])

  const sizedIcons = [
    {
      size: '192x192',
      href: 'android-icon-192x192.png'
    },
    { size: '32x32', href: 'favicon-32x32.png' },
    { size: '96x96', href: 'favicon-96x96.png' },
    { size: '16x16', href: 'favicon-16x16.png' }
  ].map(({ size, href }) => [
    'link',
    { rel: 'icon', type: 'image/png', size, href: `/icons/${href}` }
  ])

  const meta = [
    { name: 'msapplication-TileColor', content: '#ffffff' },
    { name: 'msapplication-TileImage', content: '/icons/ms-icon-144x144.png' },
    { name: 'theme-color', content: '#ffffff' },
    {
      name: 'google-site-verification',
      content: GOOGLE_SITE_VERIFICATION
    }
  ].map(({ name, content }) => ['meta', { name, content }])

  const scripts = [
    `
      (function(){
        var bsa_optimize=document.createElement('script');
        bsa_optimize.type='text/javascript';
        bsa_optimize.async=true;
        bsa_optimize.src='https://cdn4.buysellads.net/pub/fusejs.js?'+(new Date()-new Date()%600000);
        (document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(bsa_optimize);
      })();
      `
  ].map((content) => ['script', {}, content])

  return [
    ...appleTouchIcons,
    ...sizedIcons,
    ...meta,
    ['link', { rel: 'manifest', href: '/icons/manifest.json' }],
    ...scripts
  ]
}
<|endoftext|>


<commit_before>/** @module api */
import Auth from './auth.js';
import {DICOM_CONTENT_TYPE} from './dicomValues.js';
import parseMultipart from './parseMultipart.js';

/**
 * Fetches a url using a stored access token, signing the user in
 * if no access token exists
 * @param {RequestInfo} input The request info to fetch
 * @param {RequestInit=} init The request init object
 * @return {Promise<Response>} Fetch response object
 */
const authenticatedFetch = async (input, init) => {
  const accessToken = Auth.getAccessToken();
  if (accessToken) {
    if (init) {
      // Add authorization headers to given init object
      if (init.headers) {
        init.headers['Authorization'] = `Bearer ${accessToken}`;
      } else {
        init.headers = {
          'Authorization': `Bearer ${accessToken}`,
        };
      }
    } else {
      // Initialize init object if none was given
      init = {
        headers: {
          'Authorization': `Bearer ${accessToken}`,
        },
      };
    }

    const response = await fetch(input, init);

    if (!response.ok) {
      if (response.status == 401) {
        Auth.signIn();
      } else {
        throw new Error(await response.text());
      }
    }

    return response;
  } else {
    Auth.signIn();
  }
};

/**
 * Fetches one page of user's google cloud project ids
 * @param {string=} searchQuery Optional search query to filter project ids
 * @return {Promise<Array<string>>} List of project ids available to the user
 */
const fetchProjects = async (searchQuery) => {
  const request = {};
  if (searchQuery) {
    request.filter = `id:${searchQuery}*`;
  }
  // Only fetch one page to avoid taking too long to load. User will
  // most likely not scroll through more than a page of projects, so search
  // query is used to find specific projects
  const data = await gapi.client.cloudresourcemanager.projects.list(request);

  if (!data.result.projects) {
    return [];
  }
  return data.result.projects.map((project) => project.projectId);
};

/**
 * Fetches a list of the possible location ids for a given project
 * @param {string} projectId Project id to search locations for
 * @return {Promise<Array<string>>} List of locations available for project
 */
const fetchLocations = async (projectId) => {
  const data = await gapi.client.healthcare.projects.locations.list({
    name: `projects/${projectId}`,
  });

  if (!data.result.locations) {
    return [];
  }
  // Return a list of location Id's
  return data.result.locations.map((location) => location.locationId);
};

/**
 * Fetches a list of the datasets in a project location
 * @param {string} projectId Project id
 * @param {string} location Location
 * @return {Promise<Array<string>>} List of datasets available
 */
const fetchDatasets = async (projectId, location) => {
  // We currently don't support listing >100
  // datasets as this is a rare edge case
  const data = await gapi.client.healthcare.projects.locations.datasets.list({
    parent: `projects/${projectId}/locations/${location}`,
  });

  if (!data.result.datasets) {
    return [];
  }
  // Return a list of datasets by only using content of string after last '/'
  return data.result.datasets
      .map((dataset) => dataset.name.split('/').slice(-1)[0]);
};

/**
 * Fetches a list of the dicomStores in a dataset
 * @param {string} projectId Project ID
 * @param {string} location Location
 * @param {string} dataset Dataset
 * @return {Promise<Array<string>>} List of dicomStores available
 */
const fetchDicomStores = async (projectId, location, dataset) => {
  // We currently don't support listing >100
  // dicom stores as this is a rare edge case
  const data = await gapi.client.healthcare.projects.locations.datasets
      .dicomStores.list({
        parent: `projects/${projectId}/locations/${location}/` +
          `datasets/${dataset}`,
      });

  if (!data.result.dicomStores) {
    return [];
  }
  // Return a list of dicomStores by only using content of string after last '/'
  return data.result.dicomStores.map((dicomStore) =>
    dicomStore.name.split('/').slice(-1)[0]);
};

/**
 * Fetches a list of studies in a dicom store
 * @param {string} projectId Project ID
 * @param {string} location Location
 * @param {string} dataset Dataset
 * @param {string} dicomStore Dicom Store
 * @return {Promise<Array<Object>>} List of studies in the dicom store
 */
const fetchStudies =
    async (projectId, location, dataset, dicomStore) => {
  const data = await gapi.client.healthcare.projects.locations.datasets
      .dicomStores.searchForStudies({
        parent: `projects/${projectId}/locations/${location}/` +
        `datasets/${dataset}/dicomStores/${dicomStore}`,
        dicomWebPath: 'studies',
      });

  return data.result;
};

/**
 * Fetches a list of series in a study
 * @param {string} projectId Project ID
 * @param {string} location Location
 * @param {string} dataset Dataset
 * @param {string} dicomStore Dicom Store
 * @param {string} studyId Study UID
 * @return {Promise<Array<Object>>} List of series in the study
 */
const fetchSeries =
    async (projectId, location, dataset, dicomStore, studyId) => {
  const data = await gapi.client.healthcare.projects.locations.datasets
      .dicomStores.studies.searchForSeries({
        parent: `projects/${projectId}/locations/${location}/` +
        `datasets/${dataset}/dicomStores/${dicomStore}`,
        dicomWebPath: `studies/${studyId}/series`,
      });

  return data.result;
};

/**
 * Fetches a list of metadata for all instances in a given
 *    project/location/dataset/dicomStore/study/series
 * @param {string} projectId Project ID
 * @param {string} location Location
 * @param {string} dataset Dataset
 * @param {string} dicomStore Dicom Store
 * @param {string} studyId Study UID
 * @param {string} seriesId Series UID
 * @return {Promise<Array<Object<string, Object>>>} List of metadata for all instances in the series
 */
const fetchMetadata =
    async (projectId, location, dataset, dicomStore, studyId, seriesId) => {
  const data = await gapi.client.healthcare.projects.locations.datasets
    .dicomStores.studies.series.retrieveMetadata({
      parent: `projects/${projectId}/locations/${location}/` +
      `datasets/${dataset}/dicomStores/${dicomStore}`,
      dicomWebPath: `studies/${studyId}/series/${seriesId}/metadata`,
    });

  return data.result;
};

/**
 * Fetches a dicom file from a given url using Google Authentication
 * @param {string} url Url for the dicom file
 * @return {Uint8Array} Byte array of DICOM P10 contents
 */
const fetchDicomFile = async (url) => {
  // TODO(#10) Revisit using gzip without multipart headers once fix is launched
  // TODO(#11) Investigate optimal accept header for compressed instances
  const response = await authenticatedFetch(url, {
    headers: {
      'Accept': DICOM_CONTENT_TYPE,
    },
  });

  // Get the content-type header to find the boundary string
  const contentTypeHeader = response.headers.get('content-type');
  // Parse the contentTypeHeader and remove the "boundary=" prefix
  const boundary = contentTypeHeader.split(';')[1].substring(10);
  // Parse multipart header and boundary from arrayBuffer
  const arrayBuffer = parseMultipart(await response.arrayBuffer(), boundary);

  return new Int16Array(arrayBuffer);
};

/**
 * @typedef {Object} CancelablePromise
 * @property {Promise} promise The promise object
 * @property {function(): undefined} cancel Function to cancel the promise
 */

/**
 * Turns a promise into a cancelable promise to avoid
 * setting state after component unmounts
 * @param {Promise} promise Promise to make cancelable
 * @return {CancelablePromise} The cancelable promise
 */
const makeCancelable = (promise) => {
  let hasCanceled_ = false;

  const wrappedPromise = new Promise((resolve, reject) => {
    promise.then(
        // eslint-disable-next-line prefer-promise-reject-errors
        (val) => hasCanceled_ ? reject({isCanceled: true}) : resolve(val),
        // eslint-disable-next-line prefer-promise-reject-errors
        (error) => hasCanceled_ ? reject({isCanceled: true}) : reject(error),
    );
  });

  return {
    promise: wrappedPromise,
    cancel() {
      hasCanceled_ = true;
    },
  };
};

export {
  authenticatedFetch,
  fetchProjects,
  fetchLocations,
  fetchDatasets,
  fetchDicomStores,
  fetchStudies,
  fetchSeries,
  fetchMetadata,
  fetchDicomFile,
  makeCancelable,
};
<commit_msg>Removed a resolved TODO<commit_after>/** @module api */
import Auth from './auth.js';
import {DICOM_CONTENT_TYPE} from './dicomValues.js';
import parseMultipart from './parseMultipart.js';

/**
 * Fetches a url using a stored access token, signing the user in
 * if no access token exists
 * @param {RequestInfo} input The request info to fetch
 * @param {RequestInit=} init The request init object
 * @return {Promise<Response>} Fetch response object
 */
const authenticatedFetch = async (input, init) => {
  const accessToken = Auth.getAccessToken();
  if (accessToken) {
    if (init) {
      // Add authorization headers to given init object
      if (init.headers) {
        init.headers['Authorization'] = `Bearer ${accessToken}`;
      } else {
        init.headers = {
          'Authorization': `Bearer ${accessToken}`,
        };
      }
    } else {
      // Initialize init object if none was given
      init = {
        headers: {
          'Authorization': `Bearer ${accessToken}`,
        },
      };
    }

    const response = await fetch(input, init);

    if (!response.ok) {
      if (response.status == 401) {
        Auth.signIn();
      } else {
        throw new Error(await response.text());
      }
    }

    return response;
  } else {
    Auth.signIn();
  }
};

/**
 * Fetches one page of user's google cloud project ids
 * @param {string=} searchQuery Optional search query to filter project ids
 * @return {Promise<Array<string>>} List of project ids available to the user
 */
const fetchProjects = async (searchQuery) => {
  const request = {};
  if (searchQuery) {
    request.filter = `id:${searchQuery}*`;
  }
  // Only fetch one page to avoid taking too long to load. User will
  // most likely not scroll through more than a page of projects, so search
  // query is used to find specific projects
  const data = await gapi.client.cloudresourcemanager.projects.list(request);

  if (!data.result.projects) {
    return [];
  }
  return data.result.projects.map((project) => project.projectId);
};

/**
 * Fetches a list of the possible location ids for a given project
 * @param {string} projectId Project id to search locations for
 * @return {Promise<Array<string>>} List of locations available for project
 */
const fetchLocations = async (projectId) => {
  const data = await gapi.client.healthcare.projects.locations.list({
    name: `projects/${projectId}`,
  });

  if (!data.result.locations) {
    return [];
  }
  // Return a list of location Id's
  return data.result.locations.map((location) => location.locationId);
};

/**
 * Fetches a list of the datasets in a project location
 * @param {string} projectId Project id
 * @param {string} location Location
 * @return {Promise<Array<string>>} List of datasets available
 */
const fetchDatasets = async (projectId, location) => {
  // We currently don't support listing >100
  // datasets as this is a rare edge case
  const data = await gapi.client.healthcare.projects.locations.datasets.list({
    parent: `projects/${projectId}/locations/${location}`,
  });

  if (!data.result.datasets) {
    return [];
  }
  // Return a list of datasets by only using content of string after last '/'
  return data.result.datasets
      .map((dataset) => dataset.name.split('/').slice(-1)[0]);
};

/**
 * Fetches a list of the dicomStores in a dataset
 * @param {string} projectId Project ID
 * @param {string} location Location
 * @param {string} dataset Dataset
 * @return {Promise<Array<string>>} List of dicomStores available
 */
const fetchDicomStores = async (projectId, location, dataset) => {
  // We currently don't support listing >100
  // dicom stores as this is a rare edge case
  const data = await gapi.client.healthcare.projects.locations.datasets
      .dicomStores.list({
        parent: `projects/${projectId}/locations/${location}/` +
          `datasets/${dataset}`,
      });

  if (!data.result.dicomStores) {
    return [];
  }
  // Return a list of dicomStores by only using content of string after last '/'
  return data.result.dicomStores.map((dicomStore) =>
    dicomStore.name.split('/').slice(-1)[0]);
};

/**
 * Fetches a list of studies in a dicom store
 * @param {string} projectId Project ID
 * @param {string} location Location
 * @param {string} dataset Dataset
 * @param {string} dicomStore Dicom Store
 * @return {Promise<Array<Object>>} List of studies in the dicom store
 */
const fetchStudies =
    async (projectId, location, dataset, dicomStore) => {
  const data = await gapi.client.healthcare.projects.locations.datasets
      .dicomStores.searchForStudies({
        parent: `projects/${projectId}/locations/${location}/` +
        `datasets/${dataset}/dicomStores/${dicomStore}`,
        dicomWebPath: 'studies',
      });

  return data.result;
};

/**
 * Fetches a list of series in a study
 * @param {string} projectId Project ID
 * @param {string} location Location
 * @param {string} dataset Dataset
 * @param {string} dicomStore Dicom Store
 * @param {string} studyId Study UID
 * @return {Promise<Array<Object>>} List of series in the study
 */
const fetchSeries =
    async (projectId, location, dataset, dicomStore, studyId) => {
  const data = await gapi.client.healthcare.projects.locations.datasets
      .dicomStores.studies.searchForSeries({
        parent: `projects/${projectId}/locations/${location}/` +
        `datasets/${dataset}/dicomStores/${dicomStore}`,
        dicomWebPath: `studies/${studyId}/series`,
      });

  return data.result;
};

/**
 * Fetches a list of metadata for all instances in a given
 *    project/location/dataset/dicomStore/study/series
 * @param {string} projectId Project ID
 * @param {string} location Location
 * @param {string} dataset Dataset
 * @param {string} dicomStore Dicom Store
 * @param {string} studyId Study UID
 * @param {string} seriesId Series UID
 * @return {Promise<Array<Object<string, Object>>>} List of metadata for all instances in the series
 */
const fetchMetadata =
    async (projectId, location, dataset, dicomStore, studyId, seriesId) => {
  const data = await gapi.client.healthcare.projects.locations.datasets
    .dicomStores.studies.series.retrieveMetadata({
      parent: `projects/${projectId}/locations/${location}/` +
      `datasets/${dataset}/dicomStores/${dicomStore}`,
      dicomWebPath: `studies/${studyId}/series/${seriesId}/metadata`,
    });

  return data.result;
};

/**
 * Fetches a dicom file from a given url using Google Authentication
 * @param {string} url Url for the dicom file
 * @return {Uint8Array} Byte array of DICOM P10 contents
 */
const fetchDicomFile = async (url) => {
  // TODO(#11) Investigate optimal accept header for compressed instances
  const response = await authenticatedFetch(url, {
    headers: {
      'Accept': DICOM_CONTENT_TYPE,
    },
  });

  // Get the content-type header to find the boundary string
  const contentTypeHeader = response.headers.get('content-type');
  // Parse the contentTypeHeader and remove the "boundary=" prefix
  const boundary = contentTypeHeader.split(';')[1].substring(10);
  // Parse multipart header and boundary from arrayBuffer
  const arrayBuffer = parseMultipart(await response.arrayBuffer(), boundary);

  return new Int16Array(arrayBuffer);
};

/**
 * @typedef {Object} CancelablePromise
 * @property {Promise} promise The promise object
 * @property {function(): undefined} cancel Function to cancel the promise
 */

/**
 * Turns a promise into a cancelable promise to avoid
 * setting state after component unmounts
 * @param {Promise} promise Promise to make cancelable
 * @return {CancelablePromise} The cancelable promise
 */
const makeCancelable = (promise) => {
  let hasCanceled_ = false;

  const wrappedPromise = new Promise((resolve, reject) => {
    promise.then(
        // eslint-disable-next-line prefer-promise-reject-errors
        (val) => hasCanceled_ ? reject({isCanceled: true}) : resolve(val),
        // eslint-disable-next-line prefer-promise-reject-errors
        (error) => hasCanceled_ ? reject({isCanceled: true}) : reject(error),
    );
  });

  return {
    promise: wrappedPromise,
    cancel() {
      hasCanceled_ = true;
    },
  };
};

export {
  authenticatedFetch,
  fetchProjects,
  fetchLocations,
  fetchDatasets,
  fetchDicomStores,
  fetchStudies,
  fetchSeries,
  fetchMetadata,
  fetchDicomFile,
  makeCancelable,
};
<|endoftext|>


<commit_before>/*globals svgEditor */
svgEditor.readLang({
	lang: "be",
	dir : "ltr",
	common: {
		"ok": "Захаваць",
		"cancel": "Адмена",
		"key_backspace": "backspace",
		"key_del": "delete",
		"key_down": "down",
		"key_up": "up",
		"more_opts": "More Options",
		"url": "URL",
		"width": "Width",
		"height": "Height"
	},
	misc: {
		"powered_by": "Powered by"
	},
	ui: {
		"toggle_stroke_tools": "Show/hide more stroke tools",
		"palette_info": "Націсніце для змены колеру залівання, Shift-Click змяніць обводка",
		"zoom_level": "Змяненне маштабу",
		"panel_drag": "Drag left/right to resize side panel"
	},
	properties: {
		"id": "Identify the element",
		"fill_color": "Змяненне колеру залівання",
		"stroke_color": "Змяненне колеру інсульт",
		"stroke_style": "Змяненне стылю інсульт працяжнік",
		"stroke_width": "Змены шырыня штрых",
		"pos_x": "Change X coordinate",
		"pos_y": "Change Y coordinate",
		"linecap_butt": "Linecap: Butt",
		"linecap_round": "Linecap: Round",
		"linecap_square": "Linecap: Square",
		"linejoin_bevel": "Linejoin: Bevel",
		"linejoin_miter": "Linejoin: Miter",
		"linejoin_round": "Linejoin: Round",
		"angle": "Змены вугла павароту",
		"blur": "Change gaussian blur value",
		"opacity": "Старонка абранага пункта непразрыстасці",
		"circle_cx": "CX змене круга каардынаты",
		"circle_cy": "Змены гуртка CY каардынаты",
		"circle_r": "Старонка круга's радыус",
		"ellipse_cx": "Змены эліпса CX каардынаты",
		"ellipse_cy": "Змены эліпса CY каардынаты",
		"ellipse_rx": "Х змяненні эліпса радыюсам",
		"ellipse_ry": "Змены у эліпса радыюсам",
		"line_x1": "Змены лінія пачынае каардынаты х",
		"line_x2": "Змяненне за перыяд, скончыўся лінія каардынаты х",
		"line_y1": "Змены лінія пачынае Y каардынаты",
		"line_y2": "Змяненне за перыяд, скончыўся лінія Y каардынаты",
		"rect_height": "Змены прастакутнік вышынёй",
		"rect_width": "Змяненне шырыні прамавугольніка",
		"corner_radius": "Змены прастакутнік Corner Radius",
		"image_width": "Змены шырыня выявы",
		"image_height": "Змена вышыні выявы",
		"image_url": "Змяніць URL",
		"node_x": "Change node's x coordinate",
		"node_y": "Change node's y coordinate",
		"seg_type": "Change Segment type",
		"straight_segments": "Straight",
		"curve_segments": "Curve",
		"text_contents": "Змяненне зместу тэксту",
		"font_family": "Змены Сямейства шрыфтоў",
		"font_size": "Змяніць памер шрыфта",
		"bold": "Тоўсты тэкст",
		"italic": "Нахілены тэкст"
	},
	tools: {
		"main_menu": "Main Menu",
		"bkgnd_color_opac": "Змяненне колеру фону / непразрыстасць",
		"connector_no_arrow": "No arrow",
		"fitToContent": "Па памеры ўтрымання",
		"fit_to_all": "Па памеру ўсе змесціва",
		"fit_to_canvas": "Памер палатна",
		"fit_to_layer_content": "По размеру слой ўтрымання",
		"fit_to_sel": "Выбар памеру",
		"align_relative_to": "Выраўнаваць па дачыненні да ...",
		"relativeTo": "па параўнанні з:",
		"старонка": "старонка",
		"largest_object": "найбуйнейшы аб'ект",
		"selected_objects": "выбранымі аб'ектамі",
		"smallest_object": "маленькі аб'ект",
		"new_doc": "Новае выява",
		"open_doc": "Адкрыць выява",
		"export_img": "Export",
		"save_doc": "Захаваць малюнак",
		"import_doc": "Import Image",
		"align_to_page": "Align Element to Page",
		"align_bottom": "Лінаваць па ніжнім краю",
		"align_center": "Лінаваць па цэнтру",
		"align_left": "Па левым краю",
		"align_middle": "Выраўнаваць Блізкага",
		"align_right": "Па правым краю",
		"align_top": "Лінаваць па верхнім краю",
		"mode_select": "Выберыце інструмент",
		"mode_fhpath": "Pencil Tool",
		"mode_line": "Line Tool",
		"mode_connect": "Connect two objects",
		"mode_rect": "Rectangle Tool",
		"mode_square": "Square Tool",
		"mode_fhrect": "Свабоднай рукі Прастакутнік",
		"mode_ellipse": "Эліпс",
		"mode_circle": "Круг",
		"mode_fhellipse": "Свабоднай рукі Эліпс",
		"mode_path": "Poly Tool",
		"mode_shapelib": "Shape library",
		"mode_text": "Тэкст Tool",
		"mode_image": "Image Tool",
		"mode_zoom": "Zoom Tool",
		"mode_eyedropper": "Eye Dropper Tool",
		"no_embed": "NOTE: This image cannot be embedded. It will depend on this path to be displayed",
		"undo": "Адмяніць",
		"redo": "Паўтор",
		"tool_source": "Змяніць зыходны",
		"wireframe_mode": "Wireframe Mode",
		"toggle_grid": "Show/Hide Grid",
		"clone": "Clone Element(s)",
		"del": "Delete Element(s)",
		"group_elements": "Група элементаў",
		"make_link": "Make (hyper)link",
		"set_link_url": "Set link URL (leave empty to remove)",
		"to_path": "Convert to Path",
		"reorient_path": "Reorient path",
		"ungroup": "Элементы Разгруппировать",
		"docprops": "Уласцівасці дакумента",
		"imagelib": "Image Library",
		"move_bottom": "Перамясціць уніз",
		"move_top": "Перамясціць угару",
		"node_clone": "Clone Node",
		"node_delete": "Delete Node",
		"node_link": "Link Control Points",
		"add_subpath": "Add sub-path",
		"openclose_path": "Open/close sub-path",
		"source_save": "Захаваць",
		"cut": "Cut",
		"copy": "Copy",
		"paste": "Paste",
		"paste_in_place": "Paste in Place",
		"delete": "Delete",
		"group": "Group",
		"move_front": "Bring to Front",
		"move_up": "Bring Forward",
		"move_down": "Send Backward",
		"move_back": "Send to Back"
	},
	layers: {
		"layer":"Layer",
		"layers": "Layers",
		"del": "Выдаліць слой",
		"move_down": "Перамясціць слой на",
		"new": "Новы слой",
		"rename": "Перайменаваць Слой",
		"move_up": "Перамяшчэнне слоя да",
		"dupe": "Duplicate Layer",
		"merge_down": "Merge Down",
		"merge_all": "Merge All",
		"move_elems_to": "Move elements to:",
		"move_selected": "Move selected elements to a different layer"
	},
	config: {
		"image_props": "Image Properties",
		"doc_title": "Title",
		"doc_dims": "Canvas Dimensions",
		"included_images": "Included Images",
		"image_opt_embed": "Embed data (local files)",
		"image_opt_ref": "Use file reference",
		"editor_prefs": "Editor Preferences",
		"icon_size": "Icon size",
		"language": "Language",
		"background": "Editor Background",
		"editor_img_url": "Image URL",
		"editor_bg_note": "Note: Background will not be saved with image.",
		"icon_large": "Large",
		"icon_medium": "Medium",
		"icon_small": "Small",
		"icon_xlarge": "Extra Large",
		"select_predefined": "Выберыце прадвызначэньні:",
		"units_and_rulers": "Units & Rulers",
		"show_rulers": "Show rulers",
		"base_unit": "Base Unit:",
		"grid": "Grid",
		"snapping_onoff": "Snapping on/off",
		"snapping_stepsize": "Snapping Step-Size:",
		"grid_color": "Grid color"
	},
	shape_cats: {
		"basic": "Basic",
		"object": "Objects",
		"symbol": "Symbols",
		"arrow": "Arrows",
		"flowchart": "Flowchart",
		"animal": "Animals",
		"game": "Cards & Chess",
		"dialog_balloon": "Dialog balloons",
		"electronics": "Electronics",
		"math": "Mathematical",
		"music": "Music",
		"misc": "Miscellaneous",
		"raphael_1": "raphaeljs.com set 1",
		"raphael_2": "raphaeljs.com set 2"
	},
	imagelib: {
		"select_lib": "Select an image library",
		"show_list": "Show library list",
		"import_single": "Import single",
		"import_multi": "Import multiple",
		"open": "Open as new document"
	},
	notification: {
		"invalidAttrValGiven":"Invalid value given",
		"noContentToFitTo":"No content to fit to",
		"dupeLayerName":"There is already a layer named that!",
		"enterUniqueLayerName":"Please enter a unique layer name",
		"enterNewLayerName":"Please enter the new layer name",
		"layerHasThatName":"Layer already has that name",
		"QmoveElemsToLayer":"Move selected elements to layer '%s'?",
		"QwantToClear":"Do you want to clear the drawing?\nThis will also erase your undo history!",
		"QwantToOpen":"Do you want to open a new file?\nThis will also erase your undo history!",
		"QerrorsRevertToSource":"There were parsing errors in your SVG source.\nRevert back to original SVG source?",
		"QignoreSourceChanges":"Ignore changes made to SVG source?",
		"featNotSupported":"Feature not supported",
		"enterNewImgURL":"Enter the new image URL",
		"defsFailOnSave": "NOTE: Due to a bug in your browser, this image may appear wrong (missing gradients or elements). It will however appear correct once actually saved.",
		"loadingImage":"Loading image, please wait...",
		"saveFromBrowser": "Select \"Save As...\" in your browser to save this image as a %s file.",
		"noteTheseIssues": "Also note the following issues: ",
		"unsavedChanges": "There are unsaved changes.",
		"enterNewLinkURL": "Enter the new hyperlink URL",
		"errorLoadingSVG": "Error: Unable to load SVG data",
		"URLloadFail": "Unable to load from URL",
		"retrieving": "Retrieving \"%s\"..."
	},
	confirmSetStorage: {
		message: "By default and where supported, SVG-Edit can store your editor "+
		"preferences and SVG content locally on your machine so you do not "+
		"need to add these back each time you load SVG-Edit. If, for privacy "+
		"reasons, you do not wish to store this information on your machine, "+
		"you can change away from the default option below.",
		storagePrefsAndContent: "Store preferences and SVG content locally",
		storagePrefsOnly: "Only store preferences locally",
		storagePrefs: "Store preferences locally",
		storageNoPrefsOrContent: "Do not store my preferences or SVG content locally",
		storageNoPrefs: "Do not store my preferences locally",
		rememberLabel: "Remember this choice?",
		rememberTooltip: "If you choose to opt out of storage while remembering this choice, the URL will change so as to avoid asking again."
	}
});<commit_msg>Update lang.be.js<commit_after>/*globals svgEditor */
svgEditor.readLang({
	lang: "be",
	dir : "ltr",
	common: {
		"ok": "Захаваць",
		"cancel": "Адмена",
		"key_backspace": "backspace",
		"key_del": "delete",
		"key_down": "down",
		"key_up": "up",
		"more_opts": "More Options",
		"url": "URL",
		"width": "Width",
		"height": "Height"
	},
	misc: {
		"powered_by": "Powered by"
	},
	ui: {
		"toggle_stroke_tools": "Show/hide more stroke tools",
		"palette_info": "Націсніце для змены колеру залівання, Shift-Click змяніць обводка",
		"zoom_level": "Змяненне маштабу",
		"panel_drag": "Drag left/right to resize side panel"
	},
	properties: {
		"id": "Identify the element",
		"fill_color": "Змяненне колеру залівання",
		"stroke_color": "Змяненне колеру інсульт",
		"stroke_style": "Змяненне стылю інсульт працяжнік",
		"stroke_width": "Змены шырыня штрых",
		"pos_x": "Change X coordinate",
		"pos_y": "Change Y coordinate",
		"linecap_butt": "Linecap: Butt",
		"linecap_round": "Linecap: Round",
		"linecap_square": "Linecap: Square",
		"linejoin_bevel": "Linejoin: Bevel",
		"linejoin_miter": "Linejoin: Miter",
		"linejoin_round": "Linejoin: Round",
		"angle": "Змены вугла павароту",
		"blur": "Change gaussian blur value",
		"opacity": "Старонка абранага пункта непразрыстасці",
		"circle_cx": "CX змене круга каардынаты",
		"circle_cy": "Змены гуртка CY каардынаты",
		"circle_r": "Старонка круга's радыус",
		"ellipse_cx": "Змены эліпса CX каардынаты",
		"ellipse_cy": "Змены эліпса CY каардынаты",
		"ellipse_rx": "Х змяненні эліпса радыюсам",
		"ellipse_ry": "Змены у эліпса радыюсам",
		"line_x1": "Змены лінія пачынае каардынаты х",
		"line_x2": "Змяненне за перыяд, скончыўся лінія каардынаты х",
		"line_y1": "Змены лінія пачынае Y каардынаты",
		"line_y2": "Змяненне за перыяд, скончыўся лінія Y каардынаты",
		"rect_height": "Змены прастакутнік вышынёй",
		"rect_width": "Змяненне шырыні прамавугольніка",
		"corner_radius": "Змены прастакутнік Corner Radius",
		"image_width": "Змены шырыня выявы",
		"image_height": "Змена вышыні выявы",
		"image_url": "Змяніць URL",
		"node_x": "Change node's x coordinate",
		"node_y": "Change node's y coordinate",
		"seg_type": "Change Segment type",
		"straight_segments": "Straight",
		"curve_segments": "Curve",
		"text_contents": "Змяненне зместу тэксту",
		"font_family": "Змены Сямейства шрыфтоў",
		"font_size": "Змяніць памер шрыфта",
		"bold": "Тоўсты тэкст",
		"italic": "Нахілены тэкст"
	},
	tools: {
		"main_menu": "Main Menu",
		"bkgnd_color_opac": "Змяненне колеру фону / непразрыстасць",
		"connector_no_arrow": "No arrow",
		"fitToContent": "Па памеры ўтрымання",
		"fit_to_all": "Па памеру ўсе змесціва",
		"fit_to_canvas": "Памер палатна",
		"fit_to_layer_content": "По размеру слой ўтрымання",
		"fit_to_sel": "Выбар памеру",
		"align_relative_to": "Выраўнаваць па дачыненні да ...",
		"relativeTo": "па параўнанні з:",
		"page": "старонка",
		"largest_object": "найбуйнейшы аб'ект",
		"selected_objects": "выбранымі аб'ектамі",
		"smallest_object": "маленькі аб'ект",
		"new_doc": "Новае выява",
		"open_doc": "Адкрыць выява",
		"export_img": "Export",
		"save_doc": "Захаваць малюнак",
		"import_doc": "Import Image",
		"align_to_page": "Align Element to Page",
		"align_bottom": "Лінаваць па ніжнім краю",
		"align_center": "Лінаваць па цэнтру",
		"align_left": "Па левым краю",
		"align_middle": "Выраўнаваць Блізкага",
		"align_right": "Па правым краю",
		"align_top": "Лінаваць па верхнім краю",
		"mode_select": "Выберыце інструмент",
		"mode_fhpath": "Pencil Tool",
		"mode_line": "Line Tool",
		"mode_connect": "Connect two objects",
		"mode_rect": "Rectangle Tool",
		"mode_square": "Square Tool",
		"mode_fhrect": "Свабоднай рукі Прастакутнік",
		"mode_ellipse": "Эліпс",
		"mode_circle": "Круг",
		"mode_fhellipse": "Свабоднай рукі Эліпс",
		"mode_path": "Poly Tool",
		"mode_shapelib": "Shape library",
		"mode_text": "Тэкст Tool",
		"mode_image": "Image Tool",
		"mode_zoom": "Zoom Tool",
		"mode_eyedropper": "Eye Dropper Tool",
		"no_embed": "NOTE: This image cannot be embedded. It will depend on this path to be displayed",
		"undo": "Адмяніць",
		"redo": "Паўтор",
		"tool_source": "Змяніць зыходны",
		"wireframe_mode": "Wireframe Mode",
		"toggle_grid": "Show/Hide Grid",
		"clone": "Clone Element(s)",
		"del": "Delete Element(s)",
		"group_elements": "Група элементаў",
		"make_link": "Make (hyper)link",
		"set_link_url": "Set link URL (leave empty to remove)",
		"to_path": "Convert to Path",
		"reorient_path": "Reorient path",
		"ungroup": "Элементы Разгруппировать",
		"docprops": "Уласцівасці дакумента",
		"imagelib": "Image Library",
		"move_bottom": "Перамясціць уніз",
		"move_top": "Перамясціць угару",
		"node_clone": "Clone Node",
		"node_delete": "Delete Node",
		"node_link": "Link Control Points",
		"add_subpath": "Add sub-path",
		"openclose_path": "Open/close sub-path",
		"source_save": "Захаваць",
		"cut": "Cut",
		"copy": "Copy",
		"paste": "Paste",
		"paste_in_place": "Paste in Place",
		"delete": "Delete",
		"group": "Group",
		"move_front": "Bring to Front",
		"move_up": "Bring Forward",
		"move_down": "Send Backward",
		"move_back": "Send to Back"
	},
	layers: {
		"layer":"Layer",
		"layers": "Layers",
		"del": "Выдаліць слой",
		"move_down": "Перамясціць слой на",
		"new": "Новы слой",
		"rename": "Перайменаваць Слой",
		"move_up": "Перамяшчэнне слоя да",
		"dupe": "Duplicate Layer",
		"merge_down": "Merge Down",
		"merge_all": "Merge All",
		"move_elems_to": "Move elements to:",
		"move_selected": "Move selected elements to a different layer"
	},
	config: {
		"image_props": "Image Properties",
		"doc_title": "Title",
		"doc_dims": "Canvas Dimensions",
		"included_images": "Included Images",
		"image_opt_embed": "Embed data (local files)",
		"image_opt_ref": "Use file reference",
		"editor_prefs": "Editor Preferences",
		"icon_size": "Icon size",
		"language": "Language",
		"background": "Editor Background",
		"editor_img_url": "Image URL",
		"editor_bg_note": "Note: Background will not be saved with image.",
		"icon_large": "Large",
		"icon_medium": "Medium",
		"icon_small": "Small",
		"icon_xlarge": "Extra Large",
		"select_predefined": "Выберыце прадвызначэньні:",
		"units_and_rulers": "Units & Rulers",
		"show_rulers": "Show rulers",
		"base_unit": "Base Unit:",
		"grid": "Grid",
		"snapping_onoff": "Snapping on/off",
		"snapping_stepsize": "Snapping Step-Size:",
		"grid_color": "Grid color"
	},
	shape_cats: {
		"basic": "Basic",
		"object": "Objects",
		"symbol": "Symbols",
		"arrow": "Arrows",
		"flowchart": "Flowchart",
		"animal": "Animals",
		"game": "Cards & Chess",
		"dialog_balloon": "Dialog balloons",
		"electronics": "Electronics",
		"math": "Mathematical",
		"music": "Music",
		"misc": "Miscellaneous",
		"raphael_1": "raphaeljs.com set 1",
		"raphael_2": "raphaeljs.com set 2"
	},
	imagelib: {
		"select_lib": "Select an image library",
		"show_list": "Show library list",
		"import_single": "Import single",
		"import_multi": "Import multiple",
		"open": "Open as new document"
	},
	notification: {
		"invalidAttrValGiven":"Invalid value given",
		"noContentToFitTo":"No content to fit to",
		"dupeLayerName":"There is already a layer named that!",
		"enterUniqueLayerName":"Please enter a unique layer name",
		"enterNewLayerName":"Please enter the new layer name",
		"layerHasThatName":"Layer already has that name",
		"QmoveElemsToLayer":"Move selected elements to layer '%s'?",
		"QwantToClear":"Do you want to clear the drawing?\nThis will also erase your undo history!",
		"QwantToOpen":"Do you want to open a new file?\nThis will also erase your undo history!",
		"QerrorsRevertToSource":"There were parsing errors in your SVG source.\nRevert back to original SVG source?",
		"QignoreSourceChanges":"Ignore changes made to SVG source?",
		"featNotSupported":"Feature not supported",
		"enterNewImgURL":"Enter the new image URL",
		"defsFailOnSave": "NOTE: Due to a bug in your browser, this image may appear wrong (missing gradients or elements). It will however appear correct once actually saved.",
		"loadingImage":"Loading image, please wait...",
		"saveFromBrowser": "Select \"Save As...\" in your browser to save this image as a %s file.",
		"noteTheseIssues": "Also note the following issues: ",
		"unsavedChanges": "There are unsaved changes.",
		"enterNewLinkURL": "Enter the new hyperlink URL",
		"errorLoadingSVG": "Error: Unable to load SVG data",
		"URLloadFail": "Unable to load from URL",
		"retrieving": "Retrieving \"%s\"..."
	},
	confirmSetStorage: {
		message: "By default and where supported, SVG-Edit can store your editor "+
		"preferences and SVG content locally on your machine so you do not "+
		"need to add these back each time you load SVG-Edit. If, for privacy "+
		"reasons, you do not wish to store this information on your machine, "+
		"you can change away from the default option below.",
		storagePrefsAndContent: "Store preferences and SVG content locally",
		storagePrefsOnly: "Only store preferences locally",
		storagePrefs: "Store preferences locally",
		storageNoPrefsOrContent: "Do not store my preferences or SVG content locally",
		storageNoPrefs: "Do not store my preferences locally",
		rememberLabel: "Remember this choice?",
		rememberTooltip: "If you choose to opt out of storage while remembering this choice, the URL will change so as to avoid asking again."
	}
});
<|endoftext|>


<commit_before>// Global Variables Declaration -- start

var svgNS = "http://www.w3.org/2000/svg";
var displayNow = 0;
var possibleDisplays = 2;

// Global Variables Declaration -- end

// Code used for start up -- start

function displayNone()
{

  document.getElementById("container1").style.display = "none";
  document.getElementById("container2").style.display = "none";

}

function setHenosisAtCentre()
{

  var windowHeight = $(window).height();
  var windowWidth = $(window).width();
  document.getElementById("henosis").setAttribute('cx', windowWidth/2);
  document.getElementById("henosis").setAttribute('cy', windowHeight/2);
  changeShadowOfSVGElement((windowWidth/2), (windowHeight/2), 1, 0.005, "henosis", "shadow");

}

function start()
{

  displayNone();
  setHenosisAtCentre();

}

start();

// Code used for start up -- end

// Code used for dragging -- start

$( function() {
  var windowHeight = $(window).height();
  var windowWidth = $(window).width();
  $('#henosis').draggable({
    containment: [ 0, 0, windowWidth-40, windowHeight-40]
  })
  // .bind('mousedown', function(event, ui){
  //   // bring target to front
  //   $(event.target.parentElement).append( event.target );
  // })
  .bind('drag', function(event, ui){

    var ua = navigator.userAgent.toLowerCase();
    var isChromium = ua.indexOf("chromium") > -1; //&& ua.indexOf("mobile");

    if(isChromium)
    {

      var leftPosition = ui.position.left + 20;
      var topPosition = ui.position.top + 20;

    }
    else
    {

      var leftPosition = ui.position.left+(windowWidth/2);
      var topPosition = ui.position.top+(windowHeight/2);

    }

    // update coordinates manually, since top/left style props don't work on SVG
    event.target.setAttribute('cx', leftPosition);
    event.target.setAttribute('cy', topPosition);
    changeShadowOfSVGElement((windowWidth/2), (windowHeight/2), 1, 0.005, "henosis", "shadow");

  });
} );

// Code used for dragging -- end

// Code used for page refresh -- start
// Move to a better containment when possible.

// See: https://www.sitepoint.com/jquery-refresh-page-browser-resize/
//refresh page on browser resize
$(window).bind('resize', function(e)
{
  if (window.RT) clearTimeout(window.RT);
  window.RT = setTimeout(function()
  {
    this.location.reload(false); /* false to get page from cache */
  }, 200);
});

// Code used for page refresh -- end

// Code for scaleUpAct and for switching containers -- start

function createActCircle(cx, cy)
{
  var myCircle = document.createElementNS(svgNS,"circle"); //to create a circle. for rectangle use "rectangle"
  myCircle.setAttributeNS(null,"id","actCircle");
  myCircle.setAttributeNS(null,"cx",cx);
  myCircle.setAttributeNS(null,"cy",cy);
  myCircle.setAttributeNS(null,"r",20);
  myCircle.setAttributeNS(null,"fill","white");
  myCircle.setAttributeNS(null,"stroke","none");
  myCircle.setAttributeNS(null,"style","opacity: 1;");
  document.getElementById("henosisLayer").appendChild(myCircle);
}

function createActCircleShadow(cx, cy)
{
  var myCircle = document.createElementNS(svgNS,"circle"); //to create a circle. for rectangle use "rectangle"
  myCircle.setAttributeNS(null,"id","actCircleShadow");
  myCircle.setAttributeNS(null,"cx",cx);
  myCircle.setAttributeNS(null,"cy",cy);
  myCircle.setAttributeNS(null,"r",20);
  myCircle.setAttributeNS(null,"fill","grey");
  myCircle.setAttributeNS(null,"stroke","none");
  document.getElementById("henosisLayer").appendChild(myCircle);
}

function displayToggle()
{
  if(displayNow==0)
  {
    displayNow++;
    document.getElementById("container"+displayNow).style.display = "block";
  }
  else if(displayNow == possibleDisplays)
  {
    document.getElementById("container"+displayNow).style.display = "none";
    displayNow = 1;
    document.getElementById("container"+displayNow).style.display = "block";
  }
  else
  {
    document.getElementById("container"+displayNow).style.display = "none";
    displayNow++;
    document.getElementById("container"+displayNow).style.display = "block";
  }
}

function reduceOpacity()
{
  setTimeout(function () {
    var opacity = document.getElementById("actCircle").style.opacity;
    if(opacity>0)
    {
      document.getElementById("actCircle").style.opacity = (parseFloat(opacity)-parseFloat(0.1));
      reduceOpacity();
    }
    else
    {
      document.getElementById("actCircle").remove();
      if (document.getElementById("henosis").addEventListener)
      {
        // all browsers except IE before version 9
        // $('#henosis').off('click');
        document.getElementById("henosis").addEventListener("click", henosisScaleUpActStart, true);
      }
      else
      {
        if (document.getElementById("henosis").attachEvent)
        {
          // IE before version 9
          document.getElementById("henosis").attachEvent("click", henosisScaleUpActStart);
        }
      }
    }
  }, 100);
}

function scaleUpActComplete()
{
  document.getElementById("actCircleShadow").remove();
  displayToggle();
  reduceOpacity();
}

function henosisActCircleScaleUpAct(maxValue)
{
  setTimeout(function () {
    var radius = document.getElementById("actCircle").getAttribute('r');
    var windowHeight = $(window).height();
    var windowWidth = $(window).width();
    if(radius<maxValue)
    {
      document.getElementById("actCircle").setAttribute('r', parseFloat(radius)+parseFloat(maxValue/15));
      changeShadowOfSVGElement((windowWidth/2), (windowHeight/2), 1, 0.005, "actCircle", "actCircleShadow");
      henosisActCircleScaleUpAct(maxValue);
    }
    else
    {
      scaleUpActComplete();
    }
  }, 10);
}

function henosisScaleUpActStart()
{
  var windowHeight = $(window).height();
  var windowWidth = $(window).width();
  var diagonalLength = Math.sqrt((windowWidth*windowWidth)+(windowHeight*windowHeight));
  var cx = document.getElementById("henosis").getAttribute('cx');
  var cy = document.getElementById("henosis").getAttribute('cy');
  createActCircleShadow(cx, cy);
  createActCircle(cx, cy);
  changeShadowOfSVGElement((windowWidth/2), (windowHeight/2), 1, 0.005, "actCircle", "actCircleShadow");
  henosisActCircleScaleUpAct(diagonalLength);
}

// Code for scaleUpAct and for switching containers -- end

// pageloading part -- start
var colors = new Array( "Violet", "Indigo", "Blue", "Green", "Yellow", "Orange", "Red");
var colornow=1;
var loopStop=0;
function changeBackground(color) {
  document.getElementById("henosis").setAttribute('fill', color);
}

function incrementcolor() {
  if(colornow==6) {
    colornow=0;
  }
  else {
    colornow++;
  }
}

function loopLi() {
  setTimeout(function () {
    changeBackground(colors[colornow]);
    incrementcolor();
    if(loopStop==0)
    {
      loopLi();
    }
    else
    {
      document.getElementById("henosis").setAttribute('fill', "white");
      henosisScaleUpActStart();
    }
  }, 1000);
}

loopLi();
// pageloading part -- end

// pageloaded -- start
$(window).on('load', function()
{
  loopStop=1;
});
// pageloaded -- end
<commit_msg>bug fix<commit_after>// Global Variables Declaration -- start

var svgNS = "http://www.w3.org/2000/svg";
var displayNow = 0;
var possibleDisplays = 2;

// Global Variables Declaration -- end

// Code used for start up -- start

function displayNone()
{

  document.getElementById("container1").style.display = "none";
  document.getElementById("container2").style.display = "none";

}

function setHenosisAtCentre()
{

  var windowHeight = $(window).height();
  var windowWidth = $(window).width();
  document.getElementById("henosis").setAttribute('cx', windowWidth/2);
  document.getElementById("henosis").setAttribute('cy', windowHeight/2);
  changeShadowOfSVGElement((windowWidth/2), (windowHeight/2), 1, 0.005, "henosis", "shadow");

}

function start()
{

  displayNone();
  setHenosisAtCentre();

}

start();

// Code used for start up -- end

// Code used for dragging -- start

$( function() {
  var windowHeight = $(window).height();
  var windowWidth = $(window).width();
  $('#henosis').draggable({
    containment: [ 0, 0, windowWidth-40, windowHeight-40]
  })
  // .bind('mousedown', function(event, ui){
  //   // bring target to front
  //   $(event.target.parentElement).append( event.target );
  // })
  .bind('drag', function(event, ui){

    var ua = navigator.userAgent.toLowerCase();
    var isAppleWebKit = ua.indexOf("applewebkit") > -1;

    if(isAppleWebKit)
    {

      var leftPosition = ui.position.left + 20;
      var topPosition = ui.position.top + 20;

    }
    else
    {

      var leftPosition = ui.position.left+(windowWidth/2);
      var topPosition = ui.position.top+(windowHeight/2);

    }

    // update coordinates manually, since top/left style props don't work on SVG
    event.target.setAttribute('cx', leftPosition);
    event.target.setAttribute('cy', topPosition);
    changeShadowOfSVGElement((windowWidth/2), (windowHeight/2), 1, 0.005, "henosis", "shadow");

  });
} );

// Code used for dragging -- end

// Code used for page refresh -- start
// Move to a better containment when possible.

// See: https://www.sitepoint.com/jquery-refresh-page-browser-resize/
//refresh page on browser resize
$(window).bind('resize', function(e)
{
  if (window.RT) clearTimeout(window.RT);
  window.RT = setTimeout(function()
  {
    this.location.reload(false); /* false to get page from cache */
  }, 200);
});

// Code used for page refresh -- end

// Code for scaleUpAct and for switching containers -- start

function createActCircle(cx, cy)
{
  var myCircle = document.createElementNS(svgNS,"circle"); //to create a circle. for rectangle use "rectangle"
  myCircle.setAttributeNS(null,"id","actCircle");
  myCircle.setAttributeNS(null,"cx",cx);
  myCircle.setAttributeNS(null,"cy",cy);
  myCircle.setAttributeNS(null,"r",20);
  myCircle.setAttributeNS(null,"fill","white");
  myCircle.setAttributeNS(null,"stroke","none");
  myCircle.setAttributeNS(null,"style","opacity: 1;");
  document.getElementById("henosisLayer").appendChild(myCircle);
}

function createActCircleShadow(cx, cy)
{
  var myCircle = document.createElementNS(svgNS,"circle"); //to create a circle. for rectangle use "rectangle"
  myCircle.setAttributeNS(null,"id","actCircleShadow");
  myCircle.setAttributeNS(null,"cx",cx);
  myCircle.setAttributeNS(null,"cy",cy);
  myCircle.setAttributeNS(null,"r",20);
  myCircle.setAttributeNS(null,"fill","grey");
  myCircle.setAttributeNS(null,"stroke","none");
  document.getElementById("henosisLayer").appendChild(myCircle);
}

function displayToggle()
{
  if(displayNow==0)
  {
    displayNow++;
    document.getElementById("container"+displayNow).style.display = "block";
  }
  else if(displayNow == possibleDisplays)
  {
    document.getElementById("container"+displayNow).style.display = "none";
    displayNow = 1;
    document.getElementById("container"+displayNow).style.display = "block";
  }
  else
  {
    document.getElementById("container"+displayNow).style.display = "none";
    displayNow++;
    document.getElementById("container"+displayNow).style.display = "block";
  }
}

function reduceOpacity()
{
  setTimeout(function () {
    var opacity = document.getElementById("actCircle").style.opacity;
    if(opacity>0)
    {
      document.getElementById("actCircle").style.opacity = (parseFloat(opacity)-parseFloat(0.1));
      reduceOpacity();
    }
    else
    {
      document.getElementById("actCircle").remove();
      if (document.getElementById("henosis").addEventListener)
      {
        // all browsers except IE before version 9
        // $('#henosis').off('click');
        document.getElementById("henosis").addEventListener("click", henosisScaleUpActStart, true);
      }
      else
      {
        if (document.getElementById("henosis").attachEvent)
        {
          // IE before version 9
          document.getElementById("henosis").attachEvent("click", henosisScaleUpActStart);
        }
      }
    }
  }, 100);
}

function scaleUpActComplete()
{
  document.getElementById("actCircleShadow").remove();
  displayToggle();
  reduceOpacity();
}

function henosisActCircleScaleUpAct(maxValue)
{
  setTimeout(function () {
    var radius = document.getElementById("actCircle").getAttribute('r');
    var windowHeight = $(window).height();
    var windowWidth = $(window).width();
    if(radius<maxValue)
    {
      document.getElementById("actCircle").setAttribute('r', parseFloat(radius)+parseFloat(maxValue/15));
      changeShadowOfSVGElement((windowWidth/2), (windowHeight/2), 1, 0.005, "actCircle", "actCircleShadow");
      henosisActCircleScaleUpAct(maxValue);
    }
    else
    {
      scaleUpActComplete();
    }
  }, 10);
}

function henosisScaleUpActStart()
{
  var windowHeight = $(window).height();
  var windowWidth = $(window).width();
  var diagonalLength = Math.sqrt((windowWidth*windowWidth)+(windowHeight*windowHeight));
  var cx = document.getElementById("henosis").getAttribute('cx');
  var cy = document.getElementById("henosis").getAttribute('cy');
  createActCircleShadow(cx, cy);
  createActCircle(cx, cy);
  changeShadowOfSVGElement((windowWidth/2), (windowHeight/2), 1, 0.005, "actCircle", "actCircleShadow");
  henosisActCircleScaleUpAct(diagonalLength);
}

// Code for scaleUpAct and for switching containers -- end

// pageloading part -- start
var colors = new Array( "Violet", "Indigo", "Blue", "Green", "Yellow", "Orange", "Red");
var colornow=1;
var loopStop=0;
function changeBackground(color) {
  document.getElementById("henosis").setAttribute('fill', color);
}

function incrementcolor() {
  if(colornow==6) {
    colornow=0;
  }
  else {
    colornow++;
  }
}

function loopLi() {
  setTimeout(function () {
    changeBackground(colors[colornow]);
    incrementcolor();
    if(loopStop==0)
    {
      loopLi();
    }
    else
    {
      document.getElementById("henosis").setAttribute('fill', "white");
      henosisScaleUpActStart();
    }
  }, 1000);
}

loopLi();
// pageloading part -- end

// pageloaded -- start
$(window).on('load', function()
{
  loopStop=1;
});
// pageloaded -- end
<|endoftext|>


<commit_before>module.exports = {
  title: "Hello World Collection",
  description: "Collection of Hello World in Any Language",
  base: "/hello-world/",
  dest: "public"
}<commit_msg>Update config.js<commit_after>module.exports = {
  title: "Hello World Collection",
  description: "Collection of Hello World in Any Language",
  base: "/hello-world/",
  dest: "public",
  themeConfig: {
    nav: [
      { text: "Home", link: "/" },
      {
        text: "Github",
        link: "https://github.com/berviantoleo/hello-world"
      }
    ],
    sidebar: ["/"]
  }
}
<|endoftext|>


<commit_before>// Copyright (c) Martin Costello, 2017. All rights reserved.
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.

"use strict";

var constants = require("./constants");
var http = require("request-promise");

const ApiHost = "https://api.tfl.gov.uk/";

var httpGet = function (path) {
  var options = {
    uri: ApiHost + path,
    qs: {
      app_id: process.env.TFL_APP_ID || "",
      app_key: process.env.TFL_APP_KEY || ""
    },
    headers: {
      "User-Agent": constants.appName + constants.version
    },
    json: true
  };
  return http(options);
};

var api = {
  getDisruption: function (modes) {
    return httpGet("Line/Mode/" + modes.concat() + "/Disruption");
  },
  getLineStatus: function (lineName) {
    return httpGet("Line/" + lineName + "/Status");
  }
};

module.exports = api;
<commit_msg>Fix incorrect User Agent<commit_after>// Copyright (c) Martin Costello, 2017. All rights reserved.
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.

"use strict";

var constants = require("./constants");
var http = require("request-promise");

const ApiHost = "https://api.tfl.gov.uk/";

var httpGet = function (path) {
  var options = {
    uri: ApiHost + path,
    qs: {
      app_id: process.env.TFL_APP_ID || "",
      app_key: process.env.TFL_APP_KEY || ""
    },
    headers: {
      "User-Agent": constants.appName + "/" + constants.version
    },
    json: true
  };
  return http(options);
};

var api = {
  getDisruption: function (modes) {
    return httpGet("Line/Mode/" + modes.concat() + "/Disruption");
  },
  getLineStatus: function (id) {
    return httpGet("Line/" + id + "/Status");
  }
};

module.exports = api;
<|endoftext|>


<commit_before>// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you 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($, cloudStack, require) {
  if (!cloudStack.pluginAPI) cloudStack.pluginAPI = {};

  var loadCSS = function(path) {
    var $link = $('<link>');

    $link.attr({
      rel: 'stylesheet',
      type: 'text/css',
      href: path
    });

    $('head').append($link);
  };

  $.extend(cloudStack.pluginAPI, {
    ui: {
      pollAsyncJob: pollAsyncJobResult,
      apiCall: function(command, args) {
        $.ajax({
          url: createURL(command),
          data: args.data,
          success: args.success,
          error: function(json) {
            args.error(parseXMLHttpResponse(json));
          }
        })
      },
      addSection: function(section) {
        cloudStack.sections[section.id] = $.extend(section, {
          customIcon: 'plugins/' + section.id + '/icon.png'
        });
      },
      extend: function(obj) {
        $.extend(true, cloudStack, obj);
      }
    }
  });

  cloudStack.sections.plugins = {
    title: 'label.plugins',
    show: cloudStack.uiCustom.pluginListing
  };

  // Load plugins
  $(cloudStack.plugins).map(function(index, pluginID) {
    var basePath = 'plugins/' + pluginID + '/';
    var pluginJS = basePath + pluginID + '.js';
    var configJS = basePath + 'config.js';
    var pluginCSS = basePath + pluginID + '.css';

    require([pluginJS], function() {
      require([configJS]);
      loadCSS(pluginCSS);

      // Execute plugin
      cloudStack.plugins[pluginID](
        $.extend(true, {}, cloudStack.pluginAPI, {
          pluginAPI: {
            extend: function(api) {
              cloudStack.pluginAPI[pluginID] = api;
            }
          }
        })
      );
    });
  });

  // Load modules
  $(cloudStack.modules).map(function(index, moduleID) {
    var basePath = 'modules/' + moduleID + '/';
    var moduleJS = basePath + moduleID + '.js';
    var moduleCSS = basePath + moduleID + '.css';

    require([moduleJS], function() {
      loadCSS(moduleCSS);

      // Execute module
      cloudStack.modules[moduleID](
        $.extend(true, {}, cloudStack.pluginAPI, {
          pluginAPI: {
            extend: function(api) {
              cloudStack.pluginAPI[moduleID] = api;
            }
          }
        })
      );
    });
  });
}(jQuery, cloudStack, require));
<commit_msg>UI Plugin/module API: Fix load order, refactor<commit_after>// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you 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($, cloudStack, require) {
  if (!cloudStack.pluginAPI) {
    cloudStack.pluginAPI = {};
  }

  var loadCSS = function(path) {
    var $link = $('<link>');

    $link.attr({
      rel: 'stylesheet',
      type: 'text/css',
      href: path
    });

    $('head').append($link);
  };

  $.extend(cloudStack.pluginAPI, {
    ui: {
      pollAsyncJob: pollAsyncJobResult,
      apiCall: function(command, args) {
        $.ajax({
          url: createURL(command),
          data: args.data,
          success: args.success,
          error: function(json) {
            args.error(parseXMLHttpResponse(json));
          }
        });
      },
      addSection: function(section) {
        cloudStack.sections[section.id] = $.extend(section, {
          customIcon: 'plugins/' + section.id + '/icon.png'
        });
      },
      extend: function(obj) {
        $.extend(true, cloudStack, obj);
      }
    }
  });

  cloudStack.sections.plugins = {
    title: 'label.plugins',
    show: cloudStack.uiCustom.pluginListing
  };

  // Load
  $(['modules', 'plugins']).each(function() {
    var type = this;
    var paths = $(cloudStack[type]).map(function(index, id) {
      return type + '/' + id + '/' + id;
    }).toArray();

    // Load modules
    require(
      paths,
      function() {
        $(cloudStack[type]).map(function(index, id) {
          var basePath = type + '/' + id + '/';
          var css = basePath + id + '.css';
          var configJS = type == 'plugins' ? basePath + 'config' : null;

          if (configJS) {
            // Load config metadata
            require([configJS]);
          }

          // Execute module
          cloudStack[type][id](
            $.extend(true, {}, cloudStack.pluginAPI, {
              pluginAPI: {
                extend: function(api) {
                  cloudStack.pluginAPI[id] = api;
                }
              }
            })
          );
          loadCSS(css);
        });
      }
    );
  });
}(jQuery, cloudStack, require));
<|endoftext|>