Best JavaScript code snippet using wpt
html.js
Source:html.js
...65 var element = new tag("span", attributes);66 return $.extend({}, html(element));67}68var html = (function($, _){69 function getTag(tagName, attrsOrHtmlObj, text) {70 var t = new tag(tagName, attrsOrHtmlObj.currentTag || attrsOrHtmlObj);71 if(tagName.isTag){72 t = tagName.element;73 }else if(tagName.currentTag && tagName.currentTag.element){74 t = tagName.currentTag.element;75 }76 if (_.isString(text)) {77 t.text(text);78 }79 return t;80 }81 return function(tagName, objectAttributes, text){82 var container = createElement("div"),83 firstTag;84 if(_.isString(tagName)){85 firstTag = new tag(tagName, objectAttributes);86 }else if(tagName.isTag){87 firstTag = tagName;88 }else{89 throw new Error("tagName must be a valid html tagName");90 }91 firstTag.text(text);92 _.each(objectAttributes, function(v, k){93 firstTag.attr(k, v);94 });95 return {96 isTop: true,97 root: $(container),98 siblings: [firstTag],99 currentTag: firstTag,100 addRoot: function(tagName, attributes){101 var t = new tag(tagName, attributes);102 this.siblings.push(t.element || t);103 this.currentTag = t;104 return this;105 },106 /**107 * Specifies a hyperlink108 * @param attributes109 * @param text110 * @returns {*}111 */112 a: function(attributes, text){113 var t = getTag("a", attributes, text);114 this.currentTag.append(t.element || t);115 return this;116 },117 /**118 * Specifies an abbreviation119 * @param attributes120 * @param text121 * @returns {*}122 */123 abbr: function(attributes, text){124 var t = getTag("abbr", attributes, text);125 this.currentTag.append(t.element || t);126 return this;127 },128 /**129 * Specifies an address element130 * @param attributes131 * @param text132 * @returns {*}133 */134 address: function(attributes, text){135 var t = getTag("address", attributes, text);136 this.currentTag.append(t.element || t);137 return this;138 },139 /**140 * Specifies an area inside an image map141 * @param attributes142 * @param text143 * @returns {*}144 */145 area: function(attributes, text){146 var t = getTag("area", attributes, text);147 this.currentTag.append(t.element || t);148 return this;149 },150 /**151 * Specifies an article152 * @param attributes153 * @param text154 * @returns {*}155 */156 article: function(attributes, text){157 var t = getTag("article", attributes, text);158 this.currentTag.append(t.element || t);159 return this;160 },161 /**162 * Specifies content aside from the page content163 * @param attributes164 * @param text165 * @returns {*}166 */167 aside: function(attributes, text){168 var t = getTag("aside", attributes, text);169 this.currentTag.append(t.element || t);170 return this;171 },172 /**173 * Specifies sound content174 * @param attributes175 * @param text176 * @returns {*}177 */178 audio: function(attributes, text){179 var t = getTag("audio", attributes, text);180 this.currentTag.append(t.element || t);181 return this;182 },183 /**184 * Specifies bold text185 * @param attributes186 * @param text187 * @returns {*}188 */189 b: function(attributes, text){190 var t = getTag("b", attributes, text);191 this.currentTag.append(t.element || t);192 return this;193 },194 /**195 * Specifies a base URL for all the links in a page196 * @param attributes197 * @param text198 * @returns {*}199 */200 base: function(attributes, text){201 var t = getTag("base", attributes, text);202 this.currentTag.append(t.element || t);203 return this;204 },205 /**206 * For bi-directional text formatting207 * @param attributes208 * @param text209 * @returns {*}210 */211 bdi: function(attributes, text){212 var t = getTag("bdi", attributes, text);213 this.currentTag.append(t.element || t);214 return this;215 },216 /**217 * Specifies the direction of text display218 * @param attributes219 * @param text220 * @returns {*}221 */222 bdo: function(attributes, text){223 var t = getTag("bdo", attributes, text);224 this.currentTag.append(t.element || t);225 return this;226 },227 /**228 * Specifies a long quotation229 * @param attributes230 * @param text231 * @returns {*}232 */233 blockquote: function(attributes, text){234 var t = getTag("blockquote", attributes, text);235 this.currentTag.append(t.element || t);236 return this;237 },238 /**239 * Specifies the body element240 * @param attributes241 * @param text242 * @returns {*}243 */244 body: function(attributes, text){245 var t = getTag("body", attributes, text);246 this.currentTag.append(t.element || t);247 return this;248 },249 /**250 * Inserts a single line break251 * @param attributes252 * @param text253 * @returns {*}254 */255 br: function(attributes, text){256 var t = getTag("br", attributes, text);257 this.currentTag.append(t.element || t);258 return this;259 },260 /**261 * Specifies a push button262 * @param attributes263 * @param text264 * @returns {*}265 */266 button: function(attributes, text){267 var t = getTag("button", attributes, text);268 this.currentTag.append(t.element || t);269 return this;270 },271 /**272 * Define graphics273 * @param attributes274 * @param text275 * @returns {*}276 */277 canvas: function(attributes, text){278 var t = getTag("canvas", attributes, text);279 this.currentTag.append(t.element || t);280 return this;281 },282 /**283 * Specifies a table caption284 * @param attributes285 * @param text286 * @returns {*}287 */288 caption: function(attributes, text){289 var t = getTag("caption", attributes, text);290 this.currentTag.append(t.element || t);291 return this;292 },293 /**294 * Specifies a citation295 * @param attributes296 * @param text297 * @returns {*}298 */299 cite: function(attributes, text){300 var t = getTag("cite", attributes, text);301 this.currentTag.append(t.element || t);302 return this;303 },304 /**305 * Specifies computer code text306 * @param attributes307 * @param text308 * @returns {*}309 */310 code: function(attributes, text){311 var t = getTag("code", attributes, text);312 this.currentTag.append(t.element || t);313 return this;314 },315 /**316 * Specifies attributes for table columns�317 * @param attributes318 * @param text319 * @returns {*}320 */321 col: function(attributes, text){322 var t = getTag("col", attributes, text);323 this.currentTag.append(t.element || t);324 return this;325 },326 /**327 * Specifies groups of table columns328 * @param attributes329 * @param text330 * @returns {*}331 */332 colgroup: function(attributes, text){333 var t = getTag("colgroup", attributes, text);334 this.currentTag.append(t.element || t);335 return this;336 },337 /**338 * Specifies a command339 * @param attributes340 * @param text341 * @returns {*}342 */343 command: function(attributes, text){344 var t = getTag("command", attributes, text);345 this.currentTag.append(t.element || t);346 return this;347 },348 /**349 * Allows for machine-readable data to be provided350 * @param attributes351 * @param text352 * @returns {*}353 */354 data: function(attributes, text){355 var t = getTag("data", attributes, text);356 this.currentTag.append(t.element || t);357 return this;358 },359 /**360 * "Allows for an interactive representation of tree361 * @param attributes362 * @param text363 * @returns {*}364 */365 datagrid: function(attributes, text){366 var t = getTag("datagrid", attributes, text);367 this.currentTag.append(t.element || t);368 return this;369 },370 /**371 * "Specifies an ""autocomplete"" dropdown list"372 * @param attributes373 * @param text374 * @returns {*}375 */376 datalist: function(attributes, text){377 var t = getTag("datalist", attributes, text);378 this.currentTag.append(t.element || t);379 return this;380 },381 /**382 * Specifies a definition description383 * @param attributes384 * @param text385 * @returns {*}386 */387 dd: function(attributes, text){388 var t = getTag("dd", attributes, text);389 this.currentTag.append(t.element || t);390 return this;391 },392 /**393 * Specifies deleted text394 * @param attributes395 * @param text396 * @returns {*}397 */398 del: function(attributes, text){399 var t = getTag("del", attributes, text);400 this.currentTag.append(t.element || t);401 return this;402 },403 /**404 * Specifies details of an element405 * @param attributes406 * @param text407 * @returns {*}408 */409 details: function(attributes, text){410 var t = getTag("details", attributes, text);411 this.currentTag.append(t.element || t);412 return this;413 },414 /**415 * Defines�a definition term416 * @param attributes417 * @param text418 * @returns {*}419 */420 dfn: function(attributes, text){421 var t = getTag("dfn", attributes, text);422 this.currentTag.append(t.element || t);423 return this;424 },425 /**426 * Specifies a section in a document427 * @param attributes428 * @param text429 * @returns {*}430 */431 div: function(attributes, text){432 var t = getTag("div", attributes, text);433 this.currentTag.append(t.element || t);434 return this;435 },436 /**437 * Specifies a definition list438 * @param attributes439 * @param text440 * @returns {*}441 */442 dl: function(attributes, text){443 var t = getTag("dl", attributes, text);444 this.currentTag.append(t.element || t);445 return this;446 },447 /**448 * Specifies a definition term449 * @param attributes450 * @param text451 * @returns {*}452 */453 dt: function(attributes, text){454 var t = getTag("dt", attributes, text);455 this.currentTag.append(t.element || t);456 return this;457 },458 /**459 * Specifies emphasized text�460 * @param attributes461 * @param text462 * @returns {*}463 */464 em: function(attributes, text){465 var t = getTag("em", attributes, text);466 this.currentTag.append(t.element || t);467 return this;468 },469 /**470 * Specifies external application or interactive content471 * @param attributes472 * @param text473 * @returns {*}474 */475 embed: function(attributes, text){476 var t = getTag("embed", attributes, text);477 this.currentTag.append(t.element || t);478 return this;479 },480 /**481 * Specifies a target for events sent by a server482 * @param attributes483 * @param text484 * @returns {*}485 */486 eventsource: function(attributes, text){487 var t = getTag("eventsource", attributes, text);488 this.currentTag.append(t.element || t);489 return this;490 },491 /**492 * Specifies a fieldset493 * @param attributes494 * @param text495 * @returns {*}496 */497 fieldset: function(attributes, text){498 var t = getTag("fieldset", attributes, text);499 this.currentTag.append(t.element || t);500 return this;501 },502 /**503 * Specifies caption for the figure element.504 * @param attributes505 * @param text506 * @returns {*}507 */508 figcaption: function(attributes, text){509 var t = getTag("figcaption", attributes, text);510 this.currentTag.append(t.element || t);511 return this;512 },513 /**514 * "Specifies a group of media content515 * @param attributes516 * @param text517 * @returns {*}518 */519 figure: function(attributes, text){520 var t = getTag("figure", attributes, text);521 this.currentTag.append(t.element || t);522 return this;523 },524 /**525 * Specifies a footer for a section or page526 * @param attributes527 * @param text528 * @returns {*}529 */530 footer: function(attributes, text){531 var t = getTag("footer", attributes, text);532 this.currentTag.append(t.element || t);533 return this;534 },535 /**536 * Specifies a form�537 * @param attributes538 * @param text539 * @returns {*}540 */541 form: function(attributes, text){542 var t = getTag("form", attributes, text);543 this.currentTag.append(t.element || t);544 return this;545 },546 /**547 * Specifies a heading level 1548 * @param attributes549 * @param text550 * @returns {*}551 */552 h1: function(attributes, text){553 var t = getTag("h1", attributes, text);554 this.currentTag.append(t.element || t);555 return this;556 },557 /**558 * Specifies a heading level 2559 * @param attributes560 * @param text561 * @returns {*}562 */563 h2: function(attributes, text){564 var t = getTag("h2", attributes, text);565 this.currentTag.append(t.element || t);566 return this;567 },568 /**569 * Specifies a heading level 3570 * @param attributes571 * @param text572 * @returns {*}573 */574 h3: function(attributes, text){575 var t = getTag("h3", attributes, text);576 this.currentTag.append(t.element || t);577 return this;578 },579 /**580 * Specifies a heading level 4581 * @param attributes582 * @param text583 * @returns {*}584 */585 h4: function(attributes, text){586 var t = getTag("h4", attributes, text);587 this.currentTag.append(t.element || t);588 return this;589 },590 /**591 * Specifies a heading level 5592 * @param attributes593 * @param text594 * @returns {*}595 */596 h5: function(attributes, text){597 var t = getTag("h5", attributes, text);598 this.currentTag.append(t.element || t);599 return this;600 },601 /**602 * Specifies a heading level 6603 * @param attributes604 * @param text605 * @returns {*}606 */607 h6: function(attributes, text){608 var t = getTag("h6", attributes, text);609 this.currentTag.append(t.element || t);610 return this;611 },612 /**613 * Specifies information about the document614 * @param attributes615 * @param text616 * @returns {*}617 */618 head: function(attributes, text){619 var t = getTag("head", attributes, text);620 this.currentTag.append(t.element || t);621 return this;622 },623 /**624 * "Specifies a group of introductory or navigational aids625 * @param attributes626 * @param text627 * @returns {*}628 */629 header: function(attributes, text){630 var t = getTag("header", attributes, text);631 this.currentTag.append(t.element || t);632 return this;633 },634 /**635 * Specifies a header for a section or page636 * @param attributes637 * @param text638 * @returns {*}639 */640 hgroup: function(attributes, text){641 var t = getTag("hgroup", attributes, text);642 this.currentTag.append(t.element || t);643 return this;644 },645 /**646 * Specifies a horizontal rule647 * @param attributes648 * @param text649 * @returns {*}650 */651 hr: function(attributes, text){652 var t = getTag("hr", attributes, text);653 this.currentTag.append(t.element || t);654 return this;655 },656 /**657 * Specifies italic text658 * @param attributes659 * @param text660 * @returns {*}661 */662 i: function(attributes, text){663 var t = getTag("i", attributes, text);664 this.currentTag.append(t.element || t);665 return this;666 },667 /**668 * Specifies an inline sub window (frame)669 * @param attributes670 * @param text671 * @returns {*}672 */673 iframe: function(attributes, text){674 var t = getTag("iframe", attributes, text);675 this.currentTag.append(t.element || t);676 return this;677 },678 /**679 * Specifies an image680 * @param attributes681 * @param text682 * @returns {*}683 */684 img: function(attributes, text){685 var t = getTag("img", attributes, text);686 this.currentTag.append(t.element || t);687 return this;688 },689 /**690 * Specifies an input field691 * @param attributes692 * @param text693 * @returns {*}694 */695 input: function(attributes, text){696 var t = getTag("input", attributes, text);697 this.currentTag.append(t.element || t);698 return this;699 },700 /**701 * Specifies inserted text702 * @param attributes703 * @param text704 * @returns {*}705 */706 ins: function(attributes, text){707 var t = getTag("ins", attributes, text);708 this.currentTag.append(t.element || t);709 return this;710 },711 /**712 * Specifies keyboard text713 * @param attributes714 * @param text715 * @returns {*}716 */717 kbd: function(attributes, text){718 var t = getTag("kbd", attributes, text);719 this.currentTag.append(t.element || t);720 return this;721 },722 /**723 * Generates a key pair724 * @param attributes725 * @param text726 * @returns {*}727 */728 keygen: function(attributes, text){729 var t = getTag("keygen", attributes, text);730 this.currentTag.append(t.element || t);731 return this;732 },733 /**734 * Specifies a label�for a form control735 * @param attributes736 * @param text737 * @returns {*}738 */739 label: function(attributes, text){740 var t = getTag("label", attributes, text);741 this.currentTag.append(t.element || t);742 return this;743 },744 /**745 * Specifies a title in a fieldset746 * @param attributes747 * @param text748 * @returns {*}749 */750 legend: function(attributes, text){751 var t = getTag("legend", attributes, text);752 this.currentTag.append(t.element || t);753 return this;754 },755 /**756 * Specifies a list item757 * @param attributes758 * @param text759 * @returns {*}760 */761 li: function(attributes, text){762 var t = getTag("li", attributes, text);763 this.currentTag.append(t.element || t);764 return this;765 },766 /**767 * Specifies a resource reference768 * @param attributes769 * @param text770 * @returns {*}771 */772 link: function(attributes, text){773 var t = getTag("link", attributes, text);774 this.currentTag.append(t.element || t);775 return this;776 },777 /**778 * Specifies marked text779 * @param attributes780 * @param text781 * @returns {*}782 */783 mark: function(attributes, text){784 var t = getTag("mark", attributes, text);785 this.currentTag.append(t.element || t);786 return this;787 },788 /**789 * Specifies an image map�790 * @param attributes791 * @param text792 * @returns {*}793 */794 map: function(attributes, text){795 var t = getTag("map", attributes, text);796 this.currentTag.append(t.element || t);797 return this;798 },799 /**800 * Specifies a menu list801 * @param attributes802 * @param text803 * @returns {*}804 */805 menu: function(attributes, text){806 var t = getTag("menu", attributes, text);807 this.currentTag.append(t.element || t);808 return this;809 },810 /**811 * Specifies meta information812 * @param attributes813 * @param text814 * @returns {*}815 */816 meta: function(attributes, text){817 var t = getTag("meta", attributes, text);818 this.currentTag.append(t.element || t);819 return this;820 },821 /**822 * Specifies measurement within a predefined range823 * @param attributes824 * @param text825 * @returns {*}826 */827 meter: function(attributes, text){828 var t = getTag("meter", attributes, text);829 this.currentTag.append(t.element || t);830 return this;831 },832 /**833 * Specifies navigation links834 * @param attributes835 * @param text836 * @returns {*}837 */838 nav: function(attributes, text){839 var t = getTag("nav", attributes, text);840 this.currentTag.append(t.element || t);841 return this;842 },843 /**844 * Specifies a noscript section845 * @param attributes846 * @param text847 * @returns {*}848 */849 noscript: function(attributes, text){850 var t = getTag("noscript", attributes, text);851 this.currentTag.append(t.element || t);852 return this;853 },854 /**855 * Specifies an embedded object856 * @param attributes857 * @param text858 * @returns {*}859 */860 object: function(attributes, text){861 var t = getTag("object", attributes, text);862 this.currentTag.append(t.element || t);863 return this;864 },865 /**866 * Specifies an ordered list867 * @param attributes868 * @param text869 * @returns {*}870 */871 ol: function(attributes, text){872 var t = getTag("ol", attributes, text);873 this.currentTag.append(t.element || t);874 return this;875 },876 /**877 * Specifies an option group878 * @param attributes879 * @param text880 * @returns {*}881 */882 optgroup: function(attributes, text){883 var t = getTag("optgroup", attributes, text);884 this.currentTag.append(t.element || t);885 return this;886 },887 /**888 * Specifies an option in a drop-down list889 * @param attributes890 * @param text891 * @returns {*}892 */893 option: function(attributes, text){894 var t = getTag("option", attributes, text);895 this.currentTag.append(t.element || t);896 return this;897 },898 /**899 * Specifies some types of output900 * @param attributes901 * @param text902 * @returns {*}903 */904 output: function(attributes, text){905 var t = getTag("output", attributes, text);906 this.currentTag.append(t.element || t);907 return this;908 },909 /**910 * Specifies a paragraph911 * @param attributes912 * @param text913 * @returns {*}914 */915 p: function(attributes, text){916 var t = getTag("p", attributes, text);917 this.currentTag.append(t.element || t);918 return this;919 },920 /**921 * Specifies a parameter for an object922 * @param attributes923 * @param text924 * @returns {*}925 */926 param: function(attributes, text){927 var t = getTag("param", attributes, text);928 this.currentTag.append(t.element || t);929 return this;930 },931 /**932 * Specifies preformatted text933 * @param attributes934 * @param text935 * @returns {*}936 */937 pre: function(attributes, text){938 var t = getTag("pre", attributes, text);939 this.currentTag.append(t.element || t);940 return this;941 },942 /**943 * Specifies progress of a task of any kind944 * @param attributes945 * @param text946 * @returns {*}947 */948 progress: function(attributes, text){949 var t = getTag("progress", attributes, text);950 this.currentTag.append(t.element || t);951 return this;952 },953 /**954 * Specifies a short quotation955 * @param attributes956 * @param text957 * @returns {*}958 */959 q: function(attributes, text){960 var t = getTag("q", attributes, text);961 this.currentTag.append(t.element || t);962 return this;963 },964 /**965 * Specifies a ruby annotation (used in East Asian typography)966 * @param attributes967 * @param text968 * @returns {*}969 */970 ruby: function(attributes, text){971 var t = getTag("ruby", attributes, text);972 this.currentTag.append(t.element || t);973 return this;974 },975 /**976 * Used for the benefit of browsers that don't support ruby annotations977 * @param attributes978 * @param text979 * @returns {*}980 */981 rp: function(attributes, text){982 var t = getTag("rp", attributes, text);983 this.currentTag.append(t.element || t);984 return this;985 },986 /**987 * Specifies the ruby text component of a ruby annotation.988 * @param attributes989 * @param text990 * @returns {*}991 */992 rt: function(attributes, text){993 var t = getTag("rt", attributes, text);994 this.currentTag.append(t.element || t);995 return this;996 },997 /**998 * Indicates text that's no longer accurate or relevant.999 * @param attributes1000 * @param text1001 * @returns {*}1002 */1003 s: function(attributes, text){1004 var t = getTag("s", attributes, text);1005 this.currentTag.append(t.element || t);1006 return this;1007 },1008 /**1009 * Specifies sample computer code1010 * @param attributes1011 * @param text1012 * @returns {*}1013 */1014 samp: function(attributes, text){1015 var t = getTag("samp", attributes, text);1016 this.currentTag.append(t.element || t);1017 return this;1018 },1019 /**1020 * Specifies a script1021 * @param attributes1022 * @param text1023 * @returns {*}1024 */1025 script: function(attributes, text){1026 var t = getTag("script", attributes, text);1027 this.currentTag.append(t.element || t);1028 return this;1029 },1030 /**1031 * Specifies a section1032 * @param attributes1033 * @param text1034 * @returns {*}1035 */1036 section: function(attributes, text){1037 var t = getTag("section", attributes, text);1038 this.currentTag.append(t.element || t);1039 return this;1040 },1041 /**1042 * Specifies a selectable list1043 * @param attributes1044 * @param text1045 * @returns {*}1046 */1047 select: function(attributes, text){1048 var t = getTag("select", attributes, text);1049 this.currentTag.append(t.element || t);1050 return this;1051 },1052 /**1053 * Specifies small text1054 * @param attributes1055 * @param text1056 * @returns {*}1057 */1058 small: function(attributes, text){1059 var t = getTag("small", attributes, text);1060 this.currentTag.append(t.element || t);1061 return this;1062 },1063 /**1064 * Specifies media resources1065 * @param attributes1066 * @param text1067 * @returns {*}1068 */1069 source: function(attributes, text){1070 var t = getTag("source", attributes, text);1071 this.currentTag.append(t.element || t);1072 return this;1073 },1074 /**1075 * Specifies a section in a document1076 * @param attributes1077 * @param text1078 * @returns {*}1079 */1080 span: function(attributes, text){1081 var t = getTag("span", attributes, text);1082 this.currentTag.append(t.element || t);1083 return this;1084 },1085 /**1086 * Specifies strong text1087 * @param attributes1088 * @param text1089 * @returns {*}1090 */1091 strong: function(attributes, text){1092 var t = getTag("strong", attributes, text);1093 this.currentTag.append(t.element || t);1094 return this;1095 },1096 /**1097 * Specifies a style definition1098 * @param attributes1099 * @param text1100 * @returns {*}1101 */1102 style: function(attributes, text){1103 var t = getTag("style", attributes, text);1104 this.currentTag.append(t.element || t);1105 return this;1106 },1107 /**1108 * Specifies subscripted text1109 * @param attributes1110 * @param text1111 * @returns {*}1112 */1113 sub: function(attributes, text){1114 var t = getTag("sub", attributes, text);1115 this.currentTag.append(t.element || t);1116 return this;1117 },1118 /**1119 * Specifies a summary / caption for the <details> element1120 * @param attributes1121 * @param text1122 * @returns {*}1123 */1124 summary: function(attributes, text){1125 var t = getTag("summary", attributes, text);1126 this.currentTag.append(t.element || t);1127 return this;1128 },1129 /**1130 * Specifies superscripted text1131 * @param attributes1132 * @param text1133 * @returns {*}1134 */1135 sup: function(attributes, text){1136 var t = getTag("sup", attributes, text);1137 this.currentTag.append(t.element || t);1138 return this;1139 },1140 /**1141 * Specifies a table1142 * @param attributes1143 * @param text1144 * @returns {*}1145 */1146 table: function(attributes, text){1147 var t = getTag("table", attributes, text);1148 this.currentTag.append(t.element || t);1149 return this;1150 },1151 /**1152 * Specifies a table body1153 * @param attributes1154 * @param text1155 * @returns {*}1156 */1157 tbody: function(attributes, text){1158 var t = getTag("tbody", attributes, text);1159 this.currentTag.append(t.element || t);1160 return this;1161 },1162 /**1163 * Specifies a table cell1164 * @param attributes1165 * @param text1166 * @returns {*}1167 */1168 td: function(attributes, text){1169 var t = getTag("td", attributes, text);1170 this.currentTag.append(t.element || t);1171 return this;1172 },1173 /**1174 * Specifies a text area1175 * @param attributes1176 * @param text1177 * @returns {*}1178 */1179 textarea: function(attributes, text){1180 var t = getTag("textarea", attributes, text);1181 this.currentTag.append(t.element || t);1182 return this;1183 },1184 /**1185 * Specifies a table footer1186 * @param attributes1187 * @param text1188 * @returns {*}1189 */1190 tfoot: function(attributes, text){1191 var t = getTag("tfoot", attributes, text);1192 this.currentTag.append(t.element || t);1193 return this;1194 },1195 /**1196 * Specifies a table header1197 * @param attributes1198 * @param text1199 * @returns {*}1200 */1201 th: function(attributes, text){1202 var t = getTag("th", attributes, text);1203 this.currentTag.append(t.element || t);1204 return this;1205 },1206 /**1207 * Specifies a table header1208 * @param attributes1209 * @param text1210 * @returns {*}1211 */1212 thead: function(attributes, text){1213 var t = getTag("thead", attributes, text);1214 this.currentTag.append(t.element || t);1215 return this;1216 },1217 /**1218 * Specifies a date/time1219 * @param attributes1220 * @param text1221 * @returns {*}1222 */1223 time: function(attributes, text){1224 var t = getTag("time", attributes, text);1225 this.currentTag.append(t.element || t);1226 return this;1227 },1228 /**1229 * Specifies the document title1230 * @param attributes1231 * @param text1232 * @returns {*}1233 */1234 title: function(attributes, text){1235 var t = getTag("title", attributes, text);1236 this.currentTag.append(t.element || t);1237 return this;1238 },1239 /**1240 * Specifies a table row1241 * @param attributes1242 * @param text1243 * @returns {*}1244 */1245 tr: function(attributes, text){1246 var t = getTag("tr", attributes, text);1247 this.currentTag.append(t.element || t);1248 return this;1249 },1250 /**1251 * Specifies a text track for media such as video and audio1252 * @param attributes1253 * @param text1254 * @returns {*}1255 */1256 track: function(attributes, text){1257 var t = getTag("track", attributes, text);1258 this.currentTag.append(t.element || t);1259 return this;1260 },1261 /**1262 * Specifies text with a non-textual annotation.1263 * @param attributes1264 * @param text1265 * @returns {*}1266 */1267 u: function(attributes, text){1268 var t = getTag("u", attributes, text);1269 this.currentTag.append(t.element || t);1270 return this;1271 },1272 /**1273 * Specifies an unordered list1274 * @param attributes1275 * @param text1276 * @returns {*}1277 */1278 ul: function(attributes, text){1279 var t = getTag("ul", attributes, text);1280 this.currentTag.append(t.element || t);1281 return this;1282 },1283 /**1284 * Specifies a video1285 * @param attributes1286 * @param text1287 * @returns {*}1288 */1289 video: function(attributes, text){1290 var t = getTag("video", attributes, text);1291 this.currentTag.append(t.element || t);1292 return this;1293 },1294 /**1295 * Specifies a line break opportunity for very long words and strings of text with no spaces.1296 * @param attributes1297 * @param text1298 * @returns {*}1299 */1300 wbr: function(attributes, text){1301 var t = getTag("wbr", attributes, text);1302 this.currentTag.append(t.element || t);1303 return this;1304 },1305 text: function(txt){1306 this.currentTag.text(txt);1307 return this;1308 },1309 content: function(txt){1310 this.currentTag.html(txt);1311 return this;1312 },1313 render: function(cb){1314 var txt = "";1315 _.each(this.siblings, function(v, i){...
multi-image.js
Source:multi-image.js
...27 // Our output div is id'd output28 var output = document.getElementById('output');29 // set our exif data30 output.innerHTML = '<h3>EXIF Data (Img1)</h3>';31 output.innerHTML += '<p>Make: ' + EXIF.getTag(this, 'Make') + '</p>';32 output.innerHTML += '<p>Model: ' + EXIF.getTag(this, 'Model') + '</p>';33 output.innerHTML += '<p>Date: ' + EXIF.getTag(this, 'DateTime') + '</p>';34 output.innerHTML += '<p>Aperture: ' + EXIF.getTag(this, 'FNumber') + '</p>';35 output.innerHTML += '<p>ISO: ' + EXIF.getTag(this, 'ISOSpeedRatings') + '</p>';36 output.innerHTML += '<p>Exposure: ' + EXIF.getTag(this, 'ExposureTime') + '</p>';37 // If there is GPS data, display it. If not, say there's no GPS data.38 if (EXIF.getTag(this, 'GPSLatitude') == undefined) {39 output.innerHTML += '<p>No GPS data found for this image.</p>';40 }41 else {42 output.innerHTML += '<p>GPS Latitude: ' + EXIF.getTag(this, 'GPSLatitude') + '</p>';43 output.innerHTML += '<p>GPS Longitude: ' + EXIF.getTag(this, 'GPSLongitude') + '</p>';44 }45 });46 };47 };48 // Set the onload function for each reader49 reader2.onload = function(e) {50 // Create a new image and set that image to the image from the inputbox51 var img2 = new Image();52 img2.src = e.target.result;53 // Function to get our image data54 img2.onload = function() {55 EXIF.getData(img2, function() {56 // Our output div is id'd output57 var output = document.getElementById('output2');58 // set our exif data59 output.innerHTML = '<h3>EXIF Data (Img2)</h3>';60 output.innerHTML += '<p>Make: ' + EXIF.getTag(this, 'Make') + '</p>';61 output.innerHTML += '<p>Model: ' + EXIF.getTag(this, 'Model') + '</p>';62 output.innerHTML += '<p>Date: ' + EXIF.getTag(this, 'DateTime') + '</p>';63 output.innerHTML += '<p>Aperture: ' + EXIF.getTag(this, 'FNumber') + '</p>';64 output.innerHTML += '<p>ISO: ' + EXIF.getTag(this, 'ISOSpeedRatings') + '</p>';65 output.innerHTML += '<p>Exposure: ' + EXIF.getTag(this, 'ExposureTime') + '</p>';66 // If there is GPS data, display it. If not, say there's no GPS data.67 if (EXIF.getTag(this, 'GPSLatitude') == undefined) {68 output.innerHTML += '<p>No GPS data found for this image.</p>';69 }70 else {71 output.innerHTML += '<p>GPS Latitude: ' + EXIF.getTag(this, 'GPSLatitude') + '</p>';72 output.innerHTML += '<p>GPS Longitude: ' + EXIF.getTag(this, 'GPSLongitude') + '</p>';73 }74 });75 };76 };77 // Set the onload function for each reader78 reader3.onload = function(e) {79 // Create a new image and set that image to the image from the inputbox80 var img3 = new Image();81 img3.src = e.target.result;82 // Function to get our image data83 img3.onload = function() {84 EXIF.getData(img3, function() {85 // Our output div is id'd output86 var output = document.getElementById('output3');87 // set our exif data88 output.innerHTML = '<h3>EXIF Data (Img3)</h3>';89 output.innerHTML += '<p>Make: ' + EXIF.getTag(this, 'Make') + '</p>';90 output.innerHTML += '<p>Model: ' + EXIF.getTag(this, 'Model') + '</p>';91 output.innerHTML += '<p>Date: ' + EXIF.getTag(this, 'DateTime') + '</p>';92 output.innerHTML += '<p>Aperture: ' + EXIF.getTag(this, 'FNumber') + '</p>';93 output.innerHTML += '<p>ISO: ' + EXIF.getTag(this, 'ISOSpeedRatings') + '</p>';94 output.innerHTML += '<p>Exposure: ' + EXIF.getTag(this, 'ExposureTime') + '</p>';95 // If there is GPS data, display it. If not, say there's no GPS data.96 if (EXIF.getTag(this, 'GPSLatitude') == undefined) {97 output.innerHTML += '<p>No GPS data found for this image.</p>';98 }99 else {100 output.innerHTML += '<p>GPS Latitude: ' + EXIF.getTag(this, 'GPSLatitude') + '</p>';101 output.innerHTML += '<p>GPS Longitude: ' + EXIF.getTag(this, 'GPSLongitude') + '</p>';102 }103 });104 };105 };106 // Set the onload function for each reader107 reader4.onload = function(e) {108 // Create a new image and set that image to the image from the inputbox109 var img4 = new Image();110 img4.src = e.target.result;111 // Function to get our image data112 img4.onload = function() {113 EXIF.getData(img4, function() {114 // Our output div is id'd output115 var output = document.getElementById('output4');116 // set our exif data117 output.innerHTML = '<h3>EXIF Data (Img4)</h3>';118 output.innerHTML += '<p>Make: ' + EXIF.getTag(this, 'Make') + '</p>';119 output.innerHTML += '<p>Model: ' + EXIF.getTag(this, 'Model') + '</p>';120 output.innerHTML += '<p>Date: ' + EXIF.getTag(this, 'DateTime') + '</p>';121 output.innerHTML += '<p>Aperture: ' + EXIF.getTag(this, 'FNumber') + '</p>';122 output.innerHTML += '<p>ISO: ' + EXIF.getTag(this, 'ISOSpeedRatings') + '</p>';123 output.innerHTML += '<p>Exposure: ' + EXIF.getTag(this, 'ExposureTime') + '</p>';124 // If there is GPS data, display it. If not, say there's no GPS data.125 if (EXIF.getTag(this, 'GPSLatitude') == undefined) {126 output.innerHTML += '<p>No GPS data found for this image.</p>';127 }128 else {129 output.innerHTML += '<p>GPS Latitude: ' + EXIF.getTag(this, 'GPSLatitude') + '</p>';130 output.innerHTML += '<p>GPS Longitude: ' + EXIF.getTag(this, 'GPSLongitude') + '</p>';131 }132 });133 };134 };135 // Set the onload function for each reader136 reader5.onload = function(e) {137 // Create a new image and set that image to the image from the inputbox138 var img5 = new Image();139 img5.src = e.target.result;140 // Function to get our image data141 img5.onload = function() {142 EXIF.getData(img5, function() {143 // Our output div is id'd output144 var output = document.getElementById('output5');145 // set our exif data146 output.innerHTML = '<h3>EXIF Data (Img5)</h3>';147 output.innerHTML += '<p>Make: ' + EXIF.getTag(this, 'Make') + '</p>';148 output.innerHTML += '<p>Model: ' + EXIF.getTag(this, 'Model') + '</p>';149 output.innerHTML += '<p>Date: ' + EXIF.getTag(this, 'DateTime') + '</p>';150 output.innerHTML += '<p>Aperture: ' + EXIF.getTag(this, 'FNumber') + '</p>';151 output.innerHTML += '<p>ISO: ' + EXIF.getTag(this, 'ISOSpeedRatings') + '</p>';152 output.innerHTML += '<p>Exposure: ' + EXIF.getTag(this, 'ExposureTime') + '</p>';153 // If there is GPS data, display it. If not, say there's no GPS data.154 if (EXIF.getTag(this, 'GPSLatitude') == undefined) {155 output.innerHTML += '<p>No GPS data found for this image.</p>';156 }157 else {158 output.innerHTML += '<p>GPS Latitude: ' + EXIF.getTag(this, 'GPSLatitude') + '</p>';159 output.innerHTML += '<p>GPS Longitude: ' + EXIF.getTag(this, 'GPSLongitude') + '</p>';160 }161 });162 };163 }; 164 // Finally, throw away all the image data165 reader1.readAsDataURL(file1);166 reader2.readAsDataURL(file2);167 reader3.readAsDataURL(file3);168 reader4.readAsDataURL(file4);169 reader5.readAsDataURL(file5);170 // Create a new file171 var file = new Blob([document.getElementById('output').innerHTML + '\n' + document.getElementById('output2').innerHTML + '\n' + document.getElementById('output3').innerHTML + '\n' + document.getElementById('output4').innerHTML + '\n' + document.getElementById('output5').innerHTML], {type: 'text/plain'});172 // Create a button to donwliad the file173 var btn = document.createElement('a');...
ParsedComponents.js
Source:ParsedComponents.js
...96 ...props,97 }98 return <Box __themeKey={__themeKey || tag} ref={ref} as={tag} {...props} />99 })100export const A = getTag("a")101export const Abbr = getTag("abbr")102export const Address = getTag("address")103export const Area = getTag("area")104export const Article = getTag("article")105export const Aside = getTag("aside")106export const Audio = getTag("audio")107export const B = getTag("b")108export const Base = getTag("base")109export const Bdi = getTag("bdi")110export const Bdo = getTag("bdo")111export const Blockquote = getTag("blockquote")112export const Body = getTag("body")113export const Br = getTag("br")114export const Button = getTag("button")115export const Canvas = getTag("canvas")116export const Caption = getTag("caption")117export const Cite = getTag("cite")118export const Code = getTag("code")119export const Col = getTag("col")120export const Colgroup = getTag("colgroup")121export const Data = getTag("data")122export const Datalist = getTag("datalist")123export const Dd = getTag("dd")124export const Del = getTag("del")125export const Details = getTag("details")126export const Dfn = getTag("dfn")127export const Dialog = getTag("dialog")128export const Div = getTag("div")129export const Dl = getTag("dl")130export const Dt = getTag("dt")131export const Em = getTag("em")132export const Embed = getTag("embed")133export const Fieldset = getTag("fieldset")134export const Figcaption = getTag("figcaption")135export const Figure = getTag("figure")136export const Footer = getTag("footer")137export const Form = getTag("form")138export const H1 = getTag("h1")139export const H2 = getTag("h2")140export const H3 = getTag("h3")141export const H4 = getTag("h4")142export const H5 = getTag("h5")143export const H6 = getTag("h6")144export const Head = getTag("head")145export const Header = getTag("header")146export const Hr = getTag("hr")147export const Html = getTag("html")148export const I = getTag("i")149export const Iframe = getTag("iframe")150export const Img = getTag("img")151export const Input = getTag("input")152export const Ins = getTag("ins")153export const Kbd = getTag("kbd")154export const Label = getTag("label")155export const Legend = getTag("legend")156export const Li = getTag("li")157export const Main = getTag("main")158export const Map = getTag("map")159export const Mark = getTag("mark")160export const Meta = getTag("meta")161export const Meter = getTag("meter")162export const Nav = getTag("nav")163export const Ol = getTag("ol")164export const Optgroup = getTag("optgroup")165export const Option = getTag("option")166export const Output = getTag("output")167export const P = getTag("p")168export const Param = getTag("param")169export const Path = getTag("path")170export const Picture = getTag("picture")171export const Pre = getTag("pre")172export const Progress = getTag("progress")173export const Q = getTag("q")174export const Rp = getTag("rp")175export const Rt = getTag("rt")176export const Ruby = getTag("ruby")177export const S = getTag("s")178export const Samp = getTag("samp")179export const Section = getTag("section")180export const Select = getTag("select")181export const Small = getTag("small")182export const Source = getTag("source")183export const Span = getTag("span")184export const Strong = getTag("strong")185export const Style = getTag("style")186export const Sub = getTag("sub")187export const Summary = getTag("summary")188export const Sup = getTag("sup")189export const Svg = getTag("svg")190export const Table = getTag("table")191export const Tbody = getTag("tbody")192export const Td = getTag("td")193export const Template = getTag("template")194export const Textarea = getTag("textarea")195export const Tfoot = getTag("tfoot")196export const Th = getTag("th")197export const Thead = getTag("thead")198export const Time = getTag("time")199export const Title = getTag("title")200export const Tr = getTag("tr")201export const Track = getTag("track")202export const U = getTag("u")203export const Ul = getTag("ul")204export const Video = getTag("video")205export const Wbr = getTag("wbr")206// Additionl components.207export const Container = getTag(208 "div",209 {210 mx: "auto",211 },212 "container"213)214export const Flexbox = getTag(215 "div",216 {217 d: "flex",218 },219 "flexbox"220)221export const Grid = getTag(222 "div",223 {224 d: "grid",225 },226 "grid"227)228export const VisuallyHidden = getTag("span", {229 position: "absolute",230 top: "auto",231 overflow: "hidden",232 clip: "rect(1px, 1px, 1px, 1px)",233 width: "1px",234 height: "1px",235 whiteSpace: "nowrap",...
main.js
Source:main.js
...24 // Function to get our image data25 img.onload = function () {26 EXIF.getData(img, function () {27 var output = document.getElementById("output");28 if(EXIF.getTag(this, "Make") == undefined && EXIF.getTag(this, "Model") == undefined && EXIF.getTag(this, "DateTime") == undefined && EXIF.getTag(this, "FNumber") == undefined && EXIF.getTag(this, "ISOSpeedRatings") == undefined && EXIF.getTag(this, "ExposureTime") == undefined) {29 output.innerHTML = "<h3>No data found for this image.</h3>"30 return31 }32 // Our output div is id'd output33 // set our exif data34 output.innerHTML = "<h3>EXIF Data</h3>";35 output.innerHTML += "<p>Make: " + EXIF.getTag(this, "Make") + "</p>";36 output.innerHTML += "<p>Model: " + EXIF.getTag(this, "Model") + "</p>";37 output.innerHTML +=38 "<p>Date: " + EXIF.getTag(this, "DateTime") + "</p>";39 output.innerHTML +=40 "<p>Aperture: " + EXIF.getTag(this, "FNumber") + "</p>";41 output.innerHTML +=42 "<p>ISO: " + EXIF.getTag(this, "ISOSpeedRatings") + "</p>";43 output.innerHTML +=44 "<p>Exposure: " + EXIF.getTag(this, "ExposureTime") + "</p>";45 // If there is GPS data, display it. If not, say there's no GPS data.46 if (EXIF.getTag(this, "GPSLatitude") == undefined) {47 output.innerHTML += "<p>No GPS data found for this image.</p>";48 } else {49 output.innerHTML +=50 "<p>GPS Latitude: " + EXIF.getTag(this, "GPSLatitude") + "</p>";51 output.innerHTML +=52 "<p>GPS Longitude: " + EXIF.getTag(this, "GPSLongitude") + "</p>"; // If there is GPS data, get the coordinates53 }54 const downloadBtn = document.getElementById("download");55 downloadBtn.classList.remove("d-none");56 downloadBtn.onclick = () => {57 downloadJSON(this);58 };59 output.innerHTML +=60 '<p>Need extra data? <button class="btn" id="btn" onclick="extraExifData()">Get Extra Data</button></p>';61 });62 };63 };64 // No idea what this is but it's needed for it to work properly65 // TODO: figure out what this does.66 reader.readAsDataURL(file);67 // Throw away the image data after we're done with it.68 throwAway();69}70/**71 * Ideally you will have a top level variable in this script and instead of just output the data72 * to the <div> you will first store it into that variable, then just stringify that variable and73 * continue. This way you don't have to fetch again all the EXIF information.74 *75 * @param {*} $thisImage reference to the image itself76 */77function downloadJSON($thisImage) {78 const link = document.createElement("a");79 link.download = `exif_data_${new Date().toISOString()}_${80 $thisImage.name81 }.json`;82 const data = JSON.stringify(83 {84 make: EXIF.getTag($thisImage, "Make"),85 model: EXIF.getTag($thisImage, "Model"),86 date: EXIF.getTag($thisImage, "DateTime"),87 aperture: EXIF.getTag($thisImage, "FNumber"),88 ISO: EXIF.getTag($thisImage, "ISOSpeedRatings"),89 exposure: EXIF.getTag($thisImage, "ExposureTime"),90 gps_latitude: EXIF.getTag($thisImage, "GPSLatitude"),91 gps_longitude: EXIF.getTag($thisImage, "GPSLongitude"),92 gps_longitude: EXIF.getTag($thisImage, "GPSLongitude"),93 gps_altitude: EXIF.getTag($thisImage, "GPSAltitude"),94 gps_altitude_ref: EXIF.getTag($thisImage, "GPSAltitudeRed"),95 gps_date_stamp: EXIF.getTag($thisImage, "GPSDateStamp"),96 gps_time_stamp: EXIF.getTag($thisImage, "GPSTimeStamp"),97 gps_processing_method: EXIF.getTag($thisImage, "GPSProcessingMethod"),98 },99 null,100 2101 );102 const dataString = `data:text/json;charset=utf-8,${encodeURIComponent(data)}`;103 link.href = dataString;104 link.click();105 link.remove();106}107// Get extra information that one might not want108function extraExifData() {109 // This function is *exactly* the same as the one above. It just displays other information.110 var file = document.getElementById("file").files[0];111 var reader = new FileReader();112 reader.onload = function (e) {113 var img = new Image();114 img.src = e.target.result;115 img.onload = function () {116 EXIF.getData(img, function () {117 // get our extra exif data118 var output = document.getElementById("extradata");119 output.innerHTML = "<h3>Extra EXIF Data</h3>";120 output.innerHTML +=121 "<p>Focal Length: " + EXIF.getTag(this, "FocalLength") + "</p>";122 output.innerHTML += "<p>Flash: " + EXIF.getTag(this, "Flash") + "</p>";123 output.innerHTML +=124 "<p>GPS Altitude: " + EXIF.getTag(this, "GPSAltitude") + "</p>";125 output.innerHTML +=126 "<p>GPS Altitude Ref: " +127 EXIF.getTag(this, "GPSAltitudeRef") +128 "</p>";129 output.innerHTML +=130 "<p>GPS Date: " + EXIF.getTag(this, "GPSDateStamp") + "</p>";131 output.innerHTML +=132 "<p>GPS Time: " + EXIF.getTag(this, "GPSTimeStamp") + "</p>";133 output.innerHTML +=134 "<p>GPS Processing Method: " +135 EXIF.getTag(this, "GPSProcessingMethod") +136 "</p>";137 });138 };139 };140 // Again, zero idea what this does, but it's needed.141 reader.readAsDataURL(file);142 // Throw away the image data after we're done with it.143 throwAway();...
allSections.js
Source:allSections.js
...57 }58}59const data = [60 // Header61 { c: MenuV1, label: "MenuV1", ...getTag('Header')},62 // Text63 { c: CallToAction, label: "CallToAction", ...getTag('Text')},64 { c: CallToActionV5, label: "CallToActionV5", ...getTag('Text')},65 { c: CallToActionV7, label: "CallToActionV7", ...getTag('Text')},66 { c: TextV1, label: "TextV1", ...getTag('Text')},67 { c: Text, label: "Text", ...getTag('Text')},68 // Image with Text69 { c: CallToAction2, label: "CallToAction2", ...getTag('Image with text')},70 { c: GalleryV1, label: "GalleryV1", ...getTag('Image with text')},71 { c: GalleryV6, label: "GalleryV6", ...getTag('Image with text')},72 { c: GalleryV5, label: "GalleryV5", ...getTag('Image with text')},73 { c: FeaturesV10, label: "FeaturesV10", ...getTag('Image with text')},74 { c: FeaturesV11, label: "FeaturesV11", ...getTag('Image with text')},75 { c: ContactV2, label: "ContactV2", ...getTag('Image with text')},76 { c: FeaturesV2, label: "FeaturesV2", ...getTag('Image with text')},77 { c: FeaturesV4, label: "FeaturesV4", ...getTag('Image with text')},78 // Hero79 { c: HeroV1, label: "HeroV1", ...getTag('Hero')},80 { c: HeroV2, label: "HeroV2", ...getTag('Hero')},81 { c: HeroV4, label: "HeroV4", ...getTag('Hero')},82 { c: HeroV5, label: "HeroV5", ...getTag('Hero')},83 // { c: HeroV6, label: "HeroV6", ...getTag('Hero') },84 // Product85 // { c: ProductCardGridV1, label: "ProductCardGridV1", ...getTag('Product')},86 { c: ProductCardGridV2, label: "ProductCardGridV2", ...getTag('Product')},87 // { c: ProductCardGridV3, label: "ProductCardGridV3", ...getTag('Product')},88 // { c: ProductCardGridV4, label: "ProductCardGridV4", ...getTag('Product')},89 // { c: ProductDetailV1, label: "ProductDetailV1", ...getTag('Product')},90 // { c: ProductDetailV2, label: "ProductDetailV2", ...getTag('Product')},91 // { c: ProductDetailV3, label: "ProductDetailV3", ...getTag('Product')},92 // { c: ProductDetailV4, label: "ProductDetailV4", ...getTag('Product')},93 { c: ProductDetail1, label: "ProductDetail1", ...getTag('Product')},94 // Forms95 { c: CallToActionV1, label: "CallToActionV1", ...getTag('Forms')},96 { c: HeroV3, label: "HeroV3", ...getTag('Forms')},97 // { c: FormV1, label: "FormV1", ...getTag('Forms')},98 { c: Form1, label: "Form1", ...getTag('Forms')},99 // { c: FormV2, label: "FormV2", ...getTag('Forms')},100 // { c: FormV3, label: "FormV3", ...getTag('Forms')},101 { c: ContactV1, label: "ContactV1", ...getTag('Forms')},102 // Cart103 { c: CartV1, label: "CartV1", ...getTag('Cart')},104 // Image Grid105 { c: Gallery, label: "Gallery", ...getTag('Image Grid')},106 // Footer107 { c: FooterV1, label: "FooterV1", ...getTag('Footer')},108 { c: FooterV2, label: "FooterV2", ...getTag('Footer')},109 // Development, dont delete yet110 // Discarded111 // { c: FormV4, label: "FormV4", tag: "Form", id: uuid()},112 // Combined 113 // -- Gallery --114 // { c: GalleryV2, label: "GalleryV2", tag: "Gallery", id: uuid()},115 // { c: GalleryV3, label: "GalleryV3", tag: "Gallery", id: uuid()},116 // { c: GalleryV4, label: "GalleryV4", tag: "Gallery", id: uuid()},117 // { c: GalleryV7, label: "GalleryV7", tag: "Gallery", id: uuid()},118 // -- CallToAction --119 // { c: CallToActionV3, label: "CallToActionV3", tag: "CTA", id: uuid()},120 // { c: CallToActionV2, label: "CallToActionV2", tag: "CTA", id: uuid()},121 // { c: CallToActionV4, label: "CallToActionV4", tag: "CTA", id: uuid()},122 // -- CallToAction2 --123 // { c: CallToActionV6, label: "CallToActionV6", tag: "CTA", id: uuid()},124 // { c: CallToActionV8, label: "CallToActionV8", tag: "CTA", id: uuid()},125 126 // -- Text --127 // { c: TextV2, label: "TextV2", ...getTag('Text')},128 // { c: TextV3, label: "TextV3", ...getTag('Text')},129];130let tagArray = Array.from(new Set(data.map(i => i.tag)));131tagArray.unshift("All");132export const tags = tagArray;...
Using AI Code Generation
1var wptag = require('wptag');2console.log(wptag.getTag());3var wptag = require('wptag');4console.log(wptag.getTag());5var wptag = require('wptag');6console.log(wptag.getTag());7var wptag = require('wptag');8console.log(wptag.getTag());
Using AI Code Generation
1var wpt = require('webpagetest');2var options = {3};4var webpagetest = new wpt(options);5webpagetest.runTest('www.example.com', function(err, data) {6 if (err) return console.error(err);7 console.log(data);8 webpagetest.getTestResults(data.data.testId, function(err, data) {9 if (err) return console.error(err);10 console.log(data);11 });12});
Using AI Code Generation
1const wptools = require('wptools');2const wiki = wptools('Barack Obama');3wiki.get((err, data) => {4 if (err) {5 console.log(err);6 return;7 }8 console.log(data);9});10{11 claims: {
Using AI Code Generation
1var wptag = require('wp-tag');2wptag.getTag('tagname', function (err, tag) {3 if (err) {4 console.log(err);5 } else {6 console.log(tag);7 }8});9var wptag = require('wp-tag');10wptag.getTags(function (err, tags) {11 if (err) {12 console.log(err);13 } else {14 console.log(tags);15 }16});17var wptag = require('wp-tag');18wptag.getTags({page:1}, function (err, tags) {19 if (err) {20 console.log(err);21 } else {22 console.log(tags);23 }24});25var wptag = require('wp-tag');26wptag.getTags({page:1, per_page: 10}, function (err, tags) {27 if (err) {28 console.log(err);29 } else {30 console.log(tags);31 }32});33var wptag = require('wp-tag');34wptag.getTags({page:1, per_page: 10, search: 'searchterm'}, function (err, tags) {35 if (err) {36 console.log(err);37 } else {38 console.log(tags);39 }40});41var wptag = require('wp-tag');42wptag.getTags({page:1, per_page: 10, search: 'searchterm', exclude: 1}, function (err, tags) {43 if (err) {44 console.log(err);45 } else {46 console.log(tags);47 }48});49var wptag = require('wp-tag');50wptag.getTags({page:1, per_page: 10, search: 'searchterm', exclude: 1, include: 1}, function (err, tags) {51 if (err)
Using AI Code Generation
1var wptoolkit = require('wptoolkit');2var tag = wptoolkit.getTag();3console.log('Tag = ' + tag);4module.exports = {5 getTag: function () {6 return '1.0.0';7 }8};9module.exports = {10 getTag: function () {11 return '1.0.0';12 }13};14var wptoolkit = require('wptoolkit');15var tag = wptoolkit.getTag();16console.log('Tag = ' + tag);17module.exports = {18 getTag: function () {19 return '1.0.0';20 }21};22module.exports = {23 getTag: function () {24 return '1.0.0';25 }26};27var wptoolkit = require('wptoolkit');28var tag = wptoolkit.getTag();29console.log('Tag
Using AI Code Generation
1var wptoolkit = require('wptoolkit');2var tag = wptoolkit.getTag('test', 'test', 'test');3console.log(tag);4var wptoolkit = require('wptoolkit');5var tag = wptoolkit.getTag('test', 'test', 'test');6console.log(tag);7var wptoolkit = require('wptoolkit');8var tag = wptoolkit.getTag('test', 'test', 'test');9console.log(tag);10var wptoolkit = require('wptoolkit');11var tag = wptoolkit.getTag('test', 'test', 'test');12console.log(tag);13var wptoolkit = require('wptoolkit');14var tag = wptoolkit.getTag('test', 'test', 'test');15console.log(tag);16var wptoolkit = require('wptoolkit');17var tag = wptoolkit.getTag('test', 'test', 'test');18console.log(tag);19var wptoolkit = require('wptoolkit');20var tag = wptoolkit.getTag('test', 'test', 'test');21console.log(tag);22var wptoolkit = require('wptoolkit');23var tag = wptoolkit.getTag('test', 'test', 'test');24console.log(tag);25var wptoolkit = require('wptoolkit');26var tag = wptoolkit.getTag('test', 'test', 'test');27console.log(tag);28var wptoolkit = require('wptoolkit');
Using AI Code Generation
1var wptag = require('./wptag');2var tag = wptag.getTag('test');3console.log(tag);4exports.getTag = function(str) {5 return '<script type="text/javascript">alert(\'' + str + '\');</script>';6}
Using AI Code Generation
1var wpt = require('webpagetest');2var options = {3};4var test = wpt(options);5test.runTest(testUrl, function (err, data) {6 if (err) {7 console.log('Error: ' + err);8 } else {9 console.log('Test results for: ' + data.data.url);10 console.log('First View');11 console.log('------------------');12 console.log('Load time: ' + data.data.average.firstView.loadTime);13 console.log('Speed Index: ' + data.data.average.firstView.SpeedIndex);14 console.log('TTFB: ' + data.data.average.firstView.TTFB);15 console.log('Page Size: ' + data.data.average.firstView.bytesIn);16 console.log('Requests: ' + data.data.average.firstView.requests);17 console.log('Fully Loaded: ' + data.data.average.firstView.fullyLoaded);18 console.log('Doc Complete: ' + data.data.average.firstView.docTime);19 console.log('Load Time: ' + data.data.average.firstView.loadTime);20 console.log('Speed Index: ' + data.data.average.firstView.SpeedIndex);21 console.log('TTFB: ' + data.data.average.firstView.TTFB);22 console.log('Page Size: ' + data.data.average.firstView.bytesIn);23 console.log('Requests: ' + data.data.average.firstView.requests);24 console.log('Fully Loaded: ' + data.data.average.firstView.fullyLoaded);25 console.log('Doc Complete: ' + data.data.average.firstView.docTime);26 console.log('Load Time: ' + data.data.average.firstView.loadTime);27 console.log('Speed Index: ' + data.data.average.firstView.SpeedIndex);28 console.log('TTFB: ' + data.data.average.firstView.TTFB);29 console.log('Page Size: ' + data.data.average.firstView.bytesIn);30 console.log('Requests: ' + data.data.average.firstView.requests);
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!