How to use getById method in pact-foundation-pact

Best JavaScript code snippet using pact-foundation-pact

misc.js

Source:misc.js Github

copy

Full Screen

...18 assert.isNull( range.endOffset, 'endOffset must be null' );19 assert.isTrue( range.collapsed, 'range must be collapsed' );20 assert.areSame( doc.getBody().$, range.root.$,21 'range boundary must default to body element' );22 var container = doc.getById( 'playground' );23 range = new CKEDITOR.dom.range( container );24 assert.areSame( container.$, range.root.$, 'range boundary element must match.' );25 },26 test_collapsed: function() {27 var range = new CKEDITOR.dom.range( doc );28 range.setStartAt( doc.getById( '_P' ), CKEDITOR.POSITION_AFTER_START );29 assert.isTrue( range.collapsed );30 },31 test_collapse: function() {32 var range = new CKEDITOR.dom.range( doc );33 range.setStartAt( doc.getById( '_Para' ), CKEDITOR.POSITION_AFTER_START );34 range.setEndAt( doc.getById( '_Span' ), CKEDITOR.POSITION_BEFORE_END );35 assert.areSame( document.getElementById( '_Para' ), range.startContainer.$, 'startContainer' );36 assert.areSame( document.getElementById( '_Span' ), range.endContainer.$, 'endContainer' );37 assert.isFalse( range.collapsed, 'collapsed' );38 range.collapse( true );39 assert.areSame( document.getElementById( '_Para' ), range.startContainer.$, 'startContainer' );40 assert.areSame( document.getElementById( '_Para' ), range.endContainer.$, 'endContainer' );41 assert.isTrue( range.collapsed, 'collapsed' );42 },43 test_selectNodeContents_Element: function() {44 var range = new CKEDITOR.dom.range( doc );45 // Test with an Element node.46 range.selectNodeContents( doc.getById( '_Para' ) );47 assert.areSame( document.getElementById( '_Para' ), range.startContainer.$, 'range.startContainer' );48 assert.areSame( 0, range.startOffset, 'range.startOffset' );49 assert.areSame( document.getElementById( '_Para' ), range.endContainer.$, 'range.endContainer' );50 assert.areSame( 3, range.endOffset, 'range.endOffset' );51 assert.isFalse( range.collapsed, 'range.collapsed' );52 },53 test_selectNodeContents_Text: function() {54 var range = new CKEDITOR.dom.range( doc );55 // Test with a Text node.56 range.selectNodeContents( doc.getById( '_Para' ).getFirst() );57 assert.areSame( document.getElementById( '_Para' ).firstChild, range.startContainer.$, 'range.startContainer' );58 assert.areSame( 0, range.startOffset, 'range.startOffset' );59 assert.areSame( document.getElementById( '_Para' ).firstChild, range.endContainer.$, 'range.endContainer' );60 assert.areSame( 8, range.endOffset, 'range.endOffset' );61 assert.isFalse( range.collapsed, 'range.collapsed' );62 },63 test_collapse_ToStart: function() {64 var range = new CKEDITOR.dom.range( doc );65 range.selectNodeContents( doc.getById( '_P' ) );66 range.collapse( true );67 assert.areSame( document.getElementById( '_P' ), range.startContainer.$, 'range.startContainer' );68 assert.areSame( 0, range.startOffset, 'range.startOffset' );69 assert.areSame( document.getElementById( '_P' ), range.endContainer.$, 'range.endContainer' );70 assert.areSame( 0, range.endOffset, 'range.endOffset' );71 assert.isTrue( range.collapsed, 'range.collapsed' );72 },73 test_collapse_ToEnd: function() {74 var range = new CKEDITOR.dom.range( doc );75 range.selectNodeContents( doc.getById( '_Para' ) );76 range.collapse( false );77 assert.areSame( document.getElementById( '_Para' ), range.startContainer.$, 'range.startContainer' );78 assert.areSame( 3, range.startOffset, 'range.startOffset' );79 assert.areSame( document.getElementById( '_Para' ), range.endContainer.$, 'range.endContainer' );80 assert.areSame( 3, range.endOffset, 'range.endOffset' );81 assert.isTrue( range.collapsed, 'range.collapsed' );82 },83 /**84 * Test trim with text range.85 */86 test_trim: function() {87 var text = doc.getById( '_trim_ct' ).getFirst();88 var range = new CKEDITOR.dom.range( doc );89 range.setStart( text, 2 );90 range.setEnd( text, 6 );91 range.trim();92 assert.isFalse( range.collapsed );93 assert.isTrue( range.startContainer.equals( doc.getById( '_trim_ct' ) ) );94 assert.areEqual( range.startOffset, 1 );95 assert.isTrue( range.endContainer.equals( doc.getById( '_trim_ct' ) ) );96 assert.areEqual( range.endOffset, 2 );97 },98 /**99 * Trim range which collapsed at text node boundary.100 */101 test_trim_3790: function() {102 var ct = doc.getById( '_trim_ct' );103 ct.setHtml( '<span id="_SPAN1">text</span>' );104 // <span id="_SPAN1">text^</span>105 var range = new CKEDITOR.dom.range( doc );106 range.setStartAt( doc.getById( '_SPAN1' ).getFirst(), CKEDITOR.POSITION_BEFORE_END );107 range.collapse( true );108 range.trim( true );109 // <span id="_SPAN1">text^</span>110 assert.isTrue( range.collapsed );111 assert.areEqual( doc.getById( '_SPAN1' ).$, range.startContainer.$ );112 assert.areEqual( range.startOffset, 1 );113 },114 /**115 * Trim range which collapsed inside text node.116 */117 test_trim_3790_2: function() {118 var ct = doc.getById( '_trim_ct' );119 ct.setHtml( '<span id="_SPAN1">text</span>' );120 // <span id="_SPAN1">te^xt</span>121 var range = new CKEDITOR.dom.range( doc );122 range.setStart( doc.getById( '_SPAN1' ).getFirst(), 2 );123 range.collapse( true );124 range.trim( true );125 // <span id="_SPAN1">te^xt</span>126 assert.isTrue( range.collapsed );127 assert.areEqual( doc.getById( '_SPAN1' ).$, range.startContainer.$ );128 assert.areEqual( range.startOffset, 1 );129 },130 // Test enclosed node doesn't exist.131 test_enclosed_node: function() {132 var range = new CKEDITOR.dom.range( doc );133 range.setStart( doc.getById( '_enclosed' ), 1 );134 range.setEnd( doc.getById( '_enclosed_i' ), 1 );135 // <p> Test [<i>enclosed]</i> node.</p>136 assert.isNull( range.getEnclosedNode() );137 },138 // Test enclosed node doesn't exist.139 test_enclosed_node2: function() {140 var range = new CKEDITOR.dom.range( doc );141 range.setStart( doc.getById( '_enclosed' ).getLast(), 1 );142 range.setEnd( doc.getById( '_enclosed' ).getLast(), 5 );143 // <p> Test <i>enclosed</i> [node].</p>144 assert.isNull( range.getEnclosedNode() );145 },146 // Test enclosed node exist.147 test_enclosed_node3: function() {148 var range = new CKEDITOR.dom.range( doc );149 range.setStart( doc.getById( '_enclosed' ).getFirst(), 6 );150 range.setEnd( doc.getById( '_enclosed' ).getLast(), 0 );151 // <p> Test [<i>enclosed</i>] node.</p>152 assert.isTrue( doc.getById( '_enclosed_i' ).equals( range.getEnclosedNode() ) );153 },154 /* Start of https://dev.ckeditor.com/ticket/6735 */155 'test checkReadOnly when both range boundaries are inside of read-only element': function() {156 var source = 'some <strong contenteditable="false"> sample [text</strong> and a <a href="javascript:void(0)" contenteditable="false">link]</a>',157 range = bender.tools.setHtmlWithRange( doc.getById( 'editable_playground' ), source )[ 0 ];158 assert.isTrue( range.checkReadOnly() );159 },160 'test checkReadOnly when only one range boundary is inside of read-only element': function() {161 var source = '<strong contenteditable="false"> some [sample</strong> text]',162 range = bender.tools.setHtmlWithRange( doc.getById( 'editable_playground' ), source )[ 0 ];163 assert.isTrue( range.checkReadOnly() );164 },165 'test checkReadOnly when entire range is inside of read-only element': function() {166 var source = 'some <strong contenteditable="false"> [sample text ]</strong>',167 range = bender.tools.setHtmlWithRange( doc.getById( 'editable_playground' ), source )[ 0 ];168 assert.isTrue( range.checkReadOnly() );169 },170 'test checkReadOnly when read-only element is enclosed within the range': function() {171 var source = '[some <strong contenteditable="false"> sample text </strong> and ]',172 range = bender.tools.setHtmlWithRange( doc.getById( 'editable_playground' ), source )[ 0 ];173 assert.isFalse( range.checkReadOnly() );174 },175 /* End of https://dev.ckeditor.com/ticket/6735 */176 'test checkReadOnly when entire range is enclosed in an editable element which is contained by another read-only element': function() {177 var source = 'some <strong contenteditable="false"> sample text and <a href="javascript:void(0)" contenteditable="true">a [link].</a></strong>',178 range = bender.tools.setHtmlWithRange( doc.getById( 'editable_playground' ), source )[ 0 ];179 assert.isFalse( range.checkReadOnly() );180 },181 'test removeEmptyBlocksAtEnd - at the beginning': function() {182 var source = '<div><div><p>[</p></div>te]xt</div>',183 playground = doc.getById( 'editable_playground' ),184 range = bender.tools.setHtmlWithRange( playground, source )[ 0 ];185 range.removeEmptyBlocksAtEnd();186 assert.areEqual( '<div>[te]xt</div>', bender.tools.getHtmlWithRanges( playground, new CKEDITOR.dom.rangeList( [ range ] ) ) );187 },188 'test removeEmptyBlocksAtEnd - at the end': function() {189 var source = '<div>te[xt<div><p>]</p></div></div>',190 playground = doc.getById( 'editable_playground' ),191 range = bender.tools.setHtmlWithRange( playground, source )[ 0 ];192 range.removeEmptyBlocksAtEnd( true );193 assert.areEqual( '<div>te[xt]</div>', bender.tools.getHtmlWithRanges( playground, new CKEDITOR.dom.rangeList( [ range ] ) ) );194 },195 'test removeEmptyBlocksAtEnd - leave non-empty': function() {196 var source = '<div>te[xt<div><p>]</p>x</div></div>',197 playground = doc.getById( 'editable_playground' ),198 range = bender.tools.setHtmlWithRange( playground, source )[ 0 ];199 range.removeEmptyBlocksAtEnd( true );200 assert.areEqual( '<div>te[xt<div>]x</div></div>', bender.tools.getHtmlWithRanges( playground, new CKEDITOR.dom.rangeList( [ range ] ) ) );201 },202 'test clone': function() {203 var range = new CKEDITOR.dom.range( doc );204 range.selectNodeContents( doc.getBody() );205 var range2 = range.clone();206 assert.areSame( range.root, range2.root, 'root' );207 assert.areSame( range.startContainer, range2.startContainer, 'startContainer' );208 assert.areSame( range.endContainer, range2.endContainer, 'endContainer' );209 assert.areSame( range.startOffset, range2.startOffset, 'startOffset' );210 assert.areSame( range.endOffset, range2.endOffset, 'endOffset' );211 assert.areSame( range.collapsed, range2.collapsed, 'collapsed' );212 },213 'test _setStartContainer': function() {214 var range = new CKEDITOR.dom.range( doc ),215 start = new CKEDITOR.dom.element( 'a', doc );216 doc.getBody().append( start );217 range._setStartContainer( start );218 assert.areSame( start, range.startContainer );219 },220 'test _setEndContainer': function() {221 var range = new CKEDITOR.dom.range( doc ),222 end = new CKEDITOR.dom.element( 'a', doc );223 doc.getBody().append( end );224 range._setEndContainer( end );225 assert.areSame( end, range.endContainer );226 },227 'test _getTableElement': function() {228 var range = new CKEDITOR.dom.range( doc );229 // Collapsed range inside td.230 range.setStart( doc.getById( '_td1' ).getFirst(), 1 );231 range.collapse();232 assert.isTrue( range._getTableElement().equals( doc.getById( '_td1' ) ), 'collapsed td' );233 // Collapsed range inside th.234 range = new CKEDITOR.dom.range( doc );235 range.setStart( doc.getById( '_th1' ).getFirst(), 1 );236 range.collapse();237 assert.isTrue( range._getTableElement().equals( doc.getById( '_th1' ) ), 'collapsed th' );238 // Normal range inside td.239 range = new CKEDITOR.dom.range( doc );240 range.selectNodeContents( doc.getById( '_td1' ).getFirst() );241 assert.isTrue( range._getTableElement().equals( doc.getById( '_td1' ) ), 'inside td' );242 // Partial range inside td.243 range = new CKEDITOR.dom.range( doc );244 range.setStart( doc.getById( '_td1' ).getFirst(), 1 );245 range.setEnd( doc.getById( '_td1' ).getFirst(), 3 );246 assert.isTrue( range._getTableElement().equals( doc.getById( '_td1' ) ), 'partial inside td' );247 // Selected cell.248 range = new CKEDITOR.dom.range( doc );249 range.setStartBefore( doc.getById( '_td1' ) );250 range.setEndAfter( doc.getById( '_td1' ) );251 assert.isTrue( range._getTableElement().equals( doc.getById( '_td1' ) ), 'selected td' );252 // Selected heading.253 range = new CKEDITOR.dom.range( doc );254 range.setStartBefore( doc.getById( '_th1' ) );255 range.setEndAfter( doc.getById( '_th1' ) );256 assert.isTrue( range._getTableElement().equals( doc.getById( '_th1' ) ), 'selected th' );257 // Selected thead.258 range = new CKEDITOR.dom.range( doc );259 range.setStartBefore( doc.getById( '_thead' ) );260 range.setEndAfter( doc.getById( '_thead' ) );261 assert.isTrue( range._getTableElement().equals( doc.getById( '_thead' ) ), 'selected thead' );262 // Selected tbody.263 range = new CKEDITOR.dom.range( doc );264 range.setStartBefore( doc.getById( '_tbody' ) );265 range.setEndAfter( doc.getById( '_tbody' ) );266 assert.isTrue( range._getTableElement().equals( doc.getById( '_tbody' ) ), 'selected tbody' );267 // Selected tfoot.268 range = new CKEDITOR.dom.range( doc );269 range.setStartBefore( doc.getById( '_tfoot' ) );270 range.setEndAfter( doc.getById( '_tfoot' ) );271 assert.isTrue( range._getTableElement().equals( doc.getById( '_tfoot' ) ), 'selected tfoot' );272 // Selected table.273 range = new CKEDITOR.dom.range( doc );274 range.setStartBefore( doc.getById( '_table1' ) );275 range.setEndAfter( doc.getById( '_table1' ) );276 assert.isTrue( range._getTableElement().equals( doc.getById( '_table1' ) ), 'selected table1' );277 // Selected two cells.278 range = new CKEDITOR.dom.range( doc );279 range.setStartBefore( doc.getById( '_td1' ) );280 range.setEndAfter( doc.getById( '_td2' ) );281 assert.isTrue( range._getTableElement().equals( doc.getById( '_tr2' ) ), 'selected 2 tds' );282 // Selected two cells from different tables.283 range = new CKEDITOR.dom.range( doc );284 range.setStartBefore( doc.getById( '_td2' ) );285 range.setEndAfter( doc.getById( '_td3' ) );286 assert.isNull( range._getTableElement(), 'selected 2 tds from different tables' );287 // Selected two tables.288 range = new CKEDITOR.dom.range( doc );289 range.setStartBefore( doc.getById( '_table1' ) );290 range.setEndAfter( doc.getById( '_table2' ) );291 assert.isNull( range._getTableElement(), 'selected 2 tables' );292 // Selected paragraph.293 range = new CKEDITOR.dom.range( doc );294 range.setStartBefore( doc.getById( '_P' ) );295 range.setEndAfter( doc.getById( '_P' ) );296 assert.isNull( range._getTableElement(), 'selected paragraph' );297 // Special case in Safari: selecting cell inside one-cell table.298 range = new CKEDITOR.dom.range( doc );299 range.setStartBefore( doc.getById( '_td3' ) );300 range.setEndAfter( doc.getById( '_td3' ) );301 assert.isTrue( range._getTableElement().equals( doc.getById( '_td3' ) ), 'selected td in one-cell table' );302 // Filtering returned elements.303 range = new CKEDITOR.dom.range( doc );304 range.setStartBefore( doc.getById( '_td1' ) );305 range.setEndAfter( doc.getById( '_td1' ) );306 assert.isTrue( range._getTableElement( 'tbody' ).equals( doc.getById( '_tbody' ) ), 'filtering elements' );307 }308 };309 bender.test( tests );...

Full Screen

Full Screen

load.js

Source:load.js Github

copy

Full Screen

...10 repeat: false,11 handler: function(xml) {12 xsltTrMusmp.transform(xml); // ======================================================================================13 14 if (getById('btnEditUser')) getById('btnEditUser').disabled = !(getById('tableMySQLUsers'));15 if (getById('btnDeleteUser')) getById('btnDeleteUser').disabled = !(getById('tableMySQLUsers'));16 17 if (getById('btnAddUser')) {18 getById('btnAddUser').onclick = function() { selectSection('mysqladduser'); }19 }20 21 if (getById('btnEditUser')) {22 getById('btnEditUser').onclick = function() { 23 sections.mysqledituser.queries[1] = 'mysql-edit-user username="' + getSelectedUser() + '"';24 selectSection('mysqledituser');25 }26 }27 28 if (getById('btnDeleteUser')) {29 getById('btnDeleteUser').onclick = function() { executeDeleteUser(getSelectedUser()); }30 }31 32 if (getById('btnDeleteAllUsers')) {33 getById('btnDeleteAllUsers').onclick = function() { executeDeleteAllUsers(); }34 }35 36 if (getById('btnImport')) {37 getById('btnImport').onclick = function() { selectSection('mysqlimport'); }38 }39 40 if (getById('btnProfiles')) {41 getById('btnProfiles').onclick = function() { selectSection('mysqlprofiles'); }42 }43 44 if (getById('tableMySQLUsers')) {45 var rows = document.getElementById('tableMySQLUsers').getElementsByTagName("tr");46 for(var i = 1; i < rows.length; i++) {47 rows[i].onmouseover = function() { this.style.backgroundColor='#adadad'; };48 if (i % 2 == 1) {49 rows[i].onmouseout = function() { this.style.backgroundColor='#ffffff'; };50 } else {51 rows[i].onmouseout = function() { this.style.backgroundColor='#eeeeee'; };52 }53 }54 }55 }56};57sections['mysqladduser'] = {58 label: 'AddUser',59 queries: ['proxy-status', 'mysql-add-user'],60 repeat: false,61 handler: function(xml) {62 xsltTrMusmp.transform(xml); // ======================================================================================63 if (getById('btnAbort')) {64 getById('btnAbort').onclick = function() { selectSection('mysqlusers'); }65 }66 67 additionalFieldHandler();68 69 // attach handlers to ctrl command forms70 var forms = getAllByTag('form');71 for(i = 0; i < forms.length; i++) {72 forms[i].onsubmit = function() {73 executeMySQLCtrlCmd(this.getAttribute("id"), this.elements, true);74 return false;75 };76 } 77 }78};79sections['mysqledituser'] = {80 label: 'EditUser',81 queries: ['proxy-status'],82 repeat: false,83 handler: function(xml) {84 xsltTrMusmp.transform(xml); // ======================================================================================85 if (getById('btnAbort')) {86 getById('btnAbort').onclick = function() { selectSection('mysqlusers'); }87 }88 89 additionalFieldHandler();90 91 // attach handlers to ctrl command forms92 var forms = getAllByTag('form');93 for(i = 0; i < forms.length; i++) {94 forms[i].onsubmit = function() {95 executeMySQLCtrlCmd(this.getAttribute("id"), this.elements, true);96 return false;97 };98 }99 }100};101sections['mysqlimport'] = {102 label: 'Import',103 queries: ['proxy-status', 'mysql-import'],104 repeat: false,105 handler: function(xml) {106 xsltTrMusmp.transform(xml); // ======================================================================================107 additionalFieldHandler();108 109 // attach handlers to ctrl command forms110 var forms = getAllByTag('form');111 for(i = 0; i < forms.length; i++) {112 forms[i].onsubmit = function() {113 executeMySQLCtrlCmd(this.getAttribute("id"), this.elements, true);114 return false;115 };116 }117 }118 };119sections['mysqlprofiles'] = {120 label: 'MySQLProfiles',121 queries: ['proxy-status', 'mysql-profiles'],122 repeat: false,123 handler: function(xml) {124 xsltTrMusmp.transform(xml); // ======================================================================================125 if (getById('selectProfileName')) {126 getById('selectProfileName').onchange = function() { 127 if (getById('btnAddProfile')) getById('btnAddProfile').disabled = !(this.value == "NEW");128 if (getById('btnEditProfile')) getById('btnEditProfile').disabled = (this.value == "NEW");129 if (getById('btnDeleteProfile')) getById('btnDeleteProfile').disabled = (this.value == "NEW");130 if (getById('txtProfileName')) getById('txtProfileName').value = (this.value == "NEW") ? "" : 131 this.value.substring(this.value.indexOf("%") + 1);132 if (getById('txtProfileId')) getById('txtProfileId').value = (this.value == "NEW") ? "" : 133 this.value.substring(0, this.value.indexOf("%"));134 }135 }136 137 if (getById('btnAddProfile')) {138 getById('btnAddProfile').onclick = function() { executeAddProfile(getById('txtProfileName').value); }139 }140 141 if (getById('btnEditProfile')) {142 getById('btnEditProfile').onclick = function() { executeEditProfile(getById('txtProfileId').value, getById('txtProfileName').value); }143 }144 145 if (getById('btnDeleteProfile')) {146 getById('btnDeleteProfile').onclick = function() { executeDeleteProfile(getById('txtProfileId').value); }147 }148 149 if (getById('btnDeleteAllProfiles')) {150 getById('btnDeleteAllProfiles').onclick = function() { executeDeleteAllProfiles(); }151 }152 153 }154};155function additionalFieldHandler() {156 if(getById('chkbxAllProfiles')) {157 getById('chkbxAllProfiles').onclick = function(){158 var inputs = getAllByName('chkbxProfiles');159 for(var i = 0; i < inputs.length; i++) inputs[i].checked = this.checked;160 }161 }162 var inputs = getAllByTag('input', getById('profiles'));163 for(var i = 0; i < inputs.length; i++) {164 if(inputs[i].type == 'checkbox' && inputs[i].name == 'chkbxProfiles') {165 inputs[i].onclick = function(){166 var allChecked = true;167 var inputs = getAllByName('chkbxProfiles');168 for(var i = 0; i < inputs.length; i++) {169 if(inputs[i].type == 'checkbox') allChecked = allChecked && inputs[i].checked;170 }171 getById('chkbxAllProfiles').checked = allChecked;172 };173 }174 }175 // password color helper176 if (getById('inputPassword') && getById('inputPasswordRetyped')) {177 getById('inputPassword').onblur = verifyPassword;178 getById('inputPasswordRetyped').onblur = verifyPassword;179 }180 if (getById('btnReset')) {181 getById('btnReset').onclick = function() {182 if (getById('inputPasswordRetyped')) {183 getById('inputPasswordRetyped').style.backgroundColor = "";184 }185 }186 }187}188/* ############################################################################################ */189/* extended for profiles, reset and abort buttons */190/* ############################################################################################ */191function executeMySQLCtrlCmd(cmd, elements, includeProfiles) {192 var sessionId = getCookie('sessionId');193 if(sessionId != '') {194 var xml = '<cws-command-req ver="1.0">\n';195 xml += '<session session-id="' + sessionId + '"/>\n';196 xml += '<command command="' + cmd + '"';197 for(var i = 0; i < elements.length; i++) {198 if(elements[i].type == 'hidden' && elements[i].name == 'confirm' && elements[i].value == 'true')199 if(!confirm('Execute ' + cmd + ' command?')) return;200 if(elements[i].type != 'submit' && elements[i].type != 'reset' && elements[i].id != 'btnAbort') { 201 if(elements[i].type != 'checkbox') {202 xml += ' ' + elements[i].name + '="' + elements[i].value + '"';203 }204 }205 }206 if (includeProfiles) {207 xml += ' profile_ids="';208 var profiles = getSelectedProfileIds();209 for (var i = 0; i < profiles.length; i++) {210 xml += profiles[i] + ' ';211 }212 xml += '"';213 }214 xml += '/>\n';215 xml += '</cws-command-req>';216 postXml(xml, processCtrlCmd);217 } else {218 writeLoginWindow('Login required');219 }220}221/* ############################################################################################ */222/* ctrl command elements */223/* ############################################################################################ */224 function createElement(name, value) {225 var newElement = document.createElement('input');226 newElement.name = arguments[0];227 newElement.value = arguments[1];228 return newElement;229 }230 function createConfirmElement() {231 var newElement = createElement('confirm', 'true');232 newElement.type = 'hidden';233 return newElement;234 }235/* ############################################################################################ */236/* user ctrl commands */237/* ############################################################################################ */238 function executeDeleteUser(userName) {239 executeCtrlCmd('mysql-delete-user', new Array(createConfirmElement(), createElement('username',arguments[0])), true);240 }241 function executeDeleteAllUsers() {242 executeCtrlCmd('mysql-delete-all-users', new Array(createConfirmElement()), true);243 }244/* ############################################################################################ */245/* profile ctrl commands */246/* ############################################################################################ */247 function executeAddProfile(profileName) {248 executeCtrlCmd('mysql-add-profile', new Array(createElement('profilename',arguments[0])), true);249 }250 function executeEditProfile(id, profileName) {251 executeCtrlCmd('mysql-edit-profile', new Array(createElement('id',arguments[0]), createElement('profilename',arguments[1])), true);252 }253 function executeDeleteProfile(id) {254 executeCtrlCmd('mysql-delete-profile', new Array(createConfirmElement(), createElement('id',arguments[0])), true);255 }256 function executeDeleteAllProfiles() {257 executeCtrlCmd('mysql-delete-all-profiles', new Array(createConfirmElement()), true);258 }259/* ############################################################################################ */260/* some universal functions */261/* ############################################################################################ */262 function getAllByName(name) {263 return document.getElementsByName(name);264 }265 function getSelectedUser() {266 var inputs = getAllByName('rdSelectedUser');267 for(var i = 0; i < inputs.length; i++) {268 if (inputs[i].checked) {269 return inputs[i].id;270 }271 }272 }273 function getSelectedProfileIds() {274 var inputs = getAllByName('chkbxProfiles');275 var ids = new Array();276 for(var i = 0; i < inputs.length; i++) {277 if(inputs[i].checked) ids.push(inputs[i].id);278 }279 return ids;280 }281 function verifyPassword() {282 if ((getById('inputPassword').value == "") && (getById('inputPasswordRetyped').value == "")) {283 getById('inputPasswordRetyped').style.backgroundColor = "";284 } else {285 if (getById('inputPassword').value != getById('inputPasswordRetyped').value) {286 getById('inputPasswordRetyped').style.backgroundColor = "#CD3700";287 } else {288 getById('inputPasswordRetyped').style.backgroundColor = "#A2CD5A";289 }290 }291 }292 function selectPage(pageNum) {293 sections.mysqlusers.queries[1] = 'mysql-users pageNum="' + pageNum + '"';294 clickSection('mysqlusers');295 }296 297/* ############################################################################################ */298/* plugin registration */299/* ############################################################################################ */300 function mySQLWebManagementPluginPostProcess() {301 if(getCookie('isAdmin') == 'true') {302 var newLink = document.createElement('a'); // create a new link for this section in the menu303 newLink.href = '#';304 newLink.id = 'mysqlusers';305 newLink.appendChild(document.createTextNode('MySQL-Users'));306 var adminLink = document.getElementById('admin');307 adminLink.parentNode.insertBefore(newLink, adminLink);308 adminLink.parentNode.insertBefore(document.createTextNode(' '), adminLink);309 }310 }311 function mySQLWebManagementPluginLogout() {312 hide(getById('mysqlusers'));...

Full Screen

Full Screen

info.js

Source:info.js Github

copy

Full Screen

1function shadx(a){2getbyid('y101').value=md5(a).toUpperCase();3getbyid('y102').value=sha1(a).toUpperCase();4getbyid('y103').value=sha256(a).toUpperCase();5getbyid('y111').value=sha224(a);6getbyid('y111').value=getbyid('y111').value.toUpperCase();7getbyid('y112').value=sha384(a);8getbyid('y112').value=getbyid('y112').value.toUpperCase();9getbyid('y113').value=sha512(a);10getbyid('y113').value=getbyid('y113').value.toUpperCase();11getbyid('y114').value=ripemd160(a);12getbyid('y114').value=getbyid('y114').value.toUpperCase();13}14function shaxx(a){15getbyid('y101').value=md5(a);16getbyid('y102').value=sha1(a);17getbyid('y103').value=sha256(a);18getbyid('y111').value=sha224(a);19getbyid('y112').value=sha384(a);20getbyid('y113').value=sha512(a);21getbyid('y114').value=ripemd160(a);22}23function shakaishi(a){24 var aaa=document.getElementsByTagName('input');25 if(romget('shadxk')=='dx'){26 shadx(a);27 }else{28 shaxx(a);29 }30}31//HMAC32function hmacshadx(str,key){33getbyid('y101').value=hmacmd5(str,key);34getbyid('y101').value=getbyid('y101').value.toUpperCase();35getbyid('y102').value=hmacsha1(str,key);36getbyid('y102').value=getbyid('y102').value.toUpperCase();37getbyid('y103').value=hmacsha256(str,key);38getbyid('y103').value=getbyid('y103').value.toUpperCase();39getbyid('y111').value=hmacsha224(str,key);40getbyid('y111').value=getbyid('y111').value.toUpperCase();41getbyid('y112').value=hmacsha384(str,key);42getbyid('y112').value=getbyid('y112').value.toUpperCase();43getbyid('y113').value=hmacsha512(str,key);44getbyid('y113').value=getbyid('y113').value.toUpperCase();45}46function hmacshaxx(str,key){47getbyid('y101').value=hmacmd5(str,key);48getbyid('y102').value=hmacsha1(str,key);49getbyid('y103').value=hmacsha256(str,key);50getbyid('y111').value=hmacsha224(str,key);51getbyid('y112').value=hmacsha384(str,key);52getbyid('y113').value=hmacsha512(str,key);53}54function hmacshakaishi(str,key){55 var aaa=document.getElementsByTagName('input');56 if(romget('shadxk')=='dx'){57 hmacshadx(str,key);58 }else{59 hmacshaxx(str,key);60 }61}62function shatobig(){63getbyid('y101').value=getbyid('y101').value.toUpperCase();64getbyid('y102').value=getbyid('y102').value.toUpperCase();65getbyid('y103').value=getbyid('y103').value.toUpperCase();66getbyid('y111').value=getbyid('y111').value.toUpperCase();67getbyid('y112').value=getbyid('y112').value.toUpperCase();68getbyid('y113').value=getbyid('y113').value.toUpperCase();69}70function shatosmall(){71getbyid('y101').value=getbyid('y101').value.toLowerCase();72getbyid('y102').value=getbyid('y102').value.toLowerCase();73getbyid('y103').value=getbyid('y103').value.toLowerCase();74getbyid('y111').value=getbyid('y111').value.toLowerCase();75getbyid('y112').value=getbyid('y112').value.toLowerCase();76getbyid('y113').value=getbyid('y113').value.toLowerCase();77}78//本工具可实现针对AES、DES、RC4、Rabbit、TripleDes等多种算法的密钥加密。79function kaishijiami(str,type,key){80 if(str=='' || type=='' || key==''){81 return '';82 }83switch(type){84 case "1":85 return aese(str,key);86 break;87 case "2":88 return dese(str,key);89 90 break;91 case "3":92 return rc4e(str,key);93 break;94 case "4":95 return rabbite(str,key);96 97 break;98 case "5":99 return tdese(str,key);100 break;101}102}103function kaishijiemi(str,type,key){104 if(str=='' || type=='' || key==''){105 return '';106 }107switch(type){108 case "1":109 return aesd(str,key);110 break;111 case "2":112 return desd(str,key);113 114 break;115 case "3":116 return rc4d(str,key);117 break;118 case "4":119 return rabbitd(str,key);120 121 break;122 case "5":123 return tdesd(str,key);124 break;125}126}127function kaishijinzhi(a,dq){128 if(romget('aaajsdx')=='dx'){129 for (var i =2; i <=36; i++) {130 getbyid('shou'+i).value=szjzzh(a,dq,i).toUpperCase();131 }132 }else{133 for (var i =2; i <=36; i++) {134 getbyid('shou'+i).value=szjzzh(a,dq,i);135 } 136 }137}138//短视频解析139function dxpjiexi(url){140 if(!navigator.onLine){141 alert('网络已断开,请稍后尝试!');142 return;143 }144 if(url==''){145 appalert('请输入视频链接地址~');146 return;147 }148 var a = httppost('http://api.srvv.cn/jiexi.html',{'url':url});149 a=strtorow(a);150 if(a['code']==200 || a['code']=='200'){151 152 153 //alert(getbyid('y107').src);154 //getbyid('hrefaa').src=a['data']['video'];155 getbyid('y155').value=a['data']['video'];156 //getbyid('y107a').src=getbyid('y155').value;157 getbyid('hrefaa').innerHTML=a['data']['author']+'点击这里下载.';158 getbyid('hrefaa').style.display='';159 //alert(getbyid('y107a').src);160 var video = document.getElementById("myvideo"); 161 video.style.display='';162 video.src = getbyid('y155').value;//更改视频路径163 video.poster=a['data']['cover'];164 video.load(); //加载视频165 video.play(); //视频播放166 appalert('解析成功');167 }else{168 alert('错误,请联系开发者QQ:2829969554。');169 }170 //getbyid('y106').value=a['code'];171 //var b= a.match(/免费去水印接口:(\S*)\<\/p\>/)[1];172 //alert(b);173}174//***************175/*176HTTP请求调试工具177*/178function kaishipush(){179 180var url = getbyid('qingqiuurl');181var fangshi = getbyid('qingqiufangshi');182var leixing = getbyid('qingqiuleixing');183var ua = getbyid('qingqiuua');184//var ua2 = getbyid('qingqiuua2');185//if(ua.value==''){186 //ua.value=ua2.value;187//}188 if(!navigator.onLine){189 alert('网络已断开,请稍后尝试!');190 return;191 }192 if(url.value==''){193 appalert('请输入请求目标地址URL~');194 return;195 }196var host = getbyid('qingqiuhost');197var referer = getbyid('qingqiureferer');198var head = getbyid('qingqiuhead');199var cookies = getbyid('qingqiucookies');200var text = getbyid('qingqiutext');201var outhead=getbyid('xiangyinhead');202var outtext=getbyid('xiangyingtext');203/*204url.value='http://192.168.1.100/login.html';205host.value='127.0.0.1';206referer.value='http://127.0.0.1';207head.value='abc:123\nbcd:456';208cookies.value='tc=123456;tc=123456;';*/209//text.value='checkid=admin&checkid=admin';210//text.value='{"checkid":"admin"}';211//outhead.value='ohead';212//outtext.value='otext';213console.log(leixing.value,fangshi.value);214//eval('(' + text.value + ')');215var xtjnr=text.value;216var xtjnrlx=leixing.value;217if(xtjnrlx=='application/json2'){218 if(isJSON(text.value)){219 xtjnr=eval('(' + text.value + ')');220 xtjnrlx='application/x-www-form-urlencoded';221 }else{222 alert('json转表单失败:json不规范!');223 return;224 }225 226}227$.ajax({228 type: fangshi.value,229 url: url.value,230 contentType:xtjnrlx,231 data: xtjnr,232 success: function(data,status){233 //outtext.value=JSON.stringify(data);234 console.log('yes',typeof(data),data,status);235 switch (typeof(data)){236 case 'object':237 outtext.value=JSON.stringify(data);238 break;239 case 'string':240 outtext.value=data;241 break;242 }243 },244 error:function(a,b){245 console.log('错误');246 //outhead.value='错误:'+b;247 },248 processData:true,249 complete:function(xml,status){250 console.log('com',xml,status,xml.getAllResponseHeaders());251 if(plus.navigator.getCookie(url.value)!=null){252 outhead.value=xml.getAllResponseHeaders()+"Set-Cookie:"+plus.navigator.getCookie(url.value)+"\n";253 254 }else{255 outhead.value=xml.getAllResponseHeaders();256 }257 getbyid("zhuangtaima").innerHTML=xml.status+"("+xml.statusText+")";258 getbyid("zhuangtai").innerHTML=status;259 if(xml.responseXML){260 getbyid("zhuangtaileixing").innerHTML='XML对象';261 }262 if(xml.responseJSON){263 getbyid("zhuangtaileixing").innerHTML='JSON对象';264 }else{265 getbyid("zhuangtaileixing").innerHTML='Text';266 }267 getbyid("yanshifu").style.display='none';268 },269 beforeSend:function(xhr){270 //xhr.withCredential=true;271 //plus.android.setRequestHeader('referer',referer.value);272 273 plus.navigator.setCookie(url.value,cookies.value);274 getbyid("yanshifu").style.display='';275 if(head.value !='' ){276 let row =head.value.split("\n");277 for (var i = 0; i < row.length; i++) {278 let str=row[i].split(":");279 xhr.setRequestHeader(str[0], str[1]);280 }281 }282 }283});284}285function kaishiqingchu(){286var url = getbyid('qingqiuurl');287plus.navigator.removeAllCookie();288var fangshi = getbyid('qingqiufangshi');289var leixing = getbyid('qingqiuleixing');290var ua = getbyid('qingqiuua');291var host = getbyid('qingqiuhost');292var referer = getbyid('qingqiureferer');293var head = getbyid('qingqiuhead');294var cookies = getbyid('qingqiucookies');295var text = getbyid('qingqiutext');296var outhead=getbyid('xiangyinhead');297var outtext=getbyid('xiangyingtext');298url.value='';299host.value='';300referer.value='';301head.value='';302cookies.value='';303text.value='';304romset('dqurl','');305romset('dqxyt','');306romset('dqcookie','');307romset('dqtext','');308outhead.value='';309outtext.value='';310}311//保存视频到本地312function appdownload(imgUrl){313 if(imgUrl !=''){314 //imgUrl 图片网络路径315 var timestamp = (new Date()).valueOf();316 var downLoader = plus.downloader.createDownload(imgUrl, {317 method: 'GET',318 filename: '_downloads/image/' + timestamp + '.mp4'319 }, function(download, status) {320 if(status==200){321 var fileName = download.filename;322 /**323 * 保存至本地相册324 */325 plus.gallery.save(fileName, function() {326 alert("下载成功,已保存~"); 327 },function(){328 alert("保存失败,请重试"); 329 });330 }else{331 alert("下载失败,请重试"); 332 }333 });334 downLoader.start(); 335 336 }else{337 appalert("下载地址为空,请先解析~"); 338 }339 ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var pact = require('pact-foundation/pact-node');2pact.getById('pact-test', 1).then(function (pact) {3 console.log(pact);4});5var pact = require('pact-foundation/pact-node');6pact.getAll('pact-test').then(function (pacts) {7 console.log(pacts);8});9var pact = require('pact-foundation/pact-node');10pact.removeById('pact-test', 1).then(function () {11 console.log('Pact deleted');12});13var pact = require('pact-foundation/pact-node');14pact.removeAll('pact-test').then(function () {15 console.log('Pacts deleted');16});17var pact = require('pact-foundation/pact-node');18pact.publishPact({19}).then(function () {20 console.log('Pact contract publishing complete!')21 console.log('')22});

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 pact-foundation-pact 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