[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 /** 2 * @provides javelin-behavior-differential-populate 3 * @requires javelin-behavior 4 * javelin-dom 5 * javelin-stratcom 6 * phabricator-tooltip 7 * changeset-view-manager 8 */ 9 10 JX.behavior('differential-populate', function(config) { 11 12 for (var ii = 0; ii < config.changesetViewIDs.length; ii++) { 13 var id = config.changesetViewIDs[ii]; 14 var view = JX.ChangesetViewManager.getForNode(JX.$(id)); 15 if (view.shouldAutoload()) { 16 view.setStabilize(true).load(); 17 } 18 } 19 20 JX.Stratcom.listen( 21 'click', 22 'differential-load', 23 function(e) { 24 var meta = e.getNodeData('differential-load'); 25 var changeset = JX.$(meta.id); 26 var view = JX.ChangesetViewManager.getForNode(changeset); 27 28 view.load(); 29 var routable = view.getRoutable(); 30 if (routable) { 31 routable.setPriority(2000); 32 } 33 34 if (meta.kill) { 35 e.kill(); 36 } 37 }); 38 39 var highlighted = null; 40 var highlight_class = null; 41 42 JX.Stratcom.listen( 43 ['mouseover', 'mouseout'], 44 ['differential-changeset', 'tag:td'], 45 function(e) { 46 var t = e.getTarget(); 47 48 // NOTE: Using className is not best practice, but the diff UI is perf 49 // sensitive. 50 if (!t.className.match(/cov|copy/)) { 51 return; 52 } 53 54 if (e.getType() == 'mouseout') { 55 JX.Tooltip.hide(); 56 if (highlighted) { 57 JX.DOM.alterClass(highlighted, highlight_class, false); 58 highlighted = null; 59 } 60 } else { 61 highlight_class = null; 62 var msg; 63 var align = 'W'; 64 var sibling = 'previousSibling'; 65 var width = 120; 66 if (t.className.match(/cov-C/)) { 67 msg = 'Covered'; 68 highlight_class = 'source-cov-C'; 69 } else if (t.className.match(/cov-U/)) { 70 msg = 'Not Covered'; 71 highlight_class = 'source-cov-U'; 72 } else if (t.className.match(/cov-N/)) { 73 msg = 'Not Executable'; 74 highlight_class = 'source-cov-N'; 75 } else { 76 var match = /new-copy|new-move/.exec(t.className); 77 if (match) { 78 sibling = 'nextSibling'; 79 width = 500; 80 msg = JX.Stratcom.getData(t).msg; 81 highlight_class = match[0]; 82 } 83 } 84 85 if (msg) { 86 JX.Tooltip.show(t, width, align, msg); 87 } 88 89 if (highlight_class) { 90 highlighted = t[sibling]; 91 JX.DOM.alterClass(highlighted, highlight_class, true); 92 } 93 } 94 95 }); 96 97 98 });
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |