1WRMCB=function(e){var c=console;if(c&&c.log&&c.error){c.log('Error running batched script.');c.error(e);}} 2; 3try { 4/* module-key = 'confluence.extra.jira:help-dialog-extension', location = '/jira/help-dialog.js' */ 5Confluence.KeyboardShortcuts&&Confluence.KeyboardShortcuts.Editor.push({context:"editor.actions",descKey:"Insert Jira Issue/Filter"+":",keys:[["Ctrl+Shift+J"]]}); 6}catch(e){WRMCB(e)}; 7; 8try { 9/* module-key = 'com.atlassian.confluence.plugins.confluence-mentions-plugin:help-dialog-extension', location = 'js/help-dialog.js' */ 10AJS.toInit(function($) { 11 // Add the shortcut to the shortcuts dialog 12 Confluence.KeyboardShortcuts && Confluence.KeyboardShortcuts.Autoformat.push( 13 { 14 action: "@", 15 context: "autoformat.autocomplete", 16 description: "Mention" 17 }); 18}); 19}catch(e){WRMCB(e)}; 20; 21try { 22/* module-key = 'com.atlassian.confluence.plugins.confluence-dashboard:footer-analytics', location = '/js/confluence-dashboard/utils/footer-analytics.js' */ 23define("confluence-dashboard/utils/footer-analytics",["jquery","ajs","confluence/meta"],function(e,a,t){"use strict";var n=i(e).default,o=i(a).default,c=i(t).default;function i(e){return e&&e.__esModule?e:{default:e}}o.toInit(function(){var e=c.get("page-id"),a=n("body").hasClass("dashboard");n("#footer").on("click","a",function(){o.trigger("analytics",{name:"confluence.footer.item.click",data:{pageId:e,isDashboard:a}})})})}),require(["confluence-dashboard/utils/footer-analytics"]); 24}catch(e){WRMCB(e)}; 25; 26try { 27/* module-key = 'com.atlassian.auiplugin:split_aui.component.dialog2', location = 'aui.chunk.e1e571afceafc26de43c--46347bb727ebd80a352d.js' */ 28(window.__auiJsonp=window.__auiJsonp||[]).push([["aui.component.dialog2"],{"0+IH":function(t,e,i){"use strict";i.r(e),i.d(e,"dialog2",(function(){return p}));i("AehQ"),i("rWoL");var a=i("+x/D"),u=i("TmQU"),n=i("KloK"),o=i("jEnx"),c=i("6RZY"),l=i("+ay7"),s=i("Pjwx"),d={"aui-focus":"false","aui-blanketed":"true"};function f(t){var e;this._handlers=new WeakMap,this.$el=t?Object(a.default)(t):Object(a.default)(`\n <section role="dialog" class="aui-layer aui-dialog2 aui-dialog2-medium">\n <header class="aui-dialog2-header">\n <h2 class="aui-dialog2-header-main"></h2>\n ${s.CLOSE_BUTTON}\n </button>\n </header>\n <div class="aui-dialog2-content"></div>\n <footer class="aui-dialog2-footer"></footer>\n </section>`),e=this.$el,a.default.each(d,(function(t,i){var a="data-"+t;e[0].hasAttribute(a)||e.attr(a,i)}))}f.prototype.on=function(t,e){var i=this.$el;if(!this._handlers.get(e)){var a=function(t){t.target===i.get(0)&&e.apply(this,arguments)};Object(o.default)(i).on(t,a),this._handlers.set(e,a)}return this},f.prototype.off=function(t,e){var i=this.$el,a=this._handlers.get(e);return a&&(Object(o.default)(i).off(t,a),this._handlers.delete(e)),this},f.prototype.show=function(){return Object(o.default)(this.$el).show(),this},f.prototype.hide=function(){return Object(o.default)(this.$el).hide(),this},f.prototype.remove=function(){return Object(o.default)(this.$el).remove(),this},f.prototype.isVisible=function(){return Object(o.default)(this.$el).isVisible()};var r=Object(c.default)("dialog2",f),h=new Set;r.on=function(t,e){return h.has(e)||(o.default.on(t,".aui-dialog2",e),h.add(e)),this},r.off=function(t,e){return h.has(e)&&(o.default.off(t,".aui-dialog2",e),h.delete(e)),this},Object(a.default)(document).on("click keydown",`.aui-dialog2-header ${s.CLOSE_BUTTON_CLASS_SELECTOR}`,(function(t){("click"===t.type||t.keyCode===l.default.ENTER||t.keyCode===l.default.SPACE)&&(t.preventDefault(),r(Object(a.default)(t.target).closest(".aui-dialog2")).hide())})),r.on("show",(function(t,e){e.find(s.CLOSE_BUTTON_CLASS_SELECTOR).attr("tabindex",0),e.attr("tabindex",-1);var i=e[0].hasAttribute("data-aui-focus-selector")&&e.attr("data-aui-focus-selector");if(i){var a=e.find(i);if(a.length>0)return a.first().focus()}e.focus()})),r.on("hide",(function(t,e){var i=Object(o.default)(e);e.data("aui-remove-on-hide")&&i.remove()})),Object(u.default)("aui/dialog2",r),Object(n.default)("dialog2",r);var p=r}},[["0+IH","runtime","aui.splitchunk.vendors--894c8113d9","aui.splitchunk.0d131bcbf1","aui.splitchunk.fbbef27525","aui.splitchunk.444efc83be","aui.splitchunk.739b9ec8cc","aui.splitchunk.dd803a46b4","aui.splitchunk.994e478d48","aui.splitchunk.d7c46c2734","aui.splitchunk.e54c7c7304","aui.splitchunk.fb15cffa72","aui.splitchunk.f1e06f97a4","aui.splitchunk.479fe6ee76","aui.splitchunk.f673ef53ac","aui.splitchunk.8659b532c1","aui.splitchunk.5f851f97df","aui.splitchunk.d0110a864f","aui.splitchunk.afa5039e04","aui.splitchunk.bff3715233","aui.splitchunk.c750721820","aui.splitchunk.6d6f245ed3","aui.splitchunk.5b8c290363","aui.splitchunk.3d2cb1af14"]]]); 29}catch(e){WRMCB(e)}; 30; 31try { 32/* module-key = 'confluence.web.resources:page-loading-indicator', location = '/includes/js/page-loading-indicator.js' */
33define("confluence/page-loading-indicator",["jquery","underscore","ajs","confluence/templates"],function(c,k,a,h){return function(b){function d(){return c(".confluence-page-loading-blanket",b)}function e(){return c(".confluence-loading-indicator",b)}return{show:function(){0===d().length&&c(b).append(h.pageLoadingIndicator());d().show();e().spin({lines:12,length:8,width:4,radius:10,trail:60,speed:1.5,color:"#F0F0F0"})},hide:function(){e().stop();d().hide()},showUntilResolved:function(c,b){var f=this.hide.bind(this); 34this.show();c.then(function(){f()},function(){b&&a.messages.error(".confluence-page-loading-errors",{body:b});f()})},showUntilDialogVisible:function(b,d){var f=d||"An error has occurred connecting to the server. Please try again.",g=this.hide.bind(this),e=c(".aui-dialog:visible"),h=c(".aui-dialog2:visible");!e.length&&!h.length&&this.show();b.then(function(){g()},function(){a.messages.error(".confluence-page-loading-errors",{body:f});g()});a.bind("show.dialog",function i(){a.unbind("show.dialog",i);g()});if(null!=a.dialog2&& 35void 0!=a.dialog2)a.dialog2.on("show",function j(){a.dialog2.off("show",j);g()})},destroy:function(){b.remove(".confluence-page-loading-blanket")}}}});require("confluence/module-exporter").exportModuleAsGlobal("confluence/page-loading-indicator","Confluence.PageLoadingIndicator"); 36}catch(e){WRMCB(e)}; 37; 38try { 39/* module-key = 'confluence.web.resources:page-loading-indicator', location = '/includes/soy/page-loading-indicator.soy' */ 40// This file was automatically generated from page-loading-indicator.soy. 41// Please don't edit this file by hand. 42 43/** 44 * @fileoverview Templates in namespace Confluence.Templates. 45 */ 46 47if (typeof Confluence == 'undefined') { var Confluence = {}; } 48if (typeof Confluence.Templates == 'undefined') { Confluence.Templates = {}; } 49 50 51Confluence.Templates.pageLoadingIndicator = function(opt_data, opt_ignored) { 52 return '<div class="confluence-page-loading-errors"></div><div class="confluence-page-loading-blanket aui-blanket" aria-hidden="false"><div class="confluence-loading-indicator"></div></div>'; 53}; 54if (goog.DEBUG) { 55 Confluence.Templates.pageLoadingIndicator.soyTemplateName = 'Confluence.Templates.pageLoadingIndicator'; 56} 57 58}catch(e){WRMCB(e)}; 59; 60try { 61/* module-key = 'confluence.web.resources:deferred-loaders', location = '/includes/js/deferred-dialog-loader.js' */ 62define("confluence/deferred-dialog-loader",["underscore","jquery","ajs","confluence/page-loading-indicator","confluence/api/event"],function(c,d,i,j,b){return function(){var k=j(d("body")),f,g=!1,h=!1,e=function(){g&&h&&f&&(b.trigger(f),f=void 0)};b.bind("page.move.dialog.ready",function(){g=!0;e()});b.bind("blogpost.move.dialog.ready",function(){h=!0;e()});c.each({movePageDialogTools:{resource:"confluence.web.resources:page-move-resources",selector:"#action-move-page-dialog-link",event:"deferred.page-move.tools-menu"}, 63movePageDialogEditor:{resource:"confluence.web.resources:page-move-resources",selector:"#rte-button-location",event:"deferred.page-move.editor"},moveBlogDialogTools:{resource:"confluence.web.resources:page-move-resources",selector:"#action-move-blogpost-dialog-link",event:"deferred.blog-move.tools-menu"},availableGadgetsHelp:{resource:"com.atlassian.confluence.plugins.gadgets:gadget-directory-resources",selector:"#gadget-directory-link",event:"deferred.available-gadgets.help-menu"},aboutConfluenceHelp:{resource:"confluence.web.resources:about", 64selector:"#confluence-about-link",event:"deferred.about-confluence.help-menu"}},function(a){d("body").on("click",a.selector,function(c){var d=a.resource+".requested",e=WRM.require("wr!"+a.resource);e.then(function(){"confluence.web.resources:page-move-resources"!==a.resource?b.trigger(a.event):g&&h?b.trigger(a.event):f=a.event});k.showUntilDialogVisible(e);i.Analytics?i.Analytics.triggerPrivacyPolicySafeEvent(d):b.trigger("analyticsEvent",{name:d});c.preventDefault()})})}}); 65require("confluence/module-exporter").safeRequire("confluence/deferred-dialog-loader",function(c){require("ajs").toInit(c)}); 66}catch(e){WRMCB(e)}; 67; 68try { 69/* module-key = 'confluence.web.resources:deferred-loaders', location = '/includes/js/page-permissions-deferred-loader.js' */ 70define("confluence/page-permissions-deferred-loader","confluence/dark-features confluence/legacy ajs confluence/page-loading-indicator jquery wrm".split(" "),function(b,a,c,d,e,f){var g=d(e("body"));return function(b){var a=f.require("wr!com.atlassian.confluence.plugins.confluence-page-restrictions-dialog:dialog-resources");a.then(function(){c.trigger("deferred.page.permissions")});g.showUntilDialogVisible(a,"There was an error loading the page restrictions. Please try again later.");b.preventDefault()}}); 71require("confluence/module-exporter").safeRequire("confluence/page-permissions-deferred-loader",function(b){var a=require("ajs");a.toInit(function(c){c("body").on("click","#rte-button-restrictions,#action-page-permissions-link",b);a.bind("system-content-metadata.open-restrictions-dialog",b)})}); 72}catch(e){WRMCB(e)}; 73; 74try { 75/* module-key = 'confluence.web.resources:navigator-context', location = '/includes/js/api/navigator-context.js' */ 76define("confluence/api/navigator-context",["confluence/meta","document"],function(g,b){var h=function(a){a=d(a);return"undefined"!==typeof a&&0!==a},d=function(a){a=g.get(a);if(!isNaN(a))return Number(a)},i=function(){return!!b.querySelector(".page.view")||!!b.querySelector(".blogpost.view")},e=function(){return!!b.querySelector(".page.edit")||!!b.querySelector(".blogpost.edit")}
76,f=function(){return g.get("content-type")},c=function(){return d("page-id")};return{getCurrent:function(){return e()&& 770===c()&&h("draft-id")?{target:"contentcreate",context:{contentId:d("draft-id"),contentType:f()}}:e()&&!i()&&0!==c()?{target:"contentedit",context:{contentId:c(),contentType:f()}}:!e()&&i()&&h("page-id")?{target:"contentview",context:{contentId:c(),contentType:f()}}:{target:"unknown",context:{}}}}}); 78}catch(e){WRMCB(e)}; 79; 80try { 81/* module-key = 'com.gliffy.integration.confluence:gliffy-confluence-almond', location = 'gliffy/amd/AlmondNoConflictPrefix.js' */ 82// This was copied from Atlassian's almond-noconflict-pre.js 83window.__require = window.require; 84window.__requirejs = window.requirejs; 85window.__define = window.define; 86}catch(e){WRMCB(e)}; 87; 88try { 89/* module-key = 'com.gliffy.integration.confluence:gliffy-confluence-almond', location = 'thirdparty/almond.js' */ 90/** 91 * @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved. 92 * Available via the MIT or new BSD license. 93 * see: http://github.com/jrburke/almond for details 94 */ 95//Going sloppy to avoid 'use strict' string cost, but strict practices should 96//be followed. 97/*jslint sloppy: true */ 98/*global setTimeout: false */ 99 100var requirejs, require, define; 101(function (undef) { 102 var main, req, makeMap, handlers, 103 defined = {}, 104 waiting = {}, 105 config = {}, 106 defining = {}, 107 hasOwn = Object.prototype.hasOwnProperty, 108 aps = [].slice, 109 jsSuffixRegExp = /\.js$/; 110 111 function hasProp(obj, prop) { 112 return hasOwn.call(obj, prop); 113 } 114 115 /** 116 * Given a relative module name, like ./something, normalize it to 117 * a real name that can be mapped to a path. 118 * @param {String} name the relative name 119 * @param {String} baseName a real name that the name arg is relative 120 * to. 121 * @returns {String} normalized name 122 */ 123 function normalize(name, baseName) { 124 var nameParts, nameSegment, mapValue, foundMap, lastIndex, 125 foundI, foundStarMap, starI, i, j, part, 126 baseParts = baseName && baseName.split("/"), 127 map = config.map, 128 starMap = (map && map['*']) || {}; 129 130 //Adjust any relative paths. 131 if (name && name.charAt(0) === ".") { 132 //If have a base name, try to normalize against it, 133 //otherwise, assume it is a top-level require that will 134 //be relative to baseUrl in the end. 135 if (baseName) { 136 name = name.split('/'); 137 lastIndex = name.length - 1; 138 139 // Node .js allowance: 140 if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { 141 name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); 142 } 143 144 //Lop off the last part of baseParts, so that . matches the 145 //"directory" and not name of the baseName's module. For instance, 146 //baseName of "one/two/three", maps to "one/two/three.js", but we 147 //want the directory, "one/two" for this normalization. 148 name = baseParts.slice(0, baseParts.length - 1).concat(name); 149 150 //start trimDots 151 for (i = 0; i < name.length; i += 1) { 152 part = name[i]; 153 if (part === ".") { 154 name.splice(i, 1); 155 i -= 1; 156 } else if (part === "..") { 157 if (i === 1 && (name[2] === '..' || name[0] === '..')) { 158 //End of the line. Keep at least one non-dot 159 //path segment at the front so it can be mapped 160 //correctly to disk. Otherwise, there is likely 161 //no path mapping for a path starting with '..'. 162 //This can still fail, but catches the most reasonable 163 //uses of .. 164 break; 165 } else if (i > 0) { 166 name.splice(i - 1, 2); 167 i -= 2; 168 } 169 } 170 } 171 //end trimDots 172 173 name = name.join("/"); 174 } else if (name.indexOf('./') === 0) { 175 // No baseName, so this is ID is resolved relative 176 // to baseUrl, pull off the leading dot. 177 name = name.substring(2); 178 } 179 } 180 181 //Apply map config if available. 182 if ((baseParts || starMap) && map) {
vendor: 8,864 bytes, lines 183-436
183 nameParts = name.split('/'); 184 185 for (i = nameParts.length; i > 0; i -= 1) { 186 nameSegment = nameParts.slice(0, i).join("/"); 187 188 if (baseParts) { 189 //Find the longest baseName segment match in the config. 190 //So, do joins on the biggest to smallest lengths of baseParts. 191 for (j = baseParts.length; j > 0; j -= 1) { 192 mapValue = map[baseParts.slice(0, j).join('/')]; 193 194 //baseName segment has config, find if it has one for 195 //this name. 196 if (mapValue) { 197 mapValue = mapValue[nameSegment]; 198 if (mapValue) { 199 //Match, update name to the new value. 200 foundMap = mapValue; 201 foundI = i; 202 break; 203 } 204 } 205 } 206 } 207 208 if (foundMap) { 209 break; 210 } 211 212 //Check for a star map match, but just hold on to it, 213 //if there is a shorter segment match later in a matching 214 //config, then favor over this star map. 215 if (!foundStarMap && starMap && starMap[nameSegment]) { 216 foundStarMap = starMap[nameSegment]; 217 starI = i; 218 } 219 } 220 221 if (!foundMap && foundStarMap) { 222 foundMap = foundStarMap; 223 foundI = starI; 224 } 225 226 if (foundMap) { 227 nameParts.splice(0, foundI, foundMap); 228 name = nameParts.join('/'); 229 } 230 } 231 232 return name; 233 } 234 235 function makeRequire(relName, forceSync) { 236 return function () { 237 //A version of a require function that passes a moduleName 238 //value for items that may need to 239 //look up paths relative to the moduleName 240 var args = aps.call(arguments, 0); 241 242 //If first arg is not require('string'), and there is only 243 //one arg, it is the array form without a callback. Insert 244 //a null so that the following concat is correct. 245 if (typeof args[0] !== 'string' && args.length === 1) { 246 args.push(null); 247 } 248 return req.apply(undef, args.concat([relName, forceSync])); 249 }; 250 } 251 252 function makeNormalize(relName) { 253 return function (name) { 254 return normalize(name, relName); 255 }; 256 } 257 258 function makeLoad(depName) { 259 return function (value) { 260 defined[depName] = value; 261 }; 262 } 263 264 function callDep(name) { 265 if (hasProp(waiting, name)) { 266 var args = waiting[name]; 267 delete waiting[name]; 268 defining[name] = true; 269 main.apply(undef, args); 270 } 271 272 if (!hasProp(defined, name) && !hasProp(defining, name)) { 273 throw new Error('No ' + name); 274 } 275 return defined[name]; 276 } 277 278 //Turns a plugin!resource to [plugin, resource] 279 //with the plugin being undefined if the name 280 //did not have a plugin prefix. 281 function splitPrefix(name) { 282 var prefix, 283 index = name ? name.indexOf('!') : -1; 284 if (index > -1) { 285 prefix = name.substring(0, index); 286 name = name.substring(index + 1, name.length); 287 } 288 return [prefix, name]; 289 } 290 291 /** 292 * Makes a name map, normalizing the name, and using a plugin 293 * for normalization if necessary. Grabs a ref to plugin 294 * too, as an optimization. 295 */ 296 makeMap = function (name, relName) { 297 var plugin, 298 parts = splitPrefix(name), 299 prefix = parts[0]; 300 301 name = parts[1]; 302 303 if (prefix) { 304 prefix = normalize(prefix, relName); 305 plugin = callDep(prefix); 306 } 307 308 //Normalize according 309 if (prefix) { 310 if (plugin && plugin.normalize) { 311 name = plugin.normalize(name, makeNormalize(relName)); 312 } else { 313 name = normalize(name, relName); 314 } 315 } else { 316 name = normalize(name, relName); 317 parts = splitPrefix(name); 318 prefix = parts[0]; 319 name = parts[1]; 320 if (prefix) { 321 plugin = callDep(prefix); 322 } 323 } 324 325 //Using ridiculous property names for space reasons 326 return { 327 f: prefix ? prefix + '!' + name : name, //fullName 328 n: name, 329 pr: prefix, 330 p: plugin 331 }; 332 }; 333 334 function makeConfig(name) { 335 return function () { 336 return (config && config.config && config.config[name]) || {}; 337 }; 338 } 339 340 handlers = { 341 require: function (name) { 342 return makeRequire(name); 343 }, 344 exports: function (name) { 345 var e = defined[name]; 346 if (typeof e !== 'undefined') { 347 return e; 348 } else { 349 return (defined[name] = {}); 350 } 351 }, 352 module: function (name) { 353 return { 354 id: name, 355 uri: '', 356 exports: defined[name], 357 config: makeConfig(name) 358 }; 359 } 360 }; 361 362 main = function (name, deps, callback, relName) { 363 var cjsModule, depName, ret, map, i, 364 args = [], 365 callbackType = typeof callback, 366 usingExports; 367 368 //Use name if no relName 369 relName = relName || name; 370 371 //Call the callback to define the module, if necessary. 372 if (callbackType === 'undefined' || callbackType === 'function') { 373 //Pull out the defined dependencies and pass the ordered 374 //values to the callback. 375 //Default to [require, exports, module] if no deps 376 deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps; 377 for (i = 0; i < deps.length; i += 1) { 378 map = makeMap(deps[i], relName); 379 depName = map.f; 380 381 //Fast path CommonJS standard dependencies. 382 if (depName === "require") { 383 args[i] = handlers.require(name); 384 } else if (depName === "exports") { 385 //CommonJS module spec 1.1 386 args[i] = handlers.exports(name); 387 usingExports = true; 388 } else if (depName === "module") { 389 //CommonJS module spec 1.1 390 cjsModule = args[i] = handlers.module(name); 391 } else if (hasProp(defined, depName) || 392 hasProp(waiting, depName) || 393 hasProp(defining, depName)) { 394 args[i] = callDep(depName); 395 } else if (map.p) { 396 map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {}); 397 args[i] = defined[depName]; 398 } else { 399 throw new Error(name + ' missing ' + depName); 400 } 401 } 402 403 ret = callback ? callback.apply(defined[name], args) : undefined; 404 405 if (name) { 406 //If setting exports via "module" is in play, 407 //favor that over return value and exports. After that, 408 //favor a non-undefined return value over exports use. 409 if (cjsModule && cjsModule.exports !== undef && 410 cjsModule.exports !== defined[name]) { 411 defined[name] = cjsModule.exports; 412 } else if (ret !== undef || !usingExports) { 413 //Use the return value from the function. 414 defined[name] = ret; 415 } 416 } 417 } else if (name) { 418 //May just be an object definition for the module. Only 419 //worry about defining if have a module name. 420 defined[name] = callback; 421 } 422 }; 423 424 requirejs = require = req = function (deps, callback, relName, forceSync, alt) { 425 if (typeof deps === "string") { 426 if (handlers[deps]) { 427 //callback in this case is really relName 428 return handlers[deps](callback); 429 } 430 //Just return the module wanted. In this scenario, the 431 //deps arg is the module name, and second arg (if passed) 432 //is just the relName. 433 //Normalize module name, if it contains . or .. 434 return callDep(makeMap(deps, callback).f); 435 } else if (!deps.splice) { 436 //deps is a config object, not an array.
437 config = deps; 438 if (config.deps) { 439 req(config.deps, config.callback); 440 } 441 if (!callback) { 442 return; 443 } 444 445 if (callback.splice) { 446 //callback is an array, which means it is a dependency list. 447 //Adjust args if there are dependencies 448 deps = callback; 449 callback = relName; 450 relName = null; 451 } else { 452 deps = undef; 453 } 454 } 455 456 //Support require(['a']) 457 callback = callback || function () {}; 458 459 //If relName is a function, it is an errback handler, 460 //so remove it. 461 if (typeof relName === 'function') { 462 relName = forceSync; 463 forceSync = alt; 464 } 465 466 //Simulate async callback; 467 if (forceSync) { 468 main(undef, deps, callback, relName); 469 } else { 470 //Using a non-zero value because of concern for what old browsers 471 //do, and latest browsers "upgrade" to 4 if lower value is used: 472 //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout: 473 //If want a value immediately, use require('id') instead -- something 474 //that works in almond on the global level, but not guaranteed and 475 //unlikely to work in other AMD implementations. 476 setTimeout(function () { 477 main(undef, deps, callback, relName); 478 }, 4); 479 } 480 481 return req; 482 }; 483 484 /** 485 * Just drops the config on the floor, but returns req in case 486 * the config return value is used. 487 */ 488 req.config = function (cfg) { 489 return req(cfg); 490 }; 491 492 /** 493 * Expose module registry for debugging and tooling 494 */ 495 requirejs._defined = defined; 496 497 define = function (name, deps, callback) { 498 if (typeof name !== 'string') { 499 throw new Error('See almond README: incorrect module build, no module name'); 500 } 501 502 //This module may not have dependencies 503 if (!deps.splice) { 504 //deps is not an array, so probably means 505 //an object literal or factory function for 506 //the value. Adjust args. 507 callback = deps; 508 deps = []; 509 } 510 511 if (!hasProp(defined, name) && !hasProp(waiting, name)) { 512 waiting[name] = [name, deps, callback]; 513 } 514 }; 515 516 define.amd = { 517 jQuery: true 518 }; 519}()); 520}catch(e){WRMCB(e)}; 521; 522try { 523/* module-key = 'com.gliffy.integration.confluence:gliffy-confluence-almond', location = 'gliffy/amd/AlmondNoConflictPostfix.js' */ 524// This was copied from Atlassian's almond-noconflict-post.js 525 526if (window.__require) { 527 window.require = window.__require; 528 window.requirejs = window.__requirejs; 529 window.define = window.__define; 530} else { 531 // Patch our own version of Almond. 532 // 533 // If "define.amd" is truthy, some 3rd-party libs (e.g. jQuery, spin.js) 534 // automatically register themselves via define(). We don't want that, 535 // we'll take care of calling define() for each lib. 536 delete window.define.amd; 537} 538 539}catch(e){WRMCB(e)}; 540; 541try { 542/* module-key = 'com.gliffy.integration.confluence:gliffy-confluence-almond', location = 'gliffy/amd/ApexModuleManager.js' */ 543/** 544 * Simple mechanism for automatic AMD apex module (such as DOM controllers) instantiation. 545 * May not be necessary after integrating RequireJS optimizer. 546 * 547 * define() passes through all arguments to AMD loader, storing away the ID for instantiation later. So far, all apex 548 * classes have only had to add the line "require("gliffy/amd/apexModuleManager")." before the standard AMD define() 549 * call. 550 * 551 * Example use: 552 * <this file toward beginning of batch.js> 553 * 554 * require("gliffy/amd/apexModuleManager"). 555 * define("my/new/class/id", ...) 556 * define("my/new/class2/id", ...) 557 * .... 558 * 559 * ;(function($, apexModuleManager) { 560 * // Wait for DOM to be loaded before instantiating apex modules. 561 * $(function () { 562 * apexModuleManager.instantiateAll(); 563 * apexModuleManager.reset(); 564 * }); 565 * })(require('jquery'), require('gliffy/amd/apexModuleManager')); 566 567 * <end of batch.js> 568 */ 569define("gliffy/amd/apexModuleManager", function() { 570 var apexModuleIds = []; 571 572 return { 573 reset: function() { 574 apexModuleIds = []; 575 }, 576 define: function() { 577 // pass the arguments directly to define(), but register the first argument as module ID. 578 apexModuleIds.push(arguments[0]); 579 window.define.apply(window, arguments); 580 }, 581 instantiateAll: function() { 582 apexModuleIds.forEach(function(apexModuleId) { 583 require(apexModuleId); 584 }); 585 } 586 }; 587 588}); 589}catch(e){WRMCB(e)}; 590; 591try { 592/* module-key = 'com.gliffy.integration.confluence:gliffy-confluence-almond', location = 'gliffy/confluence/AlmondRegistrations.js' */ 593// You can't just bind it directly to jQuery because it is a function, which causes define to try to use it as a 594// factory method. 595 596// Remove definition to force libraries to not register themselves with AMD. This is because we need to handle registration ourselves due to Almond's name requirement. 597delete define.amd; 598 599define('jquery', [], function() { 600 return jQuery; 601}); 602 603define('underscore', [], function() { 604 return _; 605}); 606 607define('selectize', [], function () { 608 return Selectize; 609}); 610 611}catch(e){WRMCB(e)}; 612; 613try { 614/* module-key = 'com.gliffy.integration.confluence:gliffy-confluence-basics', location = 'gliffy/Util.js' */ 615define("gliffy/util", [ 616], function() { 617 "use strict"; 618 619 // similar to Java String.format(). 620 // Examples: 621 // $.format('{1} is first, {0} is second! {0} {2}', 'B', 'A') === 'A is first, B is second! B undefined'; 622 623 return { 624 format: function (format) { 625 var args = Array.prototype.slice.call(arguments, 1); 626 return format.replace(/{(\d+)}/g, function (match, number) { 627 return (typeof args[number] != 'undefined') ? args[number] : "undefined"; 628 }); 629 }, 630 htmlDecode: function(input) { 631 var e = document.createElement('div'); 632 e.innerHTML = input; 633 return e.childNodes.length === 0 ? "" : e.childNodes[0].nodeValue; 634 } 635 }; 636}); 637 638}catch(e){WRMCB(e)}; 639; 640try { 641/* module-key = 'com.gliffy.integration.confluence:gliffy-confluence-basics', location = 'gliffy/Url.js' */ 642/** 643 * URL utility functions. 644 */ 645define("gliffy/url", { 646 buildPath: function (pathElementArray) { 647 return pathElementArray.reduce(function (result, value) { 648 if (value == null) { 649 return result; 650 } else if (result) {
651 return result + "/" + encodeURIComponent(value); 652 } 653 return encodeURIComponent(value); 654 }, ""); 655 }, 656 buildQuery: function (queryMap) { 657 return _.reduce(queryMap, function (result, value, key) { 658 if (value == null) { 659 return result; 660 } else if (result) { 661 return result + "&" + encodeURIComponent(key) + "=" + encodeURIComponent(value); 662 } 663 return encodeURIComponent(key) + "=" + encodeURIComponent(value); 664 }, ""); 665 }, 666 buildPathAndQuery: function (pathElements, queryMap) { 667 var elements = [this.buildPath(pathElements)]; 668 669 if((typeof queryMap !== "undefined") && Object.keys(queryMap).length > 0) { 670 elements.push(this.buildQuery(queryMap)) 671 } 672 return elements.join("?"); 673 }, 674 buildRootedPathAndQuery: function (rootPath, pathElements, queryMap) { 675 return rootPath + "/" + this.buildPathAndQuery(pathElements, queryMap); 676 }, 677 "parse": function(url) { 678 var regex = /^(?:([a-z]*):)?(?:\/\/)?(?:([^:@]*)(?::([^@]*))?@)?([0-9a-z-._]+)?(?::([0-9]*))?(\/[^?#]*)?(?:\?([^#]*))?(?:#(.*))?$/i; 679 var md = url.match(regex) || []; 680 681 var r = { 682 "url": url, 683 "scheme": md[1], 684 "user": md[2], 685 "pass": md[3], 686 "host": md[4], 687 "port": md[5] && +md[5], 688 "path": md[6], 689 "query": md[7], 690 "hash": md[8] 691 }; 692 693 // parse query params 694 r.queryParams = {}; 695 696 var queryTokens = r.query.split("&"); 697 for(var tokenIndex = 0; tokenIndex < queryTokens.length; tokenIndex++) { 698 var subTokens = queryTokens[tokenIndex].split("="); 699 r.queryParams[decodeURIComponent(subTokens[0])] = decodeURIComponent(subTokens[1]); 700 } 701 return r; 702 } 703}); 704 705}catch(e){WRMCB(e)}; 706; 707try { 708/* module-key = 'com.gliffy.integration.confluence:gliffy-confluence-basics', location = 'gliffy/controls/alert/Alert.soy' */ 709// This file was automatically generated from Alert.soy. 710// Please don't edit this file by hand. 711 712/** 713 * @fileoverview Templates in namespace gliffySoy.controls.alert. 714 */ 715 716if (typeof gliffySoy == 'undefined') { var gliffySoy = {}; } 717if (typeof gliffySoy.controls == 'undefined') { gliffySoy.controls = {}; } 718if (typeof gliffySoy.controls.alert == 'undefined') { gliffySoy.controls.alert = {}; } 719 720 721gliffySoy.controls.alert.CompleteAlert = function(opt_data, opt_ignored) { 722 return '<div id="gliffy-alert-save-as-complete" class="alert alert-success gliffy-alert"><a href="#" class="close" data-dismiss="alert">×</a><strong>' + soy.$$escapeHtml(opt_data.diagramName) + '</strong> ' + soy.$$escapeHtml('successfully saved to page') + ' <a class="gliffy-alert-link" href="' + soy.$$escapeHtml(opt_data.linkUrl) + '" target="_blank"><img class="page-icon"/><strong> ' + soy.$$escapeHtml(opt_data.pageName) + '</strong></a><br/>' + soy.$$escapeHtml('in space') + ' <strong>' + soy.$$escapeHtml(opt_data.spaceName) + '</strong></div>'; 723}; 724if (goog.DEBUG) { 725 gliffySoy.controls.alert.CompleteAlert.soyTemplateName = 'gliffySoy.controls.alert.CompleteAlert'; 726} 727 728 729gliffySoy.controls.alert.ErrorAlert = function(opt_data, opt_ignored) { 730 return '<div id="gliffy-alert-save-as-error" class="alert alert-error gliffy-alert"><a href="#" class="close" data-dismiss="alert">×</a>' + soy.$$filterNoAutoescape(opt_data.errorDetail) + '</div>'; 731}; 732if (goog.DEBUG) { 733 gliffySoy.controls.alert.ErrorAlert.soyTemplateName = 'gliffySoy.controls.alert.ErrorAlert'; 734} 735 736}catch(e){WRMCB(e)}; 737; 738try { 739/* module-key = 'com.gliffy.integration.confluence:gliffy-confluence-basics', location = 'gliffy/ObjectValidatorFactory.js' */ 740/** 741 * Utility class for validating an object's values. Useful for constructors. 742 */ 743define("gliffy/objectValidatorFactory", [ 744 'jquery', 745 'underscore', 746 'gliffy/util' 747 ], function ($, _, util) { 748 "use strict"; 749 var ObjectValidator = function (parameters) { 750 // parameters: 751 // keyToPredicateMap 752 // key - the key of the value to pass through predicate (i.e. predicate.func(object[key])) 753 // predicate 754 // func - a function that takes a value and returns a boolean. 755 // failureMessage - the message to display when func(object[key]) == false. 756 // 757 // description - string description of the object displayed upon failures. 758 // 759 760 var fail = function (key, value, failureMessage) { 761 throw new Error(util.format("{0} {1} value ({2}) failed predicate: {3}", parameters.description, key, $.isFunction(value) ? "[function]" : value, failureMessage)); 762 }; 763 764 if (!_.isString(parameters.description)) { 765 parameters.description = "ObjectValidator construction parameters"; 766 fail("description", parameters.description, "Expected value to be a string."); 767 } 768 769 if (typeof parameters.keyToPredicateMap === 'undefined') { 770 parameters.description = "ObjectValidator construction parameters"; 771 fail("keyToPredicateMap", parameters.keyToPredicateMap, "Expected value to be defined."); 772 } 773 774 $.each(parameters.keyToPredicateMap, function (key, predicate) { 775 if (!_.isFunction(predicate.func)) { 776 fail("keyToPredicateMap " + key + ".func", predicate.func, "Expected value to be a function."); 777 } 778 if (!_.isString(predicate.failureMessage)) { 779 fail("keyToPredicateMap " + key + ".failureMessage", predicate.failureMessage, "Expected value to be a string."); 780 } 781 }); 782 783 this._ = { 784 keyToPredicateMap: parameters.keyToPredicateMap, 785 fail: fail 786 }; 787 }; 788 789 ObjectValidator.prototype.validate = function (value) { 790 var self = this; 791 if (value == null) { 792 throw new Error("ObjectValidator.validate() requires non-null input."); 793 } 794 $.each(self._.keyToPredicateMap, function (key, predicate) { 795 if (!predicate.func(value[key])) { 796 self._.fail(key, value[key], predicate.description); 797 } 798 }); 799 } 800 801 return { 802 create: function(parameters) { 803 return new ObjectValidator(parameters); 804 }, 805 predicates: { 806 isString: { 807 func: _.isString, 808 failureMessage: "Expected value to be a string." 809 }, 810 isNumber: { 811 func: _.isNumber, 812 failureMessage: "Expected value to be a number." 813 }, 814 isFunction: {
815 func: _.isFunction, 816 failureMessage: "Expected value to be a function." 817 }, 818 isArray: { 819 func: _.isArray, 820 failureMessage: "Expected value to be an array." 821 }, 822 isTruthy: { 823 func: function (value) { 824 return value == true; // coercion intentional 825 }, 826 failureMessage: "Expected value to be truthy." 827 }, 828 isFalsey: { 829 func: function (value) { 830 return value == false; // coercion intentional 831 }, 832 failureMessage: "Expected value to be falsey." 833 }, 834 isDefinedAndNotNull: { 835 func: function (value) { 836 return value != null; // coercion intentional, to include undefined. 837 }, 838 failureMessage: "Expected value to be defined and not null." 839 }, 840 containsAnyKey: { 841 func: function (value) { 842 return Object.keys(value).length > 0; 843 }, 844 failureMessage: "Expected value to contain at least one key." 845 } 846 } 847 }; 848 } 849); 850 851}catch(e){WRMCB(e)}; 852; 853try { 854/* module-key = 'com.gliffy.integration.confluence:gliffy-confluence-basics', location = 'gliffy/confluence/PageFacade.js' */ 855define("gliffy/confluence/pageFacade", [ 856 "jquery", 857 "gliffy/confluence/rest/webRequestPromiseFactory" 858], function($, webRequestPromiseFactory) { 859 "use strict"; 860 861 var unpinPageViewMacroDiagramVersion = function (diagramReference) { 862 // get current page content, remove version from appropriate element, update to server, then refresh browser 863 var getPageContent = webRequestPromiseFactory.buildGetPageContentPromise(AJS.params.pageId); 864 865 var removeVersionAndPutPageContent = function(page) { 866 var bodyStorageHtml = page.body.storage.value; 867 // Wrap data in a new div so it can be used with jquery (http://stackoverflow.com/questions/12808770/parsing-of-html-string-using-jquery). 868 var wrappedBodyNodes = $('<div/>').append(bodyStorageHtml); 869 870 // remove parameters with empty names 871 var emptyParameterNodesToRemove = wrappedBodyNodes.find("ac\\:parameter[ac\\:name='']"); 872 emptyParameterNodesToRemove.remove(); 873 874 // find all the paragraphs that have the same diagram name and version number... 875 var matchingParagraphNodes = wrappedBodyNodes.find("p:has(ac\\:parameter[ac\\:name='version'])p:has(ac\\:parameter[ac\\:name='name'])").filter(function () { 876 var versionMatches = $(this).find("ac\\:parameter[ac\\:name='version']").text() === diagramReference.version.toString(); 877 var nameMatches = $(this).find("ac\\:parameter[ac\\:name='name']").text() === diagramReference.name; 878 var parameterElement = $(this).find("ac\\:parameter[ac\\:name='pageid']"); 879 var pageIdMatches = ((parameterElement.length === 0) && (AJS.params.pageId === diagramReference.ownerPageId)) 880 || (parameterElement.text() === diagramReference.ownerPageId.toString()); 881 return versionMatches && nameMatches && pageIdMatches; 882 }); 883 884 // ... and remove their version elements. 885 var versionNodesToRemove = matchingParagraphNodes.find("ac\\:parameter[ac\\:name='version']"); 886 versionNodesToRemove.remove(); 887 888 // prepare page update 889 page.body.storage.value = wrappedBodyNodes.html(); 890 page.version.number = page.version.number + 1; 891 892 // GCONF-1956: Resolve ancestors 893 if (page.ancestors) { 894 // If page.ancestors is empty, remove it. If there is more than one ancestor, use the last one 895 if (page.ancestors.length === 0) { 896 delete page.ancestors; 897 } else if (page.ancestors.length > 1) { 898 page.ancestors = [page.ancestors.pop()]; 899 } 900 } 901 return webRequestPromiseFactory.buildPutPageContentPromise(AJS.params.pageId, page); 902 }; 903 904 var reloadBrowserPage = function() { 905 window.location.reload(); 906 }; 907 908 $.when(getPageContent).then(removeVersionAndPutPageContent).then(reloadBrowserPage); 909 }; 910 911 // Since this will be deprecated soon, I am not going to bother abstracting these into the WebRequestPromiseFactory 912 var unpinPageViewMacroDiagramVersionWithJsonRpcApi = function (diagramReference) { 913 var baseApiUrl = AJS.format("{0}/rpc/json-rpc/confluenceservice-v2", AJS.Confluence.getContextPath()); 914 var getPageUrl = baseApiUrl + "/getPage"; 915 var getPageParameters = [AJS.params.pageId]; 916 917 $.ajax({ 918 type : "POST", // must use POST with json-rpc API 919 url : getPageUrl, 920 contentType: "application/json", 921 data: JSON.stringify(getPageParameters), 922 success : function(result) { 923 var bodyHtml = result.content; 924 925 // Wrap data in a new div so it can be used with
925jquery (http://stackoverflow.com/questions/12808770/parsing-of-html-string-using-jquery). 926 var wrappedBodyNodes = $('<div/>').append(bodyHtml); 927 928 // remove parameters with empty names 929 var emptyParameterNodesToRemove = wrappedBodyNodes.find("ac\\:parameter[ac\\:name='']"); 930 emptyParameterNodesToRemove.remove(); 931 932 // find all the paragraphs that have the same diagram name and version number... 933 var matchingParagraphNodes = wrappedBodyNodes.find("p:has(ac\\:parameter[ac\\:name='version'])p:has(ac\\:parameter[ac\\:name='name'])").filter(function () { 934 var versionMatches = $(this).find("ac\\:parameter[ac\\:name='version']").text() === String(diagramReference.version); 935 var nameMatches = $(this).find("ac\\:parameter[ac\\:name='name']").text() === diagramReference.name; 936 var parameterElement = $(this).find("ac\\:parameter[ac\\:name='pageid']"); 937 var pageIdMatches = ((parameterElement.length === 0) && (AJS.params.pageId === diagramReference.ownerPageId)) 938 || (parameterElement.text() === diagramReference.ownerPageId.toString()); 939 return versionMatches && nameMatches && pageIdMatches; 940 }); 941 942 // ... and remove their version elements. 943 var versionNodesToRemove = matchingParagraphNodes.find("ac\\:parameter[ac\\:name='version']"); 944 versionNodesToRemove.remove(); 945 946 var updatePageData = { 947 "jsonrpc": "2.0", 948 "method": "updatePage", 949 "params": [ 950 { 951 "id": result.id, 952 "space": result.space, 953 "title": result.title, 954 "parentId" : result.parentId, 955 "version": result.version, 956 "content": wrappedBodyNodes.html() 957 }, 958 { 959 "versionComment": "Unpinned macro version", 960 "minorEdit": false 961 } 962 ], 963 "id": AJS.params.pageId 964 }; 965 966 // update via server 967 $.ajax({ 968 type: "POST", 969 contentType: "application/json", 970 url: baseApiUrl, 971 data: JSON.stringify(updatePageData), 972 success: function () { 973 window.location.reload(); 974 } 975 }); 976 } 977 }); 978 }; 979 980 var unpinPageEditMacroDiagramVersion = function (diagramReference) { 981 982 if(AJS.Rte && typeof AJS.Rte.getEditor === 'function' && AJS.Rte.getEditor()) { 983 984 // modify the macro to no longer be pinned 985 var macroNodeQuery = AJS.format('.editor-inline-macro[data-macro-parameters*="name={0}"]', diagramReference.name); 986 var macroNodes = AJS.Rte.getEditor().dom.select(macroNodeQuery); 987 AJS.$.each(macroNodes, function (index, macroNode) { 988 var diagramReference = getDiagramReference($(macroNode)); 989 // removing version sets to unpinned and displays nicely in macro chrome 990 diagramReference.version = undefined; 991 addDiagramReference(diagramReference, macroNode); 992 }); 993 } 994 }; 995 996 var getMacroParams = function(diagramReference) { 997 // clone diagramReference and modify to 998 var macroParams = $.extend(true, {}, diagramReference); 999 // strip default values 1000 if(macroParams.ownerPageId !== AJS.params.pageId) { 1001 macroParams.pageid = macroParams.ownerPageId; 1002 } 1003 delete macroParams.ownerPageId; 1004 if(macroParams.version === 0) { 1005 delete macroParams.version; 1006 } 1007 if(macroParams.size === 'O' || macroParams.size === 'L') { 1008 delete macroParams.size; 1009 } 1010 if(!macroParams.border) { 1011 delete macroParams.border; 1012 } 1013 if(macroParams.chrome === 'full') { 1014 delete macroParams.chrome; 1015 } 1016 if(!!macroParams.html5) { 1017 delete macroParams.html5; 1018 } 1019 return macroParams; 1020 }; 1021 1022 var getDiagramReferenceFromMacroParams = function(macroParams) { 1023 return { 1024 ownerPageId: macroParams['pageid'] || AJS.params.pageId, 1025 name: macroParams['name'], 1026 displayName: macroParams['displayName'] || macroParams['name'], 1027 version: macroParams['version'], 1028 size: macroParams['size'], 1029 border: macroParams['border'], 1030 chrome: macroParams['chrome'], 1031 html5: macroParams['html5'], 1032 pagePin: macroParams['pagePin'] 1033 } 1034 }; 1035 1036 var getDiagramReferenceFromMacroContainer = function($macroContainer) { 1037 return { 1038 ownerPageId: $macroContainer.data('ceoid') || AJS.params.pageId, 1039 displayName: $macroContainer.data('displayname') || $macroContainer.data('filename'), 1040 name: $macroContainer.data('filename'), 1041 version: $macroContainer.data('version'), 1042 size: $macroContainer.data('size'), 1043 border: $macroContainer.data('border'), 1044 chrome: $macroContainer.data('chrome'), 1045 html5: $macroContainer.data('html5'), 1046 diagramAttachmentId: $macroContainer.data('attachmentid') 1047 }; 1048 }; 1049 1050 var addDiagramReference = function(diagramReference, nodeToReplace) { 1051 if(AJS.Rte && typeof AJS.Rte.getEditor === 'function' && AJS.Rte.getEditor()) { 1052 var deferred, params = { 1053 contentId: Confluence.Editor.getContentId(), 1054 macro: { 1055 name: "gliffy", 1056 params: getMacroParams(diagramReference), 1057 defaultParameterValue: "", 1058 body: "" 1059 } 1060 }; 1061 1062 //GCONF-2360 1063 //if ($.browser.msie && AJS.$.Deferred) { 1064 // //remove this once https://jira.atlassian.com/browse/CONF-28418 is fixed 1065 // tinymce.confluence.NodeUtils.replaceNode = replaceNode; 1066 //} 1067 1068 AJS.Rte.BookmarkManager.restoreBookmark(); 1069 deferred = tinymce.confluence.MacroUtils.insertMacro(params, nodeToReplace); 1070 1071 if (deferred && deferred.then) { 1072 deferred.then(function () { 1073 if ($.browser.msie) { 1074 //remove this once https://jira.atlassian.com/browse/CONF-28418 is fixed 1075 tinymce.confluence.NodeUtils.replaceNode = originalReplaceNodeFunction; 1076 } 1077 }, function () { 1078 if ($.browser.msie) { 1079 //remove this once https://jira.atlassian.com/browse/CONF-28418 is fixed 1080 tinymce.confluence.NodeUtils.replaceNode = originalReplaceNodeFunction; 1081 } 1082 }); 1083 } 1084 1085 //AJS.log("insert gliffy macro"); 1086 fixEditorFocus(); 1087 return deferred; 1088 } else { 1089 // TODO: GCONF-2181 1090 throw "addDiagramReference not yet implemented for non-RTE"; 1091 } 1092 }; 1093 1094 var getDiagramReference = function($macroContainer) { 1095 if(AJS.Rte && typeof AJS.Rte.getEditor === 'function' && AJS.Rte.getEditor()) { 1096 var macroParams = {}; 1097 // Look for data from jQuery node. 1098 var macroParamsString = $macroContainer.data && $macroContainer.data("macro-parameters"); 1099 // If none, look for data from RTE DOM node. 1100 macroParamsString = macroParamsString || ($macroContainer.dataset && $macroContainer.dataset.macroParameters);
1101 // If string found, parse into params object (KEY1=Value1|KEY2=Value2|KEY3=Value|...) 1102 if (macroParamsString) { 1103 $.each(macroParamsString.split("|"), function (idx, item) { 1104 var param = item.split("="); 1105 macroParams[param[0]] = param[1]; 1106 }); 1107 } 1108 1109 return getDiagramReferenceFromMacroParams(macroParams); 1110 } else { 1111 return getDiagramReferenceFromMacroContainer($macroContainer); 1112 } 1113 }; 1114 1115 var fixEditorFocus = function () { 1116 //remove this if chrome+mac gets rid of focus issue. 1117 if (AJS.Rte && typeof AJS.Rte.getEditorFrame === 'function' && AJS.Rte.getEditorFrame()) { 1118 $(AJS.Rte.getEditorFrame()).focus(); 1119 } 1120 1121 // GCONF-1941: fix editor focus. Perhaps AJS.Rte.getEditorFrame may not be set? 1122 var gliffyEditorIFrame = $("#gliffy-editor")[0]; 1123 if(gliffyEditorIFrame) { 1124 gliffyEditorIFrame.contentWindow.focus(); 1125 } 1126 }; 1127 1128 //var updateDiagramReferences = function() { 1129 // if(AJS.Rte && AJS.Rte.getEditor()) { 1130 // 1131 // //find all matching macros in the editor iframe 1132 // var macros = $(AJS.Rte.getEditor().dom.select('.editor-inline-macro')).filter(function(index, element) { 1133 // return $(element).data("macro-name") === 'gliffy'; 1134 // }); 1135 // 1136 // macros.each(function (index, element) { 1137 // var $macroContainer = $(element); 1138 // var diagramReference = getDiagramReference($macroContainer); 1139 // var dataJson = $.toJSON({ 1140 // contentId : Confluence.Editor.getContentId(), 1141 // macro : { 1142 // name : 'gliffy', 1143 // params : { 1144 // pageid: diagramReference.ownerPageId, 1145 // name: diagramReference.name, 1146 // version: diagramReference.version 1147 // }, 1148 // body : "", defaultParameterValue : "" 1149 // } 1150 // }); 1151 // 1152 // $.ajax({ 1153 // type : "POST", 1154 // contentType : "application/json; charset=utf-8", 1155 // url : Confluence.getContextPath() + "/rest/tinymce/1/macro/placeholder", 1156 // data : dataJson, 1157 // dataType : "text", 1158 // success : function (macroplaceholder) { 1159 // $macroContainer.after(macroplaceholder); 1160 // $macroContainer.remove(); 1161 // } 1162 // }); 1163 // }); 1164 // 1165 // } 1166 //}; 1167 1168 //remove this once https://jira.atlassian.com/browse/CONF-28418 is fixed 1169 var originalReplaceNodeFunction = (AJS.Rte && typeof AJS.Rte.getEditor === 'function' && AJS.Rte.getEditor()) ? tinymce.confluence.NodeUtils.replaceNode : null; 1170 1171 return { 1172 unpinDiagramReferenceVersion: function(diagramReference) { 1173 if(AJS.Rte && typeof AJS.Rte.getEditor === 'function' && AJS.Rte.getEditor()) { 1174 unpinPageEditMacroDiagramVersion(diagramReference); 1175 } else { 1176 var versionComponents = AJS.version.split('.'); 1177 var useJsonRpcApi = !(parseInt(versionComponents[0]) >= 5 && parseInt(versionComponents[1]) >= 4); 1178 1179 if (useJsonRpcApi) { 1180 unpinPageViewMacroDiagramVersionWithJsonRpcApi(diagramReference); 1181 } else { 1182 unpinPageViewMacroDiagramVersion(diagramReference); 1183 } 1184 } 1185 }, 1186 1187 //updateDiagramReferences: updateDiagramReferences, 1188 1189 addDiagramReference: addDiagramReference, 1190 1191 getDiagramReference: getDiagramReference, 1192 1193 getDiagramReferences: function() { 1194 var diagramReferences = []; 1195 var $macroContainers; 1196 if(AJS.Rte && typeof AJS.Rte.getEditor === 'function' && AJS.Rte.getEditor()) { 1197 $macroContainers = $("iframe").contents().find(".editor-inline-macro[data-macro-name='gliffy']"); 1198 } else { 1199 $macroContainers = $(".gliffy-container"); 1200 } 1201 $macroContainers.each(function (index, macroContainer) {
1202 diagramReferences.push(getDiagramReference($(macroContainer))); 1203 }); 1204 return diagramReferences; 1205 } 1206 }; 1207}); 1208}catch(e){WRMCB(e)}; 1209; 1210try { 1211/* module-key = 'com.gliffy.integration.confluence:gliffy-confluence-basics', location = 'gliffy/confluence/rest/UrlFactory.js' */ 1212define("gliffy/confluence/rest/urlFactory", [ 1213 "gliffy/url" 1214], function(url) { 1215 "use strict"; 1216 1217 //GCONF-2677: following line sets the Confluence base url based on browser location instead of Confluence base URL. 1218 var confluenceBaseUrl = window.location.protocol + "//" + window.location.host + AJS.contextPath(); 1219 1220 var rootGliffyApiUrl = confluenceBaseUrl + "/rest/gliffy/1.0"; 1221 1222 return { 1223 buildPrependDiagramToPageUrl: function(parameters) { 1224 return url.buildRootedPathAndQuery(rootGliffyApiUrl, 1225 [ 1226 "diagrams", 1227 "saveas", 1228 parameters.sourcePageId, 1229 parameters.sourceDiagramName 1230 ], 1231 { 1232 sourceDiagramVersion: parameters.sourceDiagramVersion, 1233 targetPageId: parameters.targetPageId, 1234 space: parameters.targetSpaceKey, 1235 targetDiagramName: parameters.targetDiagramName, 1236 targetPageTitle: parameters.targetPageTitle, 1237 includeAlertLinkUrlParams: parameters.includeAlertLinkUrlParams 1238 } 1239 ); 1240 }, 1241 1242 buildGetSpacesUrl: function (startIndex, countLimit) { 1243 // Works only on 5.5+, but is Confluence native and probably faster 1244 //return $.ajax(GLIFFY.baseConfluenceUrl + "/rest/api/space?start=" + startIndex + "&limit=" + countLimit); 1245 1246 // Works on 5.1+ 1247 return url.buildRootedPathAndQuery(rootGliffyApiUrl, 1248 [ 1249 "spaces" 1250 ], 1251 { 1252 start: startIndex, 1253 limit: countLimit 1254 } 1255 ); 1256 }, 1257 1258 buildSpaceSearchUrl: function (searchString, startIndex, countLimit, page) { 1259 return url.buildRootedPathAndQuery(rootGliffyApiUrl, 1260 [ 1261 "spaces" 1262 ], 1263 { 1264 searchTerm: searchString, 1265 start: startIndex, 1266 limit: countLimit, 1267 page: page 1268 } 1269 ); 1270 return rootGliffyApiUrl + "/" + pathAndQuery; 1271 }, 1272 1273 // Works only on 5.5+ 1274 //var buildPageSearchUrl = function(searchString, spaceKeys, startIndex, countLimit) { 1275 // var cql = "type=page "; 1276 // 1277 // if(spaceKeys) { 1278 // cql += "and ("; 1279 // spaceKeys.forEach(function(key, index) { 1280 // if(index > 0) { 1281 // cql += " or "; 1282 // } 1283 // cql += 'space=' + key; 1284 // }); 1285 // cql += ") "; 1286 // } 1287 // 1288 // if(searchString) { 1289 // cql += 'and title ~'"' + searchString + '"'; 1290 // } 1291 // 1292 // var url = rootConfluenceApiUrl + "/rest/api/content/search?cql=" + encodeURIComponent(cql); 1293 // url += "&start=" + startIndex + "&limit=" + countLimit + "&expand=space"; 1294 // 1295 // return url; 1296 //} 1297 1298 buildPageSearchUrl: function (searchString, spaceKeys, startIndex, countLimit) { 1299 return url.buildRootedPathAndQuery(rootGliffyApiUrl, 1300 [ 1301 "page", 1302 "search" 1303 ], 1304 { 1305 searchTerm: searchString || "", 1306 start: startIndex, 1307 limit: countLimit, 1308 expand: 'space', 1309 spaceKeys: spaceKeys && spaceKeys.join(",") 1310 } 1311 ); 1312 }, 1313 1314 // We must pass in the rootGliffyAPI separately from what's configured above, since 1315 // AJS.params.baseUrl and GLIFFY.baseConfluenceUrl are not always set when this is called 1316 buildPageEditPermissionUrl: function(gliffyAPIRootServiceURL, pageId) { 1317 return AJS.format("{0}/ceo/{1}/permission", gliffyAPIRootServiceURL, pageId); 1318 }, 1319 1320 buildGetDiagramsInPageUrl: function (pageId) { 1321 return url.buildRootedPathAndQuery(rootGliffyApiUrl, 1322 [ 1323 "page", 1324 pageId, 1325 "diagrams" 1326 ] 1327 ); 1328 }, 1329 1330 buildPageWithTitleExistsInSpaceUrl: function (pageTitle, spaceKey) { 1331 return confluenceBaseUrl + '/rest/api/content?' + 'spaceKey=' + spaceKey + 1332 '&title=' + encodeURIComponent(pageTitle); 1333 }, 1334 1335 buildUnlinkDiagramUrl: function(parameters) { 1336 return url.buildRootedPathAndQuery(rootGliffyApiUrl, 1337 [ 1338 "diagrams", 1339 "unlink", 1340 parameters.sourcePageId, 1341 parameters.sourceDiagramName 1342 ], 1343 { 1344 sourceDiagramVersion: parameters.sourceDiagramVersion, 1345 targetPageId: parameters.targetPageId, 1346 targetDiagramName: parameters.targetDiagramName 1347 } 1348 ); 1349 }, 1350 1351 buildPageContentUrl: function(pageId) { 1352 return AJS.format("{0}/rest/api/content/{1}?expand=body.storage,version,space,ancestors", confluenceBaseUrl, pageId); 1353 }, 1354 1355 buildEditDiagramPermissionUrl: function(ownerPageId, diagramName) { 1356 return url.buildRootedPathAndQuery(rootGliffyApiUrl, 1357 [ 1358 "ceo", 1359 ownerPageId, 1360 "diagrams", 1361 diagramName, 1362 "permission" 1363 ] 1364 ); 1365 }, 1366 1367 buildCreateAttachmentPermissionUrl: function(ownerPageId) { 1368 return url.buildRootedPathAndQuery(rootGliffyApiUrl, 1369 [ 1370 "ceo", 1371 ownerPageId, 1372 "permission" 1373 ] 1374 ); 1375 }, 1376 1377 buildPropertyUrl: function(propertyId) { 1378 return url.buildRootedPathAndQuery(rootGliffyApiUrl, 1379 [ 1380 "properties", 1381 propertyId 1382 ] 1383 ); 1384 }, 1385 1386 buildDiagramPreviewImageUrl: function(ownerPageId, diagramName, diagramVersion) { 1387 return url.buildRootedPathAndQuery(rootGliffyApiUrl, 1388 [ 1389 "diagrams", 1390 "preview" 1391 ], 1392 { 1393 name: diagramName, 1394 pageId: ownerPageId, 1395 version: diagramVersion 1396 } 1397 ); 1398 }, 1399 1400 buildDiagramThumbnailImageUrl: function(ownerPageId, diagramName, diagramVersion) { 1401 return url.buildRootedPathAndQuery(rootGliffyApiUrl, 1402 [ 1403 "diagrams", 1404 "thumbnail" 1405 ], 1406 { 1407 name: diagramName, 1408 pageId: ownerPageId, 1409 version: diagramVersion 1410 } 1411 ); 1412 }, 1413 1414 buildGetDiagramVersionsUrl: function(ownerPageId, diagramName) { 1415 return url.buildRootedPathAndQuery(rootGliffyApiUrl, 1416 [ 1417 "diagrams", 1418 "allVersionInformation" 1419 ], 1420 { 1421 pageId: ownerPageId, 1422 name: diagramName 1423 } 1424 ); 1425 }, 1426 1427 buildCreateEmbedLinkUrl: function () { 1428 return url.buildRootedPathAndQuery(rootGliffyApiUrl, 1429 [ 1430 "embeddedDiagrams" 1431 ] 1432 ); 1433 }, 1434 1435 buildDeactivateEmbedLinkUrl: function () { 1436 return url.buildRootedPathAndQuery(rootGliffyApiUrl, 1437 [ 1438 "embeddedDiagrams", 1439 "deactivate" 1440 ] 1441 ); 1442 } 1443 }; 1444}); 1445 1446}catch(e){WRMCB(e)}; 1447; 1448try { 1449/* module-key = 'com.gliffy.integration.confluence:gliffy-confluence-basics', location = 'gliffy/confluence/rest/WebRequestPromiseFactory.js' */ 1450/** 1451 * Central place for creating promises in order to abstract URLs from controller code, as well as providing a means for 1452 * asynchronous mocks/testing. 1453 * 1454 * NOTE: /confluence/rest/api/* are only present in Confluence 5.5+ 1455 */ 1456define("gliffy/confluence/rest/webRequestPromiseFactory", [ 1457 "jquery", 1458 "gliffy/confluence/rest/urlFactory" 1459 ], function($, urlFactory) { 1460 "use strict"; 1461 1462 1463 return { 1464 /** 1465 * AJAX response spec 1466 * pageTitle: the title of the page that was modified 1467 * spaceName: the name of the space containing the page that was modified 1468 * targetPageUrl: a URL that links to the page that was modified. This URL is relative to the base Confluence URL. 1469 */ 1470 buildPrependDiagramToPagePromise: function (parameters) { 1471 1472 var postUrl = urlFactory.buildPrependDiagramToPageUrl(parameters); 1473 1474 /** 1475 * GCONF-2306: Save-as operation (from the Gliffy editor). If we have access to the Gliffy editor stage, then send the diagram 1476 * content directly from the stage. This ensures that any unsaved changes made to the stage will be properly transferred during 1477 * the save-as operation. If we do not have access to the editor, then the POST url has sufficient parameters to copy the attachment. 1478 */ 1479 if (window.GLIFFY && window.GLIFFY.Mouse && window.GLIFFY.Mouse.editor) { 1480 1481 var gliffyEditor = window.GLIFFY.Mouse.editor; 1482 var diagramObject = gliffyEditor.getDocumentManager().getActiveDocument().toObject(); // diagram content from the editor stage 1483 var gliffyEditorStage = gliffyEditor.getDocumentManager().getActiveStage(); 1484 1485 // Show a spinner while we export the image 1486 if (window.GLIFFY.Spinner) { 1487 window.GLIFFY.Spinner.show($('body')); 1488 } 1489 1490 // Get image data from the Editor stage 1491 return gliffyEditor.getDocumentManager().getImageData(gliffyEditorStage, "image/png", function(imageDataUrl, deferred) { 1492 diagramObject.image = imageDataUrl; 1493 deferred.resolve(diagramObject); 1494 }, false, 1).then(function() { 1495 return gliffyEditor.getDocumentManager().getHTMLData(gliffyEditorStage) 1496 }).then(function(html) { 1497 diagramObject.html = html; 1498 // Then return a promise that makes a POST request to the server, containing the diagram and image data url 1499 return $.ajax({ 1500 type: "POST", 1501 contentType: "application/json", 1502 data: JSON.stringify(diagramObject), 1503 url: postUrl 1504 }); 1505 }); 1506 } else { 1507 /** 1508 * Copy-to operation (from the Confluence macro viewer): the Gliffy editor is not available. 1509 * Do not send raw diagram and image data to the REST endpoint, and instead use the attachment pointers to copy the attachments. 1510 */ 1511 return $.post(postUrl); 1512 } 1513 }, 1514 1515 /** 1516 * AJAX directly returned by Atlassian REST interface 1517 */ 1518 buildGetSpacesPromise: function (startIndex, countLimit) { 1519 return $.get(urlFactory.buildGetSpacesUrl(startIndex, countLimit)); 1520 }, 1521 1522 /** 1523 * AJAX directly returned by Atlassian REST interface 1524 */ 1525 buildSpaceSearchPromise: function (searchString, startIndex, countLimit, page) { 1526 return $.get(urlFactory.buildSpaceSearchUrl(searchString, startIndex, countLimit, page)); 1527 }, 1528 1529 /** 1530 * AJAX directly returned by Atlassian REST interface 1531 */ 1532 buildPageSearchPromise: function (searchString, spaceKeys, startIndex, countLimit) { 1533 return $.get(urlFactory.buildPageSearchUrl(searchString, spaceKeys, startIndex, countLimit)); 1534 }, 1535 1536 /** 1537 * AJAX response spec 1538 * array of 1539 * id: the diagram id 1540 * title: the title of the diagram 1541 * fileName: the filename of the diagram 1542 */ 1543 buildGetDiagramsInPagePromise: function (pageId) { 1544 return $.get(urlFactory.buildGetDiagramsInPageUrl(pageId)); 1545 }, 1546 1547 /** 1548 * AJAX response spec 1549 * exists: boolean 1550 */ 1551 buildPageWithTitleExistsInSpacePromise: function (pageTitle, spaceKey) { 1552 return $.get(urlFactory.buildPageWithTitleExistsInSpaceUrl(pageTitle, spaceKey)); 1553 }, 1554 1555 buildUnlinkDiagramPromise: function(parameters) { 1556 return $.post(urlFactory.buildUnlinkDiagramUrl(parameters)); 1557 }, 1558 1559 buildGetPageContentPromise: function(pageId) { 1560 return $.ajax(urlFactory.buildPageContentUrl(pageId)); 1561 }, 1562 1563 buildPutPageContentPromise: function(pageId, pageContent) { 1564 return $.ajax({ 1565 type: "PUT", 1566 contentType: "application/json; charset=utf-8", 1567 url: urlFactory.buildPageContentUrl(pageId), 1568 data: JSON.stringify(pageContent), 1569 dataType: "text", 1570 processData: false 1571 }); 1572 }, 1573 1574 buildGetEditPagePermissionPromise: function(gliffyAPIRootServiceURL, pageId) { 1575 return $.ajax({ 1576 type: 'GET', 1577 url: urlFactory.buildPageEditPermissionUrl(gliffyAPIRootServiceURL, pageId), 1578 dataType: "json", 1579 cache: false 1580 }); 1581 }, 1582 1583 buildGetEditDiagramPermissionPromise: function(pageId, diagramName) { 1584 return $.ajax({ 1585 type: 'GET', 1586 url: urlFactory.buildEditDiagramPermissionUrl(pageId, diagramName), 1587 dataType:"json", 1588 cache:false 1589 }); 1590 }, 1591 1592 buildGetCreateAttachmentPermissionPromise: function(pageId) { 1593 return $.ajax({ 1594 type: 'GET', 1595 url: urlFactory.buildCreateAttachmentPermissionUrl(pageId), 1596 dataType:"json", 1597 cache:false 1598 }); 1599 }, 1600 1601 buildGetPropertyValuePromise: function(propertyId) { 1602 var deferred = new $.Deferred(); 1603 $.get(urlFactory.buildPropertyUrl(propertyId)).then(function(response) { 1604 deferred.resolve(response); 1605 }); 1606 return deferred; 1607 }, 1608 1609 buildGetDiagramVersionsPromise: function(ownerPageId, diagramName) { 1610 return $.get(urlFactory.buildGetDiagramVersionsUrl(ownerPageId, diagramName)); 1611 } 1612 }; 1613 } 1614); 1615 1616}catch(e){WRMCB(e)}; 1617; 1618try { 1619/* module-key = 'com.gliffy.integration.confluence:gliffy-confluence-editor-launcher', location = 'gliffy/control
1619s/imageselection/ImageSelectionControl.soy' */ 1620// This file was automatically generated from ImageSelectionControl.soy. 1621// Please don't edit this file by hand. 1622 1623/** 1624 * @fileoverview Templates in namespace gliffySoy.widget.image. 1625 */ 1626 1627if (typeof gliffySoy == 'undefined') { var gliffySoy = {}; } 1628if (typeof gliffySoy.widget == 'undefined') { gliffySoy.widget = {}; } 1629if (typeof gliffySoy.widget.image == 'undefined') { gliffySoy.widget.image = {}; } 1630 1631 1632gliffySoy.widget.image.gliffyImageSelectionWidget = function(opt_data, opt_ignored) { 1633 return '<div class="gliffy-image-selection"><div class="gliffy-image-selection-inner-panel" title="' + soy.$$escapeHtml(opt_data.labelText) + '"><div class="gliffy-image-selection-spinner"/><div><img class="gliffy-image-selection-image" src="' + soy.$$escapeHtml(opt_data.imageUrl) + '"/><div class="gliffy-image-selection-icon gliffy-image-selection-zoom"><img/></div></div></div><div class="gliffy-image-selection-label">' + soy.$$escapeHtml(opt_data.labelText) + '</div></div>'; 1634}; 1635if (goog.DEBUG) { 1636 gliffySoy.widget.image.gliffyImageSelectionWidget.soyTemplateName = 'gliffySoy.widget.image.gliffyImageSelectionWidget'; 1637} 1638 1639}catch(e){WRMCB(e)}; 1640; 1641try { 1642/* module-key = 'com.gliffy.integration.confluence:gliffy-confluence-editor-launcher', location = 'gliffy/controls/imageselection/ImageSelectionControlFactory.js' */ 1643define("gliffy/controls/imageselection/imageSelectionControlFactory", [ 1644 "jquery", 1645 "gliffy/objectValidatorFactory" 1646 ], function ($, objectValidatorFactory) { 1647 "use strict"; 1648 var ImageSelectionControl = function (parameters) { 1649 var self = this; 1650 1651 objectValidatorFactory.create({ 1652 description: "ListTable constructor parameters", 1653 keyToPredicateMap: { 1654 "parent": objectValidatorFactory.predicates.isDefinedAndNotNull, 1655 "labelText": objectValidatorFactory.predicates.isString, 1656 "imageUrl": objectValidatorFactory.predicates.isString 1657 } 1658 }).validate(parameters); 1659 1660 var parameters = $.extend({ 1661 isSelected: false 1662 }, parameters); 1663 1664 var html = gliffySoy.widget.image.gliffyImageSelectionWidget(parameters); 1665 var domRoot = $(html).appendTo(parameters.parent); 1666 1667 domRoot.on('click', function(event) { 1668 self.setIsSelected(true); 1669 }); 1670 1671 //GCONF-2013 fancybox is deprecated, use image previewer but fall back to 1672 //fancy box if it is not available 1673 var previewImage = domRoot.find(".gliffy-image-selection-image"); 1674 var zoomButton = domRoot.find(".gliffy-image-selection-zoom"); 1675 1676 if (previewImage.previewer) { 1677 zoomButton.previewer({ 1678 src: previewImage.attr('src'), 1679 type: 'image/png', 1680 zindex: 10000 1681 }); 1682 } else { 1683 zoomButton.on('click', function (event) { 1684 var content = previewImage.clone(); 1685 // modify style 1686 content.removeClass('gliffy-image-selection-image'); 1687 content.addClass('gliffy-image-selection-fancybox-image'); 1688 $.fancybox({ 1689 orig: previewImage, 1690 content: content, 1691 showCloseButton: true, 1692 hideOnOverlayClick: true, 1693 hideOnContentClick: true 1694 }); 1695 }); 1696 } 1697 1698 this._ = { 1699 domRoot: domRoot, 1700 labelText: parameters.labelText, 1701 imageUrl: parameters.imageUrl, 1702 isSelected: !parameters.isSelected, // set as opposite so that setIsSelected() below will trigger events 1703 selectionChangedListeners: [], 1704 }; 1705 1706 this.setIsSelected(parameters.isSelected); 1707 }; 1708 1709 ImageSelectionControl.prototype.getIsSelected = function () { 1710 return this._.isSelected; 1711 }; 1712 1713 ImageSelectionControl.prototype.setIsSelected = function (isSelected) { 1714 if(this._.isSelected === isSelected) { 1715 return; 1716 } 1717 1718 this._.isSelected = isSelected; 1719 if(isSelected) { 1720 this._.domRoot.addClass("gliffy-image-selected"); 1721 } else { 1722 this._.domRoot.removeClass("gliffy-image-selected"); 1723 } 1724 1725 var self = this;
1726 this._.selectionChangedListeners.forEach(function (listener) { 1727 listener({ 1728 source:self, 1729 isSelected:isSelected 1730 }); 1731 }); 1732 }; 1733 1734 ImageSelectionControl.prototype.getDomRoot = function () { 1735 return this._.domRoot; 1736 }; 1737 1738 ImageSelectionControl.prototype.addSelectionChangedListener = function (listener) { 1739 this._.selectionChangedListeners.push(listener); 1740 }; 1741 1742 return { 1743 create: function(parameters) { 1744 return new ImageSelectionControl(parameters); 1745 } 1746 }; 1747 } 1748); 1749 1750}catch(e){WRMCB(e)}; 1751; 1752try { 1753/* module-key = 'com.gliffy.integration.confluence:gliffy-confluence-editor-launcher', location = 'gliffy/confluence/versionselection/VersionSelectionDialog.soy' */ 1754// This file was automatically generated from VersionSelectionDialog.soy. 1755// Please don't edit this file by hand. 1756 1757/** 1758 * @fileoverview Templates in namespace gliffySoy.dialog.version. 1759 */ 1760 1761if (typeof gliffySoy == 'undefined') { var gliffySoy = {}; } 1762if (typeof gliffySoy.dialog == 'undefined') { gliffySoy.dialog = {}; } 1763if (typeof gliffySoy.dialog.version == 'undefined') { gliffySoy.dialog.version = {}; } 1764 1765 1766gliffySoy.dialog.version.versionSelectionDialogBody = function(opt_data, opt_ignored) { 1767 return '<form action="#" method="post" class="aui top-label"><div class="gliffy-version-dialog-panel"><div class="gliffy-version-dialog-description">' + soy.$$escapeHtml(opt_data.promptText) + '</div><div class="gliffy-image-selection-widget-area"/></div></form>'; 1768}; 1769if (goog.DEBUG) { 1770 gliffySoy.dialog.version.versionSelectionDialogBody.soyTemplateName = 'gliffySoy.dialog.version.versionSelectionDialogBody'; 1771} 1772 1773}catch(e){WRMCB(e)}; 1774; 1775try { 1776/* module-key = 'com.gliffy.integration.confluence:gliffy-confluence-editor-launcher', location = 'gliffy/confluence/versionselection/VersionSelectionDialogFactory.js' */ 1777/** 1778 * Save As/CopyTo dialog common logic. 1779 */ 1780define("gliffy/confluence/versionselection/versionSelectionDialogFactory", 1781 [ 1782 "jquery", 1783 "gliffy/controls/imageselection/imageSelectionControlFactory", 1784 "gliffy/objectValidatorFactory" 1785 ], 1786 function($, imageSelectionControlFactory, objectValidatorFactory) { 1787 "use strict"; 1788 1789 // GCONF-1922: Add diagram thumbnails to pinned version dialogs. 1790 // 1791 // PARAMETERS: 1792 // parameters 1793 // - headerText: Text to display in header area of dialog. 1794 // - promptText: Text to display above image selection widgets. 1795 // - attachmentVersion: The number of the pinned version. 1796 // - diagramName: the name of the diagram (included in macro). 1797 // - ownerPageId: ID of page that diagram is contained within. 1798 // - referencePageId: ID of page that diagram reference is contained within. 1799 // - pinnedIsDefault: true if pinned version should be default selection, false if latest version should be default selection. 1800 // - onComplete: A callback that gets executed up dialog dismissal. 1801 // * Argument pinnedVersionWasSelected: true if pinned version selected, false if latest version is selected. 1802 var VersionSelectionDialog = function (parameters) { 1803 var self = this; 1804 var parameters = $.extend({ 1805 onCancel: function () { 1806 // intentionally empty 1807 } 1808 }, parameters); 1809 objectValidatorFactory.create({ 1810 description: "VersionSelectionDialog constructor parameters", 1811 keyToPredicateMap: { 1812 "headerText": objectValidatorFactory.predicates.isString, 1813 "promptText": objectValidatorFactory.predicates.isString, 1814 "attachmentVersion": objectValidatorFactory.predicates.isNumber, 1815 "diagramName": objectValidatorFactory.predicates.isString, 1816 "ownerPageId": objectValidatorFactory.predicates.isDefinedAndNotNull, 1817 "referencePageId": objectValidatorFactory.predicates.isDefinedAndNotNull, 1818 "pinnedIsDefault": objectValidatorFactory.predicates.isDefinedAndNotNull, 1819 "onComplete": objectValidatorFactory.predicates.isFunction 1820 } 1821 }).validate(parameters); 1822 1823 this._ = { 1824 hasBeenShown: false, 1825 parameters: parameters, 1826 pinnedVersionIsSelected: parameters.pinnedIsDefault, 1827 buildDom: function () { 1828 var bodyHtml = gliffySoy.dialog.version.versionSelectionDialogBody({ 1829 promptText: parameters.promptText 1830 }); 1831 1832 var dom = $(bodyHtml); 1833 1834 var widgetArea = dom.find(".gliffy-image-selection-widget-area"); 1835 var pinnedVersionControl = imageSelectionControlFactory.create({ 1836 parent: widgetArea, 1837 labelText: AJS.format("Version {0}", parameters.attachmentVersion), 1838 imageUrl: AJS.format('{0}/download/attachments/{1}/{2}.png?api=v2&version={3}&modificationDate=0', self._.parameters.contextPath, self._.parameters.ownerPageId, encodeURIComponent(self._.parameters.diagramName), self._.parameters.attachmentVersion), 1839 isSelected: parameters.pinnedIsDefault 1840 }); 1841 1842 var latestVersionControl = imageSelectionControlFactory.create({ 1843 parent: widgetArea, 1844 labelText: "Latest", 1845 imageUrl: AJS.format('{0}/download/attachments/{1}/{2}.png?api=v2×tamp={3}&version={4}', 1846 self._.parameters.contextPath, 1847 self._.parameters.ownerPageId, 1848 encodeURIComponent(self._.parameters.diagramName), 1849 new Date().getTime(), 1850 self._.parameters.pagePin || 0), 1851 isSelected: !parameters.pinnedIsDefault 1852 }); 1853 1854 pinnedVersionControl.getDomRoot().addClass("left"); 1855 latestVersionControl.getDomRoot().addClass("right"); 1856 1857 pinnedVersionControl.addSelectionChangedListener(function(event) { 1858 if(event.isSelected) { 1859 latestVersionControl.setIsSelected(false); 1860 self._.pinnedVersionIsSelected = true; 1861 } 1862 }); 1863 1864 latestVersionControl.addSelectionChangedListener(function(event) { 1865 if(event.isSelected) { 1866 pinnedVersionControl.setIsSelected(false); 1867 self._.pinnedVersionIsSelected = false;
1868 } 1869 }); 1870 1871 return dom; 1872 } 1873 } 1874 }; 1875 1876 VersionSelectionDialog.prototype.show = function () { 1877 var self = this; 1878 if (self._.hasBeenShown) { 1879 throw new Error("versionSelectionDialogFactory can be shown only once per instance lifetime."); 1880 } 1881 1882 var dialog = new AJS.Dialog({ 1883 width: 600, 1884 height: 380, 1885 closeOnOutsideClick: false 1886 }); 1887 dialog.addHeader(self._.parameters.headerText); 1888 dialog.addPanel("", self._.buildDom(), "panel-body"); 1889 1890 dialog.addLink("Cancel", function (dialog) { 1891 dialog.remove(); 1892 }, 'aui-button gliffy-dialog-cancel'); 1893 1894 dialog.addButton("Select", function (dialog) { 1895 dialog.remove(); 1896 self._.parameters.onComplete(self._.pinnedVersionIsSelected); 1897 }); 1898 dialog.show(); 1899 self._.hasBeenShown = true; 1900 }; 1901 1902 return { 1903 create: function(parameters) { 1904 return new VersionSelectionDialog(parameters); 1905 } 1906 } 1907 } 1908); 1909 1910}catch(e){WRMCB(e)}; 1911; 1912try { 1913/* module-key = 'com.gliffy.integration.confluence:gliffy-confluence-editor-launcher', location = 'gliffy/confluence/versionselection/VersionSelectionDialogController.js' */ 1914define("gliffy/confluence/versionselection/versionSelectionDialogController", 1915 [ 1916 "jquery", 1917 "gliffy/objectValidatorFactory", 1918 "gliffy/confluence/versionselection/versionSelectionDialogFactory" 1919 ], 1920 function($, objectValidatorFactory, versionSelectionDialogFactory) { 1921 "use strict"; 1922 1923 return { 1924 // Creates a diagram which asks the user whether to unpin the recently edited diagram. 1925 // 1926 // PARAMETERS: 1927 // options 1928 // - attachmentVersion: The number of the pinned version. 1929 // - diagramName: the name of the diagram (included in macro). 1930 // - ownerPageId: ID of page that diagram is contained within. 1931 // - referencePageId: ID of page that diagram reference is contained within. 1932 // - onComplete: A callback that gets executed up dialog dismissal. 1933 // * Argument pinnedVersionWasSelected: true if pinned version selected, false if latest version is selected. 1934 1935 showUnpinMacroDiagramVersionDialog: function (parameters) { 1936 versionSelectionDialogFactory.create($.extend({ 1937 headerText: "Select Diagram Version to Display", 1938 promptText: AJS.format("Version {0} is currently pinned to this page. Which version would you like to display?", parameters.attachmentVersion), 1939 pinnedIsDefault: false 1940 }, parameters)).show(); 1941 }, 1942 1943 showSelectVersionToEditDialog: function (parameters) { 1944 versionSelectionDialogFactory.create($.extend({ 1945 headerText: "Select Diagram Version to Edit", 1946 promptText: AJS.format("Version {0} is currently pinned to this page. Which version you would like to edit?", parameters.attachmentVersion), 1947 pinnedIsDefault: true 1948 }, parameters)).show(); 1949 } 1950 }; 1951 1952 } 1953); 1954}catch(e){WRMCB(e)}; 1955; 1956try { 1957/* module-key = 'com.gliffy.integration.confluence:gliffy-confluence-editor-launcher', location = 'gliffy/confluence/versionselection/VersionSelectionController.js' */ 1958/** 1959 * Responsible for attaching to events and handling local storage "cookie" checks 1960 */ 1961 1962// Register as apex module so this module can be instantiated after everybody is registered. 1963require("gliffy/amd/apexModuleManager"). 1964define("gliffy/confluence/versionselection/versionSelectionController", [ 1965 "jquery", 1966 "gliffy/url", 1967 "gliffy/confluence/pageFacade", 1968 "gliffy/confluence/versionselection/versionSelectionDialogController" 1969], function($, url, pageFacade, versionSelectionDialogController) { 1970 "use strict"; 1971 1972 // check for edited pinned version local storage "cookie" 1973 var checkForEdit = function () { 1974 var diagramEditedDataString = window.localStorage.getItem("com.gliffy.confluence.diagram.edited"); 1975 if (diagramEditedDataString) { 1976 window.localStorage.removeItem("com.gliffy.confluence.diagram.edited"); 1977 var data = JSON.parse(diagramEditedDataString); 1978 if (data) { 1979 // Execute only when there is an element that matches the data.referencePageId parameter. 1980 var parsedUrlParameters = url.parse(data.url).queryParams; 1981 var attachmentVersion = 0; 1982 if (parsedUrlParameters.originalAttachmentVersion) { 1983 attachmentVersion = parseInt(parsedUrlParameters.originalAttachmentVersion); 1984 } else if (parsedUrlParameters.attachmentVersion) { 1985 attachmentVersion = parseInt(parsedUrlParameters.attachmentVersion); 1986 } 1987 1988 var diagramReferencesThatMatch = pageFacade.getDiagramReferences().filter(function (diagramReference) { 1989 // TODO: GCONF-2181 This will probably have issues with linked diagrams. 1990 return (diagramReference.name === parsedUrlParameters.name); 1991 }); 1992 var isPinned = parsedUrlParameters.isPinned === "true" ? true : false;
1993 if (attachmentVersion > 0 && isPinned && (parsedUrlParameters.inline === "true" || diagramReferencesThatMatch.length > 0)) { 1994 var diagramReference = { 1995 ownerPageId: parsedUrlParameters.ceoid, 1996 name: parsedUrlParameters.name, 1997 version: attachmentVersion 1998 }; 1999 2000 versionSelectionDialogController.showUnpinMacroDiagramVersionDialog({ 2001 ownerPageId: diagramReference.ownerPageId, 2002 diagramName: diagramReference.name, 2003 attachmentVersion: diagramReference.version, 2004 referencePageId: AJS.params.pageId, 2005 contextPath: AJS.Confluence.getContextPath(), 2006 onComplete: function (pinnedVersionWasSelected) { 2007 if (!pinnedVersionWasSelected) { 2008 pageFacade.unpinDiagramReferenceVersion(diagramReference); 2009 } 2010 } 2011 }); 2012 } 2013 } 2014 } 2015 } 2016 2017 AJS.bind("gliffy.confluence.inlineEditorClosed", function () { 2018 checkForEdit(); 2019 }); 2020 2021 $(function () { 2022 checkForEdit(); 2023 }); 2024}); 2025 2026}catch(e){WRMCB(e)}; 2027; 2028try { 2029/* module-key = 'com.gliffy.integration.confluence:gliffy-confluence-editor-launcher', location = 'gliffy/confluence/editor/EditorLauncher.js' */ 2030define("gliffy/confluence/editor/editorLauncher", 2031 [ 2032 "jquery", 2033 "gliffy/objectValidatorFactory", 2034 "gliffy/confluence/versionselection/versionSelectionDialogController" 2035 ], 2036 function($, objectValidatorFactory, versionSelectionDialogController) { 2037 "use strict"; 2038 2039 var determineWhetherToDisplayInitialDialog = function(contextPath, diagramName, ownerPageId, attachmentVersion, callback) { 2040 if (attachmentVersion && attachmentVersion > 0) { 2041 $.ajax({ 2042 url: contextPath + '/rest/gliffy/1.0/diagrams/allVersionInformation', 2043 type: 'GET', 2044 data: { 2045 name: diagramName, 2046 pageId: ownerPageId 2047 }, 2048 success: function (response) { 2049 callback(response.numRevisions !== parseInt(attachmentVersion)); 2050 }, 2051 error: function (response) { 2052 callback(false); 2053 } 2054 }); 2055 } else { 2056 callback(false); 2057 } 2058 } 2059 2060 //url: linkUrl, 2061 // attachmentVersion: attachmentVersion, 2062 // ownerPageId: parsedUrlParameters.ceoid, 2063 // referencePageId: parsedUrlParameters.pageId, 2064 // diagramName: parsedUrlParameters.name 2065 return { 2066 launchEditorFromViewPage: function (parameters) { 2067 parameters = $.extend({ 2068 contextPath: AJS.Confluence.getContextPath() 2069 }, parameters); 2070 2071 window.open(parameters.url, '_self'); 2072 }, 2073 launchEditorFromEditPage: function(parameters) { 2074 parameters = $.extend({ 2075 contextPath: AJS.Confluence.getContextPath() 2076 }, parameters); 2077 parameters.isPinned = (parameters.attachmentVersion) ? true : false; 2078 parameters.attachmentVersion = parameters.attachmentVersion; 2079 AJS.trigger("gliffy.confluence.launchInlineEditor", [parameters]); 2080 } 2081 }; 2082 } 2083); 2084 2085}catch(e){WRMCB(e)}; 2086; 2087try { 2088/* module-key = 'com.gliffy.integration.confluence:gliffy-spinner', location = 'gliffy/GliffySpinner.js' */ 2089/* 2090 Wrapper to implement spinners in confluence plugin. Supports the Raphael spinner, and falls back to 2091 a spinjs spinner if Raphael spinner is not supported. The spinjs fallback was added because the Editor 2092 appears to have compatability issues with the Atlassian spinners when running under earlier versions of confluence. 2093 This feature may be removable when supportfor Confluence 5.1.5 is depricated. 2094 2095 use: 2096 2097 //create a spinner object 2098 var spinner = new GliffySpinner([element to insert the spinner into], [optiond]) 2099 2100 options can be the following: 2101 inline: boolean. If true the spinner is added into the normal layout. If false, the spinner is superimposed 2102 and centered over the container element 2103 color: color of the spinner lines. 2104 radius: radius of the spinner 2105 other: If this is a spinjs spinner, this following option are also available. The defaults are set to 2106 resemble an Atlassian spinner as mush as possible. 2107 */ 2108 2109 2110define("GliffySpinner", [ 2111 "thirdparty/spinjs" 2112], function(SpinJs) { 2113 "use strict"; 2114 2115 var getZIndex = function(el) { 2116 var zIndex; 2117 var i=0; 2118 do { 2119 zIndex = $(el).css('z-index'); 2120 el = $(el).parent()[0]; 2121 i++; 2122 } while (isNaN(zIndex) && el.tagName); 2123 if (isNaN(zIndex)) { 2124 zIndex = 0; 2125 } 2126 return zIndex; 2127 }; 2128 2129 var GliffySpinner = function (parent, options) { 2130 2131 options = options || {}; 2132 options.radius = options.radius || 20; 2133 options.color = options.color || '#000'; 2134 2135 $(parent).prepend('<span></span>'); 2136 this.container= $(parent).find('span').get(0); 2137 $(this.container) 2138 .addClass('gliffy-spinner-container'); 2139 if (options.inline) { 2140 $(this.container).css('position', 'relative'); 2141 this.inline = true; 2142 } else { 2143 var zIndex = getZIndex(parent); 2144 $(this.container) 2145 .css('position', 'absolute') 2146 .css('z-index', zIndex+1); 2147 } 2148 var r = options.radius; 2149 options.length = 0.5*r; 2150 options.radius = 0.5*r; 2151 options.lines = 12; 2152 options.corners = 1.0; 2153 options.width = 0.4*options.length; 2154 var gliffySpinner = SpinJs(); 2155 var spinner = new gliffySpinner.Spinner(options).spin(); 2156 this.container.appendChild(spinner.el); 2157 if (!options.inline) { 2158 $(this.container) 2159 .css('left', $(parent).width() / 2 - $(this.container).width() / 2) 2160 .css('top', $(parent).height() / 2 - $(this.container).height() / 2); 2161 } 2162 $(this.container).hide(); 2163 2164 //function to start/display the spinner 2165 this.start = function() { 2166 2167 if ($(this.container).parent().css('position') === 'static') { 2168 //absolutely positioned elements are positioned relatively to the nearest POSITIONED ancestor 2169 //so make relative if static, position will remain unchanged it
2170 if (!this.inline) { 2171 $(this.container).parent().css('position', 'relative'); 2172 this.positioned = true; 2173 } 2174 } 2175 $(this.container).show(); 2176 }; 2177 2178 //function to stop the spinner 2179 this.stop = function() { 2180 2181 if (this.positioned) { 2182 $(parent).parent().css('position', 'static'); 2183 this.positioned = false; 2184 } 2185 $(this.container).hide(); 2186 }; 2187 }; 2188 2189 return GliffySpinner; 2190 }); 2191}catch(e){WRMCB(e)}; 2192; 2193try { 2194/* module-key = 'com.gliffy.integration.confluence:gliffy-spinner', location = 'thirdparty/spin.js' */ 2195/** 2196 * Copyright (c) 2011-2014 Felix Gnass 2197 * Licensed under the MIT license 2198 * http://spin.js.org/ 2199 * 2200 * Example: 2201 var opts = { 2202 lines: 12, // The number of lines to draw 2203 , length: 7, // The length of each line 2204 , width: 5, // The line thickness 2205 , radius: 10 // The radius of the inner circle 2206 , scale: 1.0 // Scales overall size of the spinner 2207 , corners: 1 // Roundness (0..1) 2208 , color: '#000' // #rgb or #rrggbb 2209 , opacity: 1/4 // Opacity of the lines 2210 , rotate: 0 // Rotation offset 2211 , direction: 1 // 1: clockwise, -1: counterclockwise 2212 , speed: 1 // Rounds per second 2213 , trail: 100 // Afterglow percentage 2214 , fps: 20 // Frames per second when using setTimeout() 2215 , zIndex: 2e9 // Use a high z-index by default 2216 , className: 'spinner' // CSS class to assign to the element 2217 , top: '50%' // center vertically 2218 , left: '50%' // center horizontally 2219 , shadow: false // Whether to render a shadow 2220 , hwaccel: false // Whether to use hardware acceleration (might be buggy) 2221 , position: 'absolute' // Element positioning 2222 } 2223 var target = document.getElementById('foo') 2224 var spinner = new Spinner(opts).spin(target) 2225 */ 2226 2227//modified for almond - Jan Revis@Gliffy 2228define('thirdparty/spinjs', [ 2229 2230], function() { 2231 2232 return function() { 2233 var spinner = new Object(); 2234 (function (root, factory) { 2235 2236 /* CommonJS */ 2237 if (typeof exports == 'object') module.exports = factory() 2238 2239 /* AMD module */ 2240 else if (typeof define == 'function' && define.amd) define(factory) 2241 2242 /* Browser global */ 2243 else root.Spinner = factory() 2244 }(spinner, function () { 2245 "use strict"; 2246 2247 var prefixes = ['webkit', 'Moz', 'ms', 'O'] /* Vendor prefixes */ 2248 , animations = {} /* Animation rules keyed by their name */ 2249 , useCssAnimations /* Whether to use CSS animations or setTimeout */ 2250 , sheet 2251 /* A stylesheet to hold the @keyframe or VML rules. */ 2252 2253 /** 2254 * Utility function to create elements. If no tag name is given, 2255 * a DIV is created. Optionally properties can be passed. 2256 */ 2257 function createEl(tag, prop) { 2258 var el = document.createElement(tag || 'div') 2259 , n 2260 2261 for (n in prop) el[n] = prop[n] 2262 return el 2263 } 2264 2265 /** 2266 * Appends children and returns the parent. 2267 */ 2268 function ins(parent /* child1, child2, ...*/) { 2269 for (var i = 1, n = arguments.length; i < n; i++) { 2270 parent.appendChild(arguments[i]) 2271 } 2272 2273 return parent 2274 } 2275 2276 /** 2277 * Creates an opacity keyframe animation rule and returns its name. 2278 * Since most mobile Webkits have timing issues with animation-delay, 2279 * we create separate rules for each line/segment. 2280 */ 2281 function addAnimation(alpha, trail, i, lines) { 2282 var name = ['opacity', trail, ~~(alpha * 100), i, lines].join('-') 2283 , start = 0.01 + i / lines * 100 2284 , z = Math.max(1 - (1 - alpha) / trail * (100 - start), alpha) 2285 , prefix = useCssAnimations.substring(0, useCssAnimations.indexOf('Animation')).toLowerCase() 2286 , pre = prefix && '-' + prefix + '-' || '' 2287 2288 if (!animations[name]) { 2289 sheet.insertRule( 2290 '@' + pre + 'keyframes ' + name + '{' + 2291 '0%{opacity:' + z + '}' + 2292 start + '%{opacity:' + alpha + '}' + 2293 (start + 0.01) + '%{opacity:1}' + 2294 (start + trail) % 100 + '%{opacity:' + alpha + '}' + 2295 '100%{opacity:' + z + '}' + 2296 '}', sheet.cssRules.length) 2297 2298 animations[name] = 1 2299 } 2300 2301 return name 2302 } 2303 2304 /**
vendor: 12,159 bytes, lines 2305-2602
2305 * Tries various vendor prefixes and returns the first supported property. 2306 */ 2307 function vendor(el, prop) { 2308 var s = el.style 2309 , pp 2310 , i 2311 2312 prop = prop.charAt(0).toUpperCase() + prop.slice(1) 2313 if (s[prop] !== undefined) return prop 2314 for (i = 0; i < prefixes.length; i++) { 2315 pp = prefixes[i] + prop 2316 if (s[pp] !== undefined) return pp 2317 } 2318 } 2319 2320 /** 2321 * Sets multiple style properties at once. 2322 */ 2323 function css(el, prop) { 2324 for (var n in prop) { 2325 el.style[vendor(el, n) || n] = prop[n] 2326 } 2327 2328 return el 2329 } 2330 2331 /** 2332 * Fills in default values. 2333 */ 2334 function merge(obj) { 2335 for (var i = 1; i < arguments.length; i++) { 2336 var def = arguments[i] 2337 for (var n in def) { 2338 if (obj[n] === undefined) obj[n] = def[n] 2339 } 2340 } 2341 return obj 2342 } 2343 2344 /** 2345 * Returns the line color from the given string or array. 2346 */ 2347 function getColor(color, idx) { 2348 return typeof color == 'string' ? color : color[idx % color.length] 2349 } 2350 2351 // Built-in defaults 2352 2353 var defaults = { 2354 lines: 12 // The number of lines to draw 2355 , length: 7 // The length of each line 2356 , width: 5 // The line thickness 2357 , radius: 10 // The radius of the inner circle 2358 , scale: 1.0 // Scales overall size of the spinner 2359 , corners: 1 // Roundness (0..1) 2360 , color: '#000' // #rgb or #rrggbb 2361 , opacity: 1 / 4 // Opacity of the lines 2362 , rotate: 0 // Rotation offset 2363 , direction: 1 // 1: clockwise, -1: counterclockwise 2364 , speed: 1 // Rounds per second 2365 , trail: 100 // Afterglow percentage 2366 , fps: 20 // Frames per second when using setTimeout() 2367 , zIndex: 2e9 // Use a high z-index by default 2368 , className: 'spinner' // CSS class to assign to the element 2369 , top: '50%' // center vertically 2370 , left: '50%' // center horizontally 2371 , shadow: false // Whether to render a shadow 2372 , hwaccel: false // Whether to use hardware acceleration (might be buggy) 2373 , position: 'absolute' // Element positioning 2374 } 2375 2376 /** The constructor */ 2377 function Spinner(o) { 2378 this.opts = merge(o || {}, Spinner.defaults, defaults) 2379 } 2380 2381 // Global defaults that override the built-ins: 2382 Spinner.defaults = {} 2383 2384 merge(Spinner.prototype, { 2385 /** 2386 * Adds the spinner to the given target element. If this instance is already 2387 * spinning, it is automatically removed from its previous target by calling 2388 * stop() internally. 2389 */ 2390 spin: function (target) { 2391 this.stop() 2392 2393 var self = this 2394 , o = self.opts 2395 , el = self.el = createEl(null, {className: o.className}) 2396 2397 css(el, { 2398 position: o.position 2399 , width: 0 2400 , zIndex: o.zIndex 2401 , left: o.left 2402 , top: o.top 2403 }) 2404 2405 if (target) { 2406 target.insertBefore(el, target.firstChild || null) 2407 } 2408 2409 el.setAttribute('role', 'progressbar') 2410 self.lines(el, self.opts) 2411 2412 if (!useCssAnimations) { 2413 // No CSS animation support, use setTimeout() instead 2414 var i = 0 2415 , start = (o.lines - 1) * (1 - o.direction) / 2 2416 , alpha 2417 , fps = o.fps 2418 , f = fps / o.speed 2419 , ostep = (1 - o.opacity) / (f * o.trail / 100) 2420 , astep = f / o.lines 2421 2422 ; 2423 (function anim() { 2424 i++ 2425 for (var j = 0; j < o.lines; j++) { 2426 alpha = Math.max(1 - (i + (o.lines - j) * astep) % f * ostep, o.opacity) 2427 2428 self.opacity(el, j * o.direction + start, alpha, o) 2429 } 2430 self.timeout = self.el && setTimeout(anim, ~~(1000 / fps)) 2431 })() 2432 } 2433 return self 2434 } 2435 2436 /** 2437 * Stops and removes the Spinner. 2438 */ 2439 , stop: function () { 2440 var el = this.el 2441 if (el) { 2442 clearTimeout(this.timeout) 2443 if (el.parentNode) el.parentNode.removeChild(el) 2444 this.el = undefined 2445 } 2446 return this 2447 } 2448 2449 /** 2450 * Internal method that draws the individual lines. Will be overwritten 2451 * in VML fallback mode below. 2452 */ 2453 , lines: function (el, o) { 2454 var i = 0 2455 , start = (o.lines - 1) * (1 - o.direction) / 2 2456 , seg 2457 2458 function fill(color, shadow) { 2459 return css(createEl(), { 2460 position: 'absolute' 2461 , 2462 width: o.scale * (o.length + o.width) + 'px' 2463 , 2464 height: o.scale * o.width + 'px' 2465 , 2466 background: color 2467 , 2468 boxShadow: shadow 2469 , 2470 transformOrigin: 'left' 2471 , 2472 transform: 'rotate(' + ~~(360 / o.lines * i + o.rotate) + 'deg) translate(' + o.scale * o.radius + 'px' + ',0)' 2473 , 2474 borderRadius: (o.corners * o.scale * o.width >> 1) + 'px' 2475 }) 2476 } 2477 2478 for (; i < o.lines; i++) { 2479 seg = css(createEl(), { 2480 position: 'absolute' 2481 , 2482 top: 1 + ~(o.scale * o.width / 2) + 'px' 2483 , 2484 transform: o.hwaccel ? 'translate3d(0,0,0)' : '' 2485 , 2486 opacity: o.opacity 2487 , 2488 animation: useCssAnimations && addAnimation(o.opacity, o.trail, start + i * o.direction, o.lines) + ' ' + 1 / o.speed + 's linear infinite' 2489 }) 2490 2491 if (o.shadow) ins(seg, css(fill('#000', '0 0 4px #000'), {top: '2px'})) 2492 ins(el, ins(seg, fill(getColor(o.color, i), '0 0 1px rgba(0,0,0,.1)'))) 2493 } 2494 return el 2495 } 2496 2497 /** 2498 * Internal method that adjusts the opacity of a single line. 2499 * Will be overwritten in VML fallback mode below. 2500 */ 2501 , opacity: function (el, i, val) { 2502 if (i < el.childNodes.length) el.childNodes[i].style.opacity = val 2503 } 2504 2505 }) 2506 2507 2508 function initVML() { 2509 2510 /* Utility function to create a VML tag */ 2511 function vml(tag, attr) { 2512 return createEl('<' + tag + ' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">', attr) 2513 } 2514 2515 // No CSS transforms but VML support, add a CSS rule for VML elements: 2516 sheet.addRule('.spin-vml', 'behavior:url(#default#VML)') 2517 2518 Spinner.prototype.lines = function (el, o) { 2519 var r = o.scale * (o.length + o.width) 2520 , s = o.scale * 2 * r 2521 2522 function grp() { 2523 return css( 2524 vml('group', { 2525 coordsize: s + ' ' + s 2526 , coordorigin: -r + ' ' + -r 2527 }) 2528 , {width: s, height: s} 2529 ) 2530 } 2531 2532 var margin = -(o.width + o.length) * o.scale * 2 + 'px' 2533 , g = css(grp(), {position: 'absolute', top: margin, left: margin}) 2534 , i 2535 2536 function seg(i, dx, filter) { 2537 ins( 2538 g 2539 , ins( 2540 css(grp(), {rotation: 360 / o.lines * i + 'deg', left: ~~dx}) 2541 , ins( 2542 css( 2543 vml('roundrect', {arcsize: o.corners}) 2544 , { 2545 width: r 2546 , height: o.scale * o.width 2547 , left: o.scale * o.radius 2548 , top: -o.scale * o.width >> 1 2549 , filter: filter 2550 } 2551 ) 2552 , vml('fill', {color: getColor(o.color, i), opacity: o.opacity}) 2553 , vml('stroke', {opacity: 0}) // transparent stroke to fix color bleeding upon opacity change 2554 ) 2555 ) 2556 ) 2557 } 2558 2559 if (o.shadow) 2560 for (i = 1; i <= o.lines; i++) { 2561 seg(i, -2, 'progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)') 2562 } 2563 2564 for (i = 1; i <= o.lines; i++) seg(i) 2565 return ins(el, g) 2566 } 2567 2568 Spinner.prototype.opacity = function (el, i, val, o) { 2569 var c = el.firstChild 2570 o = o.shadow && o.lines || 0 2571 if (c && i + o < c.childNodes.length) { 2572 c = c.childNodes[i + o]; 2573 c = c && c.firstChild; 2574 c = c && c.firstChild 2575 if (c) c.opacity = val 2576 } 2577 } 2578 } 2579 2580 if (typeof document !== 'undefined') { 2581 sheet = (function () { 2582 var el = createEl('style', {type: 'text/css'}) 2583 ins(document.getElementsByTagName('head')[0], el) 2584 return el.sheet || el.styleSheet 2585 }()); 2586 2587 var probe = css(createEl('group'), {behavior: 'url(#default#VML)'}) 2588 2589 if (!vendor(probe, 'transform') && probe.adj) initVML() 2590 else useCssAnimations = vendor(probe, 'animation') 2591 } 2592 2593 return Spinner 2594 2595 })); 2596 return spinner; 2597 } 2598}); 2599}catch(e){WRMCB(e)}; 2600; 2601try { 2602/* module-key = 'com.gliffy.integration.confluence:gliffy-global-resources', location = '
2602js/gliffy-on-confluence-init.js' */ 2603AJS.toInit(function() { 2604 2605 // Replaces Gliffy attachments with our icon and text 2606 AJS.$('table.attachments tr').each(function(trIndex, trElement) { 2607 AJS.$(trElement).find("td.attachment-actions a").each(function(aIndex, aElement) { 2608 if (AJS.$(aElement).attr("href").indexOf("/plugins/gliffy/view") != -1) { 2609 AJS.$(trElement).find("td.filename-column span") 2610 .removeClass("icon-file-xml icon-file-unknown") 2611 .addClass("gliffy-document-icon") 2612 .attr("title", "Gliffy File") 2613 .text("Gliffy File"); 2614 } 2615 }); 2616 }); 2617}); 2618}catch(e){WRMCB(e)}; 2619; 2620try { 2621/* module-key = 'com.gliffy.integration.confluence:gliffy-global-resources', location = 'js/gliffy-blueprint-registration.js' */ 2622AJS.toInit(function() { 2623 2624 //moved from gliffy-on-confluence-init.js so we can include this in both the global and admin web contexts 2625 if (Confluence && Confluence.Blueprint && Confluence.Blueprint.register){ 2626 2627 //direct to gliffy blank page 2628 Confluence.Blueprint.register('com.gliffy.integration.confluence:gliffy-blueprint-item-main', function(createDialog, spaceKey, createFunction){ 2629 window.location = Confluence.getContextPath() + "/pages/createpage.action?showGliffyMacro=true&fromCreateDialog=true" + 2630 "&spaceKey=" + encodeURIComponent(spaceKey) + 2631 "&newSpaceKey=" + encodeURIComponent(spaceKey) + 2632 (createDialog.getParentPageId() ? '&fromPageId=' + createDialog.getParentPageId() : ''); 2633 }); 2634 2635 //direct to a template 2636 var registerTemplate = function(type){ 2637 Confluence.Blueprint.register('com.gliffy.integration.confluence:gliffy-blueprint-item-'+type, function(createDialog, spaceKey, createFunction){ 2638 window.location = Confluence.getContextPath() + "/pages/createpage.action?showGliffyMacro=true&createDiagramType=" + type + 2639 "&spaceKey=" + encodeURIComponent(spaceKey) + 2640 "&newSpaceKey=" + encodeURIComponent(spaceKey) + 2641 (createDialog.getParentPageId() ? '&fromPageId=' + createDialog.getParentPageId() : ''); 2642 }); 2643 }; 2644 var templateCategories = ['org', 'network', 'software']; 2645 for (var i=0; i<templateCategories.length; i++){ 2646 registerTemplate(templateCategories[i]); 2647 } 2648 2649 2650 2651 //To pack dialog 2652 Confluence.Blueprint.register('com.gliffy.integration.confluence:gliffy-blueprint-item-pack', function(createDialog, spaceKey, createFunction){ 2653 2654 var page = createDialog.addPage("myplugin-step-2"), 2655 createHandler = function () { 2656 // Called when the user clicks the Submit button 2657 var title = $('#my-title').val(); 2658 var myName = $('#my-text-field').val(); 2659 createFunction(title, { myName: myName }); 2660 }; 2661 2662 //todo: AJS.I18n.getText() doesn't have our keys yet, so need to figure out a solution to localize this 2663 var html = '<div class="template-select-container-body"><ol class="templates" tabindex="100"><li class="template selected"data-item-module-complete-key="com.gliffy.integration.confluence:gliffy-blueprint-item-main"><imgclass="template-preview"src="/confluence/s/en_GB-1988229788/4103/31cc10c48352e244f00edd8fa27d95566a28e0c5.1/0.0-SNAPSHOT/_/download/resources/com.gliffy.integration.confluence:gliffy-blueprint-item-main/icon"><div class="template-meta"><div class="template-name" title="Gliffy Diagram">Corporate Org Chart</div><div class="template-description" title="Add a blank page with a Gliffy Diagram.">Add a page with a Corporate Org Chart</div></div></li><li class="template"data-item-module-complete-key="com.gliffy.integration.confluence:gliffy-blueprint-item-pack"><imgclass="template-preview"src="/confluence/s/en_GB-1988229788/4103/31cc10c48352e244f00edd8fa27d95566a28e0c5.1/0.0-SNAPSHOT/_/download/resources/com.gliffy.integration.confluence:gliffy-blueprint-item-pack/icon"><div class="template-meta"><div class="template-name" title="Gliffy Human Resources Pack">Reimbursement Process</div>
2663<div class="template-description" title="Choose from a list of diagrams relating to Human Resources.">Add a page with that shows a Reimbursement Process in your organization</div></div></li><li class="template"data-item-module-complete-key="com.gliffy.integration.confluence:gliffy-blueprint-item-pack"><imgclass="template-preview"src="/confluence/s/en_GB-1988229788/4103/31cc10c48352e244f00edd8fa27d95566a28e0c5.1/0.0-SNAPSHOT/_/download/resources/com.gliffy.integration.confluence:gliffy-blueprint-item-pack/icon"><div class="template-meta"><div class="template-name" title="Gliffy Human Resources Pack">Termination Process</div><div class="template-description" title="Choose from a list of diagrams relating to Human Resources.">Shows you how to fire the guy who had ten too many tequila shots at the last company party.</div></div></li></ol></div>'; 2664 page.addHeader("Gliffy Human Resources Pack") 2665 .addPanel("SinglePanel", html, "singlePanel") 2666 .addButton("Previous", function (dialog) { 2667 dialog.prevPage(); 2668 dialog.page.pop(); // remove this page / step when we move back. 2669 }, "") 2670 .addButton("Create", createHandler, "aui-button-primary create-dialog-create-button") 2671 .addLink("Close", function (dialog) { 2672 dialog.remove(); 2673 }, ""); 2674 page.getPanel(0).setPadding(0); 2675 /* focus first text field */ 2676 $("#my-title").focus(); 2677 /* submit form if user hits enter inside any text field */ 2678 $("#myplugin-form").submit(function () { 2679 createHandler(createDialog); 2680 return false; 2681 }); 2682 return false; 2683 // window.location = Confluence.getContextPath() + "/pages/createpage.action?showGliffyMacro=true" + 2684 // "&spaceKey=" + encodeURIComponent(spaceKey) + 2685 // "&newSpaceKey=" + encodeURIComponent(spaceKey); 2686 2687 }); 2688 } 2689 2690}); 2691}catch(e){WRMCB(e)}; 2692; 2693try { 2694/* module-key = 'com.gliffy.integration.confluence:gliffy-global-resources', location = 'js/gliffy-footer.js' */ 2695AJS.toInit(function() { 2696 2697 // AJS.template is not available until 3.0 2698 if (AJS.version >= "3.0") { 2699 // Adds markup to the global footer 2700 var poweredByNode = AJS.$("#poweredby:visible"); 2701 if (poweredByNode.length > 0) { 2702 poweredByNode.before(AJS.template.load("gliffy-webpanel-footer")); 2703 } 2704 } 2705 2706}); 2707}catch(e){WRMCB(e)}; 2708; 2709try { 2710/* module-key = 'com.gliffy.integration.confluence:gliffy-global-resources', location = 'gliffy/confluence/ContextFinalizer.js' */ 2711/** 2712 * Exists to require, and therefore execute, application-level bits like DOM controllers. 2713 * This must be included as the final resource of the web-resource definition 2714 */ 2715;(function($, apexModuleManager) { 2716 // Wait for DOM to be loaded before instantiating apex modules. 2717 $(function () { 2718 apexModuleManager.instantiateAll(); 2719 apexModuleManager.reset(); 2720 }); 2721})(require('jquery'), require('gliffy/amd/apexModuleManager')); 2722 2723 2724}catch(e){WRMCB(e)};
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.