Commit 51eb5277b9217247a924f75588fcadc8a1f3f4bb

Authored by ww
1 parent 08144f43

style: format Sidebar file

1   -(function()
2   -{
  1 +(function () {
3 2 /**
4 3 * Download from following URL as TSV and convert using https://jgraph.github.io/drawio-tools/tools/convert.html:
5 4 * https://docs.google.com/spreadsheets/d/1sAL1zn-UtmJtKPH4cLApGjRX-TRSJa5dYdfZ9NKYfRs
... ... @@ -21,7 +20,7 @@
21 20 /**
22 21 * Aliases for IDs in the libs parameter.
23 22 */
24   - Sidebar.prototype.libAliases = {'aws2': 'aws3', 'gcp' : 'gcp2'};
  23 + Sidebar.prototype.libAliases = { 'aws2': 'aws3', 'gcp': 'gcp2' };
25 24
26 25 /**
27 26 *
... ... @@ -43,43 +42,43 @@
43 42
44 43 Sidebar.prototype.gcpicons = ['AI and Machine Learning', 'API Management', 'Compute', 'Data Analytics', 'Databases', 'Developer Tools', 'Expanded Product Card Icons', 'Generic', 'Hybrid and Multi Cloud', 'Security', 'Internet of Things', 'Management Tools', 'Migration', 'Networking', 'Open Source Icons', 'Storage'];
45 44
46   - Sidebar.prototype.rack = ['General', 'APC', 'Cisco', 'Dell', 'F5', 'HP', 'HPE Aruba Gateways Controllers', 'HPE Aruba Security', 'HPE Aruba Switches', 'IBM', 'Oracle'];
  45 + Sidebar.prototype.rack = ['General', 'APC', 'Cisco', 'Dell', 'F5', 'HP', 'HPE Aruba Gateways Controllers', 'HPE Aruba Security', 'HPE Aruba Switches', 'IBM', 'Oracle'];
47 46
48 47 Sidebar.prototype.pids = ['Agitators', 'Apparatus Elements', 'Centrifuges', 'Compressors', 'Compressors ISO', 'Crushers Grinding',
49   - 'Driers', 'Engines', 'Feeders', 'Filters', 'Fittings', 'Flow Sensors', 'Heat Exchangers', 'Instruments', 'Misc',
50   - 'Mixers', 'Piping', 'Pumps', 'Pumps DIN', 'Pumps ISO', 'Separators', 'Shaping Machines', 'Valves', 'Vessels'];
  48 + 'Driers', 'Engines', 'Feeders', 'Filters', 'Fittings', 'Flow Sensors', 'Heat Exchangers', 'Instruments', 'Misc',
  49 + 'Mixers', 'Piping', 'Pumps', 'Pumps DIN', 'Pumps ISO', 'Separators', 'Shaping Machines', 'Valves', 'Vessels'];
51 50
52 51 Sidebar.prototype.cisco = ['Buildings', 'Computers and Peripherals', 'Controllers and Modules', 'Directors', 'Hubs and Gateways', 'Misc',
53   - 'Modems and Phones', 'People', 'Routers', 'Security', 'Servers', 'Storage', 'Switches', 'Wireless'];
  52 + 'Modems and Phones', 'People', 'Routers', 'Security', 'Servers', 'Storage', 'Switches', 'Wireless'];
54 53
55 54 Sidebar.prototype.cisco19 = ['LAN Switching', 'Routing WAN', 'Network Management', 'Data Center', 'Wireless LAN', 'Collaboration', 'Security Clouds Connectors', 'Endpoint Client Device Icons', 'DNA SD Access', 'SD WAN Viptela', 'ETA Stealthwatch', 'SAFE'];
56 55
57 56 Sidebar.prototype.cisco_safe = ['Architecture', 'Business Icons', 'Capability', 'Design', 'IoT Things Icons', 'People Places Things Icons', 'Security Icons', 'Technology Icons', 'Threat'];
58 57
59 58 Sidebar.prototype.sysml = ['Model Elements', 'Blocks', 'Ports and Flows', 'Constraint Blocks', 'Activities', 'Interactions', 'State Machines',
60   - 'Use Cases', 'Allocations', 'Requirements', 'Profiles', 'Stereotypes'];
  59 + 'Use Cases', 'Allocations', 'Requirements', 'Profiles', 'Stereotypes'];
61 60
62 61 Sidebar.prototype.eip = ['Message Construction', 'Message Routing', 'Message Transformation', 'Messaging Channels', 'Messaging Endpoints',
63   - 'Messaging Systems', 'System Management'];
  62 + 'Messaging Systems', 'System Management'];
64 63
65 64 Sidebar.prototype.gmdl = ['Bottom Navigation', 'Bottom Sheets', 'Buttons', 'Cards', 'Chips', 'Dialogs', 'Dividers', 'Grid Lists', 'Icons', 'Lists', 'Menus', 'Misc', 'Pickers',
66   - 'Selection Controls', 'Sliders', 'Steppers', 'Tabs', 'Text Fields'];
  65 + 'Selection Controls', 'Sliders', 'Steppers', 'Tabs', 'Text Fields'];
67 66
68 67 Sidebar.prototype.aws2 = ['Analytics', 'Application Services', 'Compute', 'Database', 'Developer Tools', 'Enterprise Applications', 'Game Development', 'General', 'Internet of Things',
69   - 'Management Tools', 'Mobile Services', 'Networking', 'On-Demand Workforce', 'SDKs', 'Security and Identity', 'Storage and Content Delivery', 'Groups'];
  68 + 'Management Tools', 'Mobile Services', 'Networking', 'On-Demand Workforce', 'SDKs', 'Security and Identity', 'Storage and Content Delivery', 'Groups'];
70 69
71 70 Sidebar.prototype.aws3 = ['Analytics', 'Application Services', 'Artificial Intelligence', 'Business Productivity', 'Compute', 'Contact Center', 'Database', 'Desktop and App Streaming', 'Developer Tools',
72   - 'Game Development', 'General', 'Groups', 'Internet of Things',
73   - 'Management Tools', 'Messaging', 'Migration', 'Mobile Services', 'Networking and Content Delivery', 'On Demand Workforce', 'SDKs', 'Security Identity and Compliance', 'Storage'];
  71 + 'Game Development', 'General', 'Groups', 'Internet of Things',
  72 + 'Management Tools', 'Messaging', 'Migration', 'Mobile Services', 'Networking and Content Delivery', 'On Demand Workforce', 'SDKs', 'Security Identity and Compliance', 'Storage'];
74 73
75 74 Sidebar.prototype.aws4b = ['Arrows', 'General Resources', 'Illustrations', 'Groups Light', 'Groups Dark', 'Analytics', 'Application Integration', 'AR VR', 'Cost Management', 'Business Productivity', 'Compute', 'Customer Engagement',
76   - 'Database', 'Desktop App Streaming', 'Developer Tools', 'Game Development', 'Internet of Things', 'IoT Things', 'IoT Resources', 'Machine Learning', 'Management Tools',
77   - 'Media Services', 'Migration', 'Mobile Services', 'Network Content Delivery', 'Security Identity Compliance', 'Storage'];
  75 + 'Database', 'Desktop App Streaming', 'Developer Tools', 'Game Development', 'Internet of Things', 'IoT Things', 'IoT Resources', 'Machine Learning', 'Management Tools',
  76 + 'Media Services', 'Migration', 'Mobile Services', 'Network Content Delivery', 'Security Identity Compliance', 'Storage'];
78 77
79 78 Sidebar.prototype.aws4 = ['Arrows', 'General Resources', 'Illustrations', 'Groups', 'Analytics', 'Application Integration', 'AR VR', 'Cost Management', 'Blockchain',
80   - 'Business Applications', 'Compute', 'Containers', 'Customer Enablement', 'Customer Engagement',
81   - 'Database', 'Developer Tools', 'End User Computing', 'Front End Web Mobile', 'Game Tech', 'Internet of Things', 'IoT Things', 'IoT Resources', 'Machine Learning', 'Management Governance',
82   - 'Media Services', 'Migration Transfer', 'Network Content Delivery', 'Quantum Technologies', 'Robotics', 'Satellite', 'Serverless', 'Security Identity Compliance', 'Storage'];
  79 + 'Business Applications', 'Compute', 'Containers', 'Customer Enablement', 'Customer Engagement',
  80 + 'Database', 'Developer Tools', 'End User Computing', 'Front End Web Mobile', 'Game Tech', 'Internet of Things', 'IoT Things', 'IoT Resources', 'Machine Learning', 'Management Governance',
  81 + 'Media Services', 'Migration Transfer', 'Network Content Delivery', 'Quantum Technologies', 'Robotics', 'Satellite', 'Serverless', 'Security Identity Compliance', 'Storage'];
83 82
84 83 Sidebar.prototype.office = ['Clouds', 'Communications', 'Concepts', 'Databases', 'Devices', 'Security', 'Servers', 'Services', 'Sites', 'Users'];
85 84
... ... @@ -133,7 +132,7 @@
133 132 * @returns {{}|*}
134 133 */
135 134 Sidebar.prototype.getVariableImageLib = function (key) {
136   - return this.variableImageLib.get(key)
  135 + return this.variableImageLib.get(key)
137 136 }
138 137
139 138 /**
... ... @@ -159,71 +158,73 @@
159 158 }
160 159 }
161 160
  161 +
  162 +
162 163 /**
163 164 * 各图形库里面要加载的图形
164 165 */
165   - Sidebar.prototype.configuration = [{id: 'general', libs: ['general', 'misc', 'advanced']},
166   - //加入自定义图形ID
167   - {id:'fan'},{id:'engine'},{id:'valve'},{id:'component'},{id:'controller'},{id:'sewage'},{id:'conduit'},{id: 'light'},{id: 'instrument'},{id: 'button'},
168   - {id: 'uml'}, {id: 'uml25'}, {id: 'search'}, {id: 'er'},
169   - {id: 'azure2', prefix: 'azure2', libs: ['AI Machine Learning', 'Analytics', 'App Services', 'Azure Stack', 'Azure VMware Solution', 'Blockchain', 'Compute', 'Containers', 'CXP', 'Databases', 'DevOps', 'General', 'Identity', 'Integration', 'Internet of Things', 'Intune', 'IoT', 'Management Governance', 'Migrate', 'Mixed Reality', 'Monitor', 'Networking', 'Other', 'Preview', 'Security', 'Storage', 'Web']},
170   - {id: 'ios', prefix: 'ios', libs: [''/*prefix is library*/, '7icons', '7ui']},
171   - {id: 'android', prefix: 'android', libs: [''/*prefix is library*/]}, {id: 'aws3d'},
172   - {id: 'flowchart'}, {id: 'basic'}, {id: 'infographic'}, {id: 'arrows'}, {id: 'arrows2'}, {id: 'lean_mapping'}, {id: 'citrix'}, {id: 'azure'}, {id: 'network'}, {id: 'vvd'},
173   - {id: 'sitemap'}, {id:'c4'}, {id: 'dfd'}, {id: 'threatModeling'}, {id : 'kubernetes'}, {id : 'cisco19', prefix: 'cisco19', libs: Sidebar.prototype.cisco19},
174   - {id: 'mscae', prefix: 'mscae', libs: ['Companies', 'EnterpriseFlat', 'IntuneFlat', 'OMSFlat', 'System CenterFlat', 'AI and ML Service', 'Analytics Service', 'Compute Service', 'Compute Service VM', 'Container Service', 'Databases Service', 'DevOps Service', 'General Service', 'Identity Service', 'Integration Service', 'Internet of Things Service', 'Intune Service', 'Management and Governance Service', 'Management and Governance Service Media', 'Migrate Service', 'Mixed Reality Service', 'Mobile Service', 'Networking Service', 'Other Category Service', 'Security Service', 'Storage Service', 'Web Service']},
175   - {id: 'active_directory'},
176   - {id: 'bpmn2', prefix: 'bpmn2', libs: ['General', 'Tasks', 'Choreographies', 'Events', 'Gateways']},
177   - {id: 'clipart', prefix: null, libs: ['computer', 'finance', 'clipart', 'networking', 'people', 'telco']},
178   - {id: 'ibm', prefix: 'ibm', libs: Sidebar.prototype.ibm},
179   - {id: 'allied_telesis', prefix: 'allied_telesis', libs: Sidebar.prototype.allied_telesis},
180   - {id: 'cumulus', libs: ['cumulus']},
181   - {id: 'eip', prefix: 'eip', libs: Sidebar.prototype.eip},
182   - {id: 'mockups', prefix: 'mockup', libs: ['Buttons', 'Containers', 'Forms', 'Graphics', 'Markup', 'Misc', 'Navigation', 'Text']},
183   - {id: 'pid2', prefix: 'pid2', libs: ['Agitators', 'Apparatus Elements', 'Centrifuges', 'Compressors', 'Compressors ISO', 'Crushers Grinding',
184   - 'Driers', 'Engines', 'Feeders', 'Filters', 'Fittings', 'Flow Sensors', 'Heat Exchangers', 'Instruments', 'Misc',
185   - 'Mixers', 'Piping', 'Pumps', 'Pumps DIN', 'Pumps ISO', 'Separators', 'Shaping Machines', 'Valves', 'Vessels']},
186   - {id: 'signs', prefix: 'signs', libs: Sidebar.prototype.signs},
187   - {id: 'gcp', prefix: 'gcp', libs: Sidebar.prototype.gcp},
188   - {id: 'gcp2', prefix: 'gcp2', libs: Sidebar.prototype.gcp2},
189   - {id: 'gcpicons', prefix: 'gcpicons', libs: Sidebar.prototype.gcpicons},
190   - {id: 'rack', prefix: 'rack', libs: Sidebar.prototype.rack},
191   - {id: 'electrical', prefix: 'electrical', libs: Sidebar.prototype.electrical},
192   - {id: 'aws2', prefix: 'aws2', libs: Sidebar.prototype.aws2},
193   - {id: 'aws3', prefix: 'aws3', libs: Sidebar.prototype.aws3},
194   - {id: 'aws4b', prefix: 'aws4b', libs: Sidebar.prototype.aws4b},
195   - {id: 'aws4', prefix: 'aws4', libs: Sidebar.prototype.aws4},
196   - {id: 'pid', prefix: 'pid', libs: Sidebar.prototype.pids},
197   - {id: 'cisco', prefix: 'cisco', libs: Sidebar.prototype.cisco},
198   - {id: 'cisco_safe', prefix: 'cisco_safe', libs: Sidebar.prototype.cisco_safe},
199   - {id: 'office', prefix: 'office', libs: Sidebar.prototype.office},
200   - {id: 'veeam', prefix: 'veeam', libs: Sidebar.prototype.veeam},
201   - {id: 'veeam2', prefix: 'veeam2', libs: Sidebar.prototype.veeam2},
202   - {id: 'cabinets', libs: ['cabinets']},
203   - {id: 'floorplan', libs: ['floorplan']},
204   - {id: 'bootstrap', libs: ['bootstrap']},
205   - {id: 'atlassian', libs: ['atlassian']},
206   - {id: 'fluid_power', libs: ['fluid_power']},
207   - {id: 'gmdl', prefix: 'gmdl', libs: Sidebar.prototype.gmdl},
208   - {id: 'archimate3', prefix: 'archimate3', libs: Sidebar.prototype.archimate3},
209   - {id: 'archimate', libs: ['archimate']},
210   - {id: 'webicons', libs: ['webicons', 'weblogos']},
211   - {id: 'sysml', prefix: 'sysml', libs: Sidebar.prototype.sysml}];
  166 + Sidebar.prototype.configuration = [
  167 + { id: 'general', libs: ['general', 'misc', 'advanced'] },
  168 + //加入自定义图形ID
  169 + { id: 'fan' }, { id: 'engine' }, { id: 'valve' }, { id: 'component' }, { id: 'controller' }, { id: 'sewage' }, { id: 'conduit' }, { id: 'light' }, { id: 'instrument' }, { id: 'button' },
  170 + { id: 'uml' }, { id: 'uml25' }, { id: 'search' }, { id: 'er' },
  171 + { id: 'azure2', prefix: 'azure2', libs: ['AI Machine Learning', 'Analytics', 'App Services', 'Azure Stack', 'Azure VMware Solution', 'Blockchain', 'Compute', 'Containers', 'CXP', 'Databases', 'DevOps', 'General', 'Identity', 'Integration', 'Internet of Things', 'Intune', 'IoT', 'Management Governance', 'Migrate', 'Mixed Reality', 'Monitor', 'Networking', 'Other', 'Preview', 'Security', 'Storage', 'Web'] },
  172 + { id: 'ios', prefix: 'ios', libs: [''/*prefix is library*/, '7icons', '7ui'] },
  173 + { id: 'android', prefix: 'android', libs: [''/*prefix is library*/] }, { id: 'aws3d' },
  174 + { id: 'flowchart' }, { id: 'basic' }, { id: 'infographic' }, { id: 'arrows' }, { id: 'arrows2' }, { id: 'lean_mapping' }, { id: 'citrix' }, { id: 'azure' }, { id: 'network' }, { id: 'vvd' },
  175 + { id: 'sitemap' }, { id: 'c4' }, { id: 'dfd' }, { id: 'threatModeling' }, { id: 'kubernetes' }, { id: 'cisco19', prefix: 'cisco19', libs: Sidebar.prototype.cisco19 },
  176 + { id: 'mscae', prefix: 'mscae', libs: ['Companies', 'EnterpriseFlat', 'IntuneFlat', 'OMSFlat', 'System CenterFlat', 'AI and ML Service', 'Analytics Service', 'Compute Service', 'Compute Service VM', 'Container Service', 'Databases Service', 'DevOps Service', 'General Service', 'Identity Service', 'Integration Service', 'Internet of Things Service', 'Intune Service', 'Management and Governance Service', 'Management and Governance Service Media', 'Migrate Service', 'Mixed Reality Service', 'Mobile Service', 'Networking Service', 'Other Category Service', 'Security Service', 'Storage Service', 'Web Service'] },
  177 + { id: 'active_directory' },
  178 + { id: 'bpmn2', prefix: 'bpmn2', libs: ['General', 'Tasks', 'Choreographies', 'Events', 'Gateways'] },
  179 + { id: 'clipart', prefix: null, libs: ['computer', 'finance', 'clipart', 'networking', 'people', 'telco'] },
  180 + { id: 'ibm', prefix: 'ibm', libs: Sidebar.prototype.ibm },
  181 + { id: 'allied_telesis', prefix: 'allied_telesis', libs: Sidebar.prototype.allied_telesis },
  182 + { id: 'cumulus', libs: ['cumulus'] },
  183 + { id: 'eip', prefix: 'eip', libs: Sidebar.prototype.eip },
  184 + { id: 'mockups', prefix: 'mockup', libs: ['Buttons', 'Containers', 'Forms', 'Graphics', 'Markup', 'Misc', 'Navigation', 'Text'] },
  185 + {
  186 + id: 'pid2', prefix: 'pid2', libs: ['Agitators', 'Apparatus Elements', 'Centrifuges', 'Compressors', 'Compressors ISO', 'Crushers Grinding',
  187 + 'Driers', 'Engines', 'Feeders', 'Filters', 'Fittings', 'Flow Sensors', 'Heat Exchangers', 'Instruments', 'Misc',
  188 + 'Mixers', 'Piping', 'Pumps', 'Pumps DIN', 'Pumps ISO', 'Separators', 'Shaping Machines', 'Valves', 'Vessels']
  189 + },
  190 + { id: 'signs', prefix: 'signs', libs: Sidebar.prototype.signs },
  191 + { id: 'gcp', prefix: 'gcp', libs: Sidebar.prototype.gcp },
  192 + { id: 'gcp2', prefix: 'gcp2', libs: Sidebar.prototype.gcp2 },
  193 + { id: 'gcpicons', prefix: 'gcpicons', libs: Sidebar.prototype.gcpicons },
  194 + { id: 'rack', prefix: 'rack', libs: Sidebar.prototype.rack },
  195 + { id: 'electrical', prefix: 'electrical', libs: Sidebar.prototype.electrical },
  196 + { id: 'aws2', prefix: 'aws2', libs: Sidebar.prototype.aws2 },
  197 + { id: 'aws3', prefix: 'aws3', libs: Sidebar.prototype.aws3 },
  198 + { id: 'aws4b', prefix: 'aws4b', libs: Sidebar.prototype.aws4b },
  199 + { id: 'aws4', prefix: 'aws4', libs: Sidebar.prototype.aws4 },
  200 + { id: 'pid', prefix: 'pid', libs: Sidebar.prototype.pids },
  201 + { id: 'cisco', prefix: 'cisco', libs: Sidebar.prototype.cisco },
  202 + { id: 'cisco_safe', prefix: 'cisco_safe', libs: Sidebar.prototype.cisco_safe },
  203 + { id: 'office', prefix: 'office', libs: Sidebar.prototype.office },
  204 + { id: 'veeam', prefix: 'veeam', libs: Sidebar.prototype.veeam },
  205 + { id: 'veeam2', prefix: 'veeam2', libs: Sidebar.prototype.veeam2 },
  206 + { id: 'cabinets', libs: ['cabinets'] },
  207 + { id: 'floorplan', libs: ['floorplan'] },
  208 + { id: 'bootstrap', libs: ['bootstrap'] },
  209 + { id: 'atlassian', libs: ['atlassian'] },
  210 + { id: 'fluid_power', libs: ['fluid_power'] },
  211 + { id: 'gmdl', prefix: 'gmdl', libs: Sidebar.prototype.gmdl },
  212 + { id: 'archimate3', prefix: 'archimate3', libs: Sidebar.prototype.archimate3 },
  213 + { id: 'archimate', libs: ['archimate'] },
  214 + { id: 'webicons', libs: ['webicons', 'weblogos'] },
  215 + { id: 'sysml', prefix: 'sysml', libs: Sidebar.prototype.sysml }];
212 216
213 217 /**
214 218 * Removes disabled libraries from search results.
215 219 */
216 220 var sidebarAddEntry = Sidebar.prototype.addEntry;
217 221
218   - Sidebar.prototype.addEntry = function(tags, fn)
219   - {
  222 + Sidebar.prototype.addEntry = function (tags, fn) {
220 223 if (this.currentSearchEntryLibrary != null && this.enabledLibraries != null &&
221   - mxUtils.indexOf(this.enabledLibraries, this.currentSearchEntryLibrary.id) < 0)
222   - {
  224 + mxUtils.indexOf(this.enabledLibraries, this.currentSearchEntryLibrary.id) < 0) {
223 225 return fn;
224 226 }
225   - else
226   - {
  227 + else {
227 228 return sidebarAddEntry.apply(this, arguments);
228 229 }
229 230 };
... ... @@ -232,13 +233,11 @@
232 233 * Refreshes scratchpad.
233 234 */
234 235 var sidebarRefresh = Sidebar.prototype.refresh;
235   - Sidebar.prototype.refresh = function()
236   - {
  236 + Sidebar.prototype.refresh = function () {
237 237 var ui = this.editorUi;
238 238 sidebarRefresh.apply(this, arguments);
239 239
240   - if (ui.scratchpad != null)
241   - {
  240 + if (ui.scratchpad != null) {
242 241 ui.loadLibrary(new StorageLibrary(ui,
243 242 ui.scratchpad.getData(),
244 243 '.scratchpad'));
... ... @@ -250,36 +249,29 @@
250 249 */
251 250 var siderbarInsertSearchHint = Sidebar.prototype.insertSearchHint;
252 251
253   - Sidebar.prototype.insertSearchHint = function(div, searchTerm, count, page, results, len, more, terms)
254   - {
255   - if (terms != null && page == 1)
256   - {
  252 + Sidebar.prototype.insertSearchHint = function (div, searchTerm, count, page, results, len, more, terms) {
  253 + if (terms != null && page == 1) {
257 254 var hintText = null;
258 255
259 256 // Adds hint for text inserts
260   - if (mxUtils.indexOf(terms, 'text') >= 0)
261   - {
  257 + if (mxUtils.indexOf(terms, 'text') >= 0) {
262 258 hintText = 'Double click anywhere in the diagram to insert text.';
263 259 }
264   - else
265   - {
  260 + else {
266 261 // Checks if any of the following keywords are in the search terms
267 262 var words = ['line', 'lines', 'arrow', 'arrows', 'connect', 'connection', 'connections',
268   - 'connector', 'connectors', 'curve', 'curves', 'link', 'links', 'directed',
269   - 'directional', 'bidirectional'];
  263 + 'connector', 'connectors', 'curve', 'curves', 'link', 'links', 'directed',
  264 + 'directional', 'bidirectional'];
270 265
271   - for (var i = 0; i < words.length; i++)
272   - {
273   - if (mxUtils.indexOf(terms, words[i]) >= 0)
274   - {
  266 + for (var i = 0; i < words.length; i++) {
  267 + if (mxUtils.indexOf(terms, words[i]) >= 0) {
275 268 hintText = 'Need help with connections?';
276 269 break;
277 270 }
278 271 }
279 272 }
280 273
281   - if (hintText != null && !this.hideSearchHint)
282   - {
  274 + if (hintText != null && !this.hideSearchHint) {
283 275 var link = document.createElement('a');
284 276 link.setAttribute('href', 'https://youtu.be/Z0D96ZikMkc');
285 277 link.setAttribute('target', '_blank');
... ... @@ -299,8 +291,7 @@
299 291 img.style.top = '1px';
300 292 img.style.right = '0px';
301 293
302   - mxEvent.addListener(img, 'click', mxUtils.bind(this, function(evt)
303   - {
  294 + mxEvent.addListener(img, 'click', mxUtils.bind(this, function (evt) {
304 295 link.parentNode.removeChild(link);
305 296 this.hideSearchHint = true;
306 297 mxEvent.consume(evt);
... ... @@ -320,26 +311,22 @@
320 311 /**
321 312 * Toggle palette.
322 313 */
323   - Sidebar.prototype.togglePalettes = function(prefix, ids)
324   - {
  314 + Sidebar.prototype.togglePalettes = function (prefix, ids) {
325 315 this.showPalettes(prefix, ids);
326 316 };
327 317
328 318 /**
329 319 * Toggle palette.
330 320 */
331   - Sidebar.prototype.togglePalette = function(id)
332   - {
  321 + Sidebar.prototype.togglePalette = function (id) {
333 322 this.showPalette(id);
334 323 };
335 324
336 325 /**
337 326 * Shows or hides palettes.
338 327 */
339   - Sidebar.prototype.showPalettes = function(prefix, ids, visible)
340   - {
341   - for (var i = 0; i < ids.length; i++)
342   - {
  328 + Sidebar.prototype.showPalettes = function (prefix, ids, visible) {
  329 + for (var i = 0; i < ids.length; i++) {
343 330 this.showPalette(prefix + ids[i], visible);
344 331 }
345 332 };
... ... @@ -347,16 +334,13 @@
347 334 /**
348 335 * Shows or hides a palette.
349 336 */
350   - Sidebar.prototype.showPalette = function(id, visible)
351   - {
  337 + Sidebar.prototype.showPalette = function (id, visible) {
352 338 var elts = this.palettes[id];
353 339
354   - if (elts != null)
355   - {
  340 + if (elts != null) {
356 341 var vis = (visible != null) ? ((visible) ? 'block' : 'none') : (elts[0].style.display == 'none') ? 'block' : 'none';
357 342
358   - for (var i = 0; i < elts.length; i++)
359   - {
  343 + for (var i = 0; i < elts.length; i++) {
360 344 elts[i].style.display = vis;
361 345 }
362 346 }
... ... @@ -367,29 +351,22 @@
367 351 /**
368 352 *
369 353 */
370   - Sidebar.prototype.getConfigurationById = function(id)
371   - {
372   - for (var i = 0; i < this.configuration.length; i++)
373   - {
374   - if (this.configuration[i].id == id)
375   - {
  354 + Sidebar.prototype.getConfigurationById = function (id) {
  355 + for (var i = 0; i < this.configuration.length; i++) {
  356 + if (this.configuration[i].id == id) {
376 357 return this.configuration[i];
377 358 }
378 359 }
379 360
380   - if (this.customEntries != null)
381   - {
382   - for (var i = 0; i < this.customEntries.length; i++)
383   - {
  361 + if (this.customEntries != null) {
  362 + for (var i = 0; i < this.customEntries.length; i++) {
384 363 var section = this.customEntries[i];
385 364
386   - for (var j = 0; j < section.entries.length; j++)
387   - {
  365 + for (var j = 0; j < section.entries.length; j++) {
388 366 var entry = section.entries[j];
389 367
390   - if (entry.id == id)
391   - {
392   - return {id: entry.id, libs: entry.libs};
  368 + if (entry.id == id) {
  369 + return { id: entry.id, libs: entry.libs };
393 370 }
394 371 }
395 372 }
... ... @@ -401,45 +378,34 @@
401 378 /**
402 379 *
403 380 */
404   - Sidebar.prototype.isEntryVisible = function(key)
405   - {
406   - if (key == '.scratchpad')
407   - {
  381 + Sidebar.prototype.isEntryVisible = function (key) {
  382 + if (key == '.scratchpad') {
408 383 return this.editorUi.scratchpad != null;
409 384 }
410   - else
411   - {
  385 + else {
412 386 var config = this.getConfigurationById(key);
413 387
414   - if (config != null)
415   - {
  388 + if (config != null) {
416 389 var id = (config.libs != null) ? ((config.prefix || '') + config.libs[0]) : key;
417 390 var elts = this.palettes[id];
418 391
419   - if (elts != null)
420   - {
  392 + if (elts != null) {
421 393 return elts[0].style.display != 'none';
422 394 }
423 395 }
424 396
425   - if (this.customEntries != null)
426   - {
427   - for (var i = 0; i < this.customEntries.length; i++)
428   - {
  397 + if (this.customEntries != null) {
  398 + for (var i = 0; i < this.customEntries.length; i++) {
429 399 var section = this.customEntries[i];
430 400
431   - for (var j = 0; j < section.entries.length; j++)
432   - {
  401 + for (var j = 0; j < section.entries.length; j++) {
433 402 var entry = section.entries[j];
434 403
435   - if (entry.id == key)
436   - {
437   - if (entry.libs != null && entry.libs.length > 0)
438   - {
  404 + if (entry.id == key) {
  405 + if (entry.libs != null && entry.libs.length > 0) {
439 406 var elts = this.palettes[entry.id + '.0'];
440 407
441   - if (elts != null)
442   - {
  408 + if (elts != null) {
443 409 return elts[0].style.display != 'none';
444 410 }
445 411 }
... ... @@ -457,40 +423,32 @@
457 423 /**
458 424 *
459 425 */
460   - Sidebar.prototype.showEntries = function(entries, remember, force)
461   - {
  426 + Sidebar.prototype.showEntries = function (entries, remember, force) {
462 427 var all = [];
463 428
464   - if (remember)
465   - {
  429 + if (remember) {
466 430 mxSettings.setLibraries(entries);
467 431 mxSettings.save();
468 432 }
469 433
470   - if (entries != null && (force || entries.length > 0))
471   - {
  434 + if (entries != null && (force || entries.length > 0)) {
472 435 all.push(entries);
473 436 }
474   - else
475   - {
  437 + else {
476 438 var done = false;
477 439
478   - if (urlParams['libs'] != null && urlParams['libs'].length > 0)
479   - {
  440 + if (urlParams['libs'] != null && urlParams['libs'].length > 0) {
480 441 all.push(decodeURIComponent(urlParams['libs']));
481 442 done = this.editorUi.getServiceName() == 'draw.io';
482 443 }
483 444
484 445 // Libs parameter overrides configuration for online app so that
485 446 // links can be created to show just the specifies libraries
486   - if (!done)
487   - {
488   - if (mxSettings != null && mxSettings.settings != null)
489   - {
  447 + if (!done) {
  448 + if (mxSettings != null && mxSettings.settings != null) {
490 449 all.push(mxSettings.getLibraries());
491 450 }
492   - else
493   - {
  451 + else {
494 452 all.push(this.defaultEntries);
495 453 }
496 454 }
... ... @@ -502,16 +460,13 @@
502 460 // Resolves aliases and creates lookup
503 461 var visible = {};
504 462
505   - for (var i = 0; i < temp.length; i++)
506   - {
  463 + for (var i = 0; i < temp.length; i++) {
507 464 visible[this.libAliases[temp[i]] || temp[i]] = true;
508 465 }
509 466
510   - for (var i = 0; i < this.configuration.length; i++)
511   - {
  467 + for (var i = 0; i < this.configuration.length; i++) {
512 468 // Search has separate switch in Extras menu
513   - if (this.configuration[i].id != 'search')
514   - {
  469 + if (this.configuration[i].id != 'search') {
515 470 this.showPalettes(this.configuration[i].prefix || '',
516 471 this.configuration[i].libs || [this.configuration[i].id],
517 472 visible[this.configuration[i].id] == true);
... ... @@ -519,22 +474,17 @@
519 474 }
520 475 }
521 476
522   - if (this.customEntries != null)
523   - {
524   - for (var i = 0; i < this.customEntries.length; i++)
525   - {
  477 + if (this.customEntries != null) {
  478 + for (var i = 0; i < this.customEntries.length; i++) {
526 479 var section = this.customEntries[i];
527 480
528   - for (var j = 0; j < section.entries.length; j++)
529   - {
  481 + for (var j = 0; j < section.entries.length; j++) {
530 482 var entry = section.entries[j];
531 483
532   - if (entry.libs != null && entry.libs.length > 0)
533   - {
  484 + if (entry.libs != null && entry.libs.length > 0) {
534 485 var libs = [];
535 486
536   - for (var k = 0; k < entry.libs.length; k++)
537   - {
  487 + for (var k = 0; k < entry.libs.length; k++) {
538 488 libs.push(entry.id + '.' + k);
539 489 }
540 490
... ... @@ -548,8 +498,7 @@
548 498 /**
549 499 * Overrides the sidebar init.
550 500 */
551   - Sidebar.prototype.init = function()
552   - {
  501 + Sidebar.prototype.init = function () {
553 502 // Defines all entries for the sidebar. This is used in the MoreShapes dialog. Create screenshots using the savesidebar URL parameter and
554 503 // http://www.alderg.com/merge.html for creating a vertical stack of PNG images if multiple sidebars are part of an entry.
555 504 //更多图形里面的加载,可以加载自己定义的图形库,同时要提供对应的图片
... ... @@ -560,83 +509,84 @@
560 509 // {title: mxResources.get('flowchart'), id: 'flowchart', image: IMAGE_PATH + '/sidebar-flowchart.png'}];
561 510 //更多图形,显示出来的的标题跟id,同时包括图片
562 511 var thingskitEntries = [
563   - {title:"风机",id:'fan',image:IMAGE_PATH + '/thingskit/风机.png'},
564   - {title:"发动机",id:'engine',image:IMAGE_PATH + '/thingskit/发动机.png'},
565   - {title:"阀门",id:'valve',image:IMAGE_PATH + '/thingskit/阀门.png'},
566   - {title:"基础组件",id:'component',image:IMAGE_PATH + '/thingskit/基础元件.png'},
567   - {title: "污水处理",id:'sewage',image: IMAGE_PATH + '/thingskit/污水处理.png'},
568   - {title: "管道",id:'conduit',image: IMAGE_PATH + '/thingskit/管道.png'},
569   - {title: "灯",id:'light',image: IMAGE_PATH + '/thingskit/灯.png'},
570   - {title: "按钮",id:'button',image: IMAGE_PATH + '/thingskit/按钮.png'},
571   - {title: "仪表",id:'instrument',image: IMAGE_PATH + '/thingskit/仪表.png'},
  512 + { title: "风机", id: 'fan', image: IMAGE_PATH + '/thingskit/风机.png' },
  513 + { title: "发动机", id: 'engine', image: IMAGE_PATH + '/thingskit/发动机.png' },
  514 + { title: "阀门", id: 'valve', image: IMAGE_PATH + '/thingskit/阀门.png' },
  515 + { title: "基础组件", id: 'component', image: IMAGE_PATH + '/thingskit/基础元件.png' },
  516 + { title: "污水处理", id: 'sewage', image: IMAGE_PATH + '/thingskit/污水处理.png' },
  517 + { title: "管道", id: 'conduit', image: IMAGE_PATH + '/thingskit/管道.png' },
  518 + { title: "灯", id: 'light', image: IMAGE_PATH + '/thingskit/灯.png' },
  519 + { title: "按钮", id: 'button', image: IMAGE_PATH + '/thingskit/按钮.png' },
  520 + { title: "仪表", id: 'instrument', image: IMAGE_PATH + '/thingskit/仪表.png' },
572 521 ];
573   - if (urlParams['sketch'] == '1')
574   - {
575   - stdEntries = [{title: mxResources.get('searchShapes'), id: 'search'},
576   - {title: mxResources.get('scratchpad'), id: '.scratchpad'}].
  522 + if (urlParams['sketch'] == '1') {
  523 + stdEntries = [{ title: mxResources.get('searchShapes'), id: 'search' },
  524 + { title: mxResources.get('scratchpad'), id: '.scratchpad' }].
577 525 concat(stdEntries);
578 526 }
579 527
580 528 this.entries = [
581   - // {title: mxResources.get('standard'), entries: stdEntries},
582   - {title: '通用', entries: thingskitEntries},
583   - // 注释掉软件
584   - // {title: mxResources.get('software'),
585   - // entries: [{title: 'Active Directory', id: 'active_directory', image: IMAGE_PATH + '/sidebar-active_directory.png'},
586   - // {title: mxResources.get('android'), id: 'android', image: IMAGE_PATH + '/sidebar-android.png'},
587   - // {title: 'Atlassian', id: 'atlassian', image: IMAGE_PATH + '/sidebar-atlassian.png'},
588   - // {title: mxResources.get('bootstrap'), id: 'bootstrap', image: IMAGE_PATH + '/sidebar-bootstrap.png'},
589   - // {title: 'C4', id: 'c4', image: IMAGE_PATH + '/sidebar-c4.png'},
590   - // {title: 'Data Flow Diagram', id: 'dfd', image: IMAGE_PATH + '/sidebar-dfd.png'},
591   - // {title: mxResources.get('entityRelation'), id: 'er', image: IMAGE_PATH + '/sidebar-er.png'},
592   - // {title: mxResources.get('ios'), id: 'ios', image: IMAGE_PATH + '/sidebar-ios.png'},
593   - // {title: mxResources.get('mockups'), id: 'mockups', image: IMAGE_PATH + '/sidebar-mockups.png'},
594   - // {title: 'Sitemap', id: 'sitemap', image: IMAGE_PATH + '/sidebar-sitemap.png'},
595   - // {title: mxResources.get('uml') + ' 2.5', id: 'uml25', image: IMAGE_PATH + '/sidebar-uml25.png'},
596   - // {title: mxResources.get('uml'), id: 'uml', image: IMAGE_PATH + '/sidebar-uml.png'}]},
597   - // 注释掉网络
598   - // {title: mxResources.get('networking'),
599   - // entries: [{title: 'Allied Telesis', id: 'allied_telesis', image: IMAGE_PATH + '/sidebar-allied_telesis.png'},
600   - // {title: 'AWS17', id: 'aws3', image: IMAGE_PATH + '/sidebar-aws3.png'},
601   - // {title: 'AWS18', id: 'aws4b', image: IMAGE_PATH + '/sidebar-aws4b.png'},
602   - // {title: 'AWS19', id: 'aws4', image: IMAGE_PATH + '/sidebar-aws4.png'},
603   - // // TODO: Add isometric containers
604   - // {title: mxResources.get('aws3d'), id: 'aws3d', image: IMAGE_PATH + '/sidebar-aws3d.png'},
605   - // {title: mxResources.get('azure'), id: 'azure2', image: IMAGE_PATH + '/sidebar-azure.png'},
606   - // {title: 'Cloud & Enterprise', id: 'mscae', image: IMAGE_PATH + '/sidebar-mscae.png'},
607   - // {title: mxResources.get('cisco'), id: 'cisco', image: IMAGE_PATH + '/sidebar-cisco.png'},
608   - // {title: 'Cisco19', id: 'cisco19', image: IMAGE_PATH + '/sidebar-cisco19.png'},
609   - // {title: 'Cisco Safe', id: 'cisco_safe', image: IMAGE_PATH + '/sidebar-cisco_safe.png'},
610   - // {title: 'Cumulus', id: 'cumulus', image: IMAGE_PATH + '/sidebar-cumulus.png'},
611   - // {title: 'Citrix', id: 'citrix', image: IMAGE_PATH + '/sidebar-citrix.png'},
612   - // {title: 'Google Cloud Platform', id: 'gcp2', image: IMAGE_PATH + '/sidebar-gcp2.png'},
613   - // {title: 'GCP Icons', id: 'gcpicons', image: IMAGE_PATH + '/sidebar-gcpicons.png'},
614   - // {title: 'IBM', id: 'ibm', image: IMAGE_PATH + '/sidebar-ibm.png'},
615   - // {title: 'Kubernetes', id: 'kubernetes', image: IMAGE_PATH + '/sidebar-kubernetes.png'},
616   - // {title: 'Network', id: 'network', image: IMAGE_PATH + '/sidebar-network.png'},
617   - // {title: 'Office', id: 'office', image: IMAGE_PATH + '/sidebar-office.png'},
618   - // {title: mxResources.get('rack'), id: 'rack', image: IMAGE_PATH + '/sidebar-rack.png'},
619   - // {title: 'Veeam', id: 'veeam2', image: IMAGE_PATH + '/sidebar-veeam.png'},
620   - // {title: 'VMware', id: 'vvd', image: IMAGE_PATH + '/sidebar-vvd.png'}]},
621   - // 注释掉商务
622   - // {title: mxResources.get('business'),
623   - // entries: [{title: 'ArchiMate 3.0', id: 'archimate3', image: IMAGE_PATH + '/sidebar-archimate3.png'},
624   - // {title: mxResources.get('archiMate21'), id: 'archimate', image: IMAGE_PATH + '/sidebar-archimate.png'},
625   - // {title: mxResources.get('bpmn') + ' 2.0', id: 'bpmn2', image: IMAGE_PATH + '/sidebar-bpmn.png'},
626   - // {title: mxResources.get('sysml'), id: 'sysml', image: IMAGE_PATH + '/sidebar-sysml.png'},
627   - // {title: 'Value Stream Mapping', id: 'lean_mapping', image: IMAGE_PATH + '/sidebar-leanmapping.png'}]},
628   - {title: mxResources.get('other'),
629   - entries: [{title: mxResources.get('cabinets'), id: 'cabinets', image: IMAGE_PATH + '/sidebar-cabinets.png'},
630   - {title: 'Infographic', id: 'infographic', image: IMAGE_PATH + '/sidebar-infographic.png'},
631   - {title: mxResources.get('eip'), id: 'eip', image: IMAGE_PATH + '/sidebar-eip.png'},
632   - {title: mxResources.get('electrical'), id: 'electrical', image: IMAGE_PATH + '/sidebar-electrical.png'},
633   - {title: mxResources.get('floorplans'), id: 'floorplan', image: IMAGE_PATH + '/sidebar-floorplans.png'},
634   - {title: 'Fluid Power (ISO 1219)', id: 'fluid_power', image: IMAGE_PATH + '/sidebar-fluid_power.png'},
635   - {title: mxResources.get('gmdl'), id: 'gmdl', image: IMAGE_PATH + '/sidebar-gmdl.png'},
636   - {title: mxResources.get('procEng'), id: 'pid', image: IMAGE_PATH + '/sidebar-pid.png'},
637   - {title: 'Threat Modeling', id: 'threatModeling', image: IMAGE_PATH + '/sidebar-threatmodeling.png'},
638   - {title: 'Web Icons', id: 'webicons', image: IMAGE_PATH + '/sidebar-webIcons.png'},
639   - {title: mxResources.get('signs'), id: 'signs', image: IMAGE_PATH + '/sidebar-signs.png'}]}];
  529 + // {title: mxResources.get('standard'), entries: stdEntries},
  530 + { title: '通用', entries: thingskitEntries },
  531 + // 注释掉软件
  532 + // {title: mxResources.get('software'),
  533 + // entries: [{title: 'Active Directory', id: 'active_directory', image: IMAGE_PATH + '/sidebar-active_directory.png'},
  534 + // {title: mxResources.get('android'), id: 'android', image: IMAGE_PATH + '/sidebar-android.png'},
  535 + // {title: 'Atlassian', id: 'atlassian', image: IMAGE_PATH + '/sidebar-atlassian.png'},
  536 + // {title: mxResources.get('bootstrap'), id: 'bootstrap', image: IMAGE_PATH + '/sidebar-bootstrap.png'},
  537 + // {title: 'C4', id: 'c4', image: IMAGE_PATH + '/sidebar-c4.png'},
  538 + // {title: 'Data Flow Diagram', id: 'dfd', image: IMAGE_PATH + '/sidebar-dfd.png'},
  539 + // {title: mxResources.get('entityRelation'), id: 'er', image: IMAGE_PATH + '/sidebar-er.png'},
  540 + // {title: mxResources.get('ios'), id: 'ios', image: IMAGE_PATH + '/sidebar-ios.png'},
  541 + // {title: mxResources.get('mockups'), id: 'mockups', image: IMAGE_PATH + '/sidebar-mockups.png'},
  542 + // {title: 'Sitemap', id: 'sitemap', image: IMAGE_PATH + '/sidebar-sitemap.png'},
  543 + // {title: mxResources.get('uml') + ' 2.5', id: 'uml25', image: IMAGE_PATH + '/sidebar-uml25.png'},
  544 + // {title: mxResources.get('uml'), id: 'uml', image: IMAGE_PATH + '/sidebar-uml.png'}]},
  545 + // 注释掉网络
  546 + // {title: mxResources.get('networking'),
  547 + // entries: [{title: 'Allied Telesis', id: 'allied_telesis', image: IMAGE_PATH + '/sidebar-allied_telesis.png'},
  548 + // {title: 'AWS17', id: 'aws3', image: IMAGE_PATH + '/sidebar-aws3.png'},
  549 + // {title: 'AWS18', id: 'aws4b', image: IMAGE_PATH + '/sidebar-aws4b.png'},
  550 + // {title: 'AWS19', id: 'aws4', image: IMAGE_PATH + '/sidebar-aws4.png'},
  551 + // // TODO: Add isometric containers
  552 + // {title: mxResources.get('aws3d'), id: 'aws3d', image: IMAGE_PATH + '/sidebar-aws3d.png'},
  553 + // {title: mxResources.get('azure'), id: 'azure2', image: IMAGE_PATH + '/sidebar-azure.png'},
  554 + // {title: 'Cloud & Enterprise', id: 'mscae', image: IMAGE_PATH + '/sidebar-mscae.png'},
  555 + // {title: mxResources.get('cisco'), id: 'cisco', image: IMAGE_PATH + '/sidebar-cisco.png'},
  556 + // {title: 'Cisco19', id: 'cisco19', image: IMAGE_PATH + '/sidebar-cisco19.png'},
  557 + // {title: 'Cisco Safe', id: 'cisco_safe', image: IMAGE_PATH + '/sidebar-cisco_safe.png'},
  558 + // {title: 'Cumulus', id: 'cumulus', image: IMAGE_PATH + '/sidebar-cumulus.png'},
  559 + // {title: 'Citrix', id: 'citrix', image: IMAGE_PATH + '/sidebar-citrix.png'},
  560 + // {title: 'Google Cloud Platform', id: 'gcp2', image: IMAGE_PATH + '/sidebar-gcp2.png'},
  561 + // {title: 'GCP Icons', id: 'gcpicons', image: IMAGE_PATH + '/sidebar-gcpicons.png'},
  562 + // {title: 'IBM', id: 'ibm', image: IMAGE_PATH + '/sidebar-ibm.png'},
  563 + // {title: 'Kubernetes', id: 'kubernetes', image: IMAGE_PATH + '/sidebar-kubernetes.png'},
  564 + // {title: 'Network', id: 'network', image: IMAGE_PATH + '/sidebar-network.png'},
  565 + // {title: 'Office', id: 'office', image: IMAGE_PATH + '/sidebar-office.png'},
  566 + // {title: mxResources.get('rack'), id: 'rack', image: IMAGE_PATH + '/sidebar-rack.png'},
  567 + // {title: 'Veeam', id: 'veeam2', image: IMAGE_PATH + '/sidebar-veeam.png'},
  568 + // {title: 'VMware', id: 'vvd', image: IMAGE_PATH + '/sidebar-vvd.png'}]},
  569 + // 注释掉商务
  570 + // {title: mxResources.get('business'),
  571 + // entries: [{title: 'ArchiMate 3.0', id: 'archimate3', image: IMAGE_PATH + '/sidebar-archimate3.png'},
  572 + // {title: mxResources.get('archiMate21'), id: 'archimate', image: IMAGE_PATH + '/sidebar-archimate.png'},
  573 + // {title: mxResources.get('bpmn') + ' 2.0', id: 'bpmn2', image: IMAGE_PATH + '/sidebar-bpmn.png'},
  574 + // {title: mxResources.get('sysml'), id: 'sysml', image: IMAGE_PATH + '/sidebar-sysml.png'},
  575 + // {title: 'Value Stream Mapping', id: 'lean_mapping', image: IMAGE_PATH + '/sidebar-leanmapping.png'}]},
  576 + {
  577 + title: mxResources.get('other'),
  578 + entries: [{ title: mxResources.get('cabinets'), id: 'cabinets', image: IMAGE_PATH + '/sidebar-cabinets.png' },
  579 + { title: 'Infographic', id: 'infographic', image: IMAGE_PATH + '/sidebar-infographic.png' },
  580 + { title: mxResources.get('eip'), id: 'eip', image: IMAGE_PATH + '/sidebar-eip.png' },
  581 + { title: mxResources.get('electrical'), id: 'electrical', image: IMAGE_PATH + '/sidebar-electrical.png' },
  582 + { title: mxResources.get('floorplans'), id: 'floorplan', image: IMAGE_PATH + '/sidebar-floorplans.png' },
  583 + { title: 'Fluid Power (ISO 1219)', id: 'fluid_power', image: IMAGE_PATH + '/sidebar-fluid_power.png' },
  584 + { title: mxResources.get('gmdl'), id: 'gmdl', image: IMAGE_PATH + '/sidebar-gmdl.png' },
  585 + { title: mxResources.get('procEng'), id: 'pid', image: IMAGE_PATH + '/sidebar-pid.png' },
  586 + { title: 'Threat Modeling', id: 'threatModeling', image: IMAGE_PATH + '/sidebar-threatmodeling.png' },
  587 + { title: 'Web Icons', id: 'webicons', image: IMAGE_PATH + '/sidebar-webIcons.png' },
  588 + { title: mxResources.get('signs'), id: 'signs', image: IMAGE_PATH + '/sidebar-signs.png' }]
  589 + }];
640 590
641 591 // Uses search.xml index file instead (faster load times)
642 592 this.addStencilsToIndex = false;
... ... @@ -645,8 +595,7 @@
645 595 this.shapetags = {};
646 596
647 597 // Adds tags from compressed text file for improved searches
648   - if (this.tagIndex != null)
649   - {
  598 + if (this.tagIndex != null) {
650 599 this.addTagIndex(Graph.decompress(this.tagIndex));
651 600 this.tagIndex = null;
652 601 }
... ... @@ -657,15 +606,12 @@
657 606 /**
658 607 * Overridden to add image export via servlet
659 608 */
660   - if (urlParams['savesidebar'] == '1')
661   - {
662   - Sidebar.prototype.addFoldingHandler = function(title, content, funct)
663   - {
  609 + if (urlParams['savesidebar'] == '1') {
  610 + Sidebar.prototype.addFoldingHandler = function (title, content, funct) {
664 611 var initialized = false;
665 612
666 613 // Avoids mixed content warning in IE6-8
667   - if (!mxClient.IS_IE || document.documentMode >= 8)
668   - {
  614 + if (!mxClient.IS_IE || document.documentMode >= 8) {
669 615 title.style.backgroundImage = (content.style.display == 'none') ?
670 616 'url(\'' + this.collapsedImage + '\')' : 'url(\'' + this.expandedImage + '\')';
671 617 }
... ... @@ -677,10 +623,8 @@
677 623 btn.style.marginLeft = '4px';
678 624 mxUtils.write(btn, 'Save');
679 625
680   - mxEvent.addListener(title, 'click', mxUtils.bind(this, function(evt)
681   - {
682   - if (mxEvent.getSource(evt).nodeName == 'BUTTON')
683   - {
  626 + mxEvent.addListener(title, 'click', mxUtils.bind(this, function (evt) {
  627 + if (mxEvent.getSource(evt).nodeName == 'BUTTON') {
684 628 var title2 = title.cloneNode(true);
685 629 title2.style.backgroundImage = '';
686 630 title2.style.textDecoration = 'none';
... ... @@ -701,10 +645,9 @@
701 645
702 646 var parser = new DOMParser();
703 647 var doc = parser.parseFromString('<body style="background:#ffffff;font-family:Helvetica,Arial;">' +
704   - title2.outerHTML + clone.outerHTML + '</body>', 'text/html');
  648 + title2.outerHTML + clone.outerHTML + '</body>', 'text/html');
705 649
706   - this.editorUi.editor.convertImages(doc.documentElement, mxUtils.bind(this, function(body)
707   - {
  650 + this.editorUi.editor.convertImages(doc.documentElement, mxUtils.bind(this, function (body) {
708 651 var html = '<!DOCTYPE html><html><head><link rel="stylesheet" type="text/css" ' +
709 652 'href="https://www.draw.io/styles/grapheditor.css"></head>' +
710 653 mxUtils.getXml(body) + '</html>';
... ... @@ -714,26 +657,21 @@
714 657 var h = clone.clientHeight + 18;
715 658 clone.parentNode.removeChild(clone);
716 659
717   - this.editorUi.confirm('Image data created', mxUtils.bind(this, function()
718   - {
719   - new mxXmlRequest(EXPORT_URL, 'w=456&h=' + h + '&html=' + encodeURIComponent(
720   - Graph.compress(html))).simulate(document, '_blank');
  660 + this.editorUi.confirm('Image data created', mxUtils.bind(this, function () {
  661 + new mxXmlRequest(EXPORT_URL, 'w=456&h=' + h + '&html=' + encodeURIComponent(
  662 + Graph.compress(html))).simulate(document, '_blank');
721 663 }), null, mxResources.get('save'), mxResources.get('cancel'));
722 664 }));
723 665
724 666 return;
725 667 }
726 668
727   - if (content.style.display == 'none')
728   - {
729   - if (!initialized)
730   - {
  669 + if (content.style.display == 'none') {
  670 + if (!initialized) {
731 671 initialized = true;
732 672
733   - if (funct != null)
734   - {
735   - if (btn.parentNode != null)
736   - {
  673 + if (funct != null) {
  674 + if (btn.parentNode != null) {
737 675 btn.parentNode.removeChild(btn);
738 676 }
739 677
... ... @@ -742,34 +680,29 @@
742 680 var prev = title.innerHTML;
743 681 title.innerHTML = mxResources.get('loading') + '...';
744 682
745   - window.setTimeout(function()
746   - {
  683 + window.setTimeout(function () {
747 684 funct(content);
748 685 title.style.cursor = '';
749 686 title.innerHTML = prev;
750 687 title.appendChild(btn);
751 688 }, 0);
752 689 }
753   - else
754   - {
  690 + else {
755 691 title.appendChild(btn);
756 692 }
757 693 }
758   - else
759   - {
  694 + else {
760 695 title.appendChild(btn);
761 696 }
762 697
763 698 title.style.backgroundImage = 'url(\'' + this.expandedImage + '\')';
764 699 content.style.display = 'block';
765 700 }
766   - else
767   - {
  701 + else {
768 702 title.style.backgroundImage = 'url(\'' + this.collapsedImage + '\')';
769 703 content.style.display = 'none';
770 704
771   - if (btn.parentNode != null)
772   - {
  705 + if (btn.parentNode != null) {
773 706 btn.parentNode.removeChild(btn);
774 707 }
775 708 }
... ... @@ -782,14 +715,11 @@
782 715 /**
783 716 * Overridden to use shapetags to improve search results.
784 717 */
785   - Sidebar.prototype.extractShapeStyle = function(style)
786   - {
787   - if (style != null && style.substring(0, 6) == 'shape=')
788   - {
  718 + Sidebar.prototype.extractShapeStyle = function (style) {
  719 + if (style != null && style.substring(0, 6) == 'shape=') {
789 720 var semi = style.indexOf(';');
790 721
791   - if (semi < 0)
792   - {
  722 + if (semi < 0) {
793 723 semi = style.length;
794 724 }
795 725
... ... @@ -804,25 +734,21 @@
804 734 */
805 735 var sidebarGetTagsForStencil = Sidebar.prototype.getTagsForStencil;
806 736
807   - Sidebar.prototype.getTagsForStencil = function(pkg, stc, moreTags)
808   - {
  737 + Sidebar.prototype.getTagsForStencil = function (pkg, stc, moreTags) {
809 738 var tags = sidebarGetTagsForStencil.apply(this, arguments);
810 739
811 740 // Adds tags from tags file
812   - if (this.shapetags != null)
813   - {
  741 + if (this.shapetags != null) {
814 742 pkg = pkg.toLowerCase();
815 743 stc = stc.toLowerCase();
816 744
817   - if (this.shapetags[pkg] != null)
818   - {
  745 + if (this.shapetags[pkg] != null) {
819 746 tags.push(this.shapetags[pkg]);
820 747 }
821 748
822 749 stc = pkg + '.' + stc;
823 750
824   - if (this.shapetags[stc] != null)
825   - {
  751 + if (this.shapetags[stc] != null) {
826 752 tags.push(this.shapetags[stc]);
827 753 }
828 754 }
... ... @@ -833,23 +759,18 @@
833 759 /**
834 760 * Overrides the sidebar init.
835 761 */
836   - Sidebar.prototype.addTagIndex = function(text)
837   - {
  762 + Sidebar.prototype.addTagIndex = function (text) {
838 763 var lines = text.split('\n');
839 764
840   - for (var i = 0; i < lines.length; i++)
841   - {
842   - if (lines[i] != null)
843   - {
  765 + for (var i = 0; i < lines.length; i++) {
  766 + if (lines[i] != null) {
844 767 var tags = lines[i].split('\t');
845 768
846   - if (tags.length > 1)
847   - {
  769 + if (tags.length > 1) {
848 770 var key = tags[0].toLowerCase().replace(' ', '_');
849 771 var value = mxUtils.trim(tags.slice(1, tags.length).join(' ').toLowerCase());
850 772
851   - if (value.length > 0)
852   - {
  773 + if (value.length > 0) {
853 774 this.shapetags[key] = value;
854 775 }
855 776 }
... ... @@ -860,36 +781,27 @@
860 781 /**
861 782 * Adds shape search UI.
862 783 */
863   - Sidebar.prototype.showPopupMenuForEntry = function(elt, libs, evt)
864   - {
865   - if (libs != null && libs.length > 0)
866   - {
  784 + Sidebar.prototype.showPopupMenuForEntry = function (elt, libs, evt) {
  785 + if (libs != null && libs.length > 0) {
867 786 var offset = mxUtils.getOffset(elt);
868 787
869   - this.editorUi.showPopupMenu(mxUtils.bind(this, function(menu, parent)
870   - {
871   - menu.addItem(mxResources.get('openLibrary'), null, mxUtils.bind(this, function()
872   - {
873   - for (var i = 0; i < libs.length; i++)
874   - {
875   - (mxUtils.bind(this, function(lib)
876   - {
  788 + this.editorUi.showPopupMenu(mxUtils.bind(this, function (menu, parent) {
  789 + menu.addItem(mxResources.get('openLibrary'), null, mxUtils.bind(this, function () {
  790 + for (var i = 0; i < libs.length; i++) {
  791 + (mxUtils.bind(this, function (lib) {
877 792 var config = this.getConfigurationById(lib.id);
878 793
879   - if (config != null)
880   - {
  794 + if (config != null) {
881 795 this.showPalettes(config.prefix || '', config.libs || [config.id], true);
882 796 var elts = this.showPalette(libs[i].lib || libs[i].id, true);
883 797
884 798 if (elts != null && elts.length > 1 && elts[1].firstChild != null &&
885 799 (elts[1].firstChild.firstChild == null ||
886   - elts[1].firstChild.style.display == 'none'))
887   - {
  800 + elts[1].firstChild.style.display == 'none')) {
888 801 elts[0].click();
889 802 }
890 803
891   - window.setTimeout(function()
892   - {
  804 + window.setTimeout(function () {
893 805 elts[1].scrollIntoView(true);
894 806 }, 0);
895 807
... ... @@ -905,38 +817,31 @@
905 817 /**
906 818 * Overrides the sidebar init.
907 819 */
908   - Sidebar.prototype.addSearchIndex = function(shapes)
909   - {
910   - if (shapes != null)
911   - {
912   - for (var i = 0; i < shapes.length; i++)
913   - {
914   - if (shapes[i].style != null)
915   - {
  820 + Sidebar.prototype.addSearchIndex = function (shapes) {
  821 + if (shapes != null) {
  822 + for (var i = 0; i < shapes.length; i++) {
  823 + if (shapes[i].style != null) {
916 824 var style = shapes[i].style;
917 825 var shapeStyle = this.extractShapeStyle(style);
918 826
919   - if (shapeStyle != null)
920   - {
  827 + if (shapeStyle != null) {
921 828 var lastDot = shapeStyle.lastIndexOf('.');
922 829
923   - if (lastDot > 0)
924   - {
  830 + if (lastDot > 0) {
925 831 var pkg = shapeStyle.substring(0, lastDot);
926 832 var stc = shapeStyle.substring(lastDot + 1, shapeStyle.length);
927 833 var tags = this.getTagsForStencil(pkg, stc, shapes[i].tags);
928 834
929 835 // TODO: Use shapetags for programmatic stencils
930   - if (tags != null)
931   - {
  836 + if (tags != null) {
932 837 // Converts stencil name to lowercase
933 838 var semi = style.indexOf(';');
934 839 style = 'shape=' + pkg + '.' + stc.toLowerCase() + ';' +
935 840 ((semi < 0) ? '' : style.substring(semi + 1));
936 841 this.setCurrentSearchEntryLibrary(shapes[i].id, shapes[i].lib);
937 842 this.createVertexTemplateEntry(style, parseInt(shapes[i].w),
938   - parseInt(shapes[i].h), '', stc.replace(/_/g, ' '),
939   - null, null, this.filterTags(tags.join(' ')));
  843 + parseInt(shapes[i].h), '', stc.replace(/_/g, ' '),
  844 + null, null, this.filterTags(tags.join(' ')));
940 845 this.setCurrentSearchEntryLibrary();
941 846 }
942 847 }
... ... @@ -949,8 +854,7 @@
949 854 /**
950 855 * Overrides the sidebar init.
951 856 */
952   - Sidebar.prototype.initPalettes = function()
953   - {
  857 + Sidebar.prototype.initPalettes = function () {
954 858 var imgDir = GRAPH_IMAGE_PATH;
955 859 var dir = STENCIL_PATH;
956 860 var signs = this.signs;
... ... @@ -959,37 +863,30 @@
959 863 var cisco = this.cisco;
960 864 var sysml = this.sysml;
961 865
962   - if (urlParams['createindex'] == '1')
963   - {
  866 + if (urlParams['createindex'] == '1') {
964 867 this.createdSearchIndex = [];
965 868 }
966 869
967 870 this.addSearchPalette(true);
968 871
969 872 // Adds custom sections first
970   - if (this.customEntries != null)
971   - {
  873 + if (this.customEntries != null) {
972 874 var preloadCount = 0;
973 875
974   - for (var i = 0; i < this.customEntries.length; i++)
975   - {
  876 + for (var i = 0; i < this.customEntries.length; i++) {
976 877 var section = this.customEntries[i];
977 878
978   - for (var j = 0; j < section.entries.length; j++)
979   - {
  879 + for (var j = 0; j < section.entries.length; j++) {
980 880 var entry = section.entries[j];
981 881
982   - for (var k = 0; k < entry.libs.length; k++)
983   - {
984   - (mxUtils.bind(this, function(lib)
985   - {
  882 + for (var k = 0; k < entry.libs.length; k++) {
  883 + (mxUtils.bind(this, function (lib) {
986 884 var data = null;
987 885 var error = null;
988 886 var content = null;
989 887 var title = null;
990 888
991   - var showError = mxUtils.bind(this, function(err, c)
992   - {
  889 + var showError = mxUtils.bind(this, function (err, c) {
993 890 var div = document.createElement('span');
994 891 div.style.paddingBottom = '6px';
995 892 div.style.paddingTop = '6px';
... ... @@ -999,26 +896,21 @@
999 896 c.appendChild(div);
1000 897 });
1001 898
1002   - var barrier = mxUtils.bind(this, function()
1003   - {
1004   - if (content != null && title != null)
1005   - {
1006   - if (error != null)
1007   - {
  899 + var barrier = mxUtils.bind(this, function () {
  900 + if (content != null && title != null) {
  901 + if (error != null) {
1008 902 content.style.display = 'block';
1009 903 title.innerHTML = '';
1010 904 mxUtils.write(title, this.editorUi.getResource(lib.title));
1011 905 showError(error, content);
1012 906 }
1013   - else if (data != null)
1014   - {
  907 + else if (data != null) {
1015 908 this.editorUi.addLibraryEntries(data, content);
1016 909 content.style.display = 'block';
1017 910 title.innerHTML = '';
1018 911 mxUtils.write(title, this.editorUi.getResource(lib.title));
1019 912 }
1020   - else
1021   - {
  913 + else {
1022 914 content.style.display = 'none';
1023 915 title.innerHTML = '';
1024 916 mxUtils.write(title, mxResources.get('loading') + '...');
... ... @@ -1026,116 +918,95 @@
1026 918 }
1027 919 });
1028 920
1029   - if (lib.data == null && lib.url != null && (!lib.preload && preloadCount >= this.maxPreloadCount))
1030   - {
  921 + if (lib.data == null && lib.url != null && (!lib.preload && preloadCount >= this.maxPreloadCount)) {
1031 922 this.addPalette(entry.id + '.' + k, this.editorUi.getResource(lib.title),
1032   - false, mxUtils.bind(this, function(content, title)
1033   - {
1034   - var dataLoaded = mxUtils.bind(this, function(images)
1035   - {
1036   - this.setCurrentSearchEntryLibrary(entry.id, entry.id + '.' + k);
1037   - this.addEntries(images);
1038   - this.setCurrentSearchEntryLibrary();
1039   - this.editorUi.addLibraryEntries(images, content);
1040   - });
1041   -
1042   - content.style.display = 'none';
1043   - title.innerHTML = '';
1044   - mxUtils.write(title, mxResources.get('loading') + '...');
1045   -
1046   - var url = lib.url;
1047   -
1048   - if (!this.editorUi.editor.isCorsEnabledForUrl(url))
1049   - {
1050   - url = PROXY_URL + '?url=' + encodeURIComponent(url);
1051   - }
  923 + false, mxUtils.bind(this, function (content, title) {
  924 + var dataLoaded = mxUtils.bind(this, function (images) {
  925 + this.setCurrentSearchEntryLibrary(entry.id, entry.id + '.' + k);
  926 + this.addEntries(images);
  927 + this.setCurrentSearchEntryLibrary();
  928 + this.editorUi.addLibraryEntries(images, content);
  929 + });
1052 930
1053   - this.editorUi.editor.loadUrl(url, mxUtils.bind(this, function(data)
1054   - {
1055   - content.style.display = 'block';
  931 + content.style.display = 'none';
1056 932 title.innerHTML = '';
1057   - mxUtils.write(title, this.editorUi.getResource(lib.title));
  933 + mxUtils.write(title, mxResources.get('loading') + '...');
  934 +
  935 + var url = lib.url;
1058 936
1059   - try
1060   - {
1061   - var doc = mxUtils.parseXml(data);
  937 + if (!this.editorUi.editor.isCorsEnabledForUrl(url)) {
  938 + url = PROXY_URL + '?url=' + encodeURIComponent(url);
  939 + }
1062 940
1063   - if (doc.documentElement.nodeName == 'mxlibrary')
1064   - {
1065   - var images = JSON.parse(mxUtils.getTextContent(doc.documentElement));
1066   - dataLoaded(images);
  941 + this.editorUi.editor.loadUrl(url, mxUtils.bind(this, function (data) {
  942 + content.style.display = 'block';
  943 + title.innerHTML = '';
  944 + mxUtils.write(title, this.editorUi.getResource(lib.title));
  945 +
  946 + try {
  947 + var doc = mxUtils.parseXml(data);
  948 +
  949 + if (doc.documentElement.nodeName == 'mxlibrary') {
  950 + var images = JSON.parse(mxUtils.getTextContent(doc.documentElement));
  951 + dataLoaded(images);
  952 + }
  953 + else {
  954 + showError(mxResources.get('notALibraryFile'), content);
  955 + }
1067 956 }
1068   - else
1069   - {
1070   - showError(mxResources.get('notALibraryFile'), content);
  957 + catch (e) {
  958 + showError(mxResources.get('error') + ': ' + e.message, content);
1071 959 }
1072   - }
1073   - catch (e)
1074   - {
1075   - showError(mxResources.get('error') + ': ' + e.message, content);
1076   - }
  960 + }));
1077 961 }));
1078   - }));
1079 962 }
1080   - else
1081   - {
  963 + else {
1082 964 this.addPalette(entry.id + '.' + k, this.editorUi.getResource(lib.title),
1083   - false, mxUtils.bind(this, function(c, t)
1084   - {
1085   - content = c;
1086   - title = t;
1087   - barrier();
1088   - }));
  965 + false, mxUtils.bind(this, function (c, t) {
  966 + content = c;
  967 + title = t;
  968 + barrier();
  969 + }));
1089 970
1090   - if (lib.data != null)
1091   - {
  971 + if (lib.data != null) {
1092 972 this.setCurrentSearchEntryLibrary(entry.id, entry.id + '.' + k);
1093 973 this.addEntries(lib.data);
1094 974 this.setCurrentSearchEntryLibrary();
1095 975 data = lib.data;
1096 976 barrier();
1097 977 }
1098   - else if (lib.url != null)
1099   - {
  978 + else if (lib.url != null) {
1100 979 preloadCount++;
1101 980 var url = lib.url;
1102 981
1103   - if (!this.editorUi.editor.isCorsEnabledForUrl(url))
1104   - {
  982 + if (!this.editorUi.editor.isCorsEnabledForUrl(url)) {
1105 983 url = PROXY_URL + '?url=' + encodeURIComponent(url);
1106 984 }
1107 985
1108   - this.editorUi.editor.loadUrl(url, mxUtils.bind(this, function(temp)
1109   - {
1110   - try
1111   - {
  986 + this.editorUi.editor.loadUrl(url, mxUtils.bind(this, function (temp) {
  987 + try {
1112 988 var doc = mxUtils.parseXml(temp);
1113 989
1114   - if (doc.documentElement.nodeName == 'mxlibrary')
1115   - {
  990 + if (doc.documentElement.nodeName == 'mxlibrary') {
1116 991 data = JSON.parse(mxUtils.getTextContent(doc.documentElement));
1117 992 this.addEntries(data);
1118 993 barrier();
1119 994 }
1120   - else
1121   - {
  995 + else {
1122 996 error = mxResources.get('notALibraryFile');
1123 997 barrier();
1124 998 }
1125 999 }
1126   - catch (e)
1127   - {
  1000 + catch (e) {
1128 1001 error = mxResources.get('error') + ': ' + e.message;
1129 1002 barrier();
1130 1003 }
1131   - }), mxUtils.bind(this, function(e)
1132   - {
  1004 + }), mxUtils.bind(this, function (e) {
1133 1005 error = (e != null && e.message != null) ? e.message : e;
1134 1006 barrier();
1135 1007 }));
1136 1008 }
1137   - else
1138   - {
  1009 + else {
1139 1010 error = mxResources.get('invalidInput');
1140 1011 barrier();
1141 1012 }
... ... @@ -1191,7 +1062,7 @@
1191 1062 'Server_Rack', 'Server_Rack_Empty', 'Server_Rack_Partial',
1192 1063 'Server_Tower', 'Software', 'Stylus', 'Touch', 'USB_Hub',
1193 1064 'Virtual_Application', 'Virtual_Machine', 'Virus',
1194   - 'Workstation' ], [ 'Antivirus', 'Data Filtering', 'Database',
  1065 + 'Workstation'], ['Antivirus', 'Data Filtering', 'Database',
1195 1066 'Database Add', 'Database Minus', 'Database Move Stack',
1196 1067 'Database Remove', 'Fujitsu Tablet', 'Harddrive', 'IBMTablet',
1197 1068 'iMac', 'iPad', 'Laptop', 'MacBook', 'Mainframe', 'Monitor',
... ... @@ -1203,7 +1074,7 @@
1203 1074
1204 1075 this.setCurrentSearchEntryLibrary('clipart', 'finance');
1205 1076 this.addImagePalette('finance', 'Clipart / Finance', imgDir
1206   - + '/lib/clip_art/finance/', '_128x128.png', [ 'Arrow_Down',
  1077 + + '/lib/clip_art/finance/', '_128x128.png', ['Arrow_Down',
1207 1078 'Arrow_Up', 'Coins', 'Credit_Card', 'Dollar', 'Graph',
1208 1079 'Pie_Chart', 'Piggy_Bank', 'Safe', 'Shopping_Cart',
1209 1080 'Stock_Down', 'Stock_Up'], ['Arrow_Down', 'Arrow Up',
... ... @@ -1212,11 +1083,11 @@
1212 1083
1213 1084 this.setCurrentSearchEntryLibrary('clipart', 'clipart');
1214 1085 this.addImagePalette('clipart', 'Clipart / Various', imgDir
1215   - + '/lib/clip_art/general/', '_128x128.png', [ 'Battery_0',
  1086 + + '/lib/clip_art/general/', '_128x128.png', ['Battery_0',
1216 1087 'Battery_100', 'Battery_50', 'Battery_75', 'Battery_allstates',
1217 1088 'Bluetooth', 'Earth_globe', 'Empty_Folder', 'Full_Folder',
1218 1089 'Gear', 'Keys', 'Lock', 'Mouse_Pointer', 'Plug', 'Ships_Wheel',
1219   - 'Star', 'Tire' ], [ 'Battery 0%', 'Battery 100%', 'Battery 50%',
  1090 + 'Star', 'Tire'], ['Battery 0%', 'Battery 100%', 'Battery 50%',
1220 1091 'Battery 75%', 'Battery', 'Bluetooth', 'Globe',
1221 1092 'Empty Folder', 'Full Folder', 'Gear', 'Keys', 'Lock', 'Mousepointer',
1222 1093 'Plug', 'Ships Wheel', 'Star', 'Tire']);
... ... @@ -1224,14 +1095,14 @@
1224 1095 this.setCurrentSearchEntryLibrary('clipart', 'networking');
1225 1096 this.addImagePalette('networking', 'Clipart / Networking', imgDir
1226 1097 + '/lib/clip_art/networking/', '_128x128.png', ['Bridge',
1227   - 'Certificate', 'Certificate_Off', 'Cloud', 'Cloud_Computer',
1228   - 'Cloud_Computer_Private', 'Cloud_Rack', 'Cloud_Rack_Private',
1229   - 'Cloud_Server', 'Cloud_Server_Private', 'Cloud_Storage',
1230   - 'Concentrator', 'Email', 'Firewall_02', 'Firewall',
1231   - 'Firewall-page1', 'Ip_Camera', 'Modem',
1232   - 'power_distribution_unit', 'Print_Server',
1233   - 'Print_Server_Wireless', 'Repeater', 'Router', 'Router_Icon',
1234   - 'Switch', 'UPS', 'Wireless_Router', 'Wireless_Router_N'],
  1098 + 'Certificate', 'Certificate_Off', 'Cloud', 'Cloud_Computer',
  1099 + 'Cloud_Computer_Private', 'Cloud_Rack', 'Cloud_Rack_Private',
  1100 + 'Cloud_Server', 'Cloud_Server_Private', 'Cloud_Storage',
  1101 + 'Concentrator', 'Email', 'Firewall_02', 'Firewall',
  1102 + 'Firewall-page1', 'Ip_Camera', 'Modem',
  1103 + 'power_distribution_unit', 'Print_Server',
  1104 + 'Print_Server_Wireless', 'Repeater', 'Router', 'Router_Icon',
  1105 + 'Switch', 'UPS', 'Wireless_Router', 'Wireless_Router_N'],
1235 1106 ['Bridge', 'Certificate', 'Certificate Off', 'Cloud', 'Cloud Computer',
1236 1107 'Cloud Computer Private', 'Cloud Rack', 'Cloud Rack Private',
1237 1108 'Cloud Server', 'Cloud Server Private', 'Cloud Storage',
... ... @@ -1240,10 +1111,12 @@
1240 1111 'Power Distribution Unit', 'Print Server',
1241 1112 'Print Server Wireless', 'Repeater', 'Router', 'Router Icon',
1242 1113 'Switch', 'UPS', 'Wireless Router', 'Wireless Router N'],
1243   - {'Wireless_Router': 'wireless router switch wap wifi access point wlan',
  1114 + {
  1115 + 'Wireless_Router': 'wireless router switch wap wifi access point wlan',
1244 1116 'Wireless_Router_N': 'wireless router switch wap wifi access point wlan',
1245 1117 'Router': 'router switch',
1246   - 'Router_Icon': 'router switch'});
  1118 + 'Router_Icon': 'router switch'
  1119 + });
1247 1120
1248 1121 this.setCurrentSearchEntryLibrary('clipart', 'people');
1249 1122 this.addImagePalette('people', 'Clipart / People', imgDir
... ... @@ -1274,8 +1147,8 @@
1274 1147 this.setCurrentSearchEntryLibrary('clipart', 'telco');
1275 1148 this.addImagePalette('telco', 'Clipart / Telecommunication', imgDir
1276 1149 + '/lib/clip_art/telecommunication/', '_128x128.png', [
1277   - 'BlackBerry', 'Cellphone', 'HTC_smartphone', 'iPhone',
1278   - 'Palm_Treo', 'Signal_tower_off', 'Signal_tower_on' ],
  1150 + 'BlackBerry', 'Cellphone', 'HTC_smartphone', 'iPhone',
  1151 + 'Palm_Treo', 'Signal_tower_off', 'Signal_tower_on'],
1279 1152 ['BlackBerry', 'Cellphone', 'HTC smartphone', 'iPhone',
1280 1153 'Palm Treo', 'Signaltower off', 'Signaltower on']);
1281 1154 this.setCurrentSearchEntryLibrary();
... ... @@ -1336,8 +1209,7 @@
1336 1209 // LATER: Check if conflicts with restore libs after loading file
1337 1210 this.showEntries();
1338 1211
1339   - if (this.createdSearchIndex != null)
1340   - {
  1212 + if (this.createdSearchIndex != null) {
1341 1213 console.log('searchFileData', Graph.compress(JSON.stringify(this.createdSearchIndex)));
1342 1214 }
1343 1215 };
... ... @@ -1346,31 +1218,27 @@
1346 1218 * Overridden to manually create search index for stencil files which are not pre-loaded
1347 1219 * and no entries are created programmatically.
1348 1220 */
1349   - if (urlParams['createindex'] == '1')
1350   - {
  1221 + if (urlParams['createindex'] == '1') {
1351 1222 var sidebarAddStencilPalette = Sidebar.prototype.addStencilPalette;
1352 1223
1353   - Sidebar.prototype.addStencilPalette = function(id, title, stencilFile, style, ignore, onInit, scale, tags, customFns, groupId)
1354   - {
  1224 + Sidebar.prototype.addStencilPalette = function (id, title, stencilFile, style, ignore, onInit, scale, tags, customFns, groupId) {
1355 1225 sidebarAddStencilPalette.apply(this, arguments);
1356 1226 scale = (scale != null) ? scale : 1;
1357 1227
1358 1228 // Used for creating index
1359   - mxStencilRegistry.loadStencilSet(stencilFile, mxUtils.bind(this, function(packageName, stencilName, displayName, w, h)
1360   - {
1361   - if (this.createdSearchIndex != null && ignore == null || mxUtils.indexOf(ignore, stencilName) < 0)
1362   - {
1363   - var entry = {style: 'shape=' + packageName + stencilName + style,
1364   - w: Math.round(w * scale), h: Math.round(h * scale)};
  1229 + mxStencilRegistry.loadStencilSet(stencilFile, mxUtils.bind(this, function (packageName, stencilName, displayName, w, h) {
  1230 + if (this.createdSearchIndex != null && ignore == null || mxUtils.indexOf(ignore, stencilName) < 0) {
  1231 + var entry = {
  1232 + style: 'shape=' + packageName + stencilName + style,
  1233 + w: Math.round(w * scale), h: Math.round(h * scale)
  1234 + };
1365 1235 var tmpTags = (tags != null) ? tags[stencilName] : null;
1366 1236
1367   - if (tmpTags != null)
1368   - {
  1237 + if (tmpTags != null) {
1369 1238 entry.tags = tmpTags;
1370 1239 }
1371 1240
1372   - if (groupId != null)
1373   - {
  1241 + if (groupId != null) {
1374 1242 entry.id = groupId;
1375 1243 entry.lib = id;
1376 1244 }
... ... @@ -1384,27 +1252,21 @@
1384 1252 /**
1385 1253 * Extracs icons from the search result.
1386 1254 */
1387   - Sidebar.prototype.extractIconsFromResponse = function(res, results)
1388   - {
1389   - for (var i = 0; i < res.icons.length; i++)
1390   - {
  1255 + Sidebar.prototype.extractIconsFromResponse = function (res, results) {
  1256 + for (var i = 0; i < res.icons.length; i++) {
1391 1257 var sizes = res.icons[i].raster_sizes;
1392 1258 var index = sizes.length - 1;
1393 1259
1394   - while (index > 0 && sizes[index].size > 128)
1395   - {
  1260 + while (index > 0 && sizes[index].size > 128) {
1396 1261 index--;
1397 1262 }
1398 1263
1399 1264 var size = sizes[index].size;
1400 1265 var url = sizes[index].formats[0].preview_url;
1401 1266
1402   - if (size != null && url != null)
1403   - {
1404   - (mxUtils.bind(this, function(s, u)
1405   - {
1406   - results.push(mxUtils.bind(this, function()
1407   - {
  1267 + if (size != null && url != null) {
  1268 + (mxUtils.bind(this, function (s, u) {
  1269 + results.push(mxUtils.bind(this, function () {
1408 1270 return this.createVertexTemplate('shape=image;html=1;verticalAlign=top;' +
1409 1271 'verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;imageAspect=0;' +
1410 1272 'aspect=fixed;image=' + u, s, s, '');
... ... @@ -1419,73 +1281,57 @@
1419 1281 */
1420 1282 var sidebarSearchEntries = Sidebar.prototype.searchEntries;
1421 1283
1422   - Sidebar.prototype.searchEntries = function(searchTerms, count, page, success, error)
1423   - {
  1284 + Sidebar.prototype.searchEntries = function (searchTerms, count, page, success, error) {
1424 1285 var succ = success;
1425 1286
1426 1287 // Lazy-load indices
1427   - if (this.searchIndexData != null)
1428   - {
  1288 + if (this.searchIndexData != null) {
1429 1289 this.addSearchIndex(JSON.parse(Graph.decompress(this.searchIndexData)));
1430 1290 this.searchIndexData = null;
1431 1291 }
1432 1292
1433   - if (ICONSEARCH_PATH != null)
1434   - {
1435   - success = mxUtils.bind(this, function(results, len, more, terms)
1436   - {
1437   - if (!this.editorUi.isOffline() && results.length <= count / 4)
1438   - {
  1293 + if (ICONSEARCH_PATH != null) {
  1294 + success = mxUtils.bind(this, function (results, len, more, terms) {
  1295 + if (!this.editorUi.isOffline() && results.length <= count / 4) {
1439 1296 var pg = page - Math.ceil((len - count / 4) / count);
1440 1297
1441 1298 mxUtils.get(ICONSEARCH_PATH + '?q=' + encodeURIComponent(searchTerms) +
1442   - '&p=' + pg + '&c=' + count, mxUtils.bind(this, function(req)
1443   - {
1444   - try
1445   - {
1446   - // Ignore response if nothing or error returned
1447   - if (req.getStatus() >= 200 && req.getStatus() <= 299 &&
1448   - req.getText() != null && req.getText().length > 0)
1449   - {
1450   - try
1451   - {
1452   - var res = JSON.parse(req.getText());
1453   -
1454   - if (res == null || res.icons == null)
1455   - {
1456   - succ(results, len, false, terms);
1457   - this.editorUi.handleError(res);
  1299 + '&p=' + pg + '&c=' + count, mxUtils.bind(this, function (req) {
  1300 + try {
  1301 + // Ignore response if nothing or error returned
  1302 + if (req.getStatus() >= 200 && req.getStatus() <= 299 &&
  1303 + req.getText() != null && req.getText().length > 0) {
  1304 + try {
  1305 + var res = JSON.parse(req.getText());
  1306 +
  1307 + if (res == null || res.icons == null) {
  1308 + succ(results, len, false, terms);
  1309 + this.editorUi.handleError(res);
  1310 + }
  1311 + else {
  1312 + this.extractIconsFromResponse(res, results);
  1313 + succ(results, (page - 1) * count + results.length, res.icons.length == count, terms);
  1314 + }
1458 1315 }
1459   - else
1460   - {
1461   - this.extractIconsFromResponse(res, results);
1462   - succ(results, (page - 1) * count + results.length, res.icons.length == count, terms);
  1316 + catch (e) {
  1317 + succ(results, len, false, terms);
  1318 + this.editorUi.handleError(e);
1463 1319 }
1464 1320 }
1465   - catch (e)
1466   - {
  1321 + else {
1467 1322 succ(results, len, false, terms);
1468   - this.editorUi.handleError(e);
1469 1323 }
1470 1324 }
1471   - else
1472   - {
  1325 + catch (e) {
1473 1326 succ(results, len, false, terms);
  1327 + this.editorUi.handleError(e);
1474 1328 }
1475   - }
1476   - catch (e)
1477   - {
1478   - succ(results, len, false, terms);
1479   - this.editorUi.handleError(e);
1480   - }
1481   - },
1482   - function()
1483   - {
1484   - succ(results, len, false, terms);
1485   - }));
  1329 + },
  1330 + function () {
  1331 + succ(results, len, false, terms);
  1332 + }));
1486 1333 }
1487   - else
1488   - {
  1334 + else {
1489 1335 succ(results, len, more || !this.editorUi.isOffline(), terms);
1490 1336 }
1491 1337 });
... ... @@ -1499,26 +1345,21 @@
1499 1345 */
1500 1346 var sidebarItemClicked = Sidebar.prototype.itemClicked;
1501 1347
1502   - Sidebar.prototype.itemClicked = function(cells, ds, evt)
1503   - {
  1348 + Sidebar.prototype.itemClicked = function (cells, ds, evt) {
1504 1349 var graph = this.editorUi.editor.graph;
1505 1350 var handled = false;
1506 1351
1507   - if (cells != null && graph.getSelectionCount() == 1 && graph.getModel().isVertex(cells[0]))
1508   - {
  1352 + if (cells != null && graph.getSelectionCount() == 1 && graph.getModel().isVertex(cells[0])) {
1509 1353 var target = graph.cloneCell(cells[0]);
1510 1354
1511 1355 // Inserts cell as target of selected edge if not connected
1512 1356 if (graph.getModel().isEdge(graph.getSelectionCell()) && graph.getModel().getTerminal(graph.getSelectionCell(), false) == null &&
1513   - graph.getModel().isVertex(target))
1514   - {
  1357 + graph.getModel().isVertex(target)) {
1515 1358 graph.getModel().beginUpdate();
1516   - try
1517   - {
  1359 + try {
1518 1360 var edgeState = graph.view.getState(graph.getSelectionCell());
1519 1361
1520   - if (edgeState != null)
1521   - {
  1362 + if (edgeState != null) {
1522 1363 var tr = graph.view.translate;
1523 1364 var s = graph.view.scale;
1524 1365 var pt = edgeState.absolutePoints[edgeState.absolutePoints.length - 1];
... ... @@ -1530,17 +1371,14 @@
1530 1371 graph.addCell(target);
1531 1372 graph.getModel().setTerminal(graph.getSelectionCell(), target, false);
1532 1373
1533   - if (evt == null || !mxEvent.isShiftDown(evt))
1534   - {
  1374 + if (evt == null || !mxEvent.isShiftDown(evt)) {
1535 1375 graph.fireEvent(new mxEventObject('cellsInserted', 'cells', [target]));
1536 1376 }
1537 1377 }
1538   - catch (e)
1539   - {
  1378 + catch (e) {
1540 1379 this.editorUi.handleError(e);
1541 1380 }
1542   - finally
1543   - {
  1381 + finally {
1544 1382 graph.getModel().endUpdate();
1545 1383 }
1546 1384
... ... @@ -1550,8 +1388,7 @@
1550 1388 }
1551 1389 }
1552 1390
1553   - if (!handled)
1554   - {
  1391 + if (!handled) {
1555 1392 sidebarItemClicked.apply(this, arguments);
1556 1393 }
1557 1394 };
... ...