<commit_before>/*========================================================================

   This file is part of the GOsa project -  http://gosa-project.org

   Copyright:
      (C) 2010-2017 GONICUS GmbH, Germany, http://www.gonicus.de

   License:
      LGPL-2.1: http://www.gnu.org/licenses/lgpl-2.1.html

   See the LICENSE file in the project's top-level directory for details.

======================================================================== */

qx.Class.define("gosa.Tools", {

  type: "static",

  statics: {

    createActionUrl: function(action, target){
      var url = document.location.origin + document.location.pathname;
      url += "#" + action + gosa.Config.actionDelimiter + target;
      return(url);
    },

    getLocale: function(){
      var locale;
      if (gosa.Config.locale) {
        locale = gosa.Config.locale;
      } else {
        locale = qx.bom.client.Locale.getLocale();
        var variant = qx.bom.client.Locale.getVariant();
        if (locale && variant) {
          locale = locale + "-" + variant;
        }
      }
      return(locale);
    },

    serialize : function(queue)
    {
      var timer = qx.util.TimerManager.getInstance();
      var locked = false;

      timer.start(function(userData, timerId){
        if (locked) {
          return;
        }

        locked = true;

        var entry = queue.shift();
        if (entry === undefined) {
          timer.stop();
          return;
        }

        var func = entry[0];
        var context = entry[1];
        var params = entry[2];
        params.push(function() {
          locked = false;
        });
        func.apply(context, params);
      }, 10, null, null, 0);
    },

    /**
     * Get an error string to the given error code
     *
     * @see https://developers.yubico.com/U2F/Libraries/Client_error_codes.html
     * @param code {Number} error code
     * @private
     */<commit_msg>remove @private from public method<commit_after>/*========================================================================

   This file is part of the GOsa project -  http://gosa-project.org

   Copyright:
      (C) 2010-2017 GONICUS GmbH, Germany, http://www.gonicus.de

   License:
      LGPL-2.1: http://www.gnu.org/licenses/lgpl-2.1.html

   See the LICENSE file in the project's top-level directory for details.

======================================================================== */

qx.Class.define("gosa.Tools", {

  type: "static",

  statics: {

    createActionUrl: function(action, target){
      var url = document.location.origin + document.location.pathname;
      url += "#" + action + gosa.Config.actionDelimiter + target;
      return(url);
    },

    getLocale: function(){
      var locale;
      if (gosa.Config.locale) {
        locale = gosa.Config.locale;
      } else {
        locale = qx.bom.client.Locale.getLocale();
        var variant = qx.bom.client.Locale.getVariant();
        if (locale && variant) {
          locale = locale + "-" + variant;
        }
      }
      return(locale);
    },

    serialize : function(queue)
    {
      var timer = qx.util.TimerManager.getInstance();
      var locked = false;

      timer.start(function(userData, timerId){
        if (locked) {
          return;
        }

        locked = true;

        var entry = queue.shift();
        if (entry === undefined) {
          timer.stop();
          return;
        }

        var func = entry[0];
        var context = entry[1];
        var params = entry[2];
        params.push(function() {
          locked = false;
        });
        func.apply(context, params);
      }, 10, null, null, 0);
    },

    /**
     * Get an error string to the given error code
     *
     * @see https://developers.yubico.com/U2F/Libraries/Client_error_codes.html
     * @param code {Number} error code
     */
{'fraction_non_alphanumeric': 0.19771369186801765, 'fraction_numerical': 0.009872694206287348, 'mean_word_length': 2.1661184210526314, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2490445', 'n_tokens_mistral': 1159, 'n_tokens_neox': 1092, 'n_words': 255}