How to use FrameWrap method in storybook-root

Best JavaScript code snippet using storybook-root

zoomqueries-beta1.0.js

Source:zoomqueries-beta1.0.js Github

copy

Full Screen

1function formatText(c) {2 var e = document.getElementById("CanvasHTML");3 var b = e.value;4 var f = b.substring(e.selectionStart, e.selectionEnd);5 var d = b.substring(0, e.selectionStart);6 var a = b.substring(e.selectionEnd, b.length);7 e.value = d + "<" + c + ">" + f + "</" + c + ">" + a8}9function formatTextTable(c) {10 var e = document.getElementById("CanvasHTML");11 var b = e.value;12 var f = b.substring(e.selectionStart, e.selectionEnd);13 var d = b.substring(0, e.selectionStart);14 var a = b.substring(e.selectionEnd, b.length);15 e.value = d + "<" + c + ">\n<tbody>\n" + f + "</tbody>\n</" + c + ">" + a16}17function formatTextImage() {18 var d = document.getElementById("CanvasHTML");19 var b = d.value;20 var c = b.substring(0, d.selectionStart);21 var f = b.substring(d.selectionEnd, b.length);22 var g = "";23 var a = "";24 smoke.prompt("Enter the URL of the image", function (e) {25 if (e) {26 smoke.prompt("Enter a description (alt) of the image", function (h) {27 if (h) {28 myValue = '<img src="' + e + '" alt="' + h + '" />';29 d.value = c + myValue + f30 }31 },32 {33 ok: "Yes",34 cancel: "Cancel",35 classname: "custom-class",36 reverseButtons: true37 })38 }39 },40 {41 ok: "Yes",42 cancel: "Cancel",43 classname: "custom-class",44 reverseButtons: true,45 value: "http://"46 })47}48function formatTextLink() {49 var c = document.getElementById("CanvasHTML");50 var a = c.value;51 var d = a.substring(c.selectionStart, c.selectionEnd);52 var b = a.substring(0, c.selectionStart);53 var f = a.substring(c.selectionEnd, a.length);54 var g = "";55 var h = "";56 smoke.prompt("Enter the URL", function (e) {57 if (e) {58 smoke.prompt("Enter a open target url like:\n _blank or _self or _top or _parent", function (i) {59 if (i) {60 myValue = '<a href="' + e + '" target="' + i + '">' + d + "</a>";61 c.value = b + myValue + f62 }63 },64 {65 ok: "Yes",66 cancel: "Cancel",67 classname: "custom-class",68 reverseButtons: true,69 value: "_blank"70 })71 }72 },73 {74 ok: "Yes",75 cancel: "Cancel",76 classname: "custom-class",77 reverseButtons: true,78 value: "http://"79 })80}81function formatTextiframe() {82 var c = document.getElementById("CanvasHTML");83 var a = c.value;84 var b = a.substring(0, c.selectionStart);85 var d = a.substring(c.selectionEnd, a.length);86 var f = "";87 smoke.prompt("Enter the Frame Src URL", function (e) {88 if (e) {89 myValue = '<iframe src="' + e + '"></iframe>';90 c.value = b + myValue + d91 }92 },93 {94 ok: "Yes",95 cancel: "Cancel",96 classname: "custom-class",97 reverseButtons: true,98 value: "http://"99 })100}101$(window).load(function () {102 $(".ui-resizable-s").css("display", "none");103 $(".ui-resizable-se").css("display", "none");104 var b = $(window).width();105 var a = $(window).height();106 $("#viewport_W").text(b + "PX");107 $("#viewport_H").text(a + "PX");108 $("#CanvasHTML").val("")109});110$(window).resize(function (b) {111 var a = $(window).width();112 var c = $(window).height();113 $("#viewport_W").text(a + "PX");114 $("#viewport_H").text(c + "PX")115});116function portraitLanscape() {117 var a = $("#framewrap").height();118 var b = $("#framewrap").width();119 if ($("#SimpleModeTAB").hasClass("active")) {120 $("#mode").text("LOCKED")121 } else {122 if (b > a) {123 $("#mode").text("LANDSCAPE")124 } else {125 $("#mode").text("PORTRAIT")126 }127 }128}129$(document).ready(function () {130 $(".borderframewrap").addClass("remborder");131 $("#SizePixelRatio").text("1");132 $("#Custom-PixelRatio").val("1");133 $("#SupportRetinaDevice").text("NO");134 $(".ui-resizable-se").css("display", "none");135 $("#lockedDIV").css({136 display: "block"137 });138 $("#RotateBTN, #CustomW-Input, #CustomH-Input, #DevMobileBTN").attr("disabled", "disable");139 $("#SimpleModeTAB").addClass("active");140 $("#fullscreen-BTN").addClass("active");141 $("#viewport_W").text($(window).width());142 $("#viewport_H").text($(window).height());143 $("#CustomW-Input").val($("#framewrap").width());144 $("#CustomH-Input").val($("#framewrap").height());145 $("#viewport_iframeW, #viewport_iframeW_PixelRatio").text($("#framewrap").width() + "PX");146 $("#viewport_iframeH, #viewport_iframeH_PixelRatio").text($("#framewrap").height() + "PX");147 $(".hideRB").css({148 display: "none"149 });150 $("#ruler-vertical[data-items]").each(function () {151 var h = $(this).empty(),152 e = Number(h.attr("data-items")) || 0,153 g = $(document.createElement("li")),154 f;155 for (f = 1; f < e; f++) {156 h.append(g.clone().text(f * 50))157 }158 });159 $("#ruler-horizontal[data-items]").each(function () {160 var g = $(this).empty(),161 e = Number(g.attr("data-items")) || 0,162 h = $(document.createElement("li")),163 f;164 for (f = 1; f < e; f++) {165 g.append(h.clone().text(f * 50))166 }167 });168 $("#framewrap").resizable({169 minHeight: 50,170 minWidth: 50,171 start: function (f, e) {172 $("iframe").css("pointer-events", "none")173 },174 stop: function (f, e) {175 $(".ui-resizable-e").removeClass("active");176 $("iframe").css("pointer-events", "auto")177 },178 resize: function (f, e) {179 $("#CustomW-Input").val($("#framewrap").width());180 $("#CustomH-Input").val($("#framewrap").height());181 $("#viewport_iframeW, #viewport_iframeW_PixelRatio").text($("#framewrap").width() + "PX");182 $("#viewport_iframeH, #viewport_iframeH_PixelRatio").text($("#framewrap").height() + "PX");183 $(".ui-resizable-e").attr("data-content", $("#viewport_iframeW_PixelRatio").text());184 $(".ui-resizable-s").attr("data-content", $("#viewport_iframeH_PixelRatio").text());185 $(".ui-resizable-e").addClass("active");186 $("#modedevice").text("CUSTOM");187 $("#SizePixelRatio").text("1");188 $("#Custom-PixelRatio").val("1");189 $("#SupportRetinaDevice").text("NO");190 portraitLanscape()191 }192 });193 $("#HtmlArea-BTN").click(function () {194 if ($(".htmleditor").css("display") == "none") {195 $(".htmleditor").show();196 $(".htmleditor").addClass("active");197 $("#HtmlArea-BTN").css({198 background: "#D14836"199 });200 if ($("#SimpleModeTAB").hasClass("active")) {201 $("#block").css({202 top: "53px",203 bottom: "216px"204 })205 } else {206 $("#block").css({207 top: "53px",208 bottom: "196px"209 })210 }211 } else {212 $(".htmleditor").hide();213 $(".htmleditor").removeClass("active");214 $("#HtmlArea-BTN").css({215 background: ""216 });217 if ($("#SimpleModeTAB").hasClass("active")) {218 $("#block").css({219 top: "53px",220 bottom: "50px"221 })222 } else {223 $("#block").css({224 top: "53px",225 bottom: "30px"226 })227 }228 }229 return false230 });231 $("#SimpleModeTAB").click(function () {232 $("#SizePixelRatio").text("1");233 $("#Custom-PixelRatio").val("1");234 $("#SupportRetinaDevice").text("NO");235 $("#VPortLockScreen").text("LOCK BROWSER");236 $(".borderframewrap").addClass("remborder");237 $("#lockedDIV").css({238 display: "block"239 });240 $("#RotateBTN, #CustomW-Input, #CustomH-Input, #DevMobileBTN").attr("disabled", "disable");241 $("#modedevice").text("CUSTOM");242 $("#ruler-horizontal").css({243 display: "none"244 });245 $("#SimpleModeTAB").addClass("active");246 $("#VPortLockScreen").css({247 display: "block"248 });249 $("#grid-view").css({250 "margin-left": "0"251 });252 $("#ruler-vertical").css({253 "margin-left": "0"254 });255 $(".SizePV240").css({256 width: "240px"257 });258 $("#rulerBOX").css({259 display: "none"260 });261 $("#SimpleModeTAB").css({262 background: "#D14836"263 });264 $("#CustomModeTAB").css({265 background: "#333"266 });267 $("#block").removeClass("full-screen");268 $("#header").css({269 height: "53px"270 });271 $("#grid-view").css({272 height: "100%",273 width: "100%"274 });275 $("#framewrap").css({276 width: "320px",277 height: "100%"278 });279 $("#CustomW-Input").val($("#framewrap").width());280 $("#CustomH-Input").val($("#framewrap").height());281 $("#viewport_iframeW, #viewport_iframeW_PixelRatio").text($("#framewrap").width() + "PX");282 $("#viewport_iframeH, #viewport_iframeH_PixelRatio").text($("#framewrap").height() + "PX");283 $(".ui-resizable-e").attr("data-content", $("#viewport_iframeW_PixelRatio").text());284 $(".ui-resizable-s").attr("data-content", $("#viewport_iframeH_PixelRatio").text());285 $(".ui-resizable-s").css("display", "none");286 $(".ui-resizable-e").css("display", "block");287 $("#mode").text("LOCKED");288 if ($(".htmleditor").hasClass("active")) {289 $("#block").css({290 top: "53px",291 bottom: "216px"292 })293 } else {294 $("#block").css({295 top: "53px",296 bottom: "50px"297 })298 }299 return false300 });301 $("#CustomModeTAB").click(function () {302 $("#SizePixelRatio").text("1");303 $("#Custom-PixelRatio").val("1");304 $("#SupportRetinaDevice").text("NO");305 $("#VPortLockScreen").text("FULL SCREEN");306 $(".borderframewrap").removeClass("remborder");307 $("#lockedDIV").css({308 display: "none"309 });310 $("#RotateBTN, #CustomW-Input, #CustomH-Input, #DevMobileBTN").removeAttr("disabled");311 $("#modedevice").text("CUSTOM");312 $("#ruler-horizontal").css({313 display: "block"314 });315 $("#SimpleModeTAB").removeClass("active");316 $("#rulerBOX").css({317 display: "block"318 });319 $("#grid-view").css({320 "margin-left": "20px"321 });322 $("#ruler-vertical").css({323 "margin-left": "20px"324 });325 $(".SizePV240").css({326 width: "260px"327 });328 $("#SimpleModeTAB").css({329 background: "#333"330 });331 $("#CustomModeTAB").css({332 background: "#D14836"333 });334 $("#block").addClass("full-screen");335 $("#header").css({336 height: "53px"337 });338 $("#grid-view").css({339 height: "3000px",340 width: "3000px"341 });342 $("#framewrap").css({343 width: "320px",344 height: "480px"345 });346 $("#CustomW-Input").val($("#framewrap").width());347 $("#CustomH-Input").val($("#framewrap").height());348 $("#viewport_iframeW, #viewport_iframeW_PixelRatio").text($("#framewrap").width() + "PX");349 $("#viewport_iframeH, #viewport_iframeH_PixelRatio").text($("#framewrap").height() + "PX");350 $(".ui-resizable-e").attr("data-content", $("#viewport_iframeW_PixelRatio").text());351 $(".ui-resizable-s").attr("data-content", $("#viewport_iframeH_PixelRatio").text());352 $(".ui-resizable-s").css("display", "block");353 $(".ui-resizable-e").css("display", "block");354 if ($(".htmleditor").hasClass("active")) {355 $("#block").css({356 top: "53px",357 bottom: "196px"358 })359 } else {360 $("#block").css({361 top: "53px",362 bottom: "30px"363 })364 }365 portraitLanscape();366 return false367 });368 $("#Reload-BTN").click(function () {369 if ($(".htmleditor").hasClass("active")) {370 window.frames.frame.location.reload()371 } else {372 $("#frame").attr("src", $("#frame").attr("src"))373 }374 return false375 });376 $("#GetUrl-BTN").click(function () {377 $("#CanvasHTML").val("");378 var g = $("#url").val().substring(0, 4);379 if (g === "http") {380 $.noop()381 } else {382 var i = $("#url").val();383 $("#url").val("http://" + i)384 }385 var m = $("#url").val();386 var f = $("#frame");387 var e = /^(https?:\/\/)?((?:[a-z0-9-]+\.)+(?:localhost|aero|asia|biz|cat|com|coop|info|int|edu|jobs|mobi|museum|name|net|org|post|pro|tel|travel|xxx|edu|gov|mil|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|fi|fj|fk|fm|fo|fr|ga|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gv|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rw|ru|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw))(?:\/|$)/i;388 var h = /^(http\:\/\/(?:localhost))/;389 smoke.signal("Loading! Please Wait...", function (k) {390 if (m.match(e)) {391 $.ajax({392 url: "validateurl.php",393 data: "geturl=" + m + "",394 type: "GET",395 success: function (l) {396 if (l == 200 || l == 301) {397 smoke.signal("SUCCESS : <span style='font-weight:bold; color:green'>HTTP/1.1 200 OK</span>", function (o) {398 f.attr("src", m);399 $($("#frame")[0].document).ready(function () {400 $.ajax({401 url: "gethtmlsource.php",402 data: "geturl=" + m + "",403 type: "GET",404 success: function (n) {405 $("#CanvasHTML").val(n)406 }407 });408 $.ajax({409 url: "lastcheckurl.php",410 data: "geturl=" + m + ""411 })412 })413 },414 {415 duration: 2000,416 classname: "custom-class"417 })418 } else {419 smoke.alert("STATUS: <span style='text-transform:uppercase;font-weight:bold; color:red'>" + l + "</span>", function (o) {420 f.attr("src", "deviceinfo.php")421 },422 {423 ok: "OK",424 cancel: "Nope",425 classname: "custom-class"426 })427 }428 }429 })430 } else {431 if (m.match(h)) {432 smoke.signal("SUCCESS : <span style='font-weight:bold; color:green'>RUNNING AT LOCALHOST</span>", function (l) {433 f.attr("src", m);434 $($("#frame")[0].document).ready(function () {435 $.ajax({436 url: "gethtmlsource.php",437 data: "geturl=" + m + "",438 type: "GET",439 success: function (n) {440 $("#CanvasHTML").val(n)441 }442 })443 })444 },445 {446 duration: 2000,447 classname: "custom-class"448 })449 } else {450 smoke.alert("Sorry! Invalid URL Request!", function (l) {451 f.attr("src", "deviceinfo.php")452 },453 {454 ok: "OK",455 cancel: "Nope",456 classname: "custom-class"457 })458 }459 }460 },461 {462 duration: 2000,463 classname: "custom-class"464 });465 return false466 });467 $("#url").keypress(function (e) {468 if (e.keyCode == 13) {469 var g = $("#url").val().substring(0, 4);470 if (g === "http") {471 $.noop()472 } else {473 var f = $("#url").val();474 $("#url").val("http://" + f)475 }476 $("#GetUrl-BTN").trigger("click");477 e.preventDefault();478 return false479 }480 });481 $("#VPort240, .SizePV240").click(function () {482 $("#framewrap").animate({483 width: "240px",484 height: "100%"485 },486 500, function () {487 $("#CustomW-Input").val($("#framewrap").width());488 $("#CustomH-Input").val($("#framewrap").height());489 $("#viewport_iframeW, #viewport_iframeW_PixelRatio").text($("#framewrap").width() + "PX");490 $("#viewport_iframeH, #viewport_iframeH_PixelRatio").text($("#framewrap").height() + "PX");491 $(".ui-resizable-e").attr("data-content", $("#viewport_iframeW_PixelRatio").text());492 $(".ui-resizable-s").attr("data-content", $("#viewport_iframeH_PixelRatio").text());493 $("#mode").text("LOCKED");494 $("#modedevice").text("CUSTOM");495 $("#SizePixelRatio").text("1");496 $("#Custom-PixelRatio").val("1");497 $("#SupportRetinaDevice").text("NO");498 $(".ui-resizable-e").css("display", "block")499 });500 return false501 });502 $("#VPort320, .SizePV320").click(function () {503 $("#framewrap").animate({504 width: "320",505 height: "100%"506 },507 500, function () {508 $("#CustomW-Input").val($("#framewrap").width());509 $("#CustomH-Input").val($("#framewrap").height());510 $("#viewport_iframeW, #viewport_iframeW_PixelRatio").text($("#framewrap").width() + "PX");511 $("#viewport_iframeH, #viewport_iframeH_PixelRatio").text($("#framewrap").height() + "PX");512 $(".ui-resizable-e").attr("data-content", $("#viewport_iframeW_PixelRatio").text());513 $(".ui-resizable-s").attr("data-content", $("#viewport_iframeH_PixelRatio").text());514 $("#mode").text("LOCKED");515 $("#modedevice").text("CUSTOM");516 $("#SizePixelRatio").text("1");517 $("#Custom-PixelRatio").val("1");518 $("#SupportRetinaDevice").text("NO");519 $(".ui-resizable-e").css("display", "block")520 });521 return false522 });523 $("#VPort480, .SizePV480").click(function () {524 $("#framewrap").animate({525 width: "480px",526 height: "100%"527 },528 500, function () {529 $("#CustomW-Input").val($("#framewrap").width());530 $("#CustomH-Input").val($("#framewrap").height());531 $("#viewport_iframeW, #viewport_iframeW_PixelRatio").text($("#framewrap").width() + "PX");532 $("#viewport_iframeH, #viewport_iframeH_PixelRatio").text($("#framewrap").height() + "PX");533 $(".ui-resizable-e").attr("data-content", $("#viewport_iframeW_PixelRatio").text());534 $(".ui-resizable-s").attr("data-content", $("#viewport_iframeH_PixelRatio").text());535 $("#mode").text("LOCKED");536 $("#modedevice").text("CUSTOM");537 $("#SizePixelRatio").text("1");538 $("#Custom-PixelRatio").val("1");539 $("#SupportRetinaDevice").text("NO");540 $(".ui-resizable-e").css("display", "block")541 });542 return false543 });544 $("#VPort768, .SizePV768").click(function () {545 $("#framewrap").animate({546 width: "768px",547 height: "100%"548 },549 500, function () {550 $("#CustomW-Input").val($("#framewrap").width());551 $("#CustomH-Input").val($("#framewrap").height());552 $("#viewport_iframeW, #viewport_iframeW_PixelRatio").text($("#framewrap").width() + "PX");553 $("#viewport_iframeH, #viewport_iframeH_PixelRatio").text($("#framewrap").height() + "PX");554 $(".ui-resizable-e").attr("data-content", $("#viewport_iframeW_PixelRatio").text());555 $(".ui-resizable-s").attr("data-content", $("#viewport_iframeH_PixelRatio").text());556 $("#mode").text("LOCKED");557 $("#modedevice").text("CUSTOM");558 $("#SizePixelRatio").text("1");559 $("#Custom-PixelRatio").val("1");560 $(".ui-resizable-e").css("display", "block")561 });562 return false563 });564 $("#VPort1024, .SizePV1024").click(function () {565 $("#framewrap").animate({566 width: "1024px",567 height: "100%"568 },569 500, function () {570 $("#CustomW-Input").val($("#framewrap").width());571 $("#CustomH-Input").val($("#framewrap").height());572 $("#viewport_iframeW, #viewport_iframeW_PixelRatio").text($("#framewrap").width() + "PX");573 $("#viewport_iframeH, #viewport_iframeH_PixelRatio").text($("#framewrap").height() + "PX");574 $(".ui-resizable-e").attr("data-content", $("#viewport_iframeW_PixelRatio").text());575 $(".ui-resizable-s").attr("data-content", $("#viewport_iframeH_PixelRatio").text());576 $("#mode").text("LOCKED");577 $("#modedevice").text("CUSTOM");578 $("#SizePixelRatio").text("1");579 $("#Custom-PixelRatio").val("1");580 $(".ui-resizable-e").css("display", "block")581 });582 return false583 });584 $("#VPort1216, .SizePV1216").click(function () {585 $("#framewrap").animate({586 width: "1216px",587 height: "100%"588 },589 500, function () {590 $("#CustomW-Input").val($("#framewrap").width());591 $("#CustomH-Input").val($("#framewrap").height());592 $("#viewport_iframeW, #viewport_iframeW_PixelRatio").text($("#framewrap").width() + "PX");593 $("#viewport_iframeH, #viewport_iframeH_PixelRatio").text($("#framewrap").height() + "PX");594 $(".ui-resizable-e").attr("data-content", $("#viewport_iframeW_PixelRatio").text());595 $(".ui-resizable-s").attr("data-content", $("#viewport_iframeH_PixelRatio").text());596 $("#mode").text("LOCKED");597 $("#modedevice").text("CUSTOM");598 $("#SizePixelRatio").text("1");599 $("#Custom-PixelRatio").val("1");600 $(".ui-resizable-e").css("display", "block")601 });602 return false603 });604 $("#VPortLockScreen, .SizeLockScreen").click(function () {605 $("#framewrap").animate({606 width: "100%",607 height: "100%"608 },609 500, function () {610 $("#CustomW-Input").val($("#framewrap").width());611 $("#CustomH-Input").val($("#framewrap").height());612 $("#viewport_iframeW, #viewport_iframeW_PixelRatio").text($("#framewrap").width() + "PX");613 $("#viewport_iframeH, #viewport_iframeH_PixelRatio").text($("#framewrap").height() + "PX");614 $(".ui-resizable-e").attr("data-content", $("#viewport_iframeW_PixelRatio").text());615 $(".ui-resizable-s").attr("data-content", $("#viewport_iframeH_PixelRatio").text());616 $("#mode").text("LOCKED");617 $("#modedevice").text("CUSTOM");618 $("#SizePixelRatio").text("1");619 $("#Custom-PixelRatio").val("1");620 $(".ui-resizable-e").css("display", "none")621 });622 return false623 });624 $("#CustomW-Input").keyup(function () {625 $("#modedevice").text("CUSTOM");626 var e = $("#CustomW-Input").val();627 var f = $("#Custom-PixelRatio").val();628 $("#viewport_iframeW").text(e + "PX");629 $("#viewport_iframeW_PixelRatio").text(e / f + "PX");630 $("#framewrap").animate({631 width: e / f632 },633 500, function () {634 portraitLanscape();635 $(".ui-resizable-e").attr("data-content", $("#viewport_iframeW_PixelRatio").text())636 });637 return false638 });639 $("#CustomH-Input").keyup(function () {640 $("#modedevice").text("CUSTOM");641 var e = $("#CustomH-Input").val();642 var f = $("#Custom-PixelRatio").val();643 $("#viewport_iframeH").text(e + "PX");644 $("#viewport_iframeH_PixelRatio").text(e / f + "PX");645 $("#framewrap").animate({646 height: e / f647 },648 500, function () {649 portraitLanscape();650 $(".ui-resizable-s").attr("data-content", $("#viewport_iframeH_PixelRatio").text())651 });652 return false653 });654 $("#Custom-PixelRatio").keyup(function () {655 $("#modedevice").text("CUSTOM");656 var g = $("#CustomW-Input").val();657 var f = $("#CustomH-Input").val();658 var e = $("#Custom-PixelRatio").val();659 $("#viewport_iframeW").text(g + "PX");660 $("#viewport_iframeH").text(f + "PX");661 $("#viewport_iframeW_PixelRatio").text(g / e + "PX");662 $("#viewport_iframeH_PixelRatio").text(f / e + "PX");663 $("#SizePixelRatio").text(e);664 $("#framewrap").animate({665 width: g / e,666 height: f / e667 },668 500, function () {669 portraitLanscape();670 $(".ui-resizable-e").attr("data-content", $("#viewport_iframeW_PixelRatio").text());671 $(".ui-resizable-s").attr("data-content", $("#viewport_iframeH_PixelRatio").text())672 });673 return false674 });675 $("#fullscreen-BTN").click(function () {676 if ($("#fullscreen-BTN").hasClass("active")) {677 $(document).fullScreen(true);678 $("#fullscreen-BTN").css({679 background: "#333"680 });681 $("#fullscreen-BTN").removeClass("active")682 } else {683 $("#fullscreen-BTN").css({684 background: "#535353"685 });686 $(document).fullScreen(false);687 $("#fullscreen-BTN").addClass("active")688 }689 return false690 });691 $("#share-BTN").click(function () {692 $("#dialog").dialog({693 height: 420,694 width: 615,695 dialogClass: "noTitleStuff",696 closeOnEscape: false,697 resizable: false,698 buttons: [{699 text: "Ok",700 click: function () {701 $(this).dialog("close")702 }703 }]704 });705 if ($("#url").val() == "http:// or localhost") {706 var f = "http://zoomqueries.com";707 $("#ShareorEmbedURL").val(f);708 var e = "<a href='http://zoomqueries.com'>ZoomQueries - Responsive Web Design Testing Tool</a>";709 $("#ShareorEmbedURLHref").val(e);710 var g = "[url=http://zoomqueries.com]ZoomQueries - Responsive Web Design Testing Tool[/url]";711 $("#ShareorEmbedURLForum").val(g)712 } else {713 var f = "http://zoomqueries.com?url=" + $("#url").val();714 $("#ShareorEmbedURL").val(f);715 var e = "<a href='http://zoomqueries.com?url=" + $("#url").val() + "'>ZoomQueries - Responsive Web Design Testing Tool</a>";716 $("#ShareorEmbedURLHref").val(e);717 var g = "[url=http://zoomqueries.com?url=" + $("#url").val() + "']ZoomQueries - Responsive Web Design Testing Tool[/url]";718 $("#ShareorEmbedURLForum").val(g)719 }720 return false721 });722 $("#btn-facebook").click(function () {723 var f = "https://www.facebook.com/sharer.php?u=http://zoomqueries.com?url=" + $("#url").val() + "&t=Responsive Web Design Testing Tool!";724 var e = "https://www.facebook.com/sharer.php?u=http://zoomqueries.com&t=Responsive Web Design Testing Tool!";725 if ($("#url").val() == "http:// or localhost") {726 window.location.href = e727 } else {728 window.location.href = f729 }730 });731 $("#btn-google").click(function () {732 var f = "https://plus.google.com/share?url=http://zoomqueries.com?url=" + $("#url").val();733 var e = "https://plus.google.com/share?url=http://zoomqueries.com";734 if ($("#url").val() == "http:// or localhost") {735 window.location.href = e736 } else {737 window.location.href = f738 }739 });740 $("#btn-twitter").click(function () {741 var f = "http://twitter.com/intent/tweet?text=Responsive Web Design Testing Tool&url=http://zoomqueries.com?url=" + $("#url").val();742 var e = "http://twitter.com/intent/tweet?text=Responsive Web Design Testing Tool&url=http://zoomqueries.com";743 if ($("#url").val() == "http:// or localhost") {744 window.location.href = e745 } else {746 window.location.href = f747 }748 });749 $("#RotateBTN").on("click", function () {750 var g = $("#CustomW-Input").val();751 var f = $("#CustomH-Input").val();752 var e = $("#Custom-PixelRatio").val();753 if (g > f) {754 $("#CustomW-Input").val(f);755 $("#CustomH-Input").val(g);756 var g = $("#CustomW-Input").val();757 var f = $("#CustomH-Input").val();758 $("#viewport_iframeW").text(g + "PX");759 $("#viewport_iframeH").text(f + "PX");760 $("#viewport_iframeW_PixelRatio").text(g / e + "PX");761 $("#viewport_iframeH_PixelRatio").text(f / e + "PX");762 $("#framewrap").animate({763 width: g / e,764 height: f / e765 },766 500, function () {767 portraitLanscape();768 $(".ui-resizable-e").attr("data-content", $("#viewport_iframeW_PixelRatio").text());769 $(".ui-resizable-s").attr("data-content", $("#viewport_iframeH_PixelRatio").text())770 })771 } else {772 $("#CustomW-Input").val(f);773 $("#CustomH-Input").val(g);774 var g = $("#CustomW-Input").val();775 var f = $("#CustomH-Input").val();776 $("#viewport_iframeW").text(g + "PX");777 $("#viewport_iframeH").text(f + "PX");778 $("#viewport_iframeW_PixelRatio").text(g / e + "PX");779 $("#viewport_iframeH_PixelRatio").text(f / e + "PX");780 $("#framewrap").animate({781 width: g / e,782 height: f / e783 },784 500, function () {785 portraitLanscape();786 $(".ui-resizable-e").attr("data-content", $("#viewport_iframeW_PixelRatio").text());787 $(".ui-resizable-s").attr("data-content", $("#viewport_iframeH_PixelRatio").text())788 })789 }790 return false791 });792 $("#DevListMobile li").not(".DevListNoClick").click(function () {793 var e = $(this).attr("data-width");794 var f = $(this).attr("data-height");795 var h = $(this).attr("data-pixelratio");796 var g = $(this).attr("data-retina");797 var i = $(this).attr("data-device");798 $("#CustomW-Input").val(e);799 $("#CustomH-Input").val(f);800 $("#viewport_iframeW").text(e + "PX");801 $("#viewport_iframeH").text(f + "PX");802 $("#SupportRetinaDevice").text(g);803 $("#SizePixelRatio").text(h);804 $("#Custom-PixelRatio").val(h);805 $("#viewport_iframeW_PixelRatio").text(e / h + "PX");806 $("#viewport_iframeH_PixelRatio").text(f / h + "PX");807 $(".ui-resizable-e").attr("data-content", $("#viewport_iframeW_PixelRatio").text());808 $(".ui-resizable-s").attr("data-content", $("#viewport_iframeH_PixelRatio").text());809 $("#modedevice").text(i);810 $("#framewrap").animate({811 width: e / h,812 height: f / h813 },814 500, function () {815 portraitLanscape()816 });817 return false818 });819 $("#DevMobileBTN").click(function () {820 $("#DeviceMenu").show();821 $("#MobileM").show();822 $("#DevMobileBTN").css({823 "background-color": "#D14836"824 });825 return false826 });827 $("#SimpleModeTAB, #CustomModeTAB, #HtmlArea-BTN, #GoTestRWD-BTN, #GetUrl-BTN, #Reload-BTN, #HtmlArea-BTN, #RotateBTN, #logo, #grid-view, #framewrap, #frame, #main-bar, #custom-viewport-stripes, #custom-viewport-stripe, #footer, #VPort240, #VPort320, #VPort480, #VPort768, #VPort1024, #VPort1216, #VPortLockScreen").click(function () {828 $("#DeviceMenu").hide();829 $("#DevMobileBTN").css({830 "background-color": "#333"831 });832 return false833 });834 $("html").click(function () {835 $("#DeviceMenu").hide();836 $("#DevMobileBTN").css({837 "background-color": "#333"838 });839 return false840 });841 $(document).click(function () {842 $("#DeviceMenu").hide();843 $("#DevMobileBTN").css({844 "background-color": "#333"845 });846 return false847 });848 $("#logo").click(function () {849 $("#WelcomeSCR").show();850 $("#WrapLockScreen").show();851 $("#lastcheck").show();852 return false853 });854 $("#GoTestRWD-BTN").click(function () {855 $("#WelcomeSCR").hide();856 $("#WrapLockScreen").hide();857 $("#lastcheck").hide();858 return false859 });860 $("#newhtml").click(function () {861 $("#DeviceMenu").hide();862 var e = '<html>\n<head>\n<style type="text/css">\n</style>\n</head>\n<body>\n</body>\n</html>';863 if (!$("#CanvasHTML").val().length) {864 $("#CanvasHTML").val(e)865 } else {866 smoke.confirm("Are you sure to replace html source?", function (f) {867 if (f) {868 $("#CanvasHTML").val(e)869 }870 },871 {872 ok: "Yes",873 cancel: "Cancel",874 classname: "custom-class",875 reverseButtons: true876 })877 }878 return false879 });880 $("#tagh1").click(function () {881 formatText("h1");882 return false883 });884 $("#tagh2").click(function () {885 formatText("h2");886 return false887 });888 $("#tagh3").click(function () {889 formatText("h3");890 return false891 });892 $("#tagh4").click(function () {893 formatText("h4");894 return false895 });896 $("#tagh5").click(function () {897 formatText("h5");898 return false899 });900 $("#tagh6").click(function () {901 formatText("h6");902 return false903 });904 $("#tagp").click(function () {905 formatText("p");906 return false907 });908 $("#tagb").click(function () {909 formatText("b");910 return false911 });912 $("#tagi").click(function () {913 formatText("i");914 return false915 });916 $("#tagu").click(function () {917 formatText("u");918 return false919 });920 $("#tagul").click(function () {921 formatText("ul");922 return false923 });924 $("#tagol").click(function () {925 formatText("ol");926 return false927 });928 $("#tagli").click(function () {929 formatText("li");930 return false931 });932 $("#tagdl").click(function () {933 formatText("dl");934 return false935 });936 $("#tagdt").click(function () {937 formatText("dt");938 return false939 });940 $("#tagdd").click(function () {941 formatText("dd");942 return false943 });944 $("#tagtable").click(function () {945 formatTextTable("table");946 return false947 });948 $("#tagtr").click(function () {949 formatText("tr");950 return false951 });952 $("#tagtd").click(function () {953 formatText("td");954 return false955 });956 $("#taglink").click(function () {957 formatTextLink();958 return false959 });960 $("#tagimg").click(function () {961 formatTextImage();962 return false963 });964 $("#tagiframe").click(function () {965 formatTextiframe();966 return false967 });968 $("#tagblockquote").click(function () {969 formatText("blockquote");970 return false971 });972 $("#tagcode").click(function () {973 formatText("code");974 return false975 });976 $("#tagpre").click(function () {977 formatText("pre");978 return false979 });980 $("#tagdiv").click(function () {981 formatText("div");982 return false983 });984 $("#tagspan").click(function () {985 formatText("span");986 return false987 });988 $("#runhtml").click(function () {989 var g = $("#frame");990 if (!$("#CanvasHTML").val().length) {991 smoke.alert("Blank html!\n please write your valid html!", function (h) {},992 {993 ok: "OK",994 cancel: "Cancel",995 classname: "custom-class"996 })997 } else {998 g.attr("src", "about:blank");999 var f = $("#CanvasHTML").val();1000 var e = document.getElementById("frame");1001 e = (e.contentWindow) ? e.contentWindow: (e.contentDocument.document) ? e.contentDocument.document: e.contentDocument;1002 e.document.open();1003 e.document.write(f);1004 e.document.close()1005 }1006 return false1007 });1008 if ($urlbookmark == "deviceinfo.php") {1009 var d = $("#frame");1010 d.attr("src", $urlbookmark);1011 $("#url").val("http:// or localhost")1012 } else {1013 var d = $("#frame");1014 var j = $urlbookmark_pr;1015 var a = $urlbookmark_wt;1016 var b = $urlbookmark_ht;1017 var c = $urlbookmark_sc;1018 $.ajax({1019 url: "validateurl.php",1020 data: "geturl=" + $urlbookmark + "",1021 type: "GET",1022 success: function (e) {1023 if (e == 200 || e == 301) {1024 smoke.signal("SUCCESS : <span style='font-weight:bold; color:green'>HTTP/1.1 200 OK</span>", function (f) {1025 if (c == "fs") {1026 d.attr("src", $urlbookmark);1027 $("#url").val($urlbookmark);1028 $("#VPortLockScreen").trigger("click")1029 } else {1030 d.attr("src", $urlbookmark);1031 $("#url").val($urlbookmark)1032 }1033 $.ajax({1034 url: "gethtmlsource.php",1035 data: "geturl=" + $urlbookmark + "",1036 type: "GET",1037 success: function (g) {1038 $("#CanvasHTML").val(g)1039 }1040 });1041 $.ajax({1042 url: "lastcheckurl.php",1043 data: "geturl=" + $urlbookmark + ""1044 })1045 },1046 {1047 duration: 2000,1048 classname: "custom-class"1049 })1050 } else {1051 smoke.alert("STATUS: <span style='text-transform:uppercase;font-weight:bold; color:red'>" + e + "</span>", function (f) {1052 iframe.attr("src", "deviceinfo.php")1053 },1054 {1055 ok: "OK",1056 cancel: "Nope",1057 classname: "custom-class"1058 })1059 }1060 }1061 })1062 } !1063 function (e) {1064 var f = function (g, h) {1065 this.init("tooltip", g, h)1066 };1067 f.prototype = {1068 constructor: f,1069 init: function (o, k, h) {1070 var g, i;1071 this.type = o;1072 this.$element = e(k);1073 this.options = this.getOptions(h);1074 this.enabled = true;1075 if (this.options.trigger != "manual") {1076 g = this.options.trigger == "hover" ? "mouseenter": "focus";1077 i = this.options.trigger == "hover" ? "mouseleave": "blur";1078 this.$element.on(g, this.options.selector, e.proxy(this.enter, this));1079 this.$element.on(i, this.options.selector, e.proxy(this.leave, this))1080 }1081 this.options.selector ? (this._options = e.extend({},1082 this.options, {1083 trigger: "manual",1084 selector: ""1085 })) : this.fixTitle()1086 },1087 getOptions: function (g) {1088 g = e.extend({},1089 e.fn[this.type].defaults, g, this.$element.data());1090 if (g.delay && typeof g.delay == "number") {1091 g.delay = {1092 show: g.delay,1093 hide: g.delay1094 }1095 }1096 return g1097 },1098 enter: function (g) {1099 var h = e(g.currentTarget)[this.type](this._options).data(this.type);1100 if (!h.options.delay || !h.options.delay.show) {1101 h.show()1102 } else {1103 h.hoverState = "in";1104 setTimeout(function () {1105 if (h.hoverState == "in") {1106 h.show()1107 }1108 },1109 h.options.delay.show)1110 }1111 },1112 leave: function (g) {1113 var h = e(g.currentTarget)[this.type](this._options).data(this.type);1114 if (!h.options.delay || !h.options.delay.hide) {1115 h.hide()1116 } else {1117 h.hoverState = "out";1118 setTimeout(function () {1119 if (h.hoverState == "out") {1120 h.hide()1121 }1122 },1123 h.options.delay.hide)1124 }1125 },1126 show: function () {1127 var n, m, l, i, h, k, g;1128 if (this.hasContent() && this.enabled) {1129 n = this.tip();1130 this.setContent();1131 if (this.options.animation) {1132 n.addClass("fade")1133 }1134 k = typeof this.options.placement == "function" ? this.options.placement.call(this, n[0], this.$element[0]) : this.options.placement;1135 m = /in/.test(k);1136 n.remove().css({1137 top: 0,1138 left: 0,1139 display: "block"1140 }).appendTo(m ? this.$element: document.body);1141 l = this.getPosition(m);1142 i = n[0].offsetWidth;1143 h = n[0].offsetHeight;1144 switch (m ? k.split(" ")[1] : k) {1145 case "bottom":1146 g = {1147 top: l.top + l.height,1148 left: l.left + l.width / 2 - i / 21149 };1150 break;1151 case "top":1152 g = {1153 top: l.top - h,1154 left: l.left + l.width / 2 - i / 21155 };1156 break;1157 case "left":1158 g = {1159 top: l.top + l.height / 2 - h / 2,1160 left: l.left - i1161 };1162 break;1163 case "right":1164 g = {1165 top: l.top + l.height / 2 - h / 2,1166 left: l.left + l.width1167 };1168 break1169 }1170 n.css(g).addClass(k).addClass("in")1171 }1172 },1173 setContent: function () {1174 var g = this.tip();1175 g.find(".tooltip-inner").html(this.getTitle());1176 g.removeClass("fade in top bottom left right")1177 },1178 hide: function () {1179 var i = this,1180 h = this.tip();1181 h.removeClass("in");1182 function g() {1183 var l = setTimeout(function () {1184 h.off(e.support.transition.end).remove()1185 },1186 500);1187 h.one(e.support.transition.end, function () {1188 clearTimeout(l);1189 h.remove()1190 })1191 }1192 e.support.transition && this.$tip.hasClass("fade") ? g() : h.remove()1193 },1194 fixTitle: function () {1195 var g = this.$element;1196 if (g.attr("title") || typeof(g.attr("data-original-title")) != "string") {1197 g.attr("data-original-title", g.attr("title") || "").removeAttr("title")1198 }1199 },1200 hasContent: function () {1201 return this.getTitle()1202 },1203 getPosition: function (g) {1204 return e.extend({},1205 (g ? {1206 top: 0,1207 left: 01208 }: this.$element.offset()), {1209 width: this.$element[0].offsetWidth,1210 height: this.$element[0].offsetHeight1211 })1212 },1213 getTitle: function () {1214 var g, i = this.$element,1215 h = this.options;1216 g = i.attr("data-original-title") || (typeof h.title == "function" ? h.title.call(i[0]) : h.title);1217 g = g.toString().replace(/(^\s*|\s*$)/, "");1218 return g1219 },1220 tip: function () {1221 return this.$tip = this.$tip || e(this.options.template)1222 },1223 validate: function () {1224 if (!this.$element[0].parentNode) {1225 this.hide();1226 this.$element = null;1227 this.options = null1228 }1229 },1230 enable: function () {1231 this.enabled = true1232 },1233 disable: function () {1234 this.enabled = false1235 },1236 toggleEnabled: function () {1237 this.enabled = !this.enabled1238 },1239 toggle: function () {1240 this[this.tip().hasClass("in") ? "hide": "show"]()1241 }1242 };1243 e.fn.tooltip = function (g) {1244 return this.each(function () {1245 var h = e(this),1246 i = h.data("tooltip"),1247 m = typeof g == "object" && g;1248 if (!i) {1249 h.data("tooltip", (i = new f(this, m)))1250 }1251 if (typeof g == "string") {1252 i[g]()1253 }1254 })1255 };1256 e.fn.tooltip.Constructor = f;1257 e.fn.tooltip.defaults = {1258 animation: true,1259 delay: 0,1260 selector: false,1261 placement: "top",1262 trigger: "hover",1263 title: "",1264 template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'1265 }1266 } (window.jQuery);1267 window.log = function () {1268 log.history = log.history || [];1269 log.history.push(arguments);1270 if (this.console) {1271 arguments.callee = arguments.callee.caller;1272 var e = [].slice.call(arguments);1273 (typeof console.log === "object" ? log.apply.call(console.log, console, e) : console.log.apply(console, e))1274 }1275 };1276 (function (h) {1277 function e() {}1278 for (var f = "assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,timeStamp,profile,profileEnd,time,timeEnd,trace,warn".split(","), g; g = f.pop();) {1279 h[g] = h[g] || e1280 }1281 })((function () {1282 try {1283 console.log();1284 return window.console1285 } catch(e) {1286 return window.console = {}1287 }1288 })());1289 $(function () {1290 $(document).tooltip({1291 selector: "input[rel=tooltip], textarea[rel=tooltip], a[rel=tooltip], select[rel=tooltip], button[rel=tooltip], span[rel=tooltip], div[rel=tooltip] "1292 })1293 });1294 $(".ui-resizable-e").attr("data-content", "320px") ...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1/**2 * use for index3 */4//菜单与tab联动效果,使用前提是各个菜单a链接的href保持一致5;(function( $, Eadccc ){6 Eadccc.mainTab = function(){7 me = this;8 me.menuItem = $( "#sidebarMenu li a[target='iframepage']" );9 me.tab = $( "#topTabUL" );10 me.frameWrap = $( "#iframeWrap" );11 var href, index, tit;12 //点击左侧菜单事件绑定13 this.menuItem.on( "click", function(){14 //如果不是最后一级子菜单,返回15 if( $(this).next().is("ul.sub-menu") ) return;16 me.showTab( $(this).attr("href"), $(this).text(), false );17 return false;18 })19 //点击tab事件绑定20 this.tab.on( "click", "a.text", function(){21 if( $(this).hasClass("currentClass") ) return;22 me.showTab( $(this).attr("href"), $(this).text(), false );23 return false;24 });25 //关闭tab事件绑定26 this.tab.on( "click", ".close", function(){27 var index = $(this).parent().index();28 $(this).parent().remove();29 me.frameWrap.find("iframe").eq( index ).remove();30 var $lastTab = me.tab.find( "li:last" ).children( "a.text" );31 me.showTab( $lastTab.attr("href"), $lastTab.text(), false );32 return false;33 });34 }35 //添加新的tab36 Eadccc.mainTab.prototype.addTab = function( href, tit ){37 if( me.tab.find("li").size() == 10 ){38 $.Alert("最多只能显示10个选项卡"); 39 return;40 };41 me.tab.find("li").removeClass( "currentClass" ).end().append("<li title='" + tit + "' class='currentClass'><a class='text' href='" + href + "'>" + tit + "</a><span class='close'>close</span></li>");42 me.frameWrap.find("iframe").hide().end().append("<iframe class='iframe-page' src='" + href + "' frameborder='0' width='100%'></iframe>");43 };44 //判断tab是否已经存在45 Eadccc.mainTab.prototype.isTabExit = function( href ){46 var i = false;47 me.tab.find("li").each( function( index, item ){48 var nHref = $(item).find("a").attr( "href" );49 if( nHref === href ){50 i = index;51 }52 });53 return i;54 };55 //判断相似URL(包含关系)的tab是否存在56 Eadccc.mainTab.prototype.isAlikeTabExit = function( href ){57 var i = false;58 me.tab.find("li").each( function( index, item ){59 var nHref = $(item).find("a").attr( "href" );60 if( nHref.indexOf( href ) >= 0 ){61 i = index;62 }63 });64 return i;65 };66 //如果tab已经存在,则显示;否则新增一个tab;67 Eadccc.mainTab.prototype.showTab = function( href, tit, reload ){68 if( href == undefined || tit == undefined ) return;69 var index = me.isTabExit( href );70 if( index !== false ){ //show tab71 var curFrame = me.frameWrap.find("iframe").eq( index );72 me.tab.find("li").eq( index ).addClass("currentClass").siblings().removeClass( "currentClass" );73 curFrame.show().siblings().hide();74 if( reload === true ) curFrame.attr( "src", curFrame.attr( 'src' ) );75 }else{ //add tab & show tab76 if( me.tab.find("li").size() == 10 ){ 77 $.Alert("最多只能显示10个选项卡"); 78 return;79 }80 me.tab.find("li").removeClass( "currentClass" ).end().append("<li title='" + tit + "' class='currentClass'><a class='text' href='" + href + "'>" + tit + "</a><span class='close'>close</span></li>");81 me.frameWrap.find("iframe").hide().end().append("<iframe class='iframe-page' src='" + href + "' frameborder='0' width='100%'></iframe>");82 }83 return false;84 };85 //在相似的url选项卡中打开新tab,tobo(相似标题)86 Eadccc.mainTab.prototype.showOnAlikeTab = function( str, href, tit ){87 var index = me.isAlikeTabExit( str );88 if( index !== false && index != 0 ){89 var curFrame = me.frameWrap.find("iframe").eq( index );90 me.tab.find("li").eq( index ).addClass("currentClass").siblings().removeClass( "currentClass" );91 me.tab.find("li").eq( index ).find("a").text( tit ).attr({ "href":href, "title":tit });92 curFrame.attr( "src", href ).show().siblings().hide();93 }else{94 me.addTab( href, tit );95 }96 };97 //销毁当前tab98 Eadccc.mainTab.prototype.destroy = function(){99 me.tab.find("li.currentClass>.close").trigger("click");100 };101 //刷新tab,url未传入或者不存在指定url的tab,则刷新当前tab102 Eadccc.mainTab.prototype.refresh = function( url ){103 var href = ( url == undefined ) ? window.location.href : url,104 index = me.isTabExit( href ),105 curFrame = ( index == false ) ? me.frameWrap.find("iframe:visible") : me.frameWrap.find("iframe").eq( index );106 curFrame.attr( "src", curFrame.attr( 'src' ) );107 };108})(jQuery,window.Eadccc||(window.Eadccc={}));109mainTab = new Eadccc.mainTab();110App.init();111/*显示签入弹屏*/112var $modal = $("#modifyCall");113function showModal( title, url ){114 $modal.modal('show').find( '.modal-title' ).text( title );115 $modal.find( 'iframe' ).prop( 'src', url );116};117/*关闭签入弹屏*/118function closeModal(){119 $("#modifyCall").modal('hide');120}121//刷新或关闭浏览器时提示信息122$(function(){123 /*window.onbeforeunload = function(){124  event.returnValue="确定要退出系统么?";125 }126*/127 $('#showOntab').on('click',function(){128 mainTab.showTab ( $(this).attr('href'), 'TAC工单创建' );129 $('#modifyContTAC').modal('hide');130 return false;131 });132 $('#showCAC').on('click',function(){133 mainTab.showTab ( $(this).attr('href'), 'CAC工单创建' );134 $('#modifyContCAC').modal('hide');135 return false;136 });137});138 /*消息提示弹框*/139$(function(){140 $("#testDemo").on('click',function(){141 $(".t_alert").show();142 });143 $(".close").on('click',function(){144 $(".t_alert").hide();145 });...

Full Screen

Full Screen

auth.js

Source:auth.js Github

copy

Full Screen

1/**2 * auth related feature3 */4import {thirdPartyConfigs} from 'ringcentral-embeddable-extension-common/src/common/app-config'5import logo from 'ringcentral-embeddable-extension-common/src/common/rc-logo'6import {7 createElementFromHTML,8 findParentBySel9} from 'ringcentral-embeddable-extension-common/src/common/helpers'10import * as ls from 'ringcentral-embeddable-extension-common/src/common/ls'11let tokenHandler12let {13 serviceName14} = thirdPartyConfigs15export async function updateUserAuthed(authed) {16 if (!authed){17 await ls.clear()18 window.rc.userAuthed = false19 } else {20 window.rc.userAuthed = true21 await ls.set('userAuthed', 'true')22 }23}24/**25 * when user click close auth button or26 * user start auth process, hide auth button27 */28export function hideAuthBtn() {29 let dom = document.querySelector('.rc-auth-button-wrap')30 dom && dom.classList.add('rc-hide-to-side')31}32/**33 * when user click contacts in ringcentral widgets or34 * try to get third party contacts,35 * need show auth button to user36 */37export function showAuthBtn() {38 let dom = document.querySelector('.rc-auth-button-wrap')39 dom && dom.classList.remove('rc-hide-to-side')40}41/**42 * hanle user click auth button43 * @param {*} e44 */45function handleAuthClick(e) {46 let {target} = e47 let {classList}= target48 if (findParentBySel(target, '.rc-auth-btn')) {49 doAuth()50 } else if (classList.contains('rc-dismiss-auth')) {51 hideAuthBtn()52 }53}54/**55 * hide auth panel when auth end56 */57export function hideAuthPanel() {58 let frameWrap = document.getElementById('rc-auth-hs')59 frameWrap && frameWrap.classList.add('rc-hide-to-side')60}61/**62 * todo63 * do the auth here,64 * might need get apikey or maybe just do nothing65 */66export async function doAuth() {67 if (window.rc.userAuthed) {68 return69 }70 hideAuthBtn()71 let frameWrap = document.getElementById('rc-auth-hs')72 frameWrap && frameWrap.classList.remove('rc-hide-to-side')73 updateUserAuthed(true)74 notifyRCAuthed()75}76/**77 * notify ringcentral widgets about auth status78 * @param {} authorized79 */80export function notifyRCAuthed(authorized = true) {81 window.rc.postMessage({82 type: 'rc-adapter-update-authorization-status',83 authorized84 })85}86/**87 * when user click unauth button from ringcentral widgets88 */89export async function unAuth() {90 await updateUserAuthed(false)91 clearTimeout(tokenHandler)92 notifyRCAuthed(false)93}94/**95 * render auth button96 * todo: you can customize this97 */98export function renderAuthButton() {99 let btn = createElementFromHTML(100 `101 <div class="rc-auth-button-wrap animate rc-hide-to-side">102 <span class="rc-auth-btn">103 <span class="rc-iblock">Auth</span>104 <img class="rc-iblock" src="${logo}" />105 <span class="rc-iblock">access ${serviceName} data</span>106 </span>107 <div class="rc-auth-desc rc-pd1t">108 After auth, you can access ${serviceName} contacts from RingCentral phone's contacts list. You can revoke access from RingCentral phone's setting.109 </div>110 <div class="rc-pd1t">111 <span class="rc-dismiss-auth" title="dismiss">&times;</span>112 </div>113 </div>114 `115 )116 btn.onclick = handleAuthClick117 if (118 !document.querySelector('.rc-auth-button-wrap')119 ) {120 document.body.appendChild(btn)121 }122}123/**124 * todo: you can customize this125 */126export function renderAuthPanel() {127 return false...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { FrameWrap } from 'storybook-root'2import { FrameWrap } from 'storybook-root'3import { FrameWrap } from 'storybook-root'4import { FrameWrap } from 'storybook-root'5import { FrameWrap } from 'storybook-root'6import { FrameWrap } from 'storybook-root'7import { FrameWrap } from 'storybook-root'8import { FrameWrap } from 'storybook-root'9import { FrameWrap } from 'storybook-root'10import { FrameWrap } from 'storybook-root'11import { FrameWrap } from 'storybook-root'12import { FrameWrap } from 'storybook-root'13import { FrameWrap } from 'storybook-root'14import { FrameWrap } from 'storybook-root'15import { FrameWrap } from 'storybook-root'16import { FrameWrap } from 'storybook-root'17import { FrameWrap } from 'storybook-root'18import { FrameWrap } from 'storybook-root'19import { FrameWrap } from 'storybook-root'20import { FrameWrap } from 'storybook-root'

Full Screen

Using AI Code Generation

copy

Full Screen

1import { FrameWrap } from 'storybook-root';2import { storiesOf } from '@storybook/react';3storiesOf('FrameWrap', module)4 .add('test', () => (5 ));6import React from 'react';7import PropTypes from 'prop-types';8import { Frame } from 'storybook-frame';9const FrameWrap = ({ children }) => <Frame>{children}</Frame>;10FrameWrap.propTypes = {11};12export default FrameWrap;13import React from 'react';14import PropTypes from 'prop-types';15const Frame = ({ children }) => <div>{children}</div>;16Frame.propTypes = {17};18export default Frame;

Full Screen

Using AI Code Generation

copy

Full Screen

1import { FrameWrap } from 'storybook-root-iframe';2export const parameters = {3 previewTabs: {4 'storybook-root-iframe': {5 },6 },7};

Full Screen

Using AI Code Generation

copy

Full Screen

1import { FrameWrap } from 'storybook-root';2import MyComponent from './MyComponent';3export default {4};5export const Default = () => <MyComponent />;6Default.story = {7};8const path = require('path');9module.exports = {10 webpackFinal: async config => {11 config.resolve.alias = {12 'storybook-root': path.resolve(__dirname, '../')13 };14 return config;15 }16};17import { addDecorator } from '@storybook/react';18import { FrameWrap } from 'storybook-root';19addDecorator(FrameWrap);20import { addons } from '@storybook/addons';21import { themes } from '@storybook/theming';22addons.setConfig({23});24<iframe id="storybook-preview-iframe" style="width:100%;height:100%;"></iframe>25import { addDecorator } from '@storybook/react';26import { FrameWrap } from 'storybook-root';27addDecorator(FrameWrap);28module.exports = ({ config }) => {29 config.module.rules.push({30 });31 return config;32};33module.exports = {34 webpackFinal: async config => {35 config.resolve.alias = {36 'storybook-root': path.resolve(__dirname, '../')37 };

Full Screen

Using AI Code Generation

copy

Full Screen

1import { FrameWrap } from 'storybook-root';2import { MyComponent } from './MyComponent';3export default {4};5export const MyComponentInFrame = () => FrameWrap(MyComponent, { title: 'MyComponent' });6import React from 'react';7import { Button } from '@storybook/react/demo';8export const MyComponent = () => (9 <Button onClick={() => alert('clicked')}>Click me</Button>10);11import React from 'react';12import { MyComponent } from './MyComponent';13export default {14};15export const MyComponentInStorybook = () => <MyComponent />;16import React from 'react';17import { render } from '@testing-library/react';18import { MyComponent } from './MyComponent';19test('renders learn react link', () => {20 const { getByText } = render(<MyComponent />);21 const linkElement = getByText(/click me/i);22 expect(linkElement).toBeInTheDocument();23});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { FrameWrap } from 'storybook-root';2const FrameWrap = () => {3 return (4 );5};6export default FrameWrap;7import React from 'react';8import { storiesOf } from '@storybook/react';9import App from '../../test.js';10storiesOf('App', module).add('default', () => <App />);

Full Screen

Using AI Code Generation

copy

Full Screen

1import { FrameWrap } from 'storybook-root';2const frameWrap = new FrameWrap();3frameWrap.setFrame('frame1');4frameWrap.setFrame('frame2');5frameWrap.setFrame('frame3');6frameWrap.setFrame('frame4');7frameWrap.setFrame('frame5');8frameWrap.setFrame('frame6');9frameWrap.setFrame('frame7');10frameWrap.setFrame('frame8');11frameWrap.setFrame('frame9');12frameWrap.setFrame('frame10');13frameWrap.setFrame('frame11');14frameWrap.setFrame('frame12');15frameWrap.setFrame('frame13');16frameWrap.setFrame('frame14');17frameWrap.setFrame('frame15');18frameWrap.setFrame('frame16');19frameWrap.setFrame('frame17');20frameWrap.setFrame('frame18');21frameWrap.setFrame('frame19');22frameWrap.setFrame('frame20');23frameWrap.setFrame('frame21');24frameWrap.setFrame('frame22');25frameWrap.setFrame('frame23');

Full Screen

Using AI Code Generation

copy

Full Screen

1import { FrameWrap } from 'storybook-root';2export const Template = (args) => <FrameWrap {...args} />;3const Story = Template.bind({});4export default Story;5import Test from './test';6import { Template } from './test';7export default {8 argTypes: {9 frame: {10 control: {11 },12 },13 },14};15export const TestStory = Template.bind({});16TestStory.args = {17};

Full Screen

Using AI Code Generation

copy

Full Screen

1module.exports = {2 FrameWrap: require('./FrameWrap.js'),3}4import React, { Component } from 'react';5import { Frame } from 'framer';6export default class FrameWrap extends Component {7 render() {8 return (9 width={this.props.width}10 height={this.props.height}11 background={this.props.background}12 radius={this.props.radius}13 {this.props.children}14 );15 }16}17FrameWrap.defaultProps = {18};19FrameWrap.propTypes = {20};21import React from 'react';22import { storiesOf } from '@storybook/react';23import FrameWrap from './FrameWrap';24storiesOf('FrameWrap', module)25 .add('Default', () => <FrameWrap />)26 .add('With Background Color', () => <FrameWrap background="#FF0000" />)27 .add('With Children', () => (28 ));29FrameWrap.propTypes = {30};31import React from 'react';32import { shallow } from 'enzyme';33import FrameWrap from './FrameWrap';34it('renders without crashing', () => {35 shallow(<FrameWrap />);36});37it('renders with children without crashing', () => {38 shallow(39 );40});41it('renders with background color without crashing', () => {42 shallow(<FrameWrap background="#FF0000" />);43});44it('renders with width without crashing', () => {45 shallow(<FrameWrap width={300} />);46});47it('renders with height without crashing', () => {48 shallow(<FrameWrap height={300} />);49});50it('renders with radius without crashing', () => {51 shallow(<FrameWrap radius={10} />);52});

Full Screen

Automation Testing Tutorials

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

LambdaTest Learning Hubs:

YouTube

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

Run storybook-root automation tests on LambdaTest cloud grid

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

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful