Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

672 lines
19 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. Ext.BLANK_IMAGE_URL = 'resources/s.gif';
  2. Docs = {};
  3. ApiPanel = function() {
  4. ApiPanel.superclass.constructor.call(this, {
  5. id:'api-tree',
  6. region:'west',
  7. split:true,
  8. header: false,
  9. width: 280,
  10. minSize: 175,
  11. maxSize: 500,
  12. collapsible: true,
  13. margins:'0 0 5 5',
  14. cmargins:'0 0 0 0',
  15. rootVisible:false,
  16. lines:false,
  17. autoScroll:true,
  18. animCollapse:false,
  19. animate: false,
  20. collapseMode:'mini',
  21. loader: new Ext.tree.TreeLoader({
  22. preloadChildren: true,
  23. clearOnLoad: false
  24. }),
  25. root: new Ext.tree.AsyncTreeNode({
  26. text:'Ext JS',
  27. id:'root',
  28. expanded:true,
  29. children:[Docs.classData]
  30. }),
  31. collapseFirst:false
  32. });
  33. // no longer needed!
  34. //new Ext.tree.TreeSorter(this, {folderSort:true,leafAttr:'isClass'});
  35. this.getSelectionModel().on('beforeselect', function(sm, node){
  36. return node.isLeaf();
  37. });
  38. };
  39. Ext.extend(ApiPanel, Ext.tree.TreePanel, {
  40. initComponent: function(){
  41. this.hiddenPkgs = [];
  42. Ext.apply(this, {
  43. tbar:[ ' ',
  44. new Ext.form.TextField({
  45. width: 200,
  46. emptyText:'Find a Class',
  47. enableKeyEvents: true,
  48. listeners:{
  49. render: function(f){
  50. this.filter = new Ext.tree.TreeFilter(this, {
  51. clearBlank: true,
  52. autoClear: true
  53. });
  54. },
  55. keydown: {
  56. fn: this.filterTree,
  57. buffer: 350,
  58. scope: this
  59. },
  60. scope: this
  61. }
  62. }), ' ', ' ',
  63. {
  64. iconCls: 'icon-expand-all',
  65. tooltip: 'Expand All',
  66. handler: function(){ this.root.expand(true); },
  67. scope: this
  68. }, '-', {
  69. iconCls: 'icon-collapse-all',
  70. tooltip: 'Collapse All',
  71. handler: function(){ this.root.collapse(true); },
  72. scope: this
  73. }]
  74. })
  75. ApiPanel.superclass.initComponent.call(this);
  76. },
  77. filterTree: function(t, e){
  78. var text = t.getValue();
  79. Ext.each(this.hiddenPkgs, function(n){
  80. n.ui.show();
  81. });
  82. if(!text){
  83. this.filter.clear();
  84. return;
  85. }
  86. this.expandAll();
  87. var re = new RegExp('^' + Ext.escapeRe(text), 'i');
  88. this.filter.filterBy(function(n){
  89. return !n.attributes.isClass || re.test(n.text);
  90. });
  91. // hide empty packages that weren't filtered
  92. this.hiddenPkgs = [];
  93. var me = this;
  94. this.root.cascade(function(n){
  95. if(!n.attributes.isClass && n.ui.ctNode.offsetHeight < 3){
  96. n.ui.hide();
  97. me.hiddenPkgs.push(n);
  98. }
  99. });
  100. },
  101. selectClass : function(cls){
  102. if(cls){
  103. var parts = cls.split('.');
  104. var last = parts.length-1;
  105. var res = [];
  106. var pkg = [];
  107. for(var i = 0; i < last; i++){ // things get nasty - static classes can have .
  108. var p = parts[i];
  109. var fc = p.charAt(0);
  110. var staticCls = fc.toUpperCase() == fc;
  111. if(p == 'Ext' || !staticCls){
  112. pkg.push(p);
  113. res[i] = 'pkg-'+pkg.join('.');
  114. }else if(staticCls){
  115. --last;
  116. res.splice(i, 1);
  117. }
  118. }
  119. res[last] = cls;
  120. this.selectPath('/root/apidocs/'+res.join('/'));
  121. }
  122. }
  123. });
  124. DocPanel = Ext.extend(Ext.Panel, {
  125. closable: true,
  126. autoScroll:true,
  127. initComponent : function(){
  128. var ps = this.cclass.split('.');
  129. this.title = ps[ps.length-1];
  130. Ext.apply(this,{
  131. tbar: ['->',{
  132. text: 'Config Options',
  133. handler: this.scrollToMember.createDelegate(this, ['configs']),
  134. iconCls: 'icon-config'
  135. },'-',{
  136. text: 'Properties',
  137. handler: this.scrollToMember.createDelegate(this, ['props']),
  138. iconCls: 'icon-prop'
  139. }, '-',{
  140. text: 'Methods',
  141. handler: this.scrollToMember.createDelegate(this, ['methods']),
  142. iconCls: 'icon-method'
  143. }, '-',{
  144. text: 'Events',
  145. handler: this.scrollToMember.createDelegate(this, ['events']),
  146. iconCls: 'icon-event'
  147. }, '-',{
  148. text: 'Direct Link',
  149. handler: this.directLink,
  150. scope: this,
  151. iconCls: 'icon-fav'
  152. }, '-',{
  153. tooltip:'Hide Inherited Members',
  154. iconCls: 'icon-hide-inherited',
  155. enableToggle: true,
  156. scope: this,
  157. toggleHandler : function(b, pressed){
  158. this.body[pressed ? 'addClass' : 'removeClass']('hide-inherited');
  159. }
  160. }, '-', {
  161. tooltip:'Expand All Members',
  162. iconCls: 'icon-expand-members',
  163. enableToggle: true,
  164. scope: this,
  165. toggleHandler : function(b, pressed){
  166. this.body[pressed ? 'addClass' : 'removeClass']('full-details');
  167. }
  168. }]
  169. });
  170. DocPanel.superclass.initComponent.call(this);
  171. },
  172. directLink : function(){
  173. var link = String.format(
  174. "<a href=\"{0}\" target=\"_blank\">{0}</a>",
  175. document.location.href+'?class='+this.cclass
  176. );
  177. Ext.Msg.alert('Direct Link to ' + this.cclass,link);
  178. },
  179. scrollToMember : function(member){
  180. var el = Ext.fly(this.cclass + '-' + member);
  181. if(el){
  182. var top = (el.getOffsetsTo(this.body)[1]) + this.body.dom.scrollTop;
  183. this.body.scrollTo('top', top-25, {duration:0.75, callback: this.hlMember.createDelegate(this, [member])});
  184. }
  185. },
  186. scrollToSection : function(id){
  187. var el = Ext.getDom(id);
  188. if(el){
  189. var top = (Ext.fly(el).getOffsetsTo(this.body)[1]) + this.body.dom.scrollTop;
  190. this.body.scrollTo('top', top-25, {duration:0.5, callback: function(){
  191. Ext.fly(el).next('h2').pause(0.2).highlight('#8DB2E3', {attr:'color'});
  192. }});
  193. }
  194. },
  195. hlMember : function(member){
  196. var el = Ext.fly(this.cclass + '-' + member);
  197. if(el){
  198. if (tr = el.up('tr')) {
  199. tr.highlight('#cadaf9');
  200. }
  201. }
  202. }
  203. });
  204. MainPanel = function(){
  205. this.searchStore = new Ext.data.Store({
  206. proxy: new Ext.data.ScriptTagProxy({
  207. url: 'http://extjs.com/playpen/api.php'
  208. }),
  209. reader: new Ext.data.JsonReader({
  210. root: 'data'
  211. },
  212. ['cls', 'member', 'type', 'doc']
  213. ),
  214. baseParams: {},
  215. listeners: {
  216. 'beforeload' : function(){
  217. this.baseParams.qt = Ext.getCmp('search-type').getValue();
  218. }
  219. }
  220. });
  221. MainPanel.superclass.constructor.call(this, {
  222. id:'doc-body',
  223. region:'center',
  224. margins:'0 5 5 0',
  225. resizeTabs: true,
  226. minTabWidth: 135,
  227. tabWidth: 135,
  228. plugins: new Ext.ux.TabCloseMenu(),
  229. enableTabScroll: true,
  230. activeTab: 0,
  231. items: {
  232. id:'welcome-panel',
  233. title: 'API Home',
  234. autoLoad: {url: 'welcome.html', callback: this.initSearch, scope: this},
  235. iconCls:'icon-docs',
  236. autoScroll: true,
  237. tbar: [
  238. 'Search: ', ' ',
  239. new Ext.ux.SelectBox({
  240. listClass:'x-combo-list-small',
  241. width:90,
  242. value:'Starts with',
  243. id:'search-type',
  244. store: new Ext.data.SimpleStore({
  245. fields: ['text'],
  246. expandData: true,
  247. data : ['Starts with', 'Ends with', 'Any match']
  248. }),
  249. displayField: 'text'
  250. }), ' ',
  251. new Ext.app.SearchField({
  252. width:240,
  253. store: this.searchStore,
  254. paramName: 'q'
  255. })
  256. ]
  257. }
  258. });
  259. };
  260. Ext.extend(MainPanel, Ext.TabPanel, {
  261. initEvents : function(){
  262. MainPanel.superclass.initEvents.call(this);
  263. this.body.on('click', this.onClick, this);
  264. },
  265. onClick: function(e, target){
  266. if(target = e.getTarget('a:not(.exi)', 3)){
  267. var cls = Ext.fly(target).getAttributeNS('ext', 'cls');
  268. e.stopEvent();
  269. if(cls){
  270. var member = Ext.fly(target).getAttributeNS('ext', 'member');
  271. this.loadClass(target.href, cls, member);
  272. }else if(target.className == 'inner-link'){
  273. this.getActiveTab().scrollToSection(target.href.split('#')[1]);
  274. }else{
  275. window.open(target.href);
  276. }
  277. }else if(target = e.getTarget('.micon', 2)){
  278. e.stopEvent();
  279. var tr = Ext.fly(target.parentNode);
  280. if(tr.hasClass('expandable')){
  281. tr.toggleClass('expanded');
  282. }
  283. }
  284. },
  285. loadClass : function(href, cls, member){
  286. var id = 'docs-' + cls;
  287. var tab = this.getComponent(id);
  288. if(tab){
  289. this.setActiveTab(tab);
  290. if(member){
  291. tab.scrollToMember(member);
  292. }
  293. }else{
  294. var autoLoad = {url: href};
  295. if(member){
  296. autoLoad.callback = function(){
  297. Ext.getCmp(id).scrollToMember(member);
  298. }
  299. }
  300. var p = this.add(new DocPanel({
  301. id: id,
  302. cclass : cls,
  303. autoLoad: autoLoad,
  304. iconCls: Docs.icons[cls]
  305. }));
  306. this.setActiveTab(p);
  307. }
  308. },
  309. initSearch : function(){
  310. // Custom rendering Template for the View
  311. var resultTpl = new Ext.XTemplate(
  312. '<tpl for=".">',
  313. '<div class="search-item">',
  314. '<a class="member" ext:cls="{cls}" ext:member="{member}" href="output/{cls}.html">',
  315. '<img src="../resources/images/default/s.gif" class="item-icon icon-{type}"/>{member}',
  316. '</a> ',
  317. '<a class="cls" ext:cls="{cls}" href="output/{cls}.html">{cls}</a>',
  318. '<p>{doc}</p>',
  319. '</div></tpl>'
  320. );
  321. var p = new Ext.DataView({
  322. applyTo: 'search',
  323. tpl: resultTpl,
  324. loadingText:'Searching...',
  325. store: this.searchStore,
  326. itemSelector: 'div.search-item',
  327. emptyText: '<h3>Use the search field above to search the Ext API for classes, properties, config options, methods and events.</h3>'
  328. });
  329. },
  330. doSearch : function(e){
  331. var k = e.getKey();
  332. if(!e.isSpecialKey()){
  333. var text = e.target.value;
  334. if(!text){
  335. this.searchStore.baseParams.q = '';
  336. this.searchStore.removeAll();
  337. }else{
  338. this.searchStore.baseParams.q = text;
  339. this.searchStore.reload();
  340. }
  341. }
  342. }
  343. });
  344. Ext.onReady(function(){
  345. Ext.QuickTips.init();
  346. var api = new ApiPanel();
  347. var mainPanel = new MainPanel();
  348. api.on('click', function(node, e){
  349. if(node.isLeaf()){
  350. e.stopEvent();
  351. mainPanel.loadClass(node.attributes.href, node.id);
  352. }
  353. });
  354. mainPanel.on('tabchange', function(tp, tab){
  355. api.selectClass(tab.cclass);
  356. });
  357. var viewport = new Ext.Viewport({
  358. layout:'border',
  359. items:[ {
  360. cls: 'docs-header',
  361. height: 44,
  362. region:'north',
  363. xtype:'box',
  364. el:'header',
  365. border:false,
  366. margins: '0 0 5 0'
  367. }, api, mainPanel ]
  368. });
  369. api.expandPath('/root/apidocs');
  370. // allow for link in
  371. var page = window.location.href.split('?')[1];
  372. if(page){
  373. var ps = Ext.urlDecode(page);
  374. var cls = ps['class'];
  375. mainPanel.loadClass('output/' + cls + '.html', cls, ps.member);
  376. }
  377. viewport.doLayout();
  378. setTimeout(function(){
  379. Ext.get('loading').remove();
  380. Ext.get('loading-mask').fadeOut({remove:true});
  381. }, 250);
  382. });
  383. Ext.app.SearchField = Ext.extend(Ext.form.TwinTriggerField, {
  384. initComponent : function(){
  385. if(!this.store.baseParams){
  386. this.store.baseParams = {};
  387. }
  388. Ext.app.SearchField.superclass.initComponent.call(this);
  389. this.on('specialkey', function(f, e){
  390. if(e.getKey() == e.ENTER){
  391. this.onTrigger2Click();
  392. }
  393. }, this);
  394. },
  395. validationEvent:false,
  396. validateOnBlur:false,
  397. trigger1Class:'x-form-clear-trigger',
  398. trigger2Class:'x-form-search-trigger',
  399. hideTrigger1:true,
  400. width:180,
  401. hasSearch : false,
  402. paramName : 'query',
  403. onTrigger1Click : function(){
  404. if(this.hasSearch){
  405. this.store.baseParams[this.paramName] = '';
  406. this.store.removeAll();
  407. this.el.dom.value = '';
  408. this.triggers[0].hide();
  409. this.hasSearch = false;
  410. this.focus();
  411. }
  412. },
  413. onTrigger2Click : function(){
  414. var v = this.getRawValue();
  415. if(v.length < 1){
  416. this.onTrigger1Click();
  417. return;
  418. }
  419. if(v.length < 2){
  420. Ext.Msg.alert('Invalid Search', 'You must enter a minimum of 2 characters to search the API');
  421. return;
  422. }
  423. this.store.baseParams[this.paramName] = v;
  424. var o = {start: 0};
  425. this.store.reload({params:o});
  426. this.hasSearch = true;
  427. this.triggers[0].show();
  428. this.focus();
  429. }
  430. });
  431. /**
  432. * Makes a ComboBox more closely mimic an HTML SELECT. Supports clicking and dragging
  433. * through the list, with item selection occurring when the mouse button is released.
  434. * When used will automatically set {@link #editable} to false and call {@link Ext.Element#unselectable}
  435. * on inner elements. Re-enabling editable after calling this will NOT work.
  436. *
  437. * @author Corey Gilmore
  438. * http://extjs.com/forum/showthread.php?t=6392
  439. *
  440. * @history 2007-07-08 jvs
  441. * Slight mods for Ext 2.0
  442. */
  443. Ext.ux.SelectBox = function(config){
  444. this.searchResetDelay = 1000;
  445. config = config || {};
  446. config = Ext.apply(config || {}, {
  447. editable: false,
  448. forceSelection: true,
  449. rowHeight: false,
  450. lastSearchTerm: false,
  451. triggerAction: 'all',
  452. mode: 'local'
  453. });
  454. Ext.ux.SelectBox.superclass.constructor.apply(this, arguments);
  455. this.lastSelectedIndex = this.selectedIndex || 0;
  456. };
  457. Ext.extend(Ext.ux.SelectBox, Ext.form.ComboBox, {
  458. lazyInit: false,
  459. initEvents : function(){
  460. Ext.ux.SelectBox.superclass.initEvents.apply(this, arguments);
  461. // you need to use keypress to capture upper/lower case and shift+key, but it doesn't work in IE
  462. this.el.on('keydown', this.keySearch, this, true);
  463. this.cshTask = new Ext.util.DelayedTask(this.clearSearchHistory, this);
  464. },
  465. keySearch : function(e, target, options) {
  466. var raw = e.getKey();
  467. var key = String.fromCharCode(raw);
  468. var startIndex = 0;
  469. if( !this.store.getCount() ) {
  470. return;
  471. }
  472. switch(raw) {
  473. case Ext.EventObject.HOME:
  474. e.stopEvent();
  475. this.selectFirst();
  476. return;
  477. case Ext.EventObject.END:
  478. e.stopEvent();
  479. this.selectLast();
  480. return;
  481. case Ext.EventObject.PAGEDOWN:
  482. this.selectNextPage();
  483. e.stopEvent();
  484. return;
  485. case Ext.EventObject.PAGEUP:
  486. this.selectPrevPage();
  487. e.stopEvent();
  488. return;
  489. }
  490. // skip special keys other than the shift key
  491. if( (e.hasModifier() && !e.shiftKey) || e.isNavKeyPress() || e.isSpecialKey() ) {
  492. return;
  493. }
  494. if( this.lastSearchTerm == key ) {
  495. startIndex = this.lastSelectedIndex;
  496. }
  497. this.search(this.displayField, key, startIndex);
  498. this.cshTask.delay(this.searchResetDelay);
  499. },
  500. onRender : function(ct, position) {
  501. this.store.on('load', this.calcRowsPerPage, this);
  502. Ext.ux.SelectBox.superclass.onRender.apply(this, arguments);
  503. if( this.mode == 'local' ) {
  504. this.calcRowsPerPage();
  505. }
  506. },
  507. onSelect : function(record, index, skipCollapse){
  508. if(this.fireEvent('beforeselect', this, record, index) !== false){
  509. this.setValue(record.data[this.valueField || this.displayField]);
  510. if( !skipCollapse ) {
  511. this.collapse();
  512. }
  513. this.lastSelectedIndex = index + 1;
  514. this.fireEvent('select', this, record, index);
  515. }
  516. },
  517. render : function(ct) {
  518. Ext.ux.SelectBox.superclass.render.apply(this, arguments);
  519. if( Ext.isSafari ) {
  520. this.el.swallowEvent('mousedown', true);
  521. }
  522. this.el.unselectable();
  523. this.innerList.unselectable();
  524. this.trigger.unselectable();
  525. this.innerList.on('mouseup', function(e, target, options) {
  526. if( target.id && target.id == this.innerList.id ) {
  527. return;
  528. }
  529. this.onViewClick();
  530. }, this);
  531. this.innerList.on('mouseover', function(e, target, options) {
  532. if( target.id && target.id == this.innerList.id ) {
  533. return;
  534. }
  535. this.lastSelectedIndex = this.view.getSelectedIndexes()[0] + 1;
  536. this.cshTask.delay(this.searchResetDelay);
  537. }, this);
  538. this.trigger.un('click', this.onTriggerClick, this);
  539. this.trigger.on('mousedown', function(e, target, options) {
  540. e.preventDefault();
  541. this.onTriggerClick();
  542. }, this);
  543. this.on('collapse', function(e, target, options) {
  544. Ext.getDoc().un('mouseup', this.collapseIf, this);
  545. }, this, true);
  546. this.on('expand', function(e, target, options) {
  547. Ext.getDoc().on('mouseup', this.collapseIf, this);
  548. }, this, true);
  549. },
  550. clearSearchHistory : function() {
  551. this.lastSelectedIndex = 0;
  552. this.lastSearchTerm = false;
  553. },
  554. selectFirst : function() {
  555. this.focusAndSelect(this.store.data.first());
  556. },
  557. selectLast : function() {
  558. this.focusAndSelect(this.store.data.last());
  559. },
  560. selectPrevPage : function() {
  561. if( !this.rowHeight ) {
  562. return;
  563. }
  564. var index = Math.max(this.selectedIndex-this.rowsPerPage, 0);
  565. this.focusAndSelect(this.store.getAt(index));
  566. },
  567. selectNextPage : function() {
  568. if( !this.rowHeight ) {
  569. return;
  570. }
  571. var index = Math.min(this.selectedIndex+this.rowsPerPage, this.store.getCount() - 1);
  572. this.focusAndSelect(this.store.getAt(index));
  573. },
  574. search : function(field, value, startIndex) {
  575. field = field || this.displayField;
  576. this.lastSearchTerm = value;
  577. var index = this.store.find.apply(this.store, arguments);
  578. if( index !== -1 ) {
  579. this.focusAndSelect(index);
  580. }
  581. },
  582. focusAndSelect : function(record) {
  583. var index = typeof record === 'number' ? record : this.store.indexOf(record);
  584. this.select(index, this.isExpanded());
  585. this.onSelect(this.store.getAt(record), index, this.isExpanded());
  586. },
  587. calcRowsPerPage : function() {
  588. if( this.store.getCount() ) {
  589. this.rowHeight = Ext.fly(this.view.getNode(0)).getHeight();
  590. this.rowsPerPage = this.maxHeight / this.rowHeight;
  591. } else {
  592. this.rowHeight = false;
  593. }
  594. }
  595. });
  596. Ext.Ajax.on('requestcomplete', function(ajax, xhr, o){
  597. if(typeof urchinTracker == 'function' && o && o.url){
  598. urchinTracker(o.url);
  599. }
  600. });