How to use autolink method in wpt

Best JavaScript code snippet using wpt

autolink.js

Source:autolink.js Github

copy

Full Screen

1/* automatically generated by JSCoverage - do not edit */2try {3 if (typeof top === 'object' && top !== null && typeof top.opener === 'object' && top.opener !== null) {4 // this is a browser window that was opened from another window5 if (! top.opener._$jscoverage) {6 top.opener._$jscoverage = {};7 }8 }9}10catch (e) {}11try {12 if (typeof top === 'object' && top !== null) {13 // this is a browser window14 try {15 if (typeof top.opener === 'object' && top.opener !== null && top.opener._$jscoverage) {16 top._$jscoverage = top.opener._$jscoverage;17 }18 }19 catch (e) {}20 if (! top._$jscoverage) {21 top._$jscoverage = {};22 }23 }24}25catch (e) {}26try {27 if (typeof top === 'object' && top !== null && top._$jscoverage) {28 _$jscoverage = top._$jscoverage;29 }30}31catch (e) {}32if (typeof _$jscoverage !== 'object') {33 _$jscoverage = {};34}35if (! _$jscoverage['plugins/autolink.js']) {36 _$jscoverage['plugins/autolink.js'] = [];37 _$jscoverage['plugins/autolink.js'][9] = 0;38 _$jscoverage['plugins/autolink.js'][10] = 0;39 _$jscoverage['plugins/autolink.js'][11] = 0;40 _$jscoverage['plugins/autolink.js'][12] = 0;41 _$jscoverage['plugins/autolink.js'][14] = 0;42 _$jscoverage['plugins/autolink.js'][15] = 0;43 _$jscoverage['plugins/autolink.js'][16] = 0;44 _$jscoverage['plugins/autolink.js'][18] = 0;45 _$jscoverage['plugins/autolink.js'][19] = 0;46 _$jscoverage['plugins/autolink.js'][21] = 0;47 _$jscoverage['plugins/autolink.js'][23] = 0;48 _$jscoverage['plugins/autolink.js'][28] = 0;49 _$jscoverage['plugins/autolink.js'][29] = 0;50 _$jscoverage['plugins/autolink.js'][30] = 0;51 _$jscoverage['plugins/autolink.js'][31] = 0;52 _$jscoverage['plugins/autolink.js'][32] = 0;53 _$jscoverage['plugins/autolink.js'][34] = 0;54 _$jscoverage['plugins/autolink.js'][35] = 0;55 _$jscoverage['plugins/autolink.js'][36] = 0;56 _$jscoverage['plugins/autolink.js'][39] = 0;57 _$jscoverage['plugins/autolink.js'][40] = 0;58 _$jscoverage['plugins/autolink.js'][41] = 0;59 _$jscoverage['plugins/autolink.js'][43] = 0;60 _$jscoverage['plugins/autolink.js'][44] = 0;61 _$jscoverage['plugins/autolink.js'][46] = 0;62 _$jscoverage['plugins/autolink.js'][47] = 0;63 _$jscoverage['plugins/autolink.js'][49] = 0;64 _$jscoverage['plugins/autolink.js'][51] = 0;65 _$jscoverage['plugins/autolink.js'][52] = 0;66 _$jscoverage['plugins/autolink.js'][54] = 0;67 _$jscoverage['plugins/autolink.js'][55] = 0;68 _$jscoverage['plugins/autolink.js'][58] = 0;69 _$jscoverage['plugins/autolink.js'][59] = 0;70 _$jscoverage['plugins/autolink.js'][60] = 0;71 _$jscoverage['plugins/autolink.js'][61] = 0;72 _$jscoverage['plugins/autolink.js'][63] = 0;73 _$jscoverage['plugins/autolink.js'][64] = 0;74 _$jscoverage['plugins/autolink.js'][67] = 0;75 _$jscoverage['plugins/autolink.js'][68] = 0;76 _$jscoverage['plugins/autolink.js'][69] = 0;77 _$jscoverage['plugins/autolink.js'][70] = 0;78 _$jscoverage['plugins/autolink.js'][72] = 0;79 _$jscoverage['plugins/autolink.js'][75] = 0;80 _$jscoverage['plugins/autolink.js'][81] = 0;81 _$jscoverage['plugins/autolink.js'][82] = 0;82 _$jscoverage['plugins/autolink.js'][84] = 0;83 _$jscoverage['plugins/autolink.js'][86] = 0;84 _$jscoverage['plugins/autolink.js'][87] = 0;85 _$jscoverage['plugins/autolink.js'][88] = 0;86 _$jscoverage['plugins/autolink.js'][89] = 0;87 _$jscoverage['plugins/autolink.js'][90] = 0;88 _$jscoverage['plugins/autolink.js'][91] = 0;89 _$jscoverage['plugins/autolink.js'][92] = 0;90 _$jscoverage['plugins/autolink.js'][94] = 0;91 _$jscoverage['plugins/autolink.js'][95] = 0;92 _$jscoverage['plugins/autolink.js'][96] = 0;93 _$jscoverage['plugins/autolink.js'][97] = 0;94 _$jscoverage['plugins/autolink.js'][98] = 0;95 _$jscoverage['plugins/autolink.js'][99] = 0;96 _$jscoverage['plugins/autolink.js'][100] = 0;97}98_$jscoverage['plugins/autolink.js'].source = ["<span class=\"c\">///import core</span>","<span class=\"c\">///commands &#20026;&#38750;ie&#27983;&#35272;&#22120;&#33258;&#21160;&#28155;&#21152;a&#26631;&#31614;</span>","<span class=\"c\">///commandsName AutoLink</span>","<span class=\"c\">///commandsTitle &#33258;&#21160;&#22686;&#21152;&#38142;&#25509;</span>","<span class=\"c\">/*</span>","<span class=\"c\"> * @description &#20026;&#38750;ie&#27983;&#35272;&#22120;&#33258;&#21160;&#28155;&#21152;a&#26631;&#31614;</span>","<span class=\"c\"> * @author zhanyi</span>","<span class=\"c\"> */</span>"," UE<span class=\"k\">.</span>plugins<span class=\"k\">[</span><span class=\"s\">'autolink'</span><span class=\"k\">]</span> <span class=\"k\">=</span> <span class=\"k\">function</span><span class=\"k\">()</span> <span class=\"k\">{</span>"," <span class=\"k\">var</span> cont <span class=\"k\">=</span> <span class=\"s\">0</span><span class=\"k\">;</span>"," <span class=\"k\">if</span> <span class=\"k\">(</span>browser<span class=\"k\">.</span>ie<span class=\"k\">)</span> <span class=\"k\">{</span>"," <span class=\"k\">return</span><span class=\"k\">;</span>"," <span class=\"k\">}</span>"," <span class=\"k\">var</span> me <span class=\"k\">=</span> <span class=\"k\">this</span><span class=\"k\">;</span>"," me<span class=\"k\">.</span>addListener<span class=\"k\">(</span><span class=\"s\">'reset'</span><span class=\"k\">,</span><span class=\"k\">function</span><span class=\"k\">()</span><span class=\"k\">{</span>"," cont <span class=\"k\">=</span> <span class=\"s\">0</span><span class=\"k\">;</span>"," <span class=\"k\">}</span><span class=\"k\">);</span>"," me<span class=\"k\">.</span>addListener<span class=\"k\">(</span><span class=\"s\">'keydown'</span><span class=\"k\">,</span> <span class=\"k\">function</span><span class=\"k\">(</span>type<span class=\"k\">,</span> evt<span class=\"k\">)</span> <span class=\"k\">{</span>"," <span class=\"k\">var</span> keyCode <span class=\"k\">=</span> evt<span class=\"k\">.</span>keyCode <span class=\"k\">||</span> evt<span class=\"k\">.</span>which<span class=\"k\">;</span>",""," <span class=\"k\">if</span> <span class=\"k\">(</span>keyCode <span class=\"k\">==</span> <span class=\"s\">32</span> <span class=\"k\">||</span> keyCode <span class=\"k\">==</span> <span class=\"s\">13</span><span class=\"k\">)</span> <span class=\"k\">{</span>",""," <span class=\"k\">var</span> sel <span class=\"k\">=</span> me<span class=\"k\">.</span>selection<span class=\"k\">.</span>getNative<span class=\"k\">(),</span>"," range <span class=\"k\">=</span> sel<span class=\"k\">.</span>getRangeAt<span class=\"k\">(</span><span class=\"s\">0</span><span class=\"k\">).</span>cloneRange<span class=\"k\">(),</span>"," offset<span class=\"k\">,</span>"," charCode<span class=\"k\">;</span>",""," <span class=\"k\">var</span> start <span class=\"k\">=</span> range<span class=\"k\">.</span>startContainer<span class=\"k\">;</span>"," <span class=\"k\">while</span> <span class=\"k\">(</span>start<span class=\"k\">.</span>nodeType <span class=\"k\">==</span> <span class=\"s\">1</span> <span class=\"k\">&amp;&amp;</span> range<span class=\"k\">.</span>startOffset <span class=\"k\">&gt;</span> <span class=\"s\">0</span><span class=\"k\">)</span> <span class=\"k\">{</span>"," start <span class=\"k\">=</span> range<span class=\"k\">.</span>startContainer<span class=\"k\">.</span>childNodes<span class=\"k\">[</span>range<span class=\"k\">.</span>startOffset <span class=\"k\">-</span> <span class=\"s\">1</span><span class=\"k\">];</span>"," <span class=\"k\">if</span> <span class=\"k\">(!</span>start<span class=\"k\">)</span><span class=\"k\">{</span>"," <span class=\"k\">break</span><span class=\"k\">;</span>"," <span class=\"k\">}</span>"," range<span class=\"k\">.</span>setStart<span class=\"k\">(</span>start<span class=\"k\">,</span> start<span class=\"k\">.</span>nodeType <span class=\"k\">==</span> <span class=\"s\">1</span> <span class=\"k\">?</span> start<span class=\"k\">.</span>childNodes<span class=\"k\">.</span>length <span class=\"k\">:</span> start<span class=\"k\">.</span>nodeValue<span class=\"k\">.</span>length<span class=\"k\">);</span>"," range<span class=\"k\">.</span>collapse<span class=\"k\">(</span><span class=\"k\">true</span><span class=\"k\">);</span>"," start <span class=\"k\">=</span> range<span class=\"k\">.</span>startContainer<span class=\"k\">;</span>"," <span class=\"k\">}</span>",""," <span class=\"k\">do</span><span class=\"k\">{</span>"," <span class=\"k\">if</span> <span class=\"k\">(</span>range<span class=\"k\">.</span>startOffset <span class=\"k\">==</span> <span class=\"s\">0</span><span class=\"k\">)</span> <span class=\"k\">{</span>"," start <span class=\"k\">=</span> range<span class=\"k\">.</span>startContainer<span class=\"k\">.</span>previousSibling<span class=\"k\">;</span>",""," <span class=\"k\">while</span> <span class=\"k\">(</span>start <span class=\"k\">&amp;&amp;</span> start<span class=\"k\">.</span>nodeType <span class=\"k\">==</span> <span class=\"s\">1</span><span class=\"k\">)</span> <span class=\"k\">{</span>"," start <span class=\"k\">=</span> start<span class=\"k\">.</span>lastChild<span class=\"k\">;</span>"," <span class=\"k\">}</span>"," <span class=\"k\">if</span> <span class=\"k\">(!</span>start <span class=\"k\">||</span> domUtils<span class=\"k\">.</span>isFillChar<span class=\"k\">(</span>start<span class=\"k\">))</span><span class=\"k\">{</span>"," <span class=\"k\">break</span><span class=\"k\">;</span>"," <span class=\"k\">}</span>"," offset <span class=\"k\">=</span> start<span class=\"k\">.</span>nodeValue<span class=\"k\">.</span>length<span class=\"k\">;</span>"," <span class=\"k\">}</span> <span class=\"k\">else</span> <span class=\"k\">{</span>"," start <span class=\"k\">=</span> range<span class=\"k\">.</span>startContainer<span class=\"k\">;</span>"," offset <span class=\"k\">=</span> range<span class=\"k\">.</span>startOffset<span class=\"k\">;</span>"," <span class=\"k\">}</span>"," range<span class=\"k\">.</span>setStart<span class=\"k\">(</span>start<span class=\"k\">,</span> offset <span class=\"k\">-</span> <span class=\"s\">1</span><span class=\"k\">);</span>"," charCode <span class=\"k\">=</span> range<span class=\"k\">.</span>toString<span class=\"k\">().</span>charCodeAt<span class=\"k\">(</span><span class=\"s\">0</span><span class=\"k\">);</span>"," <span class=\"k\">}</span> <span class=\"k\">while</span> <span class=\"k\">(</span>charCode <span class=\"k\">!=</span> <span class=\"s\">160</span> <span class=\"k\">&amp;&amp;</span> charCode <span class=\"k\">!=</span> <span class=\"s\">32</span><span class=\"k\">);</span>",""," <span class=\"k\">if</span> <span class=\"k\">(</span>range<span class=\"k\">.</span>toString<span class=\"k\">().</span>replace<span class=\"k\">(</span><span class=\"k\">new</span> RegExp<span class=\"k\">(</span>domUtils<span class=\"k\">.</span>fillChar<span class=\"k\">,</span> <span class=\"s\">'g'</span><span class=\"k\">),</span> <span class=\"s\">''</span><span class=\"k\">).</span>match<span class=\"k\">(</span><span class=\"s\">/(?:https?:\\/\\/|ssh:\\/\\/|ftp:\\/\\/|file:\\/|www\\.)/i</span><span class=\"k\">))</span> <span class=\"k\">{</span>"," <span class=\"k\">while</span><span class=\"k\">(</span>range<span class=\"k\">.</span>toString<span class=\"k\">().</span>length<span class=\"k\">)</span><span class=\"k\">{</span>"," <span class=\"k\">if</span><span class=\"k\">(</span><span class=\"s\">/^(?:https?:\\/\\/|ssh:\\/\\/|ftp:\\/\\/|file:\\/|www\\.)/i</span><span class=\"k\">.</span>test<span class=\"k\">(</span>range<span class=\"k\">.</span>toString<span class=\"k\">()))</span><span class=\"k\">{</span>"," <span class=\"k\">break</span><span class=\"k\">;</span>"," <span class=\"k\">}</span>"," <span class=\"k\">try</span><span class=\"k\">{</span>"," range<span class=\"k\">.</span>setStart<span class=\"k\">(</span>range<span class=\"k\">.</span>startContainer<span class=\"k\">,</span>range<span class=\"k\">.</span>startOffset<span class=\"k\">+</span><span class=\"s\">1</span><span class=\"k\">);</span>"," <span class=\"k\">}</span><span class=\"k\">catch</span><span class=\"k\">(</span>e<span class=\"k\">)</span><span class=\"k\">{</span>"," <span class=\"c\">//trace:2121</span>"," <span class=\"k\">var</span> start <span class=\"k\">=</span> range<span class=\"k\">.</span>startContainer<span class=\"k\">;</span>"," <span class=\"k\">while</span><span class=\"k\">(!(</span>next <span class=\"k\">=</span> start<span class=\"k\">.</span>nextSibling<span class=\"k\">))</span><span class=\"k\">{</span>"," <span class=\"k\">if</span><span class=\"k\">(</span>domUtils<span class=\"k\">.</span>isBody<span class=\"k\">(</span>start<span class=\"k\">))</span><span class=\"k\">{</span>"," <span class=\"k\">return</span><span class=\"k\">;</span>"," <span class=\"k\">}</span>"," start <span class=\"k\">=</span> start<span class=\"k\">.</span>parentNode<span class=\"k\">;</span>",""," <span class=\"k\">}</span>"," range<span class=\"k\">.</span>setStart<span class=\"k\">(</span>next<span class=\"k\">,</span><span class=\"s\">0</span><span class=\"k\">);</span>",""," <span class=\"k\">}</span>",""," <span class=\"k\">}</span>"," <span class=\"c\">//range&#30340;&#24320;&#22987;&#36793;&#30028;&#24050;&#32463;&#22312;a&#26631;&#31614;&#37324;&#30340;&#19981;&#20877;&#22788;&#29702;</span>"," <span class=\"k\">if</span><span class=\"k\">(</span>domUtils<span class=\"k\">.</span>findParentByTagName<span class=\"k\">(</span>range<span class=\"k\">.</span>startContainer<span class=\"k\">,</span><span class=\"s\">'a'</span><span class=\"k\">,</span><span class=\"k\">true</span><span class=\"k\">))</span><span class=\"k\">{</span>"," <span class=\"k\">return</span><span class=\"k\">;</span>"," <span class=\"k\">}</span>"," <span class=\"k\">var</span> a <span class=\"k\">=</span> me<span class=\"k\">.</span>document<span class=\"k\">.</span>createElement<span class=\"k\">(</span><span class=\"s\">'a'</span><span class=\"k\">),</span>text <span class=\"k\">=</span> me<span class=\"k\">.</span>document<span class=\"k\">.</span>createTextNode<span class=\"k\">(</span><span class=\"s\">' '</span><span class=\"k\">),</span>href<span class=\"k\">;</span>",""," me<span class=\"k\">.</span>undoManger <span class=\"k\">&amp;&amp;</span> me<span class=\"k\">.</span>undoManger<span class=\"k\">.</span>save<span class=\"k\">();</span>"," a<span class=\"k\">.</span>appendChild<span class=\"k\">(</span>range<span class=\"k\">.</span>extractContents<span class=\"k\">());</span>"," a<span class=\"k\">.</span>href <span class=\"k\">=</span> a<span class=\"k\">.</span>innerHTML <span class=\"k\">=</span> a<span class=\"k\">.</span>innerHTML<span class=\"k\">.</span>replace<span class=\"k\">(</span><span class=\"s\">/&lt;[^&gt;]+&gt;/g</span><span class=\"k\">,</span><span class=\"s\">''</span><span class=\"k\">);</span>"," href <span class=\"k\">=</span> a<span class=\"k\">.</span>getAttribute<span class=\"k\">(</span><span class=\"s\">\"href\"</span><span class=\"k\">).</span>replace<span class=\"k\">(</span><span class=\"k\">new</span> RegExp<span class=\"k\">(</span>domUtils<span class=\"k\">.</span>fillChar<span class=\"k\">,</span><span class=\"s\">'g'</span><span class=\"k\">),</span><span class=\"s\">''</span><span class=\"k\">);</span>"," href <span class=\"k\">=</span> <span class=\"s\">/^(?:https?:\\/\\/)/ig</span><span class=\"k\">.</span>test<span class=\"k\">(</span>href<span class=\"k\">)</span> <span class=\"k\">?</span> href <span class=\"k\">:</span> <span class=\"s\">\"http://\"</span><span class=\"k\">+</span> href<span class=\"k\">;</span>"," a<span class=\"k\">.</span>setAttribute<span class=\"k\">(</span><span class=\"s\">'_src'</span><span class=\"k\">,</span>utils<span class=\"k\">.</span>html<span class=\"k\">(</span>href<span class=\"k\">));</span>"," a<span class=\"k\">.</span>href <span class=\"k\">=</span> utils<span class=\"k\">.</span>html<span class=\"k\">(</span>href<span class=\"k\">);</span>",""," range<span class=\"k\">.</span>insertNode<span class=\"k\">(</span>a<span class=\"k\">);</span>"," a<span class=\"k\">.</span>parentNode<span class=\"k\">.</span>insertBefore<span class=\"k\">(</span>text<span class=\"k\">,</span> a<span class=\"k\">.</span>nextSibling<span class=\"k\">);</span>"," range<span class=\"k\">.</span>setStart<span class=\"k\">(</span>text<span class=\"k\">,</span> <span class=\"s\">0</span><span class=\"k\">);</span>"," range<span class=\"k\">.</span>collapse<span class=\"k\">(</span><span class=\"k\">true</span><span class=\"k\">);</span>"," sel<span class=\"k\">.</span>removeAllRanges<span class=\"k\">();</span>"," sel<span class=\"k\">.</span>addRange<span class=\"k\">(</span>range<span class=\"k\">);</span>"," me<span class=\"k\">.</span>undoManger <span class=\"k\">&amp;&amp;</span> me<span class=\"k\">.</span>undoManger<span class=\"k\">.</span>save<span class=\"k\">();</span>"," <span class=\"k\">}</span>"," <span class=\"k\">}</span>"," <span class=\"k\">}</span><span class=\"k\">);</span>"," <span class=\"k\">}</span><span class=\"k\">;</span>"];99_$jscoverage['plugins/autolink.js'][9]++;100UE.plugins.autolink = (function () {101 _$jscoverage['plugins/autolink.js'][10]++;102 var cont = 0;103 _$jscoverage['plugins/autolink.js'][11]++;104 if (browser.ie) {105 _$jscoverage['plugins/autolink.js'][12]++;106 return;107 }108 _$jscoverage['plugins/autolink.js'][14]++;109 var me = this;110 _$jscoverage['plugins/autolink.js'][15]++;111 me.addListener("reset", (function () {112 _$jscoverage['plugins/autolink.js'][16]++;113 cont = 0;114}));115 _$jscoverage['plugins/autolink.js'][18]++;116 me.addListener("keydown", (function (type, evt) {117 _$jscoverage['plugins/autolink.js'][19]++;118 var keyCode = (evt.keyCode || evt.which);119 _$jscoverage['plugins/autolink.js'][21]++;120 if (((keyCode == 32) || (keyCode == 13))) {121 _$jscoverage['plugins/autolink.js'][23]++;122 var sel = me.selection.getNative(), range = sel.getRangeAt(0).cloneRange(), offset, charCode;123 _$jscoverage['plugins/autolink.js'][28]++;124 var start = range.startContainer;125 _$jscoverage['plugins/autolink.js'][29]++;126 while (((start.nodeType == 1) && (range.startOffset > 0))) {127 _$jscoverage['plugins/autolink.js'][30]++;128 start = range.startContainer.childNodes[(range.startOffset - 1)];129 _$jscoverage['plugins/autolink.js'][31]++;130 if ((! start)) {131 _$jscoverage['plugins/autolink.js'][32]++;132 break;133 }134 _$jscoverage['plugins/autolink.js'][34]++;135 range.setStart(start, ((start.nodeType == 1)? start.childNodes.length: start.nodeValue.length));136 _$jscoverage['plugins/autolink.js'][35]++;137 range.collapse(true);138 _$jscoverage['plugins/autolink.js'][36]++;139 start = range.startContainer;140}141 _$jscoverage['plugins/autolink.js'][39]++;142 do {143 _$jscoverage['plugins/autolink.js'][40]++;144 if ((range.startOffset == 0)) {145 _$jscoverage['plugins/autolink.js'][41]++;146 start = range.startContainer.previousSibling;147 _$jscoverage['plugins/autolink.js'][43]++;148 while ((start && (start.nodeType == 1))) {149 _$jscoverage['plugins/autolink.js'][44]++;150 start = start.lastChild;151}152 _$jscoverage['plugins/autolink.js'][46]++;153 if (((! start) || domUtils.isFillChar(start))) {154 _$jscoverage['plugins/autolink.js'][47]++;155 break;156 }157 _$jscoverage['plugins/autolink.js'][49]++;158 offset = start.nodeValue.length;159 }160 else {161 _$jscoverage['plugins/autolink.js'][51]++;162 start = range.startContainer;163 _$jscoverage['plugins/autolink.js'][52]++;164 offset = range.startOffset;165 }166 _$jscoverage['plugins/autolink.js'][54]++;167 range.setStart(start, (offset - 1));168 _$jscoverage['plugins/autolink.js'][55]++;169 charCode = range.toString().charCodeAt(0);170}171 while (((charCode != 160) && (charCode != 32)));172 _$jscoverage['plugins/autolink.js'][58]++;173 if (range.toString().replace(new RegExp(domUtils.fillChar, "g"), "").match(/(?:https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)/i)) {174 _$jscoverage['plugins/autolink.js'][59]++;175 while (range.toString().length) {176 _$jscoverage['plugins/autolink.js'][60]++;177 if (/^(?:https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)/i.test(range.toString())) {178 _$jscoverage['plugins/autolink.js'][61]++;179 break;180 }181 _$jscoverage['plugins/autolink.js'][63]++;182 try {183 _$jscoverage['plugins/autolink.js'][64]++;184 range.setStart(range.startContainer, (range.startOffset + 1));185 }186 catch (e) {187 _$jscoverage['plugins/autolink.js'][67]++;188 var start = range.startContainer;189 _$jscoverage['plugins/autolink.js'][68]++;190 while ((! (next = start.nextSibling))) {191 _$jscoverage['plugins/autolink.js'][69]++;192 if (domUtils.isBody(start)) {193 _$jscoverage['plugins/autolink.js'][70]++;194 return;195 }196 _$jscoverage['plugins/autolink.js'][72]++;197 start = start.parentNode;198}199 _$jscoverage['plugins/autolink.js'][75]++;200 range.setStart(next, 0);201 }202}203 _$jscoverage['plugins/autolink.js'][81]++;204 if (domUtils.findParentByTagName(range.startContainer, "a", true)) {205 _$jscoverage['plugins/autolink.js'][82]++;206 return;207 }208 _$jscoverage['plugins/autolink.js'][84]++;209 var a = me.document.createElement("a"), text = me.document.createTextNode(" "), href;210 _$jscoverage['plugins/autolink.js'][86]++;211 (me.undoManger && me.undoManger.save());212 _$jscoverage['plugins/autolink.js'][87]++;213 a.appendChild(range.extractContents());214 _$jscoverage['plugins/autolink.js'][88]++;215 a.href = (a.innerHTML = a.innerHTML.replace(/<[^>]+>/g, ""));216 _$jscoverage['plugins/autolink.js'][89]++;217 href = a.getAttribute("href").replace(new RegExp(domUtils.fillChar, "g"), "");218 _$jscoverage['plugins/autolink.js'][90]++;219 href = (/^(?:https?:\/\/)/gi.test(href)? href: ("http://" + href));220 _$jscoverage['plugins/autolink.js'][91]++;221 a.setAttribute("_src", utils.html(href));222 _$jscoverage['plugins/autolink.js'][92]++;223 a.href = utils.html(href);224 _$jscoverage['plugins/autolink.js'][94]++;225 range.insertNode(a);226 _$jscoverage['plugins/autolink.js'][95]++;227 a.parentNode.insertBefore(text, a.nextSibling);228 _$jscoverage['plugins/autolink.js'][96]++;229 range.setStart(text, 0);230 _$jscoverage['plugins/autolink.js'][97]++;231 range.collapse(true);232 _$jscoverage['plugins/autolink.js'][98]++;233 sel.removeAllRanges();234 _$jscoverage['plugins/autolink.js'][99]++;235 sel.addRange(range);236 _$jscoverage['plugins/autolink.js'][100]++;237 (me.undoManger && me.undoManger.save());238 }239 }240}));...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2wptools.autolink('Barack Obama', function(err, response) {3 if (err) {4 console.log(err);5 } else {6 console.log(response);7 }8});9{ 10 "extract":"Barack Hussein Obama II (/bəˈrɑːk huːˈseɪn oʊˈbɑːmə/; born August 4, 1961) is an American politician and attorney who served as the 44th President of the United States from 2009 to 2017. A member of the Democratic Party, he was the first African American to be elected to the presidency. He previously served as a U.S. senator from Illinois from 2005 to 2008 and an Illinois state senator from 1997 to 2004. Born in Honolulu, Hawaii, Obama is a graduate of Columbia University and Harvard Law School, where he was president of the Harvard Law Review. He was a community organizer in Chicago before earning his law degree. He worked as a civil rights attorney and taught constitutional law at the University of Chicago Law School between 1992 and 2004. He served three terms representing the 13th District in the Illinois Senate from 1997 until 2004, when he ran for the U.S. Senate. Obama campaigned for the U.S. presidency in 2008, winning the Democratic nomination and making history as the first African American to be nominated for president by a major U.S. political party. He was elected over Republican nominee John McCain and was inaugurated as president on January 20, 2009. Nine months later, Obama was named the 2009 Nobel Peace Prize laureate. Obama was re-elected president in November 2012, defeating Republican nominee Mitt Romney, and was sworn in for a second term on January 20, 2013. His second term was marked by various international issues, including the War in Afghanistan,

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var options = {3};4wptools.page('Albert Einstein').get(options, function(err, resp){5 if(err){6 console.log(err);7 }else{8 console.log(resp);9 }10});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2wptools.autolink('en', 'United States', function(err, data) {3 if (err) {4 console.log(err);5 } else {6 console.log(data);7 }8});9{10 "infobox": {

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2wptools.autolink('Barack Obama').then(function(result) {3 console.log(result);4});5var wptools = require('wptools');6wptools.autolink('Barack Obama').then(function(result) {7 console.log(result);8});9var wptools = require('wptools');10wptools.autolink('Barack Obama').then(function(result) {11 console.log(result);12});13var wptools = require('wptools');14wptools.autolink('Barack Obama').then(function(result) {15 console.log(result);16});17var wptools = require('wptools');18wptools.autolink('Barack Obama').then(function(result) {19 console.log(result);20});21var wptools = require('wptools');22wptools.autolink('Barack Obama').then(function(result) {23 console.log(result);24});25var wptools = require('wptools');26wptools.autolink('Barack Obama').then(function(result) {27 console.log(result);28});29var wptools = require('wptools');30wptools.autolink('Barack Obama').then(function(result) {31 console.log(result);32});33var wptools = require('wptools');34wptools.autolink('Barack Obama').then(function(result) {35 console.log(result);36});37var wptools = require('wptools');38wptools.autolink('Barack Obama').then(function(result) {

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2 console.log(doc);3});4var wptools = require('wptools');5wptools.autolink('Barack Obama', function(err, doc) {6 console.log(doc);7});8var wptools = require('wptools');9wptools.autolink('Barack Obama', 'en', function(err, doc) {10 console.log(doc);11});12var wptools = require('wptools');13wptools.autolink('Barack Obama', 'en', true, function(err, doc) {14 console.log(doc);15});16var wptools = require('wptools');17wptools.autolink('Barack Obama', 'en', true, true, function(err, doc) {18 console.log(doc);19});20var wptools = require('wptools');21wptools.autolink('Barack Obama', 'en', true, true, true, function(err, doc) {22 console.log(doc);23});24var wptools = require('wptools');25wptools.autolink('Barack Obama', 'en', true, true, true, true, function(err, doc) {26 console.log(doc);27});28var wptools = require('wptools');29wptools.autolink('Barack Obama', 'en', true, true, true, true, true, function(err, doc) {30 console.log(doc);31});32var wptools = require('wptools');

Full Screen

Using AI Code Generation

copy

Full Screen

1const wptools = require('wptools');2const article = wptools.page('Barack Obama');3article.get().then(function(data) {4 console.log(data);5});6const wptools = require('wptools');7const article = wptools.page('Barack Obama');8article.get().then(function(data) {9 console.log(data);10});11const wptools = require('wptools');12const article = wptools.page('Barack Obama');13article.get().then(function(data) {14 console.log(data);15});16const wptools = require('wptools');17const article = wptools.page('Barack Obama');18article.get().then(function(data) {19 console.log(data);20});21const wptools = require('wptools');22const article = wptools.page('Barack Obama');23article.get().then(function(data) {24 console.log(data);25});26const wptools = require('wptools');27const article = wptools.page('Barack Obama');28article.get().then(function(data) {29 console.log(data);30});31const wptools = require('wptools');32const article = wptools.page('Barack Obama');33article.get().then(function(data) {34 console.log(data);35});36const wptools = require('wptools');

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2 if(err){3 console.log(err);4 }else{5 console.log(res);6 }7});8{9 "description": "Albert Einstein (14 March 1879 – 18 April 1955) was a German-born theoretical physicist who developed the theory of relativity, one of the two pillars of modern physics (alongside quantum mechanics). Einstein's work is also known for its influence on the philosophy of science. Einstein is best known in popular culture for his mass–energy equivalence formula E = mc2 (which has been dubbed \"the world's most famous equation\"). He received the 1921 Nobel Prize in Physics \"for his services to theoretical physics, and especially for his discovery of the law of the photoelectric effect\", a pivotal step in the development of quantum theory.",10}

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var wiki = new wptools('Cristiano Ronaldo');3wiki.autolink(function(err, res) {4 console.log(res);5});6{ title: 'Cristiano Ronaldo',

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var wiki = wptools.page('Barack Obama');3wiki.get(function(err, resp) {4 console.log(resp)5});6 at createError (/home/rohan/Desktop/NodeJS/node_modules/axios/lib/core/createError.js:16:15)7 at settle (/home/rohan/Desktop/NodeJS/node_modules/axios/lib/core/settle.js:17:12)8 at IncomingMessage.handleStreamEnd (/home/rohan/Desktop/NodeJS/node_modules/axios/lib/adapters/http.js:236:11)9 at IncomingMessage.emit (events.js:198:13)10 at endReadableNT (_stream_readable.js:1145:12)11 at process._tickCallback (internal/process/next_tick.js:63:19)

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful