1/** 2 * jQuery Framer Plugin 3 * 4 * @author Hirohisa Nagai 5 * @version 0.80 6 * @copyright eternity design ( http://sucaijiayuan.com/ ) 7 * @license MIT License 8 * 9 * include spin.js 10 * fgnass.github.com/spin.js#v2.1.0 11 * 12 */ 13 14(function($) { 15 var FRM = $.Framer = {}; 16 17 18 $.fn.Framer = function(settings) { 19 settings = $.extend({ 20 animation: "fade", 21 loadingColor: '#fff', 22 opacity: 0.8, 23 overlayTime: 500, 24 isOverlayClose: true, 25 isAutoResize: true, 26 isScroll: true, 27 resizeRatio: 0.9, 28 speed: 500, 29 title: '<div id="frmTitle"></div>', 30 description: '<div id="frm_description">{description}</div>', 31 closeBtn: '<div class="close_btn"></div>', 32 inner: {}, 33 width: 640, 34 height: 360, 35 iframe: '<iframe name="framer-iframe" frameborder="0" id="framer-iframe"></iframe>', 36 ajaxDataType: 'html', 37 blur: '', 38 isPushState: false, 39 isCSSAnim: false 40 }, settings); 41 42 43 FRM.target; 44 FRM.body; 45 FRM.contents; 46 FRM.indicator; 47 FRM.box; 48 FRM.type; 49 FRM.title; 50 FRM.description; 51 FRM.closeBtn; 52 FRM.container; 53 FRM.blurTarget; 54 FRM.animation; 55 56 var loading; 57 var overlay; 58 var scrollTimer; 59 var isMove = false; 60 var baseURL = location.href; 61 62 63 FRM.open = function(e) { 64 FRM.body = $('body'); 65 66 //console.log('$.Framer.open'); 67 overlay = $('<div id="frm_overlay"></div>'); 68 overlay.css('opacity', 0); 69 overlay.height($(document).height()).width($(window).width()); 70 71 72 loading = $('<div id="loading"></div>').css({ 73 width: $(window).width(), 74 height: $(window).height(), 75 top: $(window).scrollTop(), 76 left: 0 77 }); 78 79 var loading_options = { 80 lines: 12, 81 width: 4, 82 color: settings.loadingColor 83 }; 84 85 FRM.indicator = new Spinner(loading_options).spin(loading[0]); 86 FRM.body.append(loading); 87 88 FRM.body.append(overlay); 89 overlay.fadeTo(settings.overlayTime, settings.opacity); 90 91 // Blur 92 if(settings.blur !== '') { 93 FRM.blurTarget = $(settings.blur).Vague({ 94 intensity: 8, 95 animationOptions: { 96 duration: settings.speed, 97 easing: 'linear' 98 } 99 }); 100 FRM.blurTarget.blur(); 101 } 102 103 FRM.box = $('<div id="framer"></div>');
104 FRM.container = $('<div id="framerContainer" />'); 105 FRM.box.append(FRM.container); 106 107 if(arguments.length > 1) { 108 // API call 109 // console.log("API!!!", arguments[0]); 110 FRM.target = $("<a />"); 111 FRM.target.attr("href", arguments[0]); 112 FRM.target.attr("data-framer-type", arguments[1]); 113 114 if($.isPlainObject(arguments[2])) { 115 settings = $.extend(settings, arguments[2]); 116 } 117 } 118 else { 119 FRM.target = $(this); 120 } 121 122 FRM.animation = FRM.target.attr('data-framer-animation') || settings.animation; 123 124 if(FRM.animation !== "fade") { 125 FRM.container.css({ 126 "transition-duration": String(settings.speed * 0.001) + "s" 127 }); 128 FRM.box.addClass(FRM.animation); 129 } 130 131 if(!$.isEmptyObject(settings.inner)) { 132 FRM.box.append(settings.inner); 133 } 134 135 if(FRM.target.attr('title')) { 136 if(settings.title != '') { 137 if(settings.title.search(/{title}/)) { 138 FRM.title = $(settings.title.replace(/{title}/, FRM.target.attr('title'))); 139 } 140 else { 141 FRM.title = $(settings.title).text(FRM.target.attr('title')); 142 } 143 144 FRM.container.append(FRM.title); 145 } 146 } 147 148 if(FRM.target.attr('data-framer-description')) { 149 if(settings.description != '') { 150 if(settings.description.search(/{description}/)) { 151 FRM.description = $(settings.description.replace(/{description}/, FRM.target.attr('data-framer-description'))); 152 } 153 else { 154 FRM.description = $(settings.description).text(FRM.target.attr('data-framer-description')); 155 } 156 157 FRM.container.append(FRM.description); 158 } 159 } 160 161 FRM.type = getType(FRM.target.attr('href'), FRM.target.attr('data-framer-type')); 162 163 if(FRM.type == 'image') { 164 FRM.contents = $("<img />").on("load", function() { 165 loadImageComplete(); 166 // FRM.contents = setBoxSize(FRM.contents); 167 // showContents(); 168 }).on("error", function() { 169 //console.log("error", settings.resources[key][0]); 170 }); 171 FRM.contents.attr("src", FRM.target.attr('href')); 172 } 173 else if(FRM.type == 'inline') { 174 FRM.contents = getInlineContents(); 175 } 176 else if(FRM.type == 'video') { 177 FRM.contents = getVideoJSContents(); 178 } 179 else if(FRM.type == 'youtube') { 180 FRM.contents = getYoutubeContents(); 181 } 182 else if(FRM.type == 'vimeo') { 183 FRM.contents = getVimeoContents(); 184 } 185 else if(FRM.type == 'soundcloud') { 186 FRM.contents = getSCContents(); 187 } 188 else if(FRM.type == 'twitch') { 189 FRM.contents = getTwitchContents(); 190 } 191 else if(FRM.type == 'iframe') { 192 FRM.contents = getiFrameContents(); 193 } 194 else if(FRM.type == 'ajax') { 195 getAjaxContents.apply(this); 196 } 197 198 if(FRM.type != 'image' && FRM.type != 'ajax') { 199 showContents(); 200 } 201 202 FRM.box.addClass(FRM.type); 203 204 $(window).on('resize.Framer', resizeFramer); 205 206 if(settings.isScroll) { 207 $(window).on('scroll.Framer', scrollEvent); 208 $(window).on('scrollComplete.Framer', scrollCompleteEvent); 209 } 210 211 return false; 212 }; 213 214 215 FRM.close = function() { 216 $(window).off('resize.Framer', resizeFramer); 217 FRM.closeBtn.off("click", $.Framer.close); 218 219 if(settings.isScroll) { 220 $(window).off('scroll.Framer', scrollEvent); 221 $(window).off('scrollComplete.Framer', scrollCompleteEvent); 222 } 223 224 if(settings.isOverlayClose) { 225 overlay.off("click", $.Framer.close); 226 } 227 228 if(settings.closeBtn != '') { 229 FRM.closeBtn.fadeOut(settings.speed); 230 } 231 overlay.fadeOut(settings.overlayTime); 232 233 if(settings.blur !== '') { 234 FRM.blurTarget.unblur(); 235 } 236 237 if(FRM.animation !== "fade") { 238 FRM.container.on("transitionend webkitTransitionEnd", destroyBox); 239 FRM.box.removeClass('show'); 240 // setTimeout(destroyBox, settings.speed); 241 } 242 else { 243 FRM.box.fadeOut(settings.speed, destroyBox); 244 } 245 }; 246 247 248 var destroyBox = function() { 249 if(FRM.animation !== "fade") { 250 FRM.container.off("transitionend webkitTransitionEnd", destroyBox); 251 FRM.box.css({"display": "none"}); 252 } 253 254 if(FRM.type == 'inline') { 255 FRM.contents.hide(); 256 FRM.body.append(FRM.contents); 257 } 258 else if(FRM.type == 'video') { 259 FramerVideo.destroy(); 260 } 261 262 if(!$.isEmptyObject(settings.inner)) { 263 $(settings.inner).remove(); 264 } 265 266 if(FRM.title) { 267 FRM.title.remove(); 268 } 269 if(FRM.description) { 270 FRM.description.remove(); 271 } 272 273 FRM.closeBtn.remove(); 274 if(FRM.type != 'inline') { 275 FRM.contents.remove(); 276 } 277 278 FRM.container.remove(); 279 FRM.box.remove(); 280 overlay.remove(); 281 282 if(settings.isPushState && isMove) { 283 window.history.back(); 284 } 285 286 FRM.body.trigger('close.Framer'); 287 }; 288 289 290 var loadImageComplete = function() { 291 FRM.contents = setBoxSize(FRM.contents); 292 showContents(); 293 } 294 295 296 var showContents = function() { 297 FRM.container.append(FRM.contents); 298 FRM.body.append(FRM.box); 299 300 setPosition(); 301 302 FRM.indicator.stop(); 303 loading.remove(); 304 delete FRM.indicator; 305 306 if(settings.closeBtn != '') { 307 FRM.closeBtn = $(settings.closeBtn); 308 } 309 310 if(FRM.animation !== "fade") { 311 // FRM.box.css({ 312 // "display": "block" 313 // }).addClass('show').delay(settings.speed, showContentsComplete); 314 FRM.box.css({ 315 "display": "block" 316 }).addClass('show'); 317 FRM.container.on("transitionend webkitTransitionEnd", showContentsComplete); 318 } 319 else { 320 FRM.box.fadeIn(settings.speed, function() { 321 showContentsComplete(); 322 }); 323 } 324 }; 325 326 327 var showContentsComplete = function() { 328 if(FRM.animation !== "fade") { 329 FRM.container.off("transitionend webkitTransitionEnd", showContentsComplete); 330 } 331 332 if(FRM.type == 'video') { 333 FramerVideo = _V_("framer_video", $.parseJSON(FRM.target.attr('data-framer-video-setup'))); 334 335 if(isIE()) { 336 //console.log('noCloneEvent'); 337 var source = FRM.target.attr('href'); 338 if(!source.match(/\.webm$/i) && !source.match(/\.webm$/i) && !source.match(/\.mp4$/i)) { 339 FramerVideo.src(source + '.mp4'); 340 } 341 else if(source.match(/\.mp4$/i)) { 342 FramerVideo.src(source); 343 } 344 //console.log('video: ', FRM.contents.width(), FRM.contents.height()); 345 FramerVideo.width(FRM.contents.width() || FRM.target.attr('data-framer-width') || settings.width);
346 FramerVideo.height(FRM.contents.height() || FRM.target.attr('data-framer-height') || settings.height); 347 } 348 } 349 350 if(settings.isOverlayClose) { 351 overlay.on("click", $.Framer.close); 352 } 353 354 if(settings.closeBtn != '') { 355 FRM.container.append(FRM.closeBtn); 356 FRM.closeBtn.fadeIn(settings.speed); 357 FRM.closeBtn.on("click", $.Framer.close); 358 } 359 360 // pushState 361 if(settings.isPushState) { 362 if(FRM.target.attr('data-framer-ps') != null) { 363 // window.history.pushState(FRM.target.attr('data-framer-ps'), "", "#" + FRM.target.attr('data-framer-ps')); 364 window.history.pushState(FRM.target.attr('data-framer-ps'), "", FRM.target.attr('data-framer-ps')); 365 isMove = true; 366 } 367 } 368 369 FRM.body.trigger('open.Framer'); 370 }; 371 372 373 var setPosition = function() { 374 FRM.box.css({ 375 top: Math.floor(($(window).height() - FRM.box.outerHeight()) * 0.5) + $(window).scrollTop(), 376 left: Math.floor(($(window).width() - FRM.box.outerWidth()) * 0.5) 377 }); 378 }; 379 380 // windowãµã¤ãºããã#framerã«å©ç¨å¯è½ãªãµã¤ãºãè¨ç®ãè¨å® 381 var setBoxSize = function(contents) { 382 var cw, ch, ratio; 383 384 if(FRM.type === "image") { 385 var is = getImageSize(FRM.contents[0]); 386 387 cw = parseInt(FRM.target.attr('data-framer-width') || is.width); 388 ch = parseInt(FRM.target.attr('data-framer-height') || is.height); 389 } 390 else if(FRM.type === "soundcloud") { 391 cw = parseInt(FRM.target.attr('data-framer-width') || settings.width); 392 ch = 166; 393 } 394 else if(FRM.type === "twitch") { 395 cw = parseInt(FRM.target.attr('data-framer-width') || 620); 396 ch = parseInt(FRM.target.attr('data-framer-height') || 378); 397 } 398 else if(FRM.type === "inline" || FRM.type === "ajax") { 399 cw = parseInt(FRM.target.attr('data-framer-width') || contents.outerWidth() || settings.width); 400 ch = parseInt(FRM.target.attr('data-framer-height') || contents.outerHeight() || settings.height); 401 } 402 else { 403 cw = parseInt(FRM.target.attr('data-framer-width') || settings.width); 404 ch = parseInt(FRM.target.attr('data-framer-height') || settings.height); 405 } 406 407 // #framerContainer ã®borderã¨paddingã®ãµã¤ãºãåå¾ããããã®æç¹ã§ã¯widthãheightã¨ãã«0ãªã¯ãã®ãªã®ã§ã»ã»ã» 408 var containerOuterWidth = FRM.container.outerWidth() === 0 ? FRM.container.outerWidth() : FRM.container.outerWidth() - FRM.container.width(); 409 var containerOuterHeight = FRM.container.outerHeight() === 0 ? FRM.container.outerHeight() : FRM.container.outerHeight() - FRM.container.height(); 410 411 // #framerContainerã®paddingãborder-sizeã¨ã³ã³ãã³ãã®ãµã¤ãºãè¶³ããæ°å¤ãããã#framerã®ãµã¤ãºã¨ãªãããã縮å°ããå ´åã®ãã¼ã¹ã®å¤ã¨ãªã 412 var targetWidth = containerOuterWidth === 0 ? cw + containerOuterWidth : containerOuterWidth - cw; 413 var targetHeight = containerOuterHeight === 0 ? ch + containerOuterHeight : containerOuterHeight - ch; 414 415 var ww = $(window).width(); 416 var wh = $(window).height(); 417 418 // var emw = containerOuterWidth - FRM.box.width(); 419 // var emh = containerOuterHeight - FRM.box.height(); 420 421 var mw = ww - cw; 422 var mh = wh - ch; 423 424 var innerHeight = FRM.box.height() - ch; 425 426 // console.log("setMovieSize", cw, ch, containerOuterWidth, containerOuterHeight, ww, wh, mw, mh); 427 428 if(mw > mh) { // 縦ã¹ãã¼ã¹ã横ã¹ãã¼ã¹ããå°ãã 429 if(wh * settings.resizeRatio < targetHeight) { 430 // ãªãµã¤ãºå¦ç 431 if(settings.isAutoResize) { 432 // console.log("hhhh", targetHeight); 433 // ã¾ãã¯ä¸çªè¦ªã®ã³ã³ããã¨ãªã#framerã®ãµã¤ãºãè¨å®ããã®æã#framerContainerã®padding.border-sizeãå«ãã ãµã¤ãº 434 FRM.box.height(wh * settings.resizeRatio); // Framerã¸ã®paddingãèæ ®ã«å ¥ããæ°å¤ 435 ratio = FRM.box.height() / targetHeight; 436 FRM.box.width(targetWidth * ratio); 437 438 // #framerã«è¨å®ããããµã¤ãºããã#framerContainerã®paddingãborder-sizeãå¼ãããµã¤ãºãã³ã³ãã³ãã«è¨å® 439 // contents.width(parseInt(FRM.box.width() - containerOuterWidth)); 440 // contents.height(parseInt(FRM.box.height() - containerOuterHeight)); 441 contents = setContentsSize(contents, parseInt(FRM.box.width() - containerOuterWidth), parseInt(FRM.box.height() - containerOuterHeight)); 442 } 443 } 444 else { 445 FRM.box.width(targetWidth);
446 FRM.box.height(targetHeight); 447 448 contents = setContentsSize(contents, cw, ch); 449 // contents.width(cw); 450 // contents.height(ch); 451 452 // contents.attr({ 453 // width: cw, 454 // height: ch 455 // }); 456 } 457 } 458 else { // 横ã¹ãã¼ã¹ã縦ããå°ãã 459 if(ww * settings.resizeRatio < targetWidth) { 460 // ãªãµã¤ãºå¦ç 461 if(settings.isAutoResize) { 462 FRM.box.width(ww * settings.resizeRatio); 463 ratio = FRM.box.width() / targetWidth; 464 FRM.box.height(targetHeight * ratio); 465 466 // #framerã«è¨å®ããããµã¤ãºããã#framerContainerã®paddingãborder-sizeãå¼ãããµã¤ãºãã³ã³ãã³ãã«è¨å® 467 // contents.attr({ 468 // width: parseInt(FRM.box.width() - containerOuterWidth), 469 // height: parseInt(FRM.box.height() - containerOuterHeight) 470 // }); 471 contents = setContentsSize(contents, parseInt(FRM.box.width() - containerOuterWidth), parseInt(FRM.box.height() - containerOuterHeight)); 472 } 473 } 474 else { 475 FRM.box.width(targetWidth); 476 FRM.box.height(targetHeight); 477 478 contents = setContentsSize(contents, cw, ch); 479 480 // contents.attr({ 481 // width: cw, 482 // height: ch 483 // }); 484 } 485 } 486 487 return contents; 488 }; 489 490 var setContentsSize = function(contents, w, h) { 491 // 渡ãããå¤ã¯ãç»é¢ãµã¤ãºããè¨ç®ãããcontenté¨åã«å©ç¨å¯è½ãªãµã¤ãºãªã®ã§ãããã§contentèªä½ã«è¨å®ããã¦ããpaddingãborderãå¼ãããµã¤ãºãè¨å®ããã 492 493 var contentsWidth = contents.width(); 494 var contentsHeight = contents.height(); 495 496 if(contentsWidth === 0) { 497 // ããããcontentsã®ãµã¤ãºãåå¾ã§ããªãã£ããããã©ã¡ã¼ã¿ã®å¤ãã®ã¾ã¾è¨å®ãã 498 contents.width(w); 499 } 500 else { 501 var pbWidth = contents.outerWidth() - contentsWidth; 502 if(pbWidth > 0) { 503 contents.width(w - pbWidth);
504 } 505 else { 506 contents.width(w); 507 } 508 } 509 510 if(contentsHeight === 0) { 511 // ããããcontentsã®ãµã¤ãºãåå¾ã§ããªãã£ããããã©ã¡ã¼ã¿ã®å¤ãã®ã¾ã¾è¨å®ãã 512 contents.height(h); 513 } 514 else { 515 var pbHeight = contents.outerHeight() - contentsHeight; 516 if(pbHeight > 0) { 517 contents.height(h - pbHeight); 518 } 519 else { 520 contents.height(h); 521 } 522 } 523 524 if(FRM.type === "video") { 525 // console.log("video", contents, contents.width()); 526 contents.attr({ 527 width: contents.width(), 528 height: contents.height() 529 }); 530 } 531 532 return contents; 533 } 534 535 536 var resizeFramer = function(e) { 537 overlay.height($(document).height()).width($(window).width()); 538 539 scrollCompleteEvent(); 540 }; 541 542 543 var scrollEvent = function() { 544 if(scrollTimer) { 545 clearTimeout(scrollTimer); 546 } 547 scrollTimer = setTimeout(function() { 548 scrollTimer = null; 549 $(window).trigger('scrollComplete.Framer'); 550 }, 500); 551 }; 552 553 554 var scrollCompleteEvent = function() { 555 FRM.contents = setBoxSize(FRM.contents); 556 557 FRM.box.stop().animate({ 558 top: Math.floor(($(window).height() - FRM.box.outerHeight()) * 0.5) + $(window).scrollTop(), 559 left: Math.floor(($(window).width() - FRM.box.outerWidth()) * 0.5) 560 }, 561 settings.speed); 562 }; 563 564 565 var getType = function(url, type) { 566 if(url.match(/youtube\.com\/watch/i) || url.match(/youtu\.be/i) || type == 'youtube') { 567 return "youtube"; 568 } 569 else if(url.match(/vimeo\.com/i) || type == 'vimeo') { 570 return "vimeo"; 571 } 572 else if(url.match(/soundcloud\.com/i) || type == 'soundcloud') { 573 return "soundcloud"; 574 } 575 else if(url.match(/twitch\.tv/i) || type == 'twitch') { 576 return "twitch"; 577 } 578 else if(url.substr(0, 1) == '#' || type == 'inline') { 579 return "inline"; 580 } 581 else if(type == 'video') { 582 return 'video'; 583 } 584 else if(type == 'iframe') { 585 return 'iframe'; 586 } 587 else if(type =='ajax') { 588 return 'ajax'; 589 } 590 else if(url.match(/\.(gif|jpg|jpeg|png)$/i) || type == 'image') { 591 return "image"; 592 } 593 }; 594 595 596 var getInlineContents = function() { 597 var inline = $(FRM.target.attr('href')).show(); 598 599 inline = setBoxSize(inline); 600 601 return inline; 602 }; 603 604 605 var getVideoJSContents = function() { 606 var video = $('<video id="framer_video"></video>'); 607 video.addClass(FRM.target.attr('data-framer-video-class')); 608 609 var source = FRM.target.attr('href'); 610 if(source.match(/\.mp4$/i)) { 611 video.append('<source src="' + source + '" type="video/mp4" />'); 612 } 613 else if(source.match(/\.webm$/i)) { 614 video.append('<source src="' + source + '" type="video/webm" />'); 615 } 616 else if(source.match(/\.ogv$/i)) { 617 video.append('<source src="' + source + '" type="video/ogv" />'); 618 } 619 else { 620 video.append('<source src="' + source + '.mp4" type="video/mp4" />'); 621 video.append('<source src="' + source + '.webm" type="video/webm" />'); 622 video.append('<source src="' + source + '.ogv" type="video/ogv" />'); 623 } 624 625 video = setBoxSize(video); 626 627 return video; 628 }; 629 630 631 var getYoutubeContents = function() { 632 var regx = FRM.target.attr('href').match(/(youtube\.com|youtu\.be)\/(v\/|u\/|embed\/|watch\?v=)?([^#\&\?]*).*/i); 633 var movieId = regx[3]; 634 635 var youtube = $('<iframe frameborder="0"></iframe>'); 636 637 var option = ""; 638 if(FRM.target.attr('data-youtube-option')) { 639 option = FRM.target.attr('data-youtube-option').replace(/^\?/, ""); 640 } 641 642 youtube.attr({ 643 src: "http://www.youtube.com/embed/" + movieId + '?wmode=opaque' + "&" + option 644 }); 645 646 youtube = setBoxSize(youtube); 647 648 return youtube; 649 }; 650 651 652 var getVimeoContents = function() { 653 var regx = FRM.target.attr('href').match(/vimeo\.com\/([^#\&\?]*).*/i); 654 var movieId = regx[1]; 655 656 var vimeo = $('<iframe frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'); 657 658 // <iframe src="http://player.vimeo.com/video/VIDEO_ID" width="WIDTH" height="HEIGHT" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe> 659 vimeo.attr({ 660 src: "http://player.vimeo.com/video/" + movieId 661 }); 662 663 vimeo = setBoxSize(vimeo); 664 665 return vimeo; 666 }; 667 668 669 var getTwitchContents = function() { 670 // <object bgcolor="#000000" data="http://www.twitch.tv/swflibs/TwitchPlayer.swf" height="378" id="clip_embed_player_flash" type="application/x-shockwave-flash" width="620"><param name="movie" value="http://www.twitch.tv/swflibs/TwitchPlayer.swf" /><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" /><param name="allowFullScreen" value="true" /><param name="flashvars" value="channel=assassinscreed&auto_play=false&start_volume=25&videoId=v3778016&device_id=65b095e38ed0b7d9" /></object><br /><a href="http://www.twitch.tv/assassinscreed" style="padding:2px 0px 4px; display:block; width: 320px; font-weight:normal; font-size:10px; text-decoration:underline;">Watch live video from AssassinsCreed on Twitch</a> 671 // <iframe src="http://www.twitch.tv/singi751014/embed" frameborder="0" scrolling="no" height="378" width="620"></iframe><a href="http://www.twitch.tv/singi751014?tt_medium=live_embed&tt_content=text_link" style="padding:2px 0px 4px; display:block; width:345px; font-weight:normal; font-size:10px;text-decoration:underline;">
671Watch live video from singi751014 on www.twitch.tv</a> 672 673 var twitch; 674 var isLive = true; 675 if(FRM.target.attr('href').match(/\/[a-z]{1}\/[0-9]+$/i)) { 676 isLive = false; 677 } 678 679 // ã©ã¤ããã¬ã¤ã¤ã¼ã®å ´å 680 if(isLive) { 681 var twitch = $('<iframe frameborder="0" scrolling="no"></iframe>'); 682 twitch.attr({ 683 src: FRM.target.attr('href') + '/embed' 684 }); 685 686 twitch = setBoxSize(twitch); 687 } 688 else { 689 var regx = FRM.target.attr('href').match(/twitch\.tv\/([^#\&\?\/]*)\/v\/([0-9]*)/i); 690 var channel = regx[1]; 691 var videoId = regx[2]; 692 var twitch = $('<object bgcolor="#000000" data="http://www.twitch.tv/swflibs/TwitchPlayer.swf" id="clip_embed_player_flash" type="application/x-shockwave-flash"></object>'); 693 var params = '<param name="movie" value="http://www.twitch.tv/swflibs/TwitchPlayer.swf" /><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" /><param name="allowFullScreen" value="true" /><param name="flashvars" value="channel=%channel%&auto_play=false&start_volume=25&videoId=v%videoId%&device_id=65b095e38ed0b7d9" />'; 694 params = params.replace("%channel%", channel); 695 params = params.replace("%videoId%", videoId); 696 697 twitch = setBoxSize(twitch); 698 699 twitch.append(params); 700 } 701 702 return twitch; 703 }; 704 705 706 var getSCContents = function() { 707 //<iframe width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F34019569"></iframe> 708 709 var soundcloud = $('<iframe frameborder="0"></iframe>'); 710 soundcloud.attr({ 711 src: "https://w.soundcloud.com/player/?url=" + FRM.target.attr('href') 712 }); 713 714 soundcloud = setBoxSize(soundcloud); 715 716 return soundcloud; 717 }; 718 719 720 var getiFrameContents = function() { 721 var iframe = $(settings.iframe); 722 iframe.attr({ 723 src: FRM.target.attr('href') 724 }); 725 726 iframe = setBoxSize(iframe); 727 728 return iframe; 729 }; 730 731 732 var getAjaxContents = function() { 733 $.ajax({ 734 type: "GET", 735 url: FRM.target.attr('href'), 736 dataType: FRM.target.attr('data-framer-ajax-type') || settings.ajaxDataType, 737 success: function(data) { 738 FRM.contents = $(data); 739 FRM.contents = setBoxSize(FRM.contents); 740 showContents(); 741 }, 742 error: function(XMLHttpRequest, textStatus) { 743 FRM.contents = $('<div id="framer_error">' + textStatus + '</div>'); 744 FRM.contents = setBoxSize(FRM.contents); 745 showContents(); 746 } 747 }); 748 }; 749 750 751 var getUrlParams = function(src) { 752 var vars = [], hash; 753 var hashes = src.slice(src.indexOf('?') + 1).split('&'); 754 for(var i = 0; i < hashes.length; i++) { 755 hash = hashes[i].split('='); 756 vars.push(hash[0]); 757 vars[hash[0]] = hash[1]; 758 } 759 760 return vars; 761 }; 762 763 var getState = function() { 764 var url = location.href; 765 var ary = url.split("/"); 766 767 var str = ary[ary.length - 1]; 768 769 if(str.match(/.html$/)) { 770 return ary[ary.length - 2]; 771 } 772 else { 773 return str; 774 } 775 }; 776 777 778 var getImageSize = function(img) { 779 var w, h; 780 if(typeof img.naturalWidth != 'undefined') { 781 w = img.naturalWidth; 782 h = img.naturalHeight; 783 } 784 else if(typeof img.runtimeStyle !== 'undefined') { 785 //var run = img.runtimeStyle; 786 // run.width = "auto"; 787 // run.height = "auto"; 788 w = img.width; 789 h = img.height; 790 } 791 else { 792 w = img.width; 793 h = img.height; 794 } 795 796 return {width: w, height: h}; 797 }; 798 799 800 var isIE = function() { 801 if($.support.checkOn && $.support.noCloneEvent && !$.support.noCloneChecked && !$.support.cors) { 802 return true; 803 } 804 else if(!$.support.opacity) { 805 return true; 806 } 807 else { 808 return false; 809 } 810 }; 811 812 813 var isIE8 = function() { 814 if(!$.support.opacity) { 815 if(!$.support.hrefNormalized) { 816 return false; 817 } 818 else { 819 return true; 820 } 821 } 822 else { 823 return false; 824 } 825 }; 826 827 var changeStateEvent = function(e) { 828 // console.log("changeStateEvent", e); 829 var state = e.originalEvent.state; 830 // console.log("popstate : ", e.originalEvent.state, isMove); 831 if(state == null && isMove == true) { 832 // console.log("ismove"); 833 $.Framer.close(); 834 } 835 }; 836 837 if(settings.isPushState) { 838 // console.log("isPushState"); 839 $(window).on("popstate", $.proxy(changeStateEvent, this)); 840 } 841 842 this.on('click.Framer', $.Framer.open); 843 844 return this; 845 }; 846})(jQuery); 847 848 849/** 850 * spin.js 851 * 852 * @version 2.1.0 853 * @copyright http://spin.js.org/ 854 * 855 */ 856//fgnass.github.com/spin.js#v2.1.0 857!function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd?define(b):a.Spinner=b()}(this,function(){"use strict";function a(a,b){var c,d=document.createElement(a||"div");for(c in b)d[c]=b[c];return d}function b(a){for(var b=1,c=arguments.length;c>b;b++)a.appendChild(arguments[b]);return a}function c(a,b,c,d){var e=["opacity",b,~~(100*a),c,d].join("-"),f=.01+c/d*100,g=Math.max(1-(1-a)/b*(100-f),a),h=j.substring(0,j.indexOf("Animation")).toLowerCase(),i=h&&"-"+h+"-"||"";return m[e]||(k.insertRule("@"+i+"keyframes "+e+"{0%{opacity:"+g+"}"+f+"%{opacity:"+a+"}"+(f+.01)+"%{opacity:1}"+(f+b)%100+"%{opacity:"+a+"}100%{opacity:"+g+"}}",k.cssRules.length),m[e]=1),e}function d(a,b){var c,d,e=a.style;for(b=b.charAt(0).toUpperCase()+b.slice(1),d=0;d<l.length;d++)if(c=l[d]+b,void 0!==e[c])return c;return void 0!==e[b]?b:void 0}function e(a,b){for(var c in b)a.style[d(a,c)||c]=b[c];return a}function f(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)void 0===a[d]&&(a[d]=c[d])}return a}function g(a,b){return"string"==typeof a?a:a[b%a.length]}function h(a){this.opts=f(a||{},h.defaults,n)}function i(){function c(b,c){return a("<"+b+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',c)}k.addRule(".spin-vml","behavior:url(#default#VML)"),h.prototype.lines=function(a,d){function f(){return e(c("group",{coordsize:k+" "+k,coordorigin:-j+" "+-j}),{width:k,height:k})}function h(a,h,i){b(m,b(e(f(),{rotation:360/d.lines*a+"deg",left:~~h}),b(e(c("roundrect",{arcsize:d.corners}),{width:j,height:d.scale*d.width,left:d.scale*d.radius,top:-d.scale*d.width>>1,filter:i}),c("fill",{color:g(d.color,a),opacity:d.opacity}),c("stroke",{opacity:0}
vendor: 2,516 bytes, lines 857-858
857))))}var i,j=d.scale*(d.length+d.width),k=2*d.scale*j,l=-(d.width+d.length)*d.scale*2+"px",m=e(f(),{position:"absolute",top:l,left:l});if(d.shadow)for(i=1;i<=d.lines;i++)h(i,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(i=1;i<=d.lines;i++)h(i);return b(a,m)},h.prototype.opacity=function(a,b,c,d){var e=a.firstChild;d=d.shadow&&d.lines||0,e&&b+d<e.childNodes.length&&(e=e.childNodes[b+d],e=e&&e.firstChild,e=e&&e.firstChild,e&&(e.opacity=c))}}var j,k,l=["webkit","Moz","ms","O"],m={},n={lines:12,length:7,width:5,radius:10,scale:1,rotate:0,corners:1,color:"#000",direction:1,speed:1,trail:100,opacity:.25,fps:20,zIndex:2e9,className:"spinner",top:"50%",left:"50%",position:"absolute"};if(h.defaults={},f(h.prototype,{spin:function(b){this.stop();var c=this,d=c.opts,f=c.el=e(a(0,{className:d.className}),{position:d.position,width:0,zIndex:d.zIndex});if(e(f,{left:d.left,top:d.top}),b&&b.insertBefore(f,b.firstChild||null),f.setAttribute("role","progressbar"),c.lines(f,c.opts),!j){var g,h=0,i=(d.lines-1)*(1-d.direction)/2,k=d.fps,l=k/d.speed,m=(1-d.opacity)/(l*d.trail/100),n=l/d.lines;!function o(){h++;for(var a=0;a<d.lines;a++)g=Math.max(1-(h+(d.lines-a)*n)%l*m,d.opacity),c.opacity(f,a*d.direction+i,g,d);c.timeout=c.el&&setTimeout(o,~~(1e3/k))}()}return c},stop:function(){var a=this.el;return a&&(clearTimeout(this.timeout),a.parentNode&&a.parentNode.removeChild(a),this.el=void 0),this},lines:function(d,f){function h(b,c){return e(a(),{position:"absolute",width:f.scale*(f.length+f.width)+"px",height:f.scale*f.width+"px",background:b,boxShadow:c,transformOrigin:"left",transform:"rotate("+~~(360/f.lines*k+f.rotate)+"deg) translate("+f.scale*f.radius+"px,0)",borderRadius:(f.corners*f.scale*f.width>>1)+"px"})}for(var i,k=0,l=(f.lines-1)*(1-f.direction)/2;k<f.lines;k++)i=e(a(),{position:"absolute",top:1+~(f.scale*f.width/2)+"px",transform:f.hwaccel?"translate3d(0,0,0)":"",opacity:f.opacity,animation:j&&c(f.opacity,f.trail,l+k*f.direction,f.lines)+" "+1/f.speed+"s linear infinite"}),f.shadow&&b(i,e(h("#000","0 0 4px #000"),{top:"2px"})),b(d,b(i,h(g(f.color,k),"0 0 1px rgba(0,0,0,.1)")));return d},opacity:function(a,b,c){b<a.childNodes.length&&(a.childNodes[b].style.opacity=c)}}),"undefined"!=typeof document){k=function(){var c=a("style",{type:"text/css"});return b(document.getElementsByTagName("head")[0],c),c.sheet||c.styleSheet}();var o=e(a("group"),{behavior:"url(#default#VML)"});!d(o,"transform")&&o.adj?i():j=d(o,"animation")}return h}); 858
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.