Best JavaScript code snippet using playwright-internal
Json.js
Source:Json.js  
1(function () {2	Ext.define('CMDBuild.proxy.index.Json', {3		singleton: true,4		attachment: {5			create: 'services/json/attachments/uploadattachment',6			read: '',7			update: 'services/json/attachments/modifyattachment',8			remove: 'services/json/attachments/deleteattachment',9			readAll: 'services/json/attachments/getattachmentlist',10			download: 'services/json/attachments/downloadattachment',11			getContext: 'services/json/attachments/getattachmentscontext'12		},13		attribute: {14			create: '', // TODO: waiting for refactor (crud)15			read: 'services/json/schema/modclass/getattributelist', // TODO: waiting for refactor (crud + rename)16			update: 'services/json/schema/modclass/saveattribute', // TODO: waiting for refactor (crud + rename)17			remove: 'services/json/schema/modclass/deleteattribute',18			readAll: 'services/json/schema/modclass/getattributelist', // TODO: waiting for refactor (crud + rename)19			readTypes: 'services/json/schema/modclass/getattributetypes', // TODO: waiting for refactor (rename name, description)20			readRenceableDomains: 'services/json/schema/modclass/getreferenceabledomainlist',21			sorting: {22				reorder: 'services/json/schema/modclass/reorderattribute',23				update: 'services/json/schema/modclass/saveordercriteria'24			}25		},26		bim: {27			create: 'services/json/bim/create',28			read: 'services/json/bim/read',29			update: 'services/json/bim/update',30			remove: '',31			activeForClassName: 'services/json/bim/getactiveforclassname',32			disable: 'services/json/bim/disableproject',33			enable: 'services/json/bim/enableproject',34			fetchCardFromViewewId: 'services/json/bim/fetchcardfromviewewid',35			fetchJsonForBimViewer: 'services/json/bim/fetchjsonforbimviewer',36			roidForCardId: 'services/json/bim/getroidforcardid',37			ifc: {38				download: 'services/json/bim/download',39				imports: 'services/json/bim/importifc'40			},41			layer: {42				create: '', // TODO: waiting for refactor (crud)43				read: '',44				update: 'services/json/bim/savebimlayer', // TODO: waiting for refactor (crud)45				remove: '',46				readAll: 'services/json/bim/readbimlayer',47				rootName: 'services/json/bim/rootclassname'48			}49		},50		card: {51			create: '', // TODO: waiting for refactor (crud)52			read: 'services/json/management/modcard/getcard',53			update: 'services/json/management/modcard/updatecard', // TODO: waiting for refactor (crud)54			remove: 'services/json/management/modcard/deletecard',55			readAll: 'services/json/management/modcard/getcardlist',56			bulkUpdate: 'services/json/management/modcard/bulkupdate',57			bulkUpdateFromFilter: 'services/json/management/modcard/bulkupdatefromfilter',58			getPosition: 'services/json/management/modcard/getcardposition',59			getSqlCardList: 'services/json/management/modcard/getsqlcardlist',60			lock: 'services/json/lock/lockcard',61			unlock: 'services/json/lock/unlockcard',62			unlockAll: 'services/json/lock/unlockall'63		},64		classes: {65			create: 'services/json/schema/modclass/savetable', // TODO: waiting for refactor (crud)66			read: 'services/json/schema/modclass/getallclasses', // TODO: waiting for refactor (crud)67			update: 'services/json/schema/modclass/savetable', // TODO: waiting for refactor (crud)68			remove: 'services/json/schema/modclass/deletetable',69			readAll: 'services/json/schema/modclass/readall',70			readById: 'services/json/schema/modclass/readbyid',71			readByName: 'services/json/schema/modclass/readbyname',72			foreignKeyTargetClass: 'services/json/schema/modclass/getfktargetingclass',73			getAll: 'services/json/schema/modclass/getallclasses' /** @deprecated */74		},75		configuration: {76			create: '',77			read: 'services/json/schema/setup/getconfiguration',78			update: 'services/json/schema/setup/saveconfiguration', // TODO: waiting for refactor (rename)79			remove: '',80			apply: 'services/json/configure/apply',81			connectionTest: 'services/json/configure/testconnection',82			dms: {83				readAllPreset: 'services/json/attachments/getpresets'84			},85			ui: {86				read: 'services/json/schema/modsecurity/getuiconfiguration'87			}88		},89		csv: {90			readAll: 'services/json/management/importcsv/getcsvrecords',91			exports: {92				create: 'services/json/management/exportcsv/writecsv',93				read: '',94				update: '',95				remove: '',96				download: 'services/json/management/exportcsv/export'97			},98			imports: {99				create: 'services/json/management/importcsv/uploadcsv',100				read: 'services/json/management/importcsv/readcsv',101				update: 'services/json/management/importcsv/storecsvrecords', // TODO: waiting for refactor (rename)102				remove: '',103				clearSession: 'services/json/management/importcsv/clearsession',104				updateRecords: 'services/json/management/importcsv/updatecsvrecords'105			}106		},107		customPage: {108			readForCurrentUser: 'services/json/custompages/readforcurrentuser'109		},110		dashboard: {111			create: 'services/json/dashboard/add',112			read: '',113			update: 'services/json/dashboard/modifybaseproperties',114			remove: 'services/json/dashboard/remove',115			readAll: 'services/json/dashboard/fulllist', // @administration116			readAllVisible: 'services/json/dashboard/list', // @management - manage permissions117			chart: {118				create: 'services/json/dashboard/addchart',119				read: 'services/json/dashboard/getchartdata',120				update: 'services/json/dashboard/modifychart',121				remove: 'services/json/dashboard/removechart',122				readForPreview: 'services/json/dashboard/getchartdataforpreview'123			},124			columns: {125				create: '',126				read: '',127				update: 'services/json/dashboard/modifycolumns',128				remove: ''129			}130		},131		dataView: {132			readAll: 'services/json/viewmanagement/read', // TODO: waiting for refactor (rename on server)133			filter: {134				create: 'services/json/viewmanagement/createfilterview',135				read: 'services/json/viewmanagement/readfilterview', // TODO: waiting for refactor (crud)136				update: 'services/json/viewmanagement/updatefilterview',137				remove: 'services/json/viewmanagement/deletefilterview',138				readAll: 'services/json/viewmanagement/readfilterview' // TODO: waiting for refactor (crud)139			},140			sql: {141				create: 'services/json/viewmanagement/createsqlview',142				read: 'services/json/viewmanagement/readsqlview', // TODO: waiting for refactor (crud)143				update: 'services/json/viewmanagement/updatesqlview',144				remove: 'services/json/viewmanagement/deletesqlview',145				readAll: 'services/json/viewmanagement/readsqlview' // TODO: waiting for refactor (crud)146			}147		},148		domain: {149			create: 'services/json/schema/modclass/savedomain', // TODO: waiting for refactor (crud)150			read: 'services/json/schema/modclass/getalldomains', // TODO: waiting for refactor (crud)151			update: 'services/json/schema/modclass/savedomain', // TODO: waiting for refactor (crud)152			remove: 'services/json/schema/modclass/deletedomain',153			getDomains: 'services/json/schema/modclass/getdomains',154			readAll: 'services/json/schema/modclass/getalldomains',155			readAllByClass: 'services/json/schema/modclass/getdomainlist' // @deprecated156		},157		email: {158			create: 'services/json/email/email/create',159			read: 'services/json/email/email/read',160			update: 'services/json/email/email/update',161			remove: 'services/json/email/email/delete',162			readAll: 'services/json/email/email/readall',163			enabled: 'services/json/email/email/enabled',164			account:{165				create: 'services/json/schema/emailaccount/post',166				read: 'services/json/schema/emailaccount/get',167				update: 'services/json/schema/emailaccount/put',168				remove: 'services/json/schema/emailaccount/delete',169				readAll: 'services/json/schema/emailaccount/getall',170				setDefault: 'services/json/schema/emailaccount/setdefault'171			},172			attachment: {173				create: 'services/json/email/attachment/upload',174				read: '',175				update: '',176				remove: 'services/json/email/attachment/delete',177				readAll: 'services/json/email/attachment/readall',178				copy: 'services/json/email/attachment/copy',179				download: 'services/json/email/attachment/download'180			},181			queue: {182				read: 'services/json/email/queue/configuration',183				save: 'services/json/email/queue/configure',184				isRunning: 'services/json/email/queue/running',185				start: 'services/json/email/queue/start',186				stop: 'services/json/email/queue/stop'187			},188			template:{189				create: 'services/json/email/template/create',190				read: 'services/json/email/template/read',191				update: 'services/json/email/template/update',192				remove: 'services/json/email/template/delete',193				readAll: 'services/json/email/template/readall'194			}195		},196		entryType: {197			readAll: 'services/json/schema/modclass/getallclasses'198		},199		filter: {200			defaults: {201				create: '',202				read: 'services/json/filter/getdefault',203				update: 'services/json/filter/setdefaultsforgroup',204				remove: ''205			},206			group: {207				create: 'services/json/filter/create',208				read: 'services/json/filter/readallgroupfilters', // TODO: waiting for refactor (CRUD)209				update: 'services/json/filter/update',210				remove: 'services/json/filter/delete',211				readAll: 'services/json/filter/readallgroupfilters', // TODO: waiting for refactor (CRUD)212				defaults: {213					create: '',214					read: 'services/json/filter/getgroups',215					update: 'services/json/filter/setdefaultgroups',216					remove: ''217				}218			},219			user: {220				create: '',221				read: 'services/json/filter/read',222				update: '',223				remove: '',224				readAll: 'services/json/filter/readforuser'225			}226		},227		functions: {228			readAll: 'services/json/schema/modclass/getfunctions',229			readCards: 'services/json/management/modcard/getsqlcardlist'230		},231		gis: {232			expandDomainTree: 'services/json/gis/expanddomaintree',233			getFeatures: 'services/json/gis/getfeature',234			getGeoCardList: 'services/json/gis/getgeocardlist',235			geoAttribute: {236				create: 'services/json/gis/addgeoattribute',237				read: '',238				update: 'services/json/gis/modifygeoattribute',239				remove: 'services/json/gis/deletegeoattribute'240			},241			geoServer: {242				layer: {243					create: 'services/json/gis/addgeoserverlayer',244					read: '',245					update: 'services/json/gis/modifygeoserverlayer',246					remove: 'services/json/gis/deletegeoserverlayer',247					readAll: 'services/json/gis/getgeoserverlayers'248				}249			},250			icons: {251				create: 'services/json/icon/upload',252				read: '',253				update: 'services/json/icon/update',254				remove: 'services/json/icon/remove',255				readAll: 'services/json/icon/list'256			},257			layer: {258				create: '',259				read: 'services/json/gis/getalllayers', // TODO: waiting for refactor (CRUD)260				update: '',261				remove: '',262				readAll: 'services/json/gis/getalllayers', // TODO: waiting for refactor (rename)263				setOrder: 'services/json/gis/setlayersorder',264				setVisibility: 'services/json/gis/setlayervisibility'265			},266			treeNavigation: {267				create: '', // TODO: waiting for refactor (CRUD)268				read: 'services/json/gis/getgistreenavigation',269				update: 'services/json/gis/savegistreenavigation', // TODO: waiting for refactor (CRUD)270				remove: 'services/json/gis/removegistreenavigation'271			}272		},273		group: {274			create: 'services/json/schema/modsecurity/savegroup', // TODO: waiting for refactor (crud)275			read: 'services/json/schema/modsecurity/getgrouplist', // TODO: waiting for refactor (crud)276			update: 'services/json/schema/modsecurity/savegroup', // TODO: waiting for refactor (crud)277			remove: '',278			readAll: 'services/json/schema/modsecurity/getgrouplist',279			enableDisableGroup: 'services/json/schema/modsecurity/enabledisablegroup',280			user: {281				readAll: 'services/json/schema/modsecurity/getgroupuserlist',282				save: 'services/json/schema/modsecurity/savegroupuserlist'283			},284			userInterface: {285				read: 'services/json/schema/modsecurity/getgroupuiconfiguration',286				save: 'services/json/schema/modsecurity/savegroupuiconfiguration'287			}288		},289		history: {290			classes: {291				card: {292					create: '',293					read: 'services/json/management/modcard/getcardhistory',294					update: '',295					remove: '',296					readRelations: 'services/json/management/modcard/getrelationshistory',297					readHistoric: 'services/json/management/modcard/gethistoriccard',298					readHistoricRelation: 'services/json/management/modcard/gethistoricrelation'299				}300			},301			workflow: { // TODO: waiting for refactor (different endpoints)302				activity: {303					create: '',304					read: 'services/json/management/modcard/getprocesshistory',305					update: '',306					remove: '',307					readRelations: 'services/json/management/modcard/getrelationshistory',308					readHistoric: 'services/json/management/modcard/gethistoriccard',309					readHistoricRelation: 'services/json/management/modcard/gethistoricrelation'310				}311			}312		},313		localization: {314			translation: {315				create: '',316				read: 'services/json/schema/translation/read',317				update: 'services/json/schema/translation/update',318				remove: '',319				readAll: 'services/json/schema/translation/readall'320			},321			utility: {322				csv: {323					exports: 'services/json/schema/translation/exportcsv',324					imports: 'services/json/schema/translation/importcsv'325				}326			}327		},328		lookup: {329			create: 'services/json/schema/modlookup/savelookup', // TODO: waiting for refactor (crud)330			read: 'services/json/schema/modlookup/getlookuplist', // TODO: waiting for refactor (crud)331			update: 'services/json/schema/modlookup/savelookup', // TODO: waiting for refactor (crud)332			remove: '',333			readAll: 'services/json/schema/modlookup/getlookuplist',334			readAllParents: 'services/json/schema/modlookup/getparentlist',335			disable: 'services/json/schema/modlookup/disablelookup',336			enable: 'services/json/schema/modlookup/enablelookup',337			setOrder: 'services/json/schema/modlookup/reorderlookup',338			type: {339				create: 'services/json/schema/modlookup/savelookuptype', // TODO: waiting for refactor (crud)340				read: 'services/json/schema/modlookup/tree', // TODO: waiting for refactor (crud)341				update: 'services/json/schema/modlookup/savelookuptype', // TODO: waiting for refactor (crud)342				remove: '',343				readAll: 'services/json/schema/modlookup/tree' // TODO: waiting for refactor (crud)344			}345		},346		menu: {347			create: '', // TODO: waiting for refactor (crud)348			read: 'services/json/schema/modmenu/getassignedmenu',349			update: 'services/json/schema/modmenu/savemenu', // TODO: waiting for refactor (crud)350			remove: 'services/json/schema/modmenu/deletemenu',351			readAvailableItems: 'services/json/schema/modmenu/getavailablemenuitems',352			readConfiguration: 'services/json/schema/modmenu/getmenuconfiguration'353		},354		navigationTree: {355			create: 'services/json/navigationtree/create',356			read: 'services/json/navigationtree/read',357			update: 'services/json/navigationtree/save', // TODO: waiting for refactor (rename update)358			remove: 'services/json/navigationtree/remove',359			readAll: 'services/json/navigationtree/get' // TODO: waiting for refactor (rename readAll)360		},361		patchManager: {362			update: 'services/json/configure/applypatches',363			readAll: 'services/json/configure/getpatches'364		},365		privilege: {366			classes: {367				update: 'services/json/schema/modsecurity/saveclassprivilege',368				readAll: 'services/json/schema/modsecurity/getclassprivilegelist',369				setRowAndColumnPrivileges: 'services/json/schema/modsecurity/setrowandcolumnprivileges',370				uiConfiguration: {371					read: 'services/json/schema/modsecurity/loadclassuiconfiguration',372					update: 'services/json/schema/modsecurity/saveclassuiconfiguration'373				}374			},375			customPage: {376				update: 'services/json/schema/modsecurity/savecustompageprivilege',377				readAll: 'services/json/schema/modsecurity/getcustompageprivilegelist'378			},379			dataView: {380				update: 'services/json/schema/modsecurity/saveviewprivilege',381				readAll: 'services/json/schema/modsecurity/getviewprivilegelist'382			},383			filter: {384				update: 'services/json/schema/modsecurity/savefilterprivilege',385				readAll: 'services/json/schema/modsecurity/getfilterprivilegelist'386			},387			workflow: {388				update: 'services/json/schema/modsecurity/saveprocessprivilege',389				readAll: 'services/json/schema/modsecurity/getprocessprivilegelist',390				setRowAndColumnPrivileges: 'services/json/schema/modsecurity/setrowandcolumnprivileges'391			}392		},393		relation: {394			create: 'services/json/management/modcard/createrelations',395			read: '',396			update: 'services/json/management/modcard/modifyrelation',397			remove: 'services/json/management/modcard/deleterelation',398			readAll: 'services/json/management/modcard/getrelationlist',399			readAlreadyRelatedCards: 'services/json/management/modcard/getalreadyrelatedcards',400			removeDetail: 'services/json/management/modcard/deletedetail'401		},402		report: {403			readByType: 'services/json/management/modreport/getreportsbytype',404			readTypesTree: 'services/json/management/modreport/getreporttypestree',405			menuTree: 'services/json/schema/modreport/menutree',406			factory: {407				create: 'services/json/management/modreport/createreportfactory',408				createByTypeCode: 'services/json/management/modreport/createreportfactorybytypecode',409				print: 'services/json/management/modreport/printreportfactory',410				updateParams: 'services/json/management/modreport/updatereportfactoryparams'411			},412			jasper: {413				create: 'services/json/management/modreport/createreportfactory',414				read: '',415				update: '',416				remove: 'services/json/schema/modreport/deletereport',417				save: 'services/json/schema/modreport/savejasperreport',418				analyze: 'services/json/schema/modreport/analyzejasperreport',419				imports: 'services/json/schema/modreport/importjasperreport',420				resetSession: 'services/json/schema/modreport/resetsession'421			},422			print: {423				cardDetails: 'services/json/management/modreport/printcarddetails',424				classSchema: 'services/json/schema/modreport/printclassschema',425				currentView: 'services/json/management/modreport/printcurrentview',426				schema: 'services/json/schema/modreport/printschema',427				sqlView: 'services/json/management/modreport/printsqlview'428			}429		},430		session: {431			create: 'services/json/session/create', // @unauthorized432			update: 'services/json/session/update', // @unauthorized433			remove: 'services/json/session/delete'434		},435		taskManager: {436			readAll: 'services/json/schema/taskmanager/readall',437			cyclicExecution: 'services/json/schema/taskmanager/start',438			singleExecution: 'services/json/schema/taskmanager/execute',439			stop: 'services/json/schema/taskmanager/stop',440			connector: {441				create: 'services/json/schema/taskmanager/connector/create',442				read: 'services/json/schema/taskmanager/connector/read',443				update: 'services/json/schema/taskmanager/connector/update',444				remove: 'services/json/schema/taskmanager/connector/delete',445				readAll: 'services/json/schema/taskmanager/connector/readall',446				readSqlSources: 'services/json/schema/taskmanager/connector/availablesqlsources'447			},448			email: {449				create: 'services/json/schema/taskmanager/reademail/create',450				read: 'services/json/schema/taskmanager/reademail/read',451				update: 'services/json/schema/taskmanager/reademail/update',452				remove: 'services/json/schema/taskmanager/reademail/delete',453				readAll: 'services/json/schema/taskmanager/reademail/readall'454			},455			event: {456				readAll: 'services/json/schema/taskmanager/event/readall',457				asynchronous: {458					create: 'services/json/schema/taskmanager/event/asynchronous/create',459					read: 'services/json/schema/taskmanager/event/asynchronous/read',460					update: 'services/json/schema/taskmanager/event/asynchronous/update',461					remove: 'services/json/schema/taskmanager/event/asynchronous/delete',462					readAll: 'services/json/schema/taskmanager/event/asynchronous/readall'463				},464				synchronous: {465					create: 'services/json/schema/taskmanager/event/synchronous/create',466					read: 'services/json/schema/taskmanager/event/synchronous/read',467					update: 'services/json/schema/taskmanager/event/synchronous/update',468					remove: 'services/json/schema/taskmanager/event/synchronous/delete',469					readAll: 'services/json/schema/taskmanager/event/synchronous/readall'470				}471			},472			generic: {473				create: 'services/json/schema/taskmanager/generic/create',474				read: 'services/json/schema/taskmanager/generic/read',475				update: 'services/json/schema/taskmanager/generic/update',476				remove: 'services/json/schema/taskmanager/generic/delete',477				readAll: 'services/json/schema/taskmanager/generic/readall'478			},479			workflow: {480				create: 'services/json/schema/taskmanager/startworkflow/create',481				read: 'services/json/schema/taskmanager/startworkflow/read',482				update: 'services/json/schema/taskmanager/startworkflow/update',483				remove: 'services/json/schema/taskmanager/startworkflow/delete',484				readAll: 'services/json/schema/taskmanager/startworkflow/readall',485				readAllByWorkflow: 'services/json/schema/taskmanager/startworkflow/readallbyworkflow'486			}487		},488		user: {489			create: 'services/json/schema/modsecurity/saveuser', // TODO: waiting for refactor (crud)490			read: 'services/json/schema/modsecurity/getgrouplist', // TODO: waiting for refactor (crud)491			update: 'services/json/schema/modsecurity/saveuser', // TODO: waiting for refactor (crud)492			remove: '',493			readAll: 'services/json/schema/modsecurity/getuserlist',494			readAllGroups: 'services/json/schema/modsecurity/getusergrouplist',495			disable: 'services/json/schema/modsecurity/disableuser'496		},497		utility: {498			changePassword: 'services/json/schema/modsecurity/changepassword'499		},500		utils: {501			clearCache: 'services/json/utils/clearcache',502			generateId: 'services/json/utils/generateid',503			readAllAvailableTranslations: 'services/json/utils/listavailabletranslations', // @unauthorized504			readDefaultLanguage: 'services/json/utils/getdefaultlanguage' // @unauthorized505		},506		widget: {507			create: 'services/json/widget/create',508			read: 'services/json/widget/read',509			update: 'services/json/widget/update',510			remove: 'services/json/widget/delete',511			readAll: 'services/json/widget/readall',512			readAllForClass: 'services/json/widget/readallforclass',513			// Widgets end-points514			ping: 'services/json/widget/callwidget',515			webService: 'services/json/widget/callwidget'516		},517		workflow: {518			create: 'services/json/schema/modclass/savetable', // TODO: waiting for refactor (crud)519			read: 'services/json/schema/modclass/getallclasses', /** @deprecated */520			update: 'services/json/schema/modclass/savetable', // TODO: waiting for refactor (crud)521			remove: 'services/json/schema/modclass/deletetable', // TODO: waiting for refactor (crud)522			readAll: 'services/json/workflow/readall',523			readById: 'services/json/workflow/readbyid',524			readByName: 'services/json/workflow/readbyname',525			getAll: 'services/json/schema/modclass/getallclasses', /** @deprecated */526			getPosition: 'services/json/workflow/getposition',527			isProcessUpdated: 'services/json/workflow/isprocessupdated',528			synchronize: 'services/json/workflow/sync',529			activity: {530				create: '', // TODO: waiting for refactor (crud)531				read: 'services/json/workflow/getactivityinstance', // TODO: waiting for refactor (crud)532				update: 'services/json/workflow/saveactivity', // TODO: waiting for refactor (crud)533				remove: '',534				readStart: 'services/json/workflow/getstartactivity',535				abort: 'services/json/workflow/abortprocess',536				lock: 'services/json/lock/lockactivity',537				unlock: 'services/json/lock/unlockactivity'538			},539			instance: {540				create: '',541				read: 'services/json/workflow/getinstance',542				update: '',543				remove: '',544				readAll: 'services/json/workflow/getinstances'545			},546			xpdl: {547				download: 'services/json/workflow/downloadxpdl',548				downloadTemplate: 'services/json/workflow/downloadxpdltemplate',549				upload: 'services/json/workflow/uploadxpdl',550				versions: 'services/json/workflow/xpdlversions'551			}552		}553	});...jquery.readall.js
Source:jquery.readall.js  
1/*2 * jQuery.ReadAll ia a jQuery plugin to shrink large blocks of content and place a read more button below.3 * Created by Anders Fjällström - anders@morriz.net - http://www.morriz.net4 * For documentation see https://github.com/morriznet/jquery.readall5 * Released under MIT license6 * version 1.17 */8(function ($) {9    $.fn.readall = function (options) {10        var settings = $.extend({11            // Default values12            showheight: 96,                         // height to show13            showrows: null,                         // rows to show (overrides showheight)14            animationspeed: 200,                    // speed of transition15            btnTextShowmore: 'Read more',           // text shown on button to show more16            btnTextShowless: 'Read less',           // text shown on button to show less17            btnClassShowmore: 'readall-button',     // class(es) on button to show more18            btnClassShowless: 'readall-button'      // class(es) on button to show less19        }, options);20        $(this).each(function () {21            var $this = $(this),22                fullheight = function () { return $this[0].scrollHeight; },23                wrapperclass = 'readall-wrapper',24                hiddenclass = 'readall-hide';25            if (settings.showrows != null) {26                var lineHeight = Math.floor(parseFloat($this.css('font-size')) * 1.5);27                settings.showheight = lineHeight * settings.showrows;28            }29            $this.addClass('readall').css({ 'overflow': 'hidden' });30            var onResize = function (event) {31                // on resize check if readall is needed32                var _button = $this.parent().find('button.' + settings.btnClassShowmore.replace(/\s+/g, '.') + ', button.' + settings.btnClassShowless.replace(/\s+/g, '.'));33                if (fullheight() > settings.showheight + $(_button).outerHeight()) {34                    if (!$(_button).is(':visible') || event == null) {35                        $this.css({ 'height': settings.showheight + 'px', 'max-height': settings.showheight + 'px' });36                        $(_button).text(settings.btnTextShowmore);37                        $this.addClass(hiddenclass);38                        $(_button).removeClass(settings.btnClassShowless).addClass(settings.btnClassShowmore);39                        $(_button).show();40                    }41                } else {42                    if ($(_button).is(':visible') || event == null) {43                        $this.css({ 'height': '', 'max-height': '' });44                        $this.removeClass(hiddenclass);45                        $(_button).hide();46                    }47                }48            };49            50            if ($this.parent().not(wrapperclass)) {51                $this.wrap($('<div />').addClass(wrapperclass));52                var _button = $('<button />').addClass(settings.btnClassShowmore).text(settings.btnTextShowmore).on('click', function (e) {53                    e.preventDefault();54                    if ($this.hasClass(hiddenclass)) {55                        $this.css({ 'height': settings.showheight + 'px', 'max-height': '' }).animate({ height: fullheight() + 'px' }, settings.animationspeed, function () {56                            $this.css({ 'height': '' });57                            $(_button).text(settings.btnTextShowless);58                        });59                    } else {60                        $this.animate({ 'height': settings.showheight + 'px' }, settings.animationspeed, function () {61                            $this.css({ 'max-height': settings.showheight + 'px' });62                            $(_button).text(settings.btnTextShowmore);63                        });64                    }65                    $this.toggleClass(hiddenclass);66                    $(this).toggleClass(settings.btnClassShowmore).toggleClass(settings.btnClassShowless);67                });68                $this.after(_button);69                $(window).on('orientationchange resize', onResize);70                71                onResize(null);72            }73        });74        return this;75    };...binder.js
Source:binder.js  
1import assert from "assert";2import sinon from "sinon";3import Binder from "../src/binder";4describe("Binder", () => {5  describe("#aToB", () => {6    it("should write all value of 'a' to 'b' on init.", async () => {7      const binder = new Binder({8        a: {9          readAll: sinon.spy(10            async () =>11              new Map([12                ["n1", "v1"],13                ["n2", "v2"]14              ])15          ),16          write: sinon.spy()17        },18        b: {19          readAll: sinon.spy(),20          write: sinon.spy()21        },22        diff: (oldValue, newValue) => ({23          change: { newValue },24          isChanged: oldValue !== newValue25        })26      });27      await binder.aToB();28      assert.equal(binder.handler.a.readAll.callCount, 1);29      assert.equal(binder.handler.b.readAll.callCount, 0);30      assert.equal(binder.handler.a.write.callCount, 0);31      assert.equal(binder.handler.b.write.callCount, 1);32      const args = binder.handler.b.write.args[0];33      const diffs = args[0];34      assert.equal(diffs.size, 2);35      const d1 = diffs.get("n1");36      assert.equal(d1 && d1.newValue, "v1");37      const d2 = diffs.get("n2");38      assert.equal(d2 && d2.newValue, "v2");39    });40    it("should do nothing if no value in 'a'.", async () => {41      const binder = new Binder({42        a: {43          readAll: sinon.spy(async () => new Map()),44          write: sinon.spy()45        },46        b: {47          readAll: sinon.spy(),48          write: sinon.spy()49        },50        diff: (oldValue, newValue) => ({51          change: { newValue },52          isChanged: oldValue !== newValue53        })54      });55      await binder.aToB();56      assert.equal(binder.handler.a.readAll.callCount, 1);57      assert.equal(binder.handler.b.readAll.callCount, 0);58      assert.equal(binder.handler.a.write.callCount, 0);59      assert.equal(binder.handler.b.write.callCount, 0);60    });61    it("should do nothing on second call.", async () => {62      const binder = new Binder({63        a: {64          readAll: sinon.spy(65            async () =>66              new Map([67                ["n1", "v1"],68                ["n2", "v2"]69              ])70          ),71          write: sinon.spy()72        },73        b: {74          readAll: sinon.spy(),75          write: sinon.spy()76        },77        diff: (oldValue, newValue) => ({78          change: { newValue },79          isChanged: oldValue !== newValue80        })81      });82      await binder.aToB();83      assert.equal(binder.handler.a.readAll.callCount, 1);84      assert.equal(binder.handler.b.readAll.callCount, 0);85      assert.equal(binder.handler.a.write.callCount, 0);86      assert.equal(binder.handler.b.write.callCount, 1);87      await binder.aToB();88      assert.equal(binder.handler.a.readAll.callCount, 2);89      assert.equal(binder.handler.b.readAll.callCount, 0);90      assert.equal(binder.handler.a.write.callCount, 0);91      assert.equal(binder.handler.b.write.callCount, 1);92    });93    it("should write twice if provided 'force' on second call.", async () => {94      const binder = new Binder({95        a: {96          readAll: sinon.spy(97            async () =>98              new Map([99                ["n1", "v1"],100                ["n2", "v2"]101              ])102          ),103          write: sinon.spy()104        },105        b: {106          readAll: sinon.spy(),107          write: sinon.spy()108        },109        diff: (oldValue, newValue) => ({110          change: { newValue },111          isChanged: oldValue !== newValue112        })113      });114      await binder.aToB();115      assert.equal(binder.handler.a.readAll.callCount, 1);116      assert.equal(binder.handler.b.readAll.callCount, 0);117      assert.equal(binder.handler.a.write.callCount, 0);118      assert.equal(binder.handler.b.write.callCount, 1);119      await binder.aToB({ force: true });120      assert.equal(binder.handler.a.readAll.callCount, 2);121      assert.equal(binder.handler.b.readAll.callCount, 0);122      assert.equal(binder.handler.a.write.callCount, 0);123      assert.equal(binder.handler.b.write.callCount, 2);124    });125  });...zlib_test.js
Source:zlib_test.js  
...26    it("deflateTo (from Buffer)", () => {27        var stm = new io.MemoryStream();28        zlib.deflateTo(b, stm);29        stm.rewind();30        assert.deepEqual(zlib.inflate(stm.readAll()), b);31    });32    it("inflateTo (from Buffer)", () => {33        var stm = new io.MemoryStream();34        zlib.inflateTo(zlib.deflate(b), stm);35        stm.rewind();36        assert.deepEqual(stm.readAll(), b);37    });38    it("gzipTo (from Buffer)", () => {39        var stm = new io.MemoryStream();40        zlib.gzipTo(b, stm);41        stm.rewind();42        assert.deepEqual(zlib.gunzip(stm.readAll()), b);43    });44    it("gunzipTo (from Buffer)", () => {45        var stm = new io.MemoryStream();46        zlib.gunzipTo(zlib.gzip(b), stm);47        stm.rewind();48        assert.deepEqual(stm.readAll(), b);49    });50    it("deflateTo (from Stream)", () => {51        var stm = new io.MemoryStream();52        stm.write(b);53        stm.rewind();54        var stm1 = new io.MemoryStream();55        zlib.deflateTo(stm, stm1);56        stm1.rewind();57        assert.deepEqual(zlib.inflate(stm1.readAll()), b);58    });59    it("inflateTo (from Stream)", () => {60        var stm = new io.MemoryStream();61        stm.write(zlib.deflate(b));62        stm.rewind()63        var stm1 = new io.MemoryStream();64        zlib.inflateTo(stm, stm1);65        stm1.rewind();66        assert.deepEqual(stm1.readAll(), b);67    });68    it("gzipTo (from Stream)", () => {69        var stm = new io.MemoryStream();70        stm.write(b);71        stm.rewind()72        var stm1 = new io.MemoryStream();73        zlib.gzipTo(stm, stm1);74        stm1.rewind();75        assert.deepEqual(zlib.gunzip(stm1.readAll()), b);76    });77    it("gunzipTo (from Stream)", () => {78        var stm = new io.MemoryStream();79        stm.write(zlib.gzip(b));80        stm.rewind()81        var stm1 = new io.MemoryStream();82        zlib.gunzipTo(stm, stm1);83        stm1.rewind();84        assert.deepEqual(stm1.readAll(), b);85    });86    it("gunzip (from file)", () => {87        var f1 = fs.openFile(path.join(__dirname, 'zlib_files', 'gzip'));88        var f2 = fs.openFile(path.join(__dirname, 'zlib_files', 'original.js'));89        assert.deepEqual(zlib.gunzip(f1.readAll()), f2.readAll());90    });91    it("inflate (from file)", () => {92        var f1 = fs.openFile(path.join(__dirname, 'zlib_files', 'deflate'));93        var f2 = fs.openFile(path.join(__dirname, 'zlib_files', 'original.js'));94        assert.deepEqual(zlib.inflateRaw(f1.readAll()), f2.readAll());95    });96});...script.js
Source:script.js  
1var article = [2    {3        img: 'assets/img/test.webp',4        name: 'Article Name1',5        readAll: 'some-link.html',6    },7    {8        img: 'assets/img/test.webp',9        name: 'Article Nam2',10        readAll: 'some-link2.html',11    },12    {13        img: 'assets/img/test.webp',14        name: 'Article Name3',15        readAll: 'some-link3.html',16    },17    {18        img: 'assets/img/test.webp',19        name: 'Article Name4',20        readAll: 'some-link.html',21    },22    {23        img: 'assets/img/test.webp',24        name: 'Article Nam5',25        readAll: 'some-link2.html',26    },27    {28        img: 'assets/img/test.webp',29        name: 'Article Name6',30        readAll: 'some-link3.html',31    },32];33let card = document.getElementById('card');34let page = 1,35    step = 3;36let renderCard = function() {37    for (let i = page * step - step; i < page * step && i < article.length; i++) {38        let img = article[i].img;39        let name = article[i].name;40        let readAll = article[i].readAll;41        card.innerHTML += `<div class="article-content"><img src="${img}"/>` + '<h4>' + name + '</h4>' + `<a href="${readAll}" class="link">ЧиÑаÑÑ</a>`+ '</div>'; 42    }43}44document.querySelector('#more').addEventListener('click', function(e){45    renderCard();46    page += 1;47    48    if(article.length < page * step) {49        this.remove();50    }...ToolbarConstants.js
Source:ToolbarConstants.js  
1const CHANGE_SEARCH_NAME_INPUT ="CHANGE_SEARCH_NAME_INPUT"2const ONSCREEN_NOTIFICATION_DATA_REQUEST = "ONSCREEN_NOTIFICATION_DATA_REQUEST"3const ONSCREEN_NOTIFICATION_DATA_SUCCESS = "ONSCREEN_NOTIFICATION_DATA_SUCCESS"4const ONSCREEN_NOTIFICATION_DATA_FAILURE = "ONSCREEN_NOTIFICATION_DATA_FAILURE"5const READALL_NOTIFICATION_DATA_REQUEST = "READALL_NOTIFICATION_DATA_REQUEST"6const READALL_NOTIFICATION_DATA_SUCCESS = "READALL_NOTIFICATION_DATA_SUCCESS"7const READALL_NOTIFICATION_DATA_FAILURE = "READALL_NOTIFICATION_DATA_FAILURE"8export{CHANGE_SEARCH_NAME_INPUT ,ONSCREEN_NOTIFICATION_DATA_REQUEST,ONSCREEN_NOTIFICATION_DATA_SUCCESS,ONSCREEN_NOTIFICATION_DATA_FAILURE,...coffee.js
Source:coffee.js  
1function nextId() {2  const coffees = readAll();3  const ids = coffees.map((coffee) => coffee.id);4  const maxId = Math.max(...ids);5  return maxId + 1;6}7function load(newCoffees) {8  localStorage.setItem('coffees-app:coffees', JSON.stringify(newCoffees));9}10function create(coffee) {11  coffee = { id: nextId(), ...coffee };12  const coffees = readAll();13  const newCoffees = [...coffees, coffee];14  load(newCoffees);15  return coffee;16}17function readAll() {18  return JSON.parse(localStorage.getItem('coffees-app:coffees'));19}20function read(id) {21  const coffees = readAll();22  const coffee = coffees.find((coffee) => coffee.id === id);23  return ;24}...challenge.js
Source:challenge.js  
1export const challengeConstants = {2  READALL_REQUEST: 'CHALLENGE_READALL_REQUEST',3  READALL_SUCCESS: 'CHALLENGE_READALL_SUCCESS',4  READALL_FAILURE: 'CHALLENGE_READALL_FAILURE',5  READALL_ORPHANS_REQUEST: 'CHALLENGE_READALL_ORPHANS_REQUEST',6  READALL_ORPHANS_SUCCESS: 'CHALLENGE_READALL_ORPHANS_SUCCESS',7  READALL_ORPHANS_FAILURE: 'CHALLENGE_READALL_ORPHANS_FAILURE',8  READALL_GROUPS_REQUEST: 'CHALLENGE_GROUPS_READALL_REQUEST',9  READALL_GROUPS_SUCCESS: 'CHALLENGE_GROUPS_READALL_SUCCESS',10  READALL_GROUPS_FAILURE: 'CHALLENGE_GROUPS_READALL_FAILURE'
...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  const cookies = await page.context().cookies();7  console.log(cookies);8  await browser.close();9})();Using AI Code Generation
1(async () => {2    const { chromium } = require('playwright');3    const browser = await chromium.launch({ headless: false });4    const context = await browser.newContext();5    const page = await context.newPage();6    const cookies = await page.context().cookies();7    console.log(cookies);8    await browser.close();9})();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    const storageState = await context.storageState();7    console.log(storageState);8    await browser.close();9})();Using AI Code Generation
1const { chromium } = require('playwright');2const { readAll } = require('playwright/lib/server/trace/recorder/recorderApp');3(async () => {4  const browser = await chromium.launch({ headless: false });5  const page = await browser.newPage();6  await page.click('text="Sign in"');7  await page.fill('input[name="identifier"]', 'Using AI Code Generation
1const { readAll } = require('@playwright/test/lib/utils/stdio');2(async () => {3  const { stdout, stderr } = await readAll(process.stdout, process.stderr);4  console.log(`stdout: ${stdout}`);5  console.log(`stderr: ${stderr}`);6})();Using AI Code Generation
1const { readAll } = require('@playwright/test/lib/server/trace/recorder/screencastFrameCollector');2const fs = require('fs');3(async () => {4  const frames = await readAll('/path/to/screencastTraceDir');5  fs.writeFileSync('/path/to/screencastTraceDir/screencast.json', JSON.stringify(frames));6})();Using AI Code Generation
1const { readAll } = require('playwright/lib/server/trace/recorder/recorderApp');2const fs = require('fs');3(async () => {4  const trace = await readAll(fs.createReadStream('trace.zip'));5  fs.writeFileSync('trace.json', JSON.stringify(trace, null, 2));6})();Using AI Code Generation
1const { test, expect } = require('@playwright/test');2const { readAll } = require('@playwright/test/lib/utils/stdio');3const { chromium } = require('playwright');4const fs = require('fs');5const path = require('path');6const { promisify } = require('util');7const readFileAsync = promisify(fs.readFile);8const writeFileAsync = promisify(fs.writeFile);9const { exec } = require("child_process");10test('readAll', async ({ page }) => {11    const data = await readAll(process.stdout);12    console.log('data', data);13    expect(data).toContain('Google');14});15test('readAll', async ({ page }) => {16    const data = await readAll(process.stdout);17    console.log('data', data);18    expect(data).toContain('Google');19});20test('readAll', async ({ page }) => {21    const data = await readAll(process.stdout);22    console.log('data', data);23    expect(data).toContain('Google');24});25test('readAll', async ({ page }) => {26    const data = await readAll(process.stdout);27    console.log('data', data);28    expect(data).toContain('Google');29});30test('readAll', async ({ page }) => {31    const data = await readAll(process.stdout);32    console.log('data', data);33    expect(data).toContain('Google');34});35test('readAll', async ({ page }) => {36    const data = await readAll(process.stdout);37    console.log('data', data);38    expect(data).toContain('Google');39});40test('readAll', async ({ page }) => {41    const data = await readAll(process.stdout);42    console.log('data', data);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!!
