PageSourceSearch

https://servicedesk.adult-empire.com/includes/jira/common/namespace.js

js adult-empire.com collected 2026-09-25 14:28:24 UTC 6,835 bytes, 195 lines download raw bytes

1function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2/**
3 * @fileOverview
4 * The {@link AJS.namespace} function and all AMD modules in this file are deprecated and not to be used.
5 * Please create AMD modules for your code.
6 * Read [JIRA's JavaScript Documentation]{@link https://extranet.atlassian.com/display/JIRASERVER/JIRA+JavaScript+Documentation} for more.
7 *
8 * The code here exists to support defining JIRA's legacy globals such that they can be
9 * deprecated and removed in favour of AMD modules. The 'jira/legacy' AMD modules exist to support testing.
10 *
11 * I am deliberately avoiding use of other AMD modules here to do things like dark feature checks,
12 * because doing so would create a synchronous circular dependency on those modules (since they use
13 * AJS.namespace to put themselves in the global namespace).
14 *
15 * To reiterate, these AMD modules ONLY exist for testing. DO NOT ADD DEPENDENCIES TO OR require() THESE MODULES!!!
16 *
17 * See [INC-71]{@link https://jdog.jira-dev.com/browse/INC-71} for more.
18 */
19
20/**
21 * @module
22 * @ignore
23 * @note
24 * I am deliberately avoiding use of other AMD modules here to do things like dark feature checks,
25 * because doing so would create a synchronous circular dependency on those modules (since they use
26 * AJS.namespace to put themselves in the global namespace).
27 */
28define('jira/legacy/config', function () {
29  'use strict';
30
31  // Are we in dev mode?
32  var isDevMode = document.querySelector('meta[name=ajs-dev-mode]');
33  isDevMode = isDevMode && 'true' === isDevMode.getAttribute('content');
34  // Check if some dark features are on or not.
35  var darkFeatures = document.querySelector('meta[name=ajs-enabled-dark-features]');
36  darkFeatures = darkFeatures && darkFeatures.getAttribute('content') || '';
37  function isEnabled(key) {
38    return darkFeatures && darkFeatures.indexOf(key) !== -1;
39  }
40  var noGlobals = isEnabled('amd.loader.noglobals');
41  var logDeprecationNotice = isDevMode || noGlobals || isEnabled('amd.loader.globals.deprecation.warning');
42  var hasDefineProperty = function () {
43    try {
44      return Object.defineProperty && Object.defineProperty({}, 'x', {
45        get: function get() {
46          return true;
47        }
48      }).x === true;
49    } catch (e) {}
50    return false;
51  }();
52  return {
53    hasDefineProperty: hasDefineProperty,
54    logDeprecationNotice: logDeprecationNotice,
55    noGlobals: noGlobals
56  };
57});
58
59/**
60 * @module
61 * @ignore
62 */
63define('jira/legacy/logger', ['jira/util/logger'], function (logger) {
64  'use strict';
65
66  /**
67   * An array of all arguments passed to the logging function
68   * that we are yet to output to the developer console.
69   * @type {Array<Array>}
70   */
71  var messages = [];
72  var nextTick;
73  function logMessages() {
74    var i = 0;
75    var ii = messages.length;
76    console && console.groupCollapsed && console.groupCollapsed("Global object deprecations (" + ii + ")");
77    for (; i < ii; i++) {
78      logger.warn.apply(undefined, messages[i]);
79    }
80    console && console.groupEnd && console.groupEnd();
81    messages.length = 0;
82  }
83  return function () {
84    messages.push(Array.prototype.slice.apply(arguments));
85    if (nextTick) {
86      clearTimeout(nextTick);
87    }
88    nextTick = setTimeout(function () {
89      logMessages();
90      nextTick = undefined;
91    }, 200);
92  };
93});
94
95/**
96 * @module
97 * @ignore
98 * @deprecated We are moving this dependency into a new one, please include jira.webresources:deprecator in your xml and require("jira/deprecator")
99 */
100define('jira/legacy/deprecator', ['jira/deprecator'], function (deprecator) {
101  'use strict';
102
103  return deprecator;
104});
105
106/**
107 * @module
108 * @ignore
109 */
110define('jira/legacy/namespace', ['jira/legacy/config', 'jira/legacy/logger', 'jira/legacy/deprecator'], function (config, log, deprecator) {
111  'use strict';
112
113  return function (namespace, context, value) {
114    var logMessage;
115    var names;
116    if (config.logDeprecationNotice) {
117      // Output an appropriate message based on what the function will end up doing.
118      if (config.noGlobals) {
119        logMessage = 'GONE: The global object ' + namespace + ' was not created!';
120      } else {
121        logMessage = 'DEPRECATED: The global object ' + namespace + ' is deprecated.';
122      }
123      // Check if there's enough info to output a message suggesting the more correct alternative
124      if (_typeof(value) === 'object' || typeof value === 'function') {
125        if (value.__amdModuleName) {
126          logMessage += ' Please use require(["' + value.__amdModuleName + '"]) instead.';
127          delete value.__amdModuleName;
128        }
129      }
130    }
131    if (config.noGlobals) {
132      log(logMessage);
133      return;
134    }
135
136    // Calculate and output the global.
137
138    names = namespace.split('.');
139    context = context || window;
140    for (var i = 0, n = names.length - 1; i < n; i++) {
141      var x = context[names[i]];
142      context = x != null ? x : context[names[i]] = {};
143    }
144    var returnedValue = value || context[names[i]] || {};
145    (function (val) {
146      if (config.hasDefineProperty && config.logDeprecationNotice) {
147        Object.defineProperty(context, names[i], {
148          configurable: true,
149          get: function get() {
150            if (deprecator && deprecator.getDeprecatedLocation) {
151              var trace = deprecator.getDeprecatedLocation(0);
152              if (trace && trace.indexOf("AJS.namespace") === -1) {
153                log(logMessage, "\n" + trace);
154              } else {
155                log(logMessage);
156              }
157            }
158            return val;
159          },
160          set: function set(newVal) {
161            val = newVal;
162          }
163        });
164      } else {
165        if (config.logDeprecationNotice) {
166          log(logMessage);
167        }
168        context[names[i]] = val;
169      }
170    })(returnedValue);
171    return returnedValue;
172  };
173});
174
175// INC-71 - In order for AJS.namespace to continue working... we need to be evil and use a top-level synchronous require
176
177/**
178 * Get/set the value at a compound namespace, gracefully adding values where missing.
179 * @param {string} namespace
180 * @param {Object} [context=window]
181 * @param {Object} [value={}]
182 * @deprecated please create AMD modules in the appropriate place in the /webapp/static/ folder!
183 * Read [JIRA's JavaScript Documentation]{@link https://extranet.atlassian.com/display/JIRADEV/JIRA+JavaScript+Documentation} for more.
184 */
185AJS.namespace = require('jira/legacy/namespace');
186
187/**
188 * @deprecated
189 * @ignore
190 */
191AJS.namespace('jQuery.namespace', null, function (namespace) {
192  'use strict';
193
194  AJS.namespace(namespace);
195});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.