Best JavaScript code snippet using playwright-internal
inlines.test.js
Source:inlines.test.js
1/* global QUnit */2'use strict';3QUnit.module('admin.inlines: tabular formsets', {4 beforeEach: function() {5 const $ = django.jQuery;6 const that = this;7 this.addText = 'Add another';8 $('#qunit-fixture').append($('#tabular-formset').text());9 this.table = $('table.inline');10 this.inlineRow = this.table.find('tr');11 this.inlineRow.tabularFormset('table.inline tr.form-row', {12 prefix: 'first',13 addText: that.addText,14 deleteText: 'Remove'15 });16 }17});18QUnit.test('no forms', function(assert) {19 assert.ok(this.inlineRow.hasClass('dynamic-first'));20 assert.equal(this.table.find('.add-row a').text(), this.addText);21});22QUnit.test('add form', function(assert) {23 const addButton = this.table.find('.add-row a');24 assert.equal(addButton.text(), this.addText);25 addButton.click();26 assert.ok(this.table.find('#first-1'));27});28QUnit.test('added form has remove button', function(assert) {29 const addButton = this.table.find('.add-row a');30 assert.equal(addButton.text(), this.addText);31 addButton.click();32 assert.equal(this.table.find('#first-1 .inline-deletelink').length, 1);33});34QUnit.test('add/remove form events', function(assert) {35 assert.expect(6);36 const $ = django.jQuery;37 const $document = $(document);38 const addButton = this.table.find('.add-row a');39 $document.on('formset:added', function(event, $row, formsetName) {40 assert.ok(true, 'event `formset:added` triggered');41 assert.equal(true, $row.is('#first-1'));42 assert.equal(formsetName, 'first');43 $document.off('formset:added');44 });45 addButton.click();46 const deletedRow = $('#first-1');47 const deleteLink = this.table.find('.inline-deletelink');48 $document.on('formset:removed', function(event, $row, formsetName) {49 assert.ok(true, 'event `formset:removed` triggered');50 assert.equal(true, $row.is(deletedRow));51 assert.equal(formsetName, 'first');52 $document.off('formset:removed');53 });54 deleteLink.trigger($.Event('click', {target: deleteLink}));55});56QUnit.test('existing add button', function(assert) {57 const $ = django.jQuery;58 $('#qunit-fixture').empty(); // Clear the table added in beforeEach59 $('#qunit-fixture').append($('#tabular-formset').text());60 this.table = $('table.inline');61 this.inlineRow = this.table.find('tr');62 this.table.append('<i class="add-button"></i>');63 const addButton = this.table.find('.add-button');64 this.inlineRow.tabularFormset('table.inline tr', {65 prefix: 'first',66 deleteText: 'Remove',67 addButton: addButton68 });69 assert.equal(this.table.find('.add-row a').length, 0);70 addButton.click();71 assert.ok(this.table.find('#first-1'));72});73QUnit.module('admin.inlines: tabular formsets with validation errors', {74 beforeEach: function() {75 const $ = django.jQuery;76 $('#qunit-fixture').append($('#tabular-formset-with-validation-error').text());77 this.table = $('table.inline');78 this.inlineRows = this.table.find('tr.form-row');79 this.inlineRows.tabularFormset('table.inline tr.form-row', {80 prefix: 'second'81 });82 }83});84QUnit.test('first form has delete checkbox and no button', function(assert) {85 const tr = this.inlineRows.slice(0, 1);86 assert.ok(tr.hasClass('dynamic-second'));87 assert.ok(tr.hasClass('has_original'));88 assert.equal(tr.find('td.delete input').length, 1);89 assert.equal(tr.find('td.delete .inline-deletelink').length, 0);90});91QUnit.test('dynamic form has remove button', function(assert) {92 const tr = this.inlineRows.slice(1, 2);93 assert.ok(tr.hasClass('dynamic-second'));94 assert.notOk(tr.hasClass('has_original'));95 assert.equal(tr.find('.inline-deletelink').length, 1);96});97QUnit.test('dynamic template has nothing', function(assert) {98 const tr = this.inlineRows.slice(2, 3);99 assert.ok(tr.hasClass('empty-form'));100 assert.notOk(tr.hasClass('dynamic-second'));101 assert.notOk(tr.hasClass('has_original'));102 assert.equal(tr.find('td.delete')[0].innerHTML, '');103});104QUnit.test('removing a form-row also removed related row with non-field errors', function(assert) {105 const $ = django.jQuery;106 assert.ok(this.table.find('.row-form-errors').length);107 const tr = this.inlineRows.slice(1, 2);108 const trWithErrors = tr.prev();109 assert.ok(trWithErrors.hasClass('row-form-errors'));110 const deleteLink = tr.find('a.inline-deletelink');111 deleteLink.trigger($.Event('click', {target: deleteLink}));112 assert.notOk(this.table.find('.row-form-errors').length);113});114QUnit.module('admin.inlines: tabular formsets with max_num', {115 beforeEach: function() {116 const $ = django.jQuery;117 $('#qunit-fixture').append($('#tabular-formset-with-validation-error').text());118 this.table = $('table.inline');119 this.maxNum = $('input.id_second-MAX_NUM_FORMS');120 this.maxNum.val(2);121 this.inlineRows = this.table.find('tr.form-row');122 this.inlineRows.tabularFormset('table.inline tr.form-row', {123 prefix: 'second'124 });125 }126});127QUnit.test('does not show the add button if already at max_num', function(assert) {128 const addButton = this.table.find('tr.add_row > td > a');129 assert.notOk(addButton.is(':visible'));130});131QUnit.test('make addButton visible again', function(assert) {132 const $ = django.jQuery;133 const addButton = this.table.find('tr.add_row > td > a');134 const removeButton = this.table.find('tr.form-row:first').find('a.inline-deletelink');135 removeButton.trigger($.Event( "click", { target: removeButton } ));136 assert.notOk(addButton.is(':visible'));137});138QUnit.module('admin.inlines: tabular formsets with min_num', {139 beforeEach: function() {140 const $ = django.jQuery;141 $('#qunit-fixture').append($('#tabular-formset-with-validation-error').text());142 this.table = $('table.inline');143 this.minNum = $('input#id_second-MIN_NUM_FORMS');144 this.minNum.val(2);145 this.inlineRows = this.table.find('tr.form-row');146 this.inlineRows.tabularFormset('table.inline tr.form-row', {147 prefix: 'second'148 });149 }150});151QUnit.test('does not show the remove buttons if already at min_num', function(assert) {152 assert.notOk(this.table.find('.inline-deletelink:visible').length);153});154QUnit.test('make removeButtons visible again', function(assert) {155 const $ = django.jQuery;156 const addButton = this.table.find('tr.add-row > td > a');157 addButton.trigger($.Event( "click", { target: addButton } ));158 assert.equal(this.table.find('.inline-deletelink:visible').length, 2);...
searchbuttons.js
Source:searchbuttons.js
...24 var whereAppend = $($("body"));25 console.log(whereAppend);26 var sel = getSelected();27 28 function addButton(sName, url)29 {30 var sButton = '<button class="rickdog">' + sName + '</button>';31 var btn = $(sButton).click(function () {32 window.open(url, '_blank');33 });34 whereAppend.append(btn);35 }36 whereAppend.append($("<B>" + sel + "</B><br>"));37 addButton('Google', 'https://google.com?q=' + quote(sel));38 addButton('Google Blog', 'https://google.com?q=' + quote(sel) + '&tbm=blg');39 addButton('Google Image', 'https://www.google.com/searchbyimage?image_url=' + quote(sel));40 addButton('tineye', 'http://tineye.com/search?url=' + quote(sel));41 addButton('DDGG', 'https://duckduckgo.com/?ia=audio&q=' + quote(sel));42 addButton('mail.ru', 'http://go.mail.ru/search?q=' + quote(sel));43 addButton('Inoreader', 'http://www.inoreader.com/search/' + quote(sel) + '/public');44 addButton('Feedly', 'http://feedly.com/i/search/' + sel + '/all/engagement.any/any/topic/global.popular');45 addButton('Spotify', 'https://play.spotify.com/search/' + sel);46 addButton('reviews', 'http://developer.echonest.com/api/v4/artist/reviews?format=json&api_key=FEQK8YEAC4WDXAWSP&results=100&name=' + sel);47 addButton('AllMusic', 'http://www.allmusic.com/search/all/' + sel);48 addButton('MBrainz', 'http://musicbrainz.org/search?type=release&query=' + sel);49 addButton('Discogs', 'http://www.discogs.com/search/?type=all&q=' + sel);50 addButton('Ranker', 'http://www.ranker.com/app/search.htm?q=' + sel);51 addButton('viewMe', 'http://www.viewme.com/search?q=' + sel);52 addButton('myzuka.org', 'http://go.mail.ru/search_site?p=1&aux=PLA099&q=' + sel);53 addButton('GenFile', 'http://www.generalfil.es/?qa=' + sel);54 addButton('GenSearch', 'http://www.general-search.net/download/' + sel);55 addButton('FBug', 'http://www.filesbug.com/search/' + sel);56 addButton('FDeck', 'http://filesdeck.com/search.php?q=' + sel);57 addButton('Ebookee', 'http://ebookee.org/search.php?q=' + sel);58 addButton('Avax', 'http://avaxsearch.org/search?q=' + sel);59 addButton('mp3releases', 'http://mp3releases.org/search/' + sel);60 addButton('Taringa', 'http://www.taringa.net/buscar/?q=' + sel);61 addButton('sharedir', 'http://sharedir.com/index.php?s=' + sel);62 addButton('downloadstube', 'http://www.downloadstube.net/' + sel + '/DDLs.html');63 addButton('RSE', 'http://rapid-search-engine.com/index-s=' + sel + ".html");64 addButton('ULOZ', 'http://www.ulozto.net/hledej?q=' + sel);65 addButton('fileKnow', 'http://fileknow.org/' + sel);66 addButton('fileTram', 'http://filetram.com/' + sel);67 addButton('byDuck', 'http://www.byduck.com/?s=' + sel);68 addButton('media-tube', 'http://media-tube.me/?do=search&subaction=search&story=' + sel);69 addButton('NoNaMe', 'http://nnm.me/search?in=news&q=' + sel);70 addButton('NNC', 'http://go.mail.ru/search_site?p=%5Bobject+Object%5D&aux=nK3H8d&q=' + sel);71 addButton('waretube', 'http://waretube.org/index.php?do=search&do=search&full_search=0&result_from=1&search_start=1&subaction=search&story=' + sel);72 addButton('FileSkull', 'http://www.filesal.com/search.php?q=' + sel);73 addButton('cdBaby', 'http://www.cdbaby.com/?q=' + sel);74 addButton('tehparadox', 'http://tehparadox.com/forum/search.php?do=process&quicksearch=1&childforums=1&showposts=0&exactname=1&s=&securitytoken=1425005892-87caad13ca34df98b139e467ff9f838b2cc242a2&query=' + sel);75 addButton('NeThing', 'http://nethingoez.com/index.php?app=core&module=search&do=search&fromMainBar=1&search_app=forums&search_term=' + sel);76 addButton('fileCatch', 'http://filecatch.com/?q=' + sel);77 addButton('MFT', 'http://mediafiretrend.com/?q=' + sel);78 addButton('tfile.me', 'http://tfile.me/forum/ssearch.php?q=' + sel);79 addButton('rutracker', 'http://rutracker.org/forum/tracker.php?nm=' + sel);80 addButton('bitsnoop', 'http://bitsnoop.com/search/all/' + sel);81 addButton('bestDL', 'https://www.bestdownload.eu/search?f=' + sel);82 addButton('ruhunt', 'http://ruhunt.org/search?q=' + sel);83 addButton('realmt', 'http://realmt.org/tracker.php?max=1&to=1&nm=' + sel);84 addButton('filespr', 'http://www.filespr.me/' + sel.toString().toLowerCase() [0] + '/' + sel);85 addButton('byFiles', 'http://byfiles.com/search/' + sel);86 var html = '<form method="post" action="http://www.filesloop.com/search/" target="_blank"><input type="text" id="search" value="XXX" name="search" style="display:none"></input><input type="submit" value="FilesLoop"></input></form>';87 html = html.replace('XXX', sel);88 whereAppend.append($(html));89 $(".rickdog")[0].scrollIntoView();90}91(function() {92 var script = document.createElement('script');93 script.src = '//code.jquery.com/jquery.min.js';94 if(script.addEventListener) {95 script.addEventListener("load", loaded, false);96 } else {97 script.onreadystatechange = function() {98 if (this.readyState=="complete"){99 loaded();...
my_quicktags.js
Source:my_quicktags.js
1QTags.addButton( 'zyy', 'å¼ç¨', "<blockquote>", "</blockquote>\n" );//æ·»å å¼ç¨2QTags.addButton( 'hr', '横线', "<hr />\n" );//æ·»å 横线3QTags.addButton( 'h2', 'H2æ ç¾', "<h2>", "</h2>\n" ); //æ·»å æ é¢24QTags.addButton( 'h3', 'H3æ ç¾', "<h3>", "</h3>\n" ); //æ·»å æ é¢35QTags.addButton( 'shsj', 'é¦è¡ç¼©è¿', " " );6QTags.addButton( 'hc', 'å车', "<br />" );7QTags.addButton( 'jz', 'å±
ä¸', "<center>","</center>" );8QTags.addButton( 'mark', 'é»å', "<mark>","</mark>" );9QTags.addButton( 'xhx', 'ä¸å线', "<u>","</u>" );10QTags.addButton( 'g</>', '</>', "<", ">" );11QTags.addButton( 'ipre', '代ç é«äº®', '<pre class="prettyprint linenums" >\n\n</pre>', "" );//æ·»å é«äº®ä»£ç 12QTags.addButton( 'ilinks', 'é¾æ¥æé®', "[dm href='']", "[/dm]" );13QTags.addButton( 'idownload', 'ä¸è½½æé®', "[dl href='']", "[/dl]" );14QTags.addButton( 'ikaiyuan', 'å¼æºæé®', "[gt href='']å¼æºå°å[/gt]", "" );15QTags.addButton( 'v_notice', '绿è²éç¥', "[v_notice]", "[/v_notice]" );16QTags.addButton( 'v_error', '红è²è¦å', "[v_error]", "[/v_error]" );17QTags.addButton( 'v_warn', 'é»è²é误', "[v_warn]", "[/v_warn]" );18QTags.addButton( 'v_tips', 'ç°è²æ示', "[v_tips]", "[/v_tips]" );19QTags.addButton( 'v_blue', 'èè²æ示', "[v_blue]", "[/v_blue]" );20QTags.addButton( 'v_act', 'èè¾¹ææ¬', "[v_act]", "[/v_act]" );21QTags.addButton( 'bs_notice', 'BS绿è²', '<div class="alert alert-success" role="alert">', '</div>' );22QTags.addButton( 'bs_error', 'BSèè²', '<div class="alert alert-info" role="alert">', '</div>' );23QTags.addButton( 'bs_warn', 'BSé»è²', '<div class="alert alert-warning" role="alert">', '</div>' );24QTags.addButton( 'bs_tip', 'BS红è²', '<div class="alert alert-error" role="alert">', '</div>' );25QTags.addButton( 'gb', '绿è²æé®', "[gb href='']", "[/gb]" );26QTags.addButton( 'bb', 'èè²æé®', "[bb href='']", "[/bb]" );27QTags.addButton( 'yb', 'é»è²æé®', "[yb href='']", "[/yb]" );28QTags.addButton( 'lhb', 'éææé®', "[lhb href='']", "[/lhb]" );29QTags.addButton( 'netmusic', 'ç½æäºé³ä¹', "[netmusic play='1']", "[/netmusic]" );30QTags.addButton( 'video', 'è§é¢æé®', "[video play='0']", "[/video]" );31QTags.addButton( 'audio', 'é³é¢æé®', "[audio play='0']", "[/audio]" );32QTags.addButton( 'collapse', 'éèæ¶ç¼©', '[collapse title=""]\n\n[/collapse]', "" );33QTags.addButton( 'reply', 'åå¤å¯è§', "[reply]", "[/reply]" );34QTags.addButton( 'vip', 'ç»å½å¯è§', "[vip]", "[/vip]" );35QTags.addButton( 'mimakejian', 'å¯ç å¯è§', '[secret wx=0]', '[/secret]' );36QTags.addButton( 'fancydl', 'å¼¹çªä¸è½½', "[fanctdl filename='è¿éå¡«åæ件å' filesize='è¿éå¡«åæ件大å°' href='è¿éå¡«åç主ä¸è½½é¾æ¥' filedown='è¿éå¡«åçæ¯æ件ç主ä¸è½½å称']è¿éå¡«åçæ件çè¾
å©ä¸è½½é¾æ¥ï¼Aæ ç¾å³å¯ï¼[/fanctdl]" );37QTags.addButton( 'dltable', 'ä¸è½½é¢æ¿', '[dltable file="å¨æ¤å¤åä¸æ件å称" size="å¨è¿éåä¸æ件大å°"]è¿éçæ件ä¸è½½Aæ ç¾é¾æ¥ï¼å¯ä»¥æ¾å¤ä¸ªé¾æ¥[/dltable]' );38QTags.addButton( 'download', 'å页ä¸è½½', "[download]", "[/download]" );39QTags.addButton( 'nextpage', 'ä¸ä¸é¡µ', '<!--nextpage-->', "" );40QTags.addButton( 'demo', '代ç æ¼ç¤º', "[demo]", "[/demo]" );41QTags.addButton( 'phpcode', 'è¿è¡PHP', '[phpcode file="æ件å"]', "" );42QTags.addButton( 'nl', 'æç« å
é¾', '[neilian ids=]', '');43QTags.addButton( 'wl', 'æç« å¤é¾', '[wailian]', '[/wailian]');44QTags.addButton( 'ulli', 'æ åºå表', '[list]', '[/list]' );45QTags.addButton( 'pay', 'ä¼åä»è´¹æ¥ç', '[pay point="10"]\nè¿éæ¯éè¦ä»è´¹çå
容\n[/pay]', '' );46QTags.addButton( 'pax', '游客ä»è´¹æ¥ç', '[pax money=1]', '' );...
plugin.js
Source:plugin.js
...4 init: function( editor ) {5 var lang = editor.lang.table;6 //---------- BUTTONS7 //-----------BUTTONS > table8 editor.ui.addButton( 'tableinsert', {9 label: lang.toolbar,10 command: 'table',11 toolbar: 'table'12 });13 editor.ui.addButton( 'tabledelete', {14 label: lang.deleteTable,15 command: 'tableDelete',16 toolbar: 'table'17 });18 editor.ui.addButton( 'tableproperties', {19 label: lang.menu,20 command: 'tableProperties',21 toolbar: 'table'22 });23 //TODO: How to add separator?24 //-----------BUTTONS > tabletools25 //-----------BUTTONS > tabletools > row26 editor.ui.addButton( 'tablerowinsertbefore', {27 label: lang.row.insertBefore,28 command: 'rowInsertBefore',29 toolbar: 'tablerow'30 });31 editor.ui.addButton( 'tablerowinsertafter', {32 label: lang.row.insertAfter,33 command: 'rowInsertAfter',34 toolbar: 'tablerow'35 });36 editor.ui.addButton( 'tablerowdelete', {37 label: lang.row.deleteRow,38 command: 'rowDelete',39 toolbar: 'tablerow'40 });41 //-----------BUTTONS > tabletools > column42 editor.ui.addButton( 'tablecolumninsertbefore', {43 label: lang.column.insertBefore,44 command: 'columnInsertBefore',45 toolbar: 'tablecolumn'46 });47 editor.ui.addButton( 'tablecolumninsertafter', {48 label: lang.column.insertAfter,49 command: 'columnInsertAfter',50 toolbar: 'tablecolumn'51 });52 editor.ui.addButton( 'tablecolumndelete', {53 label: lang.column.deleteColumn,54 command: 'columnDelete',55 toolbar: 'tablecolumn'56 });57 //-----------BUTTONS > tabletools > cell58 editor.ui.addButton( 'tablecellinsertbefore', {59 label: lang.cell.insertBefore,60 command: 'cellInsertBefore',61 toolbar: 'tablecell'62 });63 64 editor.ui.addButton( 'tablecellinsertafter', {65 label: lang.cell.insertAfter,66 command: 'cellInsertAfter',67 toolbar: 'tablecell'68 });69 editor.ui.addButton( 'tablecelldelete', {70 label: lang.cell.deleteCell,71 command: 'cellDelete',72 toolbar: 'tablecell'73 });74 editor.ui.addButton( 'tablecellproperties', {75 label: lang.cell.title,76 command: 'cellProperties',77 toolbar: 'tablecell'78 });79 //-----------BUTTONS > tabletools > cell merge/split80 editor.ui.addButton( 'tablecellsmerge', {81 label: lang.cell.merge,82 command: 'cellMerge',83 toolbar: 'tablecellmergesplit'84 });85 editor.ui.addButton( 'tablecellmergeright', {86 label: lang.cell.mergeRight,87 command: 'cellMergeRight',88 toolbar: 'tablecellmergesplit'89 });90 editor.ui.addButton( 'tablecellmergedown', {91 label: lang.cell.mergeDown,92 command: 'cellMergeDown',93 toolbar: 'tablecellmergesplit'94 });95 editor.ui.addButton( 'tablecellsplithorizontal', {96 label: lang.cell.splitHorizontal,97 command: 'cellHorizontalSplit',98 toolbar: 'tablecellmergesplit'99 });100 editor.ui.addButton( 'tablecellsplitvertical', {101 label: lang.cell.splitVertical,102 command: 'cellVerticalSplit',103 toolbar: 'tablecellmergesplit'104 });105 }...
buttons.js
Source:buttons.js
1(function() {2 tinymce.create('tinymce.plugins.MyButtons', {3 init : function(ed, url) {4 ed.addButton( 'down', {5 title : 'å¼¹çªä¸è½½é¾æ¥',6 image : '', 7 text: '',8 icon: 'nonbreaking',9 onclick : function() {10 ed.selection.setContent('[button]' + ed.selection.getContent() + 'æé®å称[/button]');11 }12 });13 14 ed.addButton( 'url', {15 title : 'é¾æ¥æé®',16 icon: 'newtab',17 onclick : function() {18 ed.selection.setContent('[url href=' + ed.selection.getContent() + 'é¾æ¥å°å]æé®å称[/url]');19 }20 });21 ed.addButton( 'videos', {22 title : 'æ·»å è§é¢',23 icon: 'media',24 onclick : function() {25 ed.selection.setContent('[videos href=è§é¢ä»£ç ]å¾çé¾æ¥' + ed.selection.getContent() + '[/videos]');26 }27 });28 ed.addButton( 'img', {29 title : 'æ·»å ç¸å',30 icon: 'image',31 onclick : function() {32 ed.selection.setContent('[img]æå
¥å¾ç' + ed.selection.getContent() + '[/img]');33 }34 });35 ed.addButton( 'slide', {36 title : 'æ·»å å¹»ç¯(å¯èªå®ä¹é«åº¦)',37 icon: 'image',38 onclick : function() {39 ed.selection.setContent('[slide h=é«åº¦]æå
¥å¾ç' + ed.selection.getContent() + '[/slide]');40 }41 });42 ed.addButton( 'reply', {43 title : 'åå¤å¯è§',44 icon: 'bubble',45 onclick : function() {46 ed.selection.setContent('[reply]éèçå
容' + ed.selection.getContent() + '[/reply]');47 }48 });49 ed.addButton( 'login', {50 title : 'ç»å½å¯è§',51 icon: 'user',52 onclick : function() {53 ed.selection.setContent('[login]éèçå
容' + ed.selection.getContent() + '[/login]');54 }55 });56 ed.addButton( 'password', {57 title : 'å¯ç ä¿æ¤',58 icon: 'lock',59 onclick : function() {60 ed.selection.setContent('[password key=å¯ç ]' + ed.selection.getContent() + 'å å¯çå
容[/password]');61 }62 });63 ed.addButton( 'addcode', {64 title : 'æ·»å 代ç ',65 icon: 'code',66 onclick : function() {67 ed.selection.setContent('[code]' + ed.selection.getContent() + '[/code]');68 }69 });70 ed.addButton( 'addfolding', {71 title : 'æåæå ',72 icon: 'pluscircle',73 onclick : function() {74 ed.selection.setContent('[s][p]<p>éèçæå</p>' + ed.selection.getContent() + '<p>[/p]</p>');75 }76 });77 ed.addButton( 'field', {78 title : 'fieldsetæ ç¾',79 icon: 'template',80 onclick : function() {81 ed.selection.setContent('<fieldset><legend>ææ¯æ é¢</legend>è¿éæ¯å
容</fieldset>' + ed.selection.getContent() + '');82 }83 });84 ed.addButton( 'ad', {85 title : 'æå
¥å¹¿å',86 icon: 'fill',87 onclick : function() {88 ed.selection.setContent('[ad]' + ed.selection.getContent() + '');89 }90 });91 },92 createControl : function(n, cm) {93 return null;94 },95 });96 tinymce.PluginManager.add( 'begin_button_script', tinymce.plugins.MyButtons );...
quicktags.js
Source:quicktags.js
1/* ææ¬ç¼è¾å¿«æ·æé® */2if ( typeof QTags != 'undefined' ) { 3QTags.addButton( 'wp_page', 'å页æé®', "<!--nextpage-->\n", "" );4QTags.addButton( 'hr', 'hr åå²çº¿', "\n<hr/>\n", "" );5QTags.addButton( 'h1', 'h1 æ é¢', '<h1>è¾å
¥å
容</h1>');6QTags.addButton( 'h2', 'h2 æ é¢', '<h2>è¾å
¥å
容</h2>');7QTags.addButton( 'h3', 'h3 æ é¢', '<h3>è¾å
¥å
容</h3>');8QTags.addButton( 'h4', 'h4 æ é¢', '<h4>è¾å
¥å
容</h4>');9QTags.addButton( 'chatl', '左边è¯æ¡', '[chatl][/chatl]', '' );10QTags.addButton( 'chatr', 'å³è¾¹è¯æ¡', '[chatr][/chatr]', '' ); 11QTags.addButton( 'pullquote', 'Pullquote', '[pullquote]å¡«åå
容[/pullquote]', '' ); 12QTags.addButton( 'marker', 'è§å
ç¬ææ', '<span class="marker">å¡«åå
容</span>', '' ); 13QTags.addButton( 'marker-under', 'è§å
ç¬ææ2', '<span class="marker-under">å¡«åå
容</span>', '' );14QTags.addButton( 'red-under', 'ä¸ç»çº¢çº¿', '<span class="red-under">å¡«åå
容</span>', '' );15QTags.addButton( 'Yellow-under', 'ä¸ç»é»çº¿', '<span class="yellow-under">å¡«åå
容</span>', '' );16QTags.addButton( 'key-word', 'å
³é®è¯', '<span class="key-word">å¡«åå
容</span>', '' ); 17QTags.addButton( 'videoin', 'è§é¢ç代ç ', '[videoin]å¡«åè§é¢å°å[/videoin]');18QTags.addButton( 'code_highlight', 'css 代ç é«äº®', '<pre><code class="language-css">å¤å¶ä»£ç å°æ¤</code></pre>');19QTags.addButton( 'code_highlight2', 'php 代ç é«äº®', '<pre><code class="language-php">转ä¹åç代ç å¤å¶å°æ¤</code></pre>');20QTags.addButton( 'code_highlight3', 'javascript 代ç é«äº®', '<pre><code class="language-javascript">å¤å¶ä»£ç å°æ¤</code></pre>');21QTags.addButton( 'time-line-style-list', 'æ¶é´è½´å表', '<div id="update" class="applicant__timeline"><ul>æå
¥å¾
å/è¦ç¤º/å®æäºé¡¹</ul></div>');22QTags.addButton( 'do-list', 'å¾
å', '<li><div>å¡«å项ç®æè¿°å
容<br><span class="time-ago">å¡«å项ç®æ¶é´</span></div></li>');23QTags.addButton( 'warning-list', 'è¦ç¤ºæç¹å«è¯´æ', '<li class="warning"><div>å¡«å说æå
容</div></li>');24QTags.addButton( 'finish-list', 'å®æäºé¡¹è¯´æ', '<li class="success"><div>å¡«åäºé¡¹å
容<br><span class="time-ago">å¡«åæ¶é´</span></div></li>');...
view.js
Source:view.js
1// Copyright (c) 2012 The Chromium Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4function View(calcModel) {5 this.calcElement = $('#calc');6 this.BuildWidgets();7 var displayElement = $('#display');8 $('.calc-button').click(function() {9 displayElement.val(calcModel.HandleButtonClick($(this).val()));10 });11}12View.prototype.BuildWidgets = function() {13 this.AddDisplay(this.calcElement);14 this.AddButtons(this.calcElement);15}16View.prototype.AddDisplay = function() {17 this.displayElement = this.calcElement.append(18 '<input id="display" class="calc-display" type="text" value="0" />');19}20View.prototype.AddButtons = function() {21 var row;22 row = this.AddRow();23 this.AddButton(row, 7);24 this.AddButton(row, 8);25 this.AddButton(row, 9);26 this.AddButton(row, '-');27 row = this.AddRow();28 this.AddButton(row, 4);29 this.AddButton(row, 5);30 this.AddButton(row, 6);31 this.AddButton(row, '+');32 row = this.AddRow();33 this.AddButton(row, 1);34 this.AddButton(row, 2);35 this.AddButton(row, 3);36 this.AddButton(row, 'C');37 row = this.AddRow();38 this.AddButton(row, 0, true);39 this.AddButton(row, '=', true);40}41View.prototype.AddRow = function() {42 var row = $('<div/>');43 this.calcElement.append(row);44 return row;45}46View.prototype.AddButton = function(row, value, big) {47 var class_suffix = big ? ' big' : '';48 row.append('<input class="calc-button' + class_suffix +49 '" type="button" value="' +50 value + '" />');...
add-new.js
Source:add-new.js
1/*global jQuery, _, Backbone, Marionette, wp */2import template from 'pods-dfv/_src/pick/views/add-new.html';3import { PodsFieldView } from 'pods-dfv/_src/core/pods-field-views';4const DISABLED_CLASS = 'button-disabled';5export const AddNew = PodsFieldView.extend( {6 childViewEventPrefix: false, // Disable implicit event listeners in favor of explicit childViewTriggers and childViewEvents7 tagName: 'div',8 className: 'podsform-dfv-list-relationship-container',9 ui: {10 addButton: 'a.pods-related-add-new'11 },12 template: _.template( template ),13 triggers: {14 'click @ui.addButton': 'add:new:click'15 },16 /**17 *18 */19 disable: function () {20 const addButton = this.getUI( 'addButton' );21 addButton.addClass( DISABLED_CLASS ); // Note: this just styles the link (button), click event enforces22 },23 /**24 *25 */26 enable: function () {27 const addButton = this.getUI( 'addButton' );28 addButton.removeClass( DISABLED_CLASS ); // Note: this just styles the link (button), click event enforces29 },30 /**31 *32 */33 onAddNewClick: function () {34 const addButton = this.getUI( 'addButton' );35 // Only pass the event up the view chain if we're enabled36 if ( !addButton.hasClass( DISABLED_CLASS ) ) {37 this.trigger( 'childview:add:new', this );38 }39 }...
Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.click('text=I agree');7 await page.fill('input[name="q"]', 'Playwright');8 await page.click('input[type="submit"]');9 await page.screenshot({ path: `example.png` });10 await browser.close();11})();12const { chromium } = require('playwright');13(async () => {14 const browser = await chromium.launch();15 const context = await browser.newContext();16 const page = await context.newPage();17 await page.click('text=I agree');18 await page.fill('input[name="q"]', 'Playwright');19 await page.click('input[type="submit"]');20 await page.screenshot({ path: `example.png` });21 await browser.close();22})();23const { chromium } = require('playwright');24(async () => {25 const browser = await chromium.launch();26 const context = await browser.newContext();27 const page = await context.newPage();28 await page.click('text=I agree');29 await page.fill('input[name="q"]', 'Playwright');30 await page.click('input[type="submit"]');31 await page.screenshot({ path: `example.png` });32 await browser.close();33})();34const { chromium } = require('playwright');35(async () => {36 const browser = await chromium.launch();37 const context = await browser.newContext();38 const page = await context.newPage();39 await page.click('text=I agree');40 await page.fill('input[name="q"]', 'Playwright');41 await page.click('input[type="submit"]');42 await page.screenshot({ path: `example.png` });43 await browser.close();44})();
Using AI Code Generation
1const { addButton } = require('playwright-internal-library');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const page = await browser.newPage();6 await page.screenshot({ path: `example.png` });7 await browser.close();8})();9Please read [CONTRIBUTING.md](
Using AI Code Generation
1const { addButton } = require('playwright/lib/server/chromium/crBrowser');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 await addButton(page, 'Button');8 await page.screenshot({ path: `example.png` });9 await browser.close();10})();
Using AI Code Generation
1const { addButton } = require('playwright/lib/server/chromium/crBrowser');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const page = await browser.newPage();6 await addButton(page, 'Hello World');7 await page.screenshot({ path: 'example.png' });8 await browser.close();9})();10const { addButton } = require('playwright/lib/server/chromium/crBrowser');11const { chromium } = require('playwright');12(async () => {13 const browser = await chromium.launch();14 const page = await browser.newPage();15 await addButton(page, 'Hello World');16 await page.screenshot({ path: 'example.png' });17 await browser.close();18})();19const { addButton } = require('playwright/lib/server/chromium/crBrowser');20const { chromium } = require('playwright');21(async () => {22 const browser = await chromium.launch();23 const page = await browser.newPage();24 await addButton(page, 'Hello World');25 await page.screenshot({ path: 'example.png' });26 await browser.close();27})();28const { addButton } = require('playwright/lib/server/chromium/crBrowser');29const { chromium } = require('playwright');30(async () => {31 const browser = await chromium.launch();32 const page = await browser.newPage();33 await addButton(page, 'Hello World');34 await page.screenshot({ path: 'example.png' });35 await browser.close();36})();37const { addButton } = require('playwright/lib/server/chromium/crBrowser');38const { chromium } = require('playwright');39(async () => {40 const browser = await chromium.launch();41 const page = await browser.newPage();42 await addButton(page, 'Hello World');
Using AI Code Generation
1const {addButton} = require('playwright-core/lib/server/chromium/crBrowser.js');2const {chromium} = require('playwright-core');3(async () => {4 const browser = await chromium.launch({headless: false});5 const context = await browser.newContext();6 const page = await context.newPage();7 await addButton(page, 'Click Me', async () => {8 console.log('Button Clicked!');9 });10 await page.waitForTimeout(100000);11 await browser.close();12})();
Using AI Code Generation
1const {addButton} = require('@playwright/test');2const { test, expect } = require('@playwright/test');3test('Test', async ({ page }) => {4 await addButton(page, {text: 'Click Me'});5 await page.click('text=Click Me');6 await expect(page).toHaveText('text=Click Me');7});
Using AI Code Generation
1const { addButton } = require('@playwright/test');2addButton('Custom Button', async () => {3 console.log('Custom Button clicked');4});5const { addStep } = require('@playwright/test');6addStep('Custom Step', async () => {7 console.log('Custom Step executed');8});9const { test } = require('@playwright/test');10test('my test', async ({ page }) => {11 await page.click('text="Get started"');12 await page.click('text="Docs"');13});14const { test } = require('@playwright/test');15test('my test', async ({ page }) => {16 await page.click('text="Get started"');17 await page.click('text="Docs"');18});
Using AI Code Generation
1const { addButton } = require('@playwright/test');2addButton('My Button', async ({ page }) => {3 await page.click('text=Click me');4});5### `addButton(label: string, callback: (options: ButtonCallbackOptions) => Promise<void>)`6See [CONTRIBUTING.md](
Using AI Code Generation
1const { addButton } = require('playwright/lib/internal/inspector');2addButton('My Button', async () => {3 console.log('My Button Clicked');4});5const { addInput } = require('playwright/lib/internal/inspector');6addInput('My Input', 'initial value', async (value) => {7 console.log('My Input Value', value);8});9const { addCheckbox } = require('playwright/lib/internal/inspector');10addCheckbox('My Checkbox', true, async (value) => {11 console.log('My Checkbox Value', value);12});13const { addSelect } = require('playwright/lib/internal/inspector');14addSelect('My Select', 'option-1', async (value) => {15 console.log('My Select Value', value);16});
Using AI Code Generation
1const { addButton } = require('@playwright/test');2addButton({ title: 'My Button', label: 'Click Me', onClick: async({ page }) => {3 await page.click('text=Click Me');4}});5const { addAttachment } = require('@playwright/test');6test('My Test', async ({ page }) => {7 await addAttachment({ name: 'screenshot', path: await page.screenshot() });8});9const { addAttachment } = require('@playwright/test');10test('My Test', async ({ page }) => {11 await addAttachment({ name: 'video', path: await page.video().path() });12});13const { addAttachment } = require('@playwright/test');14test('My Test', async ({ page }) => {15 await addAttachment({ name: 'trace', path: await page.context().tracing().path() });16});17const { addAttachment } = require('@playwright/test');18test('My Test', async ({ page }) => {19 await addAttachment({ name: 'my html', contentType: 'text/html', body: '<h1>Hello World</h1
Using AI Code Generation
1const {addButton} = require('@playwright/test');2const { test, expect } = require('@playwright/test');3test('Test', async ({ page }) => {4 await addButton(page, {text: 'Click Me'});5 await page.click('text=Click Me');6 await expect(page).toHaveText('text=Click Me');7});
Using AI Code Generation
1const { addButton } = require('@playwright/test');2addButton('Custom Button', async () => {3 console.log('Custom Button clicked');4});5const { addStep } = require('@playwright/test');6addStep('Custom Step', async () => {7 console.log('Custom Step executed');8});9const { test } = require('@playwright/test');10test('my test', async ({ page }) => {11 await page.click('text="Get started"');12 await page.click('text="Docs"');13});14const { test } = require('@playwright/test');15test('my test', async ({ page }) => {16 await page.click('text="Get started"');17 await page.click('text="Docs"');18});
Using AI Code Generation
1const { addButton } = require('@playwright/test');2addButton('My Button', async ({ page }) => {3 await page.click('text=Click me');4});5### `addButton(label: string, callback: (options: ButtonCallbackOptions) => Promise<void>)`6See [CONTRIBUTING.md](
Using AI Code Generation
1const { addButton } = require('playwright/lib/internal/inspector');2addButton('My Button', async () => {3 console.log('My Button Clicked');4});5const { addInput } = require('playwright/lib/internal/inspector');6addInput('My Input', 'initial value', async (value) => {7 console.log('My Input Value', value);8});9const { addCheckbox } = require('playwright/lib/internal/inspector');10addCheckbox('My Checkbox', true, async (value) => {11 console.log('My Checkbox Value', value);12});13const { addSelect } = require('playwright/lib/internal/inspector');14addSelect('My Select', 'option-1', async (value) => {15 console.log('My Select Value', value);16});
LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!