mirror of
https://bitbucket.org/skobkin/chrome_point_plus.git
synced 2024-11-23 10:46:02 +00:00
Merged skobkin/chrome_point_plus into master
This commit is contained in:
commit
442cb4ad15
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,2 +1,5 @@
|
|||
chrome_point_plus/vendor/
|
||||
/nbproject/private/
|
||||
node_modules/
|
||||
publish
|
||||
vendor/
|
||||
|
|
41
Gruntfile.js
Normal file
41
Gruntfile.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
var vendorCopy = [
|
||||
'jquery/jquery.min.js',
|
||||
|
||||
'fancybox/source/jquery.fancybox.pack.js',
|
||||
'fancybox/source/helpers/jquery.fancybox-media.js',
|
||||
'fancybox/source/jquery.fancybox.css',
|
||||
|
||||
'markitup/markitup/jquery.markitup.js',
|
||||
'markitup/markitup/skins/markitup/style.css'
|
||||
].map(function(file) {
|
||||
return {
|
||||
src: 'vendor/' + file,
|
||||
dest: 'chrome_point_plus/vendor/' + file
|
||||
};
|
||||
});
|
||||
|
||||
vendorCopy.push({
|
||||
expand: true,
|
||||
src: [ 'vendor/fancybox/source/*.png' ],
|
||||
dest: 'chrome_point_plus/'
|
||||
});
|
||||
|
||||
module.exports = function(grunt) {
|
||||
|
||||
// Настройки
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
// Что копировать
|
||||
copy: {
|
||||
main: {
|
||||
files: vendorCopy
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Загрузить плагины
|
||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||
|
||||
// Что выполнять по команде `grunt`
|
||||
grunt.registerTask('default', [ 'copy' ]);
|
||||
};
|
21
bower.json
Normal file
21
bower.json
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"name": "chrome-point-plus",
|
||||
"version": "1.17.3",
|
||||
"authors": [
|
||||
"Alexey Skobkin"
|
||||
],
|
||||
"description": "Chrome extension for point.im",
|
||||
"license": "MIT",
|
||||
"homepage": "https://bitbucket.org/skobkin/chrome_point_plus",
|
||||
"private": true,
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"chrome_point_plus/vendors/**"
|
||||
],
|
||||
"dependencies": {
|
||||
"jquery": "~1.10.1",
|
||||
"fancybox": "~2.1.5",
|
||||
"markitup": "~1.1.14"
|
||||
}
|
||||
}
|
274
chrome_point_plus/css/jquery.fancybox.css
vendored
274
chrome_point_plus/css/jquery.fancybox.css
vendored
|
@ -1,274 +0,0 @@
|
|||
/*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */
|
||||
.fancybox-wrap,
|
||||
.fancybox-skin,
|
||||
.fancybox-outer,
|
||||
.fancybox-inner,
|
||||
.fancybox-image,
|
||||
.fancybox-wrap iframe,
|
||||
.fancybox-wrap object,
|
||||
.fancybox-nav,
|
||||
.fancybox-nav span,
|
||||
.fancybox-tmp
|
||||
{
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
outline: none;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.fancybox-wrap {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 8020;
|
||||
}
|
||||
|
||||
.fancybox-skin {
|
||||
position: relative;
|
||||
background: #f9f9f9;
|
||||
color: #444;
|
||||
text-shadow: none;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.fancybox-opened {
|
||||
z-index: 8030;
|
||||
}
|
||||
|
||||
.fancybox-opened .fancybox-skin {
|
||||
-webkit-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
|
||||
-moz-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
|
||||
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.fancybox-outer, .fancybox-inner {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.fancybox-inner {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.fancybox-type-iframe .fancybox-inner {
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.fancybox-error {
|
||||
color: #444;
|
||||
font: 14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif;
|
||||
margin: 0;
|
||||
padding: 15px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.fancybox-image, .fancybox-iframe {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.fancybox-image {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
#fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span {
|
||||
background-image: url('chrome-extension://__MSG_@@extension_id__/images/fancybox_sprite.png');
|
||||
}
|
||||
|
||||
#fancybox-loading {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin-top: -22px;
|
||||
margin-left: -22px;
|
||||
background-position: 0 -108px;
|
||||
opacity: 0.8;
|
||||
cursor: pointer;
|
||||
z-index: 8060;
|
||||
}
|
||||
|
||||
#fancybox-loading div {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
background: url('chrome-extension://__MSG_@@extension_id__/images/fancybox_loading.gif') center center no-repeat;
|
||||
}
|
||||
|
||||
.fancybox-close {
|
||||
position: absolute;
|
||||
top: -18px;
|
||||
right: -18px;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
cursor: pointer;
|
||||
z-index: 8040;
|
||||
}
|
||||
|
||||
.fancybox-nav {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 40%;
|
||||
height: 100%;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
background: transparent url('chrome-extension://__MSG_@@extension_id__/images/blank.gif'); /* helps IE */
|
||||
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
||||
z-index: 8040;
|
||||
}
|
||||
|
||||
.fancybox-prev {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.fancybox-next {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.fancybox-nav span {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: 36px;
|
||||
height: 34px;
|
||||
margin-top: -18px;
|
||||
cursor: pointer;
|
||||
z-index: 8040;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.fancybox-prev span {
|
||||
left: 10px;
|
||||
background-position: 0 -36px;
|
||||
}
|
||||
|
||||
.fancybox-next span {
|
||||
right: 10px;
|
||||
background-position: 0 -72px;
|
||||
}
|
||||
|
||||
.fancybox-nav:hover span {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.fancybox-tmp {
|
||||
position: absolute;
|
||||
top: -99999px;
|
||||
left: -99999px;
|
||||
visibility: hidden;
|
||||
max-width: 99999px;
|
||||
max-height: 99999px;
|
||||
overflow: visible !important;
|
||||
}
|
||||
|
||||
/* Overlay helper */
|
||||
|
||||
.fancybox-lock {
|
||||
overflow: hidden !important;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.fancybox-lock body {
|
||||
overflow: hidden !important;
|
||||
}
|
||||
|
||||
.fancybox-lock-test {
|
||||
overflow-y: hidden !important;
|
||||
}
|
||||
|
||||
.fancybox-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
overflow: hidden;
|
||||
display: none;
|
||||
z-index: 8010;
|
||||
background: url('chrome-extension://__MSG_@@extension_id__/images/fancybox_overlay.png');
|
||||
}
|
||||
|
||||
.fancybox-overlay-fixed {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.fancybox-lock .fancybox-overlay {
|
||||
overflow: auto;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
/* Title helper */
|
||||
|
||||
.fancybox-title {
|
||||
visibility: hidden;
|
||||
font: normal 13px/20px "Helvetica Neue",Helvetica,Arial,sans-serif;
|
||||
position: relative;
|
||||
text-shadow: none;
|
||||
z-index: 8050;
|
||||
}
|
||||
|
||||
.fancybox-opened .fancybox-title {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.fancybox-title-float-wrap {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 50%;
|
||||
margin-bottom: -35px;
|
||||
z-index: 8050;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.fancybox-title-float-wrap .child {
|
||||
display: inline-block;
|
||||
margin-right: -100%;
|
||||
padding: 2px 20px;
|
||||
background: transparent; /* Fallback for web browsers that doesn't support RGBa */
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
-webkit-border-radius: 15px;
|
||||
-moz-border-radius: 15px;
|
||||
border-radius: 15px;
|
||||
text-shadow: 0 1px 2px #222;
|
||||
color: #FFF;
|
||||
font-weight: bold;
|
||||
line-height: 24px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.fancybox-title-outside-wrap {
|
||||
position: relative;
|
||||
margin-top: 10px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.fancybox-title-inside-wrap {
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
.fancybox-title-over-wrap {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
color: #fff;
|
||||
padding: 10px;
|
||||
background: #000;
|
||||
background: rgba(0, 0, 0, .8);
|
||||
}
|
||||
|
||||
/*Retina graphics!*/
|
||||
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
|
||||
only screen and (min--moz-device-pixel-ratio: 1.5),
|
||||
only screen and (min-device-pixel-ratio: 1.5){
|
||||
|
||||
#fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span {
|
||||
background-image: url('chrome-extension://__MSG_@@extension_id__/images/fancybox_sprite@2x.png');
|
||||
background-size: 44px 152px; /*The size of the normal image, half the size of the hi-res image*/
|
||||
}
|
||||
|
||||
#fancybox-loading div {
|
||||
background-image: url('chrome-extension://__MSG_@@extension_id__/images/fancybox_loading@2x.gif');
|
||||
background-size: 24px 24px; /*The size of the normal image, half the size of the hi-res image*/
|
||||
}
|
||||
}
|
4
chrome_point_plus/js/jquery-1.10.1.min.js
vendored
4
chrome_point_plus/js/jquery-1.10.1.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1,199 +0,0 @@
|
|||
/*!
|
||||
* Media helper for fancyBox
|
||||
* version: 1.0.6 (Fri, 14 Jun 2013)
|
||||
* @requires fancyBox v2.0 or later
|
||||
*
|
||||
* Usage:
|
||||
* $(".fancybox").fancybox({
|
||||
* helpers : {
|
||||
* media: true
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* Set custom URL parameters:
|
||||
* $(".fancybox").fancybox({
|
||||
* helpers : {
|
||||
* media: {
|
||||
* youtube : {
|
||||
* params : {
|
||||
* autoplay : 0
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* Or:
|
||||
* $(".fancybox").fancybox({,
|
||||
* helpers : {
|
||||
* media: true
|
||||
* },
|
||||
* youtube : {
|
||||
* autoplay: 0
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* Supports:
|
||||
*
|
||||
* Youtube
|
||||
* http://www.youtube.com/watch?v=opj24KnzrWo
|
||||
* http://www.youtube.com/embed/opj24KnzrWo
|
||||
* http://youtu.be/opj24KnzrWo
|
||||
* http://www.youtube-nocookie.com/embed/opj24KnzrWo
|
||||
* Vimeo
|
||||
* http://vimeo.com/40648169
|
||||
* http://vimeo.com/channels/staffpicks/38843628
|
||||
* http://vimeo.com/groups/surrealism/videos/36516384
|
||||
* http://player.vimeo.com/video/45074303
|
||||
* Metacafe
|
||||
* http://www.metacafe.com/watch/7635964/dr_seuss_the_lorax_movie_trailer/
|
||||
* http://www.metacafe.com/watch/7635964/
|
||||
* Dailymotion
|
||||
* http://www.dailymotion.com/video/xoytqh_dr-seuss-the-lorax-premiere_people
|
||||
* Twitvid
|
||||
* http://twitvid.com/QY7MD
|
||||
* Twitpic
|
||||
* http://twitpic.com/7p93st
|
||||
* Instagram
|
||||
* http://instagr.am/p/IejkuUGxQn/
|
||||
* http://instagram.com/p/IejkuUGxQn/
|
||||
* Google maps
|
||||
* http://maps.google.com/maps?q=Eiffel+Tower,+Avenue+Gustave+Eiffel,+Paris,+France&t=h&z=17
|
||||
* http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16
|
||||
* http://maps.google.com/?ll=48.859463,2.292626&spn=0.000965,0.002642&t=m&z=19&layer=c&cbll=48.859524,2.292532&panoid=YJ0lq28OOy3VT2IqIuVY0g&cbp=12,151.58,,0,-15.56
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
//Shortcut for fancyBox object
|
||||
var F = $.fancybox,
|
||||
format = function( url, rez, params ) {
|
||||
params = params || '';
|
||||
|
||||
if ( $.type( params ) === "object" ) {
|
||||
params = $.param(params, true);
|
||||
}
|
||||
|
||||
$.each(rez, function(key, value) {
|
||||
url = url.replace( '$' + key, value || '' );
|
||||
});
|
||||
|
||||
if (params.length) {
|
||||
url += ( url.indexOf('?') > 0 ? '&' : '?' ) + params;
|
||||
}
|
||||
|
||||
return url;
|
||||
};
|
||||
|
||||
//Add helper object
|
||||
F.helpers.media = {
|
||||
defaults : {
|
||||
youtube : {
|
||||
matcher : /(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(watch\?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*)).*/i,
|
||||
params : {
|
||||
autoplay : 1,
|
||||
autohide : 1,
|
||||
fs : 1,
|
||||
rel : 0,
|
||||
hd : 1,
|
||||
wmode : 'opaque',
|
||||
enablejsapi : 1
|
||||
},
|
||||
type : 'iframe',
|
||||
url : '//www.youtube.com/embed/$3'
|
||||
},
|
||||
vimeo : {
|
||||
matcher : /(?:vimeo(?:pro)?.com)\/(?:[^\d]+)?(\d+)(?:.*)/,
|
||||
params : {
|
||||
autoplay : 1,
|
||||
hd : 1,
|
||||
show_title : 1,
|
||||
show_byline : 1,
|
||||
show_portrait : 0,
|
||||
fullscreen : 1
|
||||
},
|
||||
type : 'iframe',
|
||||
url : '//player.vimeo.com/video/$1'
|
||||
},
|
||||
metacafe : {
|
||||
matcher : /metacafe.com\/(?:watch|fplayer)\/([\w\-]{1,10})/,
|
||||
params : {
|
||||
autoPlay : 'yes'
|
||||
},
|
||||
type : 'swf',
|
||||
url : function( rez, params, obj ) {
|
||||
obj.swf.flashVars = 'playerVars=' + $.param( params, true );
|
||||
|
||||
return '//www.metacafe.com/fplayer/' + rez[1] + '/.swf';
|
||||
}
|
||||
},
|
||||
dailymotion : {
|
||||
matcher : /dailymotion.com\/video\/(.*)\/?(.*)/,
|
||||
params : {
|
||||
additionalInfos : 0,
|
||||
autoStart : 1
|
||||
},
|
||||
type : 'swf',
|
||||
url : '//www.dailymotion.com/swf/video/$1'
|
||||
},
|
||||
twitvid : {
|
||||
matcher : /twitvid\.com\/([a-zA-Z0-9_\-\?\=]+)/i,
|
||||
params : {
|
||||
autoplay : 0
|
||||
},
|
||||
type : 'iframe',
|
||||
url : '//www.twitvid.com/embed.php?guid=$1'
|
||||
},
|
||||
twitpic : {
|
||||
matcher : /twitpic\.com\/(?!(?:place|photos|events)\/)([a-zA-Z0-9\?\=\-]+)/i,
|
||||
type : 'image',
|
||||
url : '//twitpic.com/show/full/$1/'
|
||||
},
|
||||
instagram : {
|
||||
matcher : /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,
|
||||
type : 'image',
|
||||
url : '//$1/p/$2/media/?size=l'
|
||||
},
|
||||
google_maps : {
|
||||
matcher : /maps\.google\.([a-z]{2,3}(\.[a-z]{2})?)\/(\?ll=|maps\?)(.*)/i,
|
||||
type : 'iframe',
|
||||
url : function( rez ) {
|
||||
return '//maps.google.' + rez[1] + '/' + rez[3] + '' + rez[4] + '&output=' + (rez[4].indexOf('layer=c') > 0 ? 'svembed' : 'embed');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
beforeLoad : function(opts, obj) {
|
||||
var url = obj.href || '',
|
||||
type = false,
|
||||
what,
|
||||
item,
|
||||
rez,
|
||||
params;
|
||||
|
||||
for (what in opts) {
|
||||
if (opts.hasOwnProperty(what)) {
|
||||
item = opts[ what ];
|
||||
rez = url.match( item.matcher );
|
||||
|
||||
if (rez) {
|
||||
type = item.type;
|
||||
params = $.extend(true, {}, item.params, obj[ what ] || ($.isPlainObject(opts[ what ]) ? opts[ what ].params : null));
|
||||
|
||||
url = $.type( item.url ) === "function" ? item.url.call( this, rez, params, obj ) : format( item.url, rez, params );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (type) {
|
||||
obj.href = url;
|
||||
obj.type = type;
|
||||
|
||||
obj.autoHeight = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}(jQuery));
|
|
@ -1,46 +0,0 @@
|
|||
/*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */
|
||||
(function(r,G,f,v){var J=f("html"),n=f(r),p=f(G),b=f.fancybox=function(){b.open.apply(this,arguments)},I=navigator.userAgent.match(/msie/i),B=null,s=G.createTouch!==v,t=function(a){return a&&a.hasOwnProperty&&a instanceof f},q=function(a){return a&&"string"===f.type(a)},E=function(a){return q(a)&&0<a.indexOf("%")},l=function(a,d){var e=parseInt(a,10)||0;d&&E(a)&&(e*=b.getViewport()[d]/100);return Math.ceil(e)},w=function(a,b){return l(a,b)+"px"};f.extend(b,{version:"2.1.5",defaults:{padding:15,margin:20,
|
||||
width:800,height:600,minWidth:100,minHeight:100,maxWidth:9999,maxHeight:9999,pixelRatio:1,autoSize:!0,autoHeight:!1,autoWidth:!1,autoResize:!0,autoCenter:!s,fitToView:!0,aspectRatio:!1,topRatio:0.5,leftRatio:0.5,scrolling:"auto",wrapCSS:"",arrows:!0,closeBtn:!0,closeClick:!1,nextClick:!1,mouseWheel:!0,autoPlay:!1,playSpeed:3E3,preload:3,modal:!1,loop:!0,ajax:{dataType:"html",headers:{"X-fancyBox":!0}},iframe:{scrolling:"auto",preload:!0},swf:{wmode:"transparent",allowfullscreen:"true",allowscriptaccess:"always"},
|
||||
keys:{next:{13:"left",34:"up",39:"left",40:"up"},prev:{8:"right",33:"down",37:"right",38:"down"},close:[27],play:[32],toggle:[70]},direction:{next:"left",prev:"right"},scrollOutside:!0,index:0,type:null,href:null,content:null,title:null,tpl:{wrap:'<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',image:'<img class="fancybox-image" src="{href}" alt="" />',iframe:'<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen'+
|
||||
(I?' allowtransparency="true"':"")+"></iframe>",error:'<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',closeBtn:'<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',next:'<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',prev:'<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0,
|
||||
openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1,
|
||||
isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=t(a)?f(a).get():[a]),f.each(a,function(e,c){var k={},g,h,j,m,l;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),t(c)?(k={href:c.data("fancybox-href")||c.attr("href"),title:c.data("fancybox-title")||c.attr("title"),isDom:!0,element:c},f.metadata&&f.extend(!0,k,
|
||||
c.metadata())):k=c);g=d.href||k.href||(q(c)?c:null);h=d.title!==v?d.title:k.title||"";m=(j=d.content||k.content)?"html":d.type||k.type;!m&&k.isDom&&(m=c.data("fancybox-type"),m||(m=(m=c.prop("class").match(/fancybox\.(\w+)/))?m[1]:null));q(g)&&(m||(b.isImage(g)?m="image":b.isSWF(g)?m="swf":"#"===g.charAt(0)?m="inline":q(c)&&(m="html",j=c)),"ajax"===m&&(l=g.split(/\s+/,2),g=l.shift(),l=l.shift()));j||("inline"===m?g?j=f(q(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):k.isDom&&(j=c):"html"===m?j=g:!m&&(!g&&
|
||||
k.isDom)&&(m="inline",j=c));f.extend(k,{href:g,type:m,content:j,title:h,selector:l});a[e]=k}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==v&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),b.coming=null,b.current||
|
||||
b._afterZoomOut(a))},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),b.isActive&&(!b.isOpen||!0===a?(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut()):(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),b.transitions[b.current.closeMethod]())))},play:function(a){var d=function(){clearTimeout(b.player.timer)},e=function(){d();b.current&&b.player.isActive&&(b.player.timer=
|
||||
setTimeout(b.next,b.current.playSpeed))},c=function(){d();p.unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};if(!0===a||!b.player.isActive&&!1!==a){if(b.current&&(b.current.loop||b.current.index<b.group.length-1))b.player.isActive=!0,p.bind({"onCancel.player beforeClose.player":c,"onUpdate.player":e,"beforeLoad.player":d}),e(),b.trigger("onPlayStart")}else c()},next:function(a){var d=b.current;d&&(q(a)||(a=d.direction.next),b.jumpto(d.index+1,a,"next"))},prev:function(a){var d=b.current;
|
||||
d&&(q(a)||(a=d.direction.prev),b.jumpto(d.index-1,a,"prev"))},jumpto:function(a,d,e){var c=b.current;c&&(a=l(a),b.direction=d||c.direction[a>=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==v&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,k;c&&(k=b._getPosition(d),a&&"scroll"===a.type?(delete k.position,c.stop(!0,!0).animate(k,200)):(c.css(k),e.pos=f.extend({},e.dim,k)))},update:function(a){var d=
|
||||
a&&a.type,e=!d||"orientationchange"===d;e&&(clearTimeout(B),B=null);b.isOpen&&!B&&(B=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),B=null)},e&&!s?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,s&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"),b.trigger("onUpdate")),
|
||||
b.update())},hideLoading:function(){p.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f('<div id="fancybox-loading"><div></div></div>').click(b.cancel).appendTo("body");p.bind("keydown.loading",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}))},getViewport:function(){var a=b.current&&b.current.locked||!1,d={x:n.scrollLeft(),
|
||||
y:n.scrollTop()};a?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=s&&r.innerWidth?r.innerWidth:n.width(),d.h=s&&r.innerHeight?r.innerHeight:n.height());return d},unbindEvents:function(){b.wrap&&t(b.wrap)&&b.wrap.unbind(".fb");p.unbind(".fb");n.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(n.bind("orientationchange.fb"+(s?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&p.bind("keydown.fb",function(e){var c=e.which||e.keyCode,k=e.target||e.srcElement;
|
||||
if(27===c&&b.coming)return!1;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!k||!k.type&&!f(k).is("[contenteditable]")))&&f.each(d,function(d,k){if(1<a.group.length&&k[c]!==v)return b[d](k[c]),e.preventDefault(),!1;if(-1<f.inArray(c,k))return b[d](),e.preventDefault(),!1})}),f.fn.mousewheel&&a.mouseWheel&&b.wrap.bind("mousewheel.fb",function(d,c,k,g){for(var h=f(d.target||null),j=!1;h.length&&!j&&!h.is(".fancybox-skin")&&!h.is(".fancybox-wrap");)j=h[0]&&!(h[0].style.overflow&&"hidden"===h[0].style.overflow)&&
|
||||
(h[0].clientWidth&&h[0].scrollWidth>h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==c&&!j&&1<b.group.length&&!a.canShrink){if(0<g||0<k)b.prev(0<g?"down":"left");else if(0>g||0>k)b.next(0>g?"up":"right");d.preventDefault()}}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d,e){if(e&&b.helpers[d]&&f.isFunction(b.helpers[d][a]))b.helpers[d][a](f.extend(!0,
|
||||
{},b.helpers[d].defaults,e),c)});p.trigger(a)}},isImage:function(a){return q(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i)},isSWF:function(a){return q(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c;a=l(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&&(d.padding=[c,c,c,c]);d.modal&&f.extend(!0,d,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,
|
||||
mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});d.autoSize&&(d.autoWidth=d.autoHeight=!0);"auto"===d.width&&(d.autoWidth=!0);"auto"===d.height&&(d.autoHeight=!0);d.group=b.group;d.index=a;b.coming=d;if(!1===b.trigger("beforeLoad"))b.coming=null;else{c=d.type;e=d.href;if(!c)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive=!0;if("image"===c||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio=
|
||||
!0);"iframe"===c&&s&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(s?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,w(d.padding[a]))});b.trigger("onReady");if("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href");
|
||||
"image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width=this.width/b.opts.pixelRatio;b.coming.height=this.height/b.opts.pixelRatio;b._afterLoad()};a.onerror=function(){this.onload=
|
||||
this.onerror=null;b._error("image")};a.src=b.coming.href;!0!==a.complete&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(d,e){"success"===e&&(a.content=d,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,d=f(a.tpl.iframe.replace(/\{rnd\}/g,(new Date).getTime())).attr("scrolling",s?"auto":a.iframe.scrolling).attr("src",a.href);
|
||||
f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);s||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a=b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload,
|
||||
e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,k,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());b.unbindEvents();e=a.content;c=a.type;k=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin,
|
||||
outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case "inline":case "ajax":case "html":a.selector?e=f("<div>").html(e).find(a.selector):t(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('<div class="fancybox-placeholder"></div>').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder",!1)}));break;case "image":e=a.tpl.image.replace("{href}",
|
||||
g);break;case "swf":e='<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="'+g+'"></param>',h="",f.each(a.swf,function(a,b){e+='<param name="'+a+'" value="'+b+'"></param>';h+=" "+a+'="'+b+'"'}),e+='<embed src="'+g+'" type="application/x-shockwave-flash" width="100%" height="100%"'+h+"></embed></object>"}(!t(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow");a.inner.css("overflow","yes"===k?"scroll":
|
||||
"no"===k?"hidden":k);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(d.prevMethod)b.transitions[d.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,k=b.skin,g=b.inner,h=b.current,c=h.width,j=h.height,m=h.minWidth,u=h.minHeight,n=h.maxWidth,p=h.maxHeight,s=h.scrolling,q=h.scrollOutside?
|
||||
h.scrollbarWidth:0,x=h.margin,y=l(x[1]+x[3]),r=l(x[0]+x[2]),v,z,t,C,A,F,B,D,H;e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp");x=l(k.outerWidth(!0)-k.width());v=l(k.outerHeight(!0)-k.height());z=y+x;t=r+v;C=E(c)?(a.w-z)*l(c)/100:c;A=E(j)?(a.h-t)*l(j)/100:j;if("iframe"===h.type){if(H=h.content,h.autoHeight&&1===H.data("ready"))try{H[0].contentWindow.document.location&&(g.width(C).height(9999),F=H.contents().find("body"),q&&F.css("overflow-x","hidden"),A=F.outerHeight(!0))}catch(G){}}else if(h.autoWidth||
|
||||
h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(C),h.autoHeight||g.height(A),h.autoWidth&&(C=g.width()),h.autoHeight&&(A=g.height()),g.removeClass("fancybox-tmp");c=l(C);j=l(A);D=C/A;m=l(E(m)?l(m,"w")-z:m);n=l(E(n)?l(n,"w")-z:n);u=l(E(u)?l(u,"h")-t:u);p=l(E(p)?l(p,"h")-t:p);F=n;B=p;h.fitToView&&(n=Math.min(a.w-z,n),p=Math.min(a.h-t,p));z=a.w-y;r=a.h-r;h.aspectRatio?(c>n&&(c=n,j=l(c/D)),j>p&&(j=p,c=l(j*D)),c<m&&(c=m,j=l(c/D)),j<u&&(j=u,c=l(j*D))):(c=Math.max(m,Math.min(c,n)),h.autoHeight&&
|
||||
"iframe"!==h.type&&(g.width(c),j=g.height()),j=Math.max(u,Math.min(j,p)));if(h.fitToView)if(g.width(c).height(j),e.width(c+x),a=e.width(),y=e.height(),h.aspectRatio)for(;(a>z||y>r)&&(c>m&&j>u)&&!(19<d++);)j=Math.max(u,Math.min(p,j-10)),c=l(j*D),c<m&&(c=m,j=l(c/D)),c>n&&(c=n,j=l(c/D)),g.width(c).height(j),e.width(c+x),a=e.width(),y=e.height();else c=Math.max(m,Math.min(c,c-(a-z))),j=Math.max(u,Math.min(j,j-(y-r)));q&&("auto"===s&&j<A&&c+x+q<z)&&(c+=q);g.width(c).height(j);e.width(c+x);a=e.width();
|
||||
y=e.height();e=(a>z||y>r)&&c>m&&j>u;c=h.aspectRatio?c<F&&j<B&&c<C&&j<A:(c<F||j<B)&&(c<C||j<A);f.extend(h,{dim:{width:w(a),height:w(y)},origWidth:C,origHeight:A,canShrink:e,canExpand:c,wPadding:x,hPadding:v,wrapSpace:y-k.outerHeight(!0),skinSpace:k.height()-j});!H&&(h.autoHeight&&j>u&&j<p&&!c)&&g.height("auto")},_getPosition:function(a){var d=b.current,e=b.getViewport(),c=d.margin,f=b.wrap.width()+c[1]+c[3],g=b.wrap.height()+c[0]+c[2],c={position:"absolute",top:c[0],left:c[3]};d.autoCenter&&d.fixed&&
|
||||
!a&&g<=e.h&&f<=e.w?c.position="fixed":d.locked||(c.top+=e.y,c.left+=e.x);c.top=w(Math.max(c.top,c.top+(e.h-g)*d.topRatio));c.left=w(Math.max(c.left,c.left+(e.w-f)*d.leftRatio));return c},_afterZoomIn:function(){var a=b.current;a&&(b.isOpen=b.isOpened=!0,b.wrap.css("overflow","visible").addClass("fancybox-opened"),b.update(),(a.closeClick||a.nextClick&&1<b.group.length)&&b.inner.css("cursor","pointer").bind("click.fb",function(d){!f(d.target).is("a")&&!f(d.target).parent().is("a")&&(d.preventDefault(),
|
||||
b[a.closeClick?"close":"next"]())}),a.closeBtn&&f(a.tpl.closeBtn).appendTo(b.skin).bind("click.fb",function(a){a.preventDefault();b.close()}),a.arrows&&1<b.group.length&&((a.loop||0<a.index)&&f(a.tpl.prev).appendTo(b.outer).bind("click.fb",b.prev),(a.loop||a.index<b.group.length-1)&&f(a.tpl.next).appendTo(b.outer).bind("click.fb",b.next)),b.trigger("afterShow"),!a.loop&&a.index===a.group.length-1?b.play(!1):b.opts.autoPlay&&!b.player.isActive&&(b.opts.autoPlay=!1,b.play()))},_afterZoomOut:function(a){a=
|
||||
a||b.current;f(".fancybox-wrap").trigger("onReset").remove();f.extend(b,{group:{},opts:{},router:!1,current:null,isActive:!1,isOpened:!1,isOpen:!1,isClosing:!1,wrap:null,skin:null,outer:null,inner:null});b.trigger("afterClose",a)}});b.transitions={getOrigPosition:function(){var a=b.current,d=a.element,e=a.orig,c={},f=50,g=50,h=a.hPadding,j=a.wPadding,m=b.getViewport();!e&&(a.isDom&&d.is(":visible"))&&(e=d.find("img:first"),e.length||(e=d));t(e)?(c=e.offset(),e.is("img")&&(f=e.outerWidth(),g=e.outerHeight())):
|
||||
(c.top=m.y+(m.h-g)*a.topRatio,c.left=m.x+(m.w-f)*a.leftRatio);if("fixed"===b.wrap.css("position")||a.locked)c.top-=m.y,c.left-=m.x;return c={top:w(c.top-h*a.topRatio),left:w(c.left-j*a.leftRatio),width:w(f+j),height:w(g+h)}},step:function(a,d){var e,c,f=d.prop;c=b.current;var g=c.wrapSpace,h=c.skinSpace;if("width"===f||"height"===f)e=d.end===d.start?1:(a-d.start)/(d.end-d.start),b.isClosing&&(e=1-e),c="width"===f?c.wPadding:c.hPadding,c=a-c,b.skin[f](l("width"===f?c:c-g*e)),b.inner[f](l("width"===
|
||||
f?c:c-g*e-h*e))},zoomIn:function(){var a=b.current,d=a.pos,e=a.openEffect,c="elastic"===e,k=f.extend({opacity:1},d);delete k.position;c?(d=this.getOrigPosition(),a.openOpacity&&(d.opacity=0.1)):"fade"===e&&(d.opacity=0.1);b.wrap.css(d).animate(k,{duration:"none"===e?0:a.openSpeed,easing:a.openEasing,step:c?this.step:null,complete:b._afterZoomIn})},zoomOut:function(){var a=b.current,d=a.closeEffect,e="elastic"===d,c={opacity:0.1};e&&(c=this.getOrigPosition(),a.closeOpacity&&(c.opacity=0.1));b.wrap.animate(c,
|
||||
{duration:"none"===d?0:a.closeSpeed,easing:a.closeEasing,step:e?this.step:null,complete:b._afterZoomOut})},changeIn:function(){var a=b.current,d=a.nextEffect,e=a.pos,c={opacity:1},f=b.direction,g;e.opacity=0.1;"elastic"===d&&(g="down"===f||"up"===f?"top":"left","down"===f||"right"===f?(e[g]=w(l(e[g])-200),c[g]="+=200px"):(e[g]=w(l(e[g])+200),c[g]="-=200px"));"none"===d?b._afterZoomIn():b.wrap.css(e).animate(c,{duration:a.nextSpeed,easing:a.nextEasing,complete:b._afterZoomIn})},changeOut:function(){var a=
|
||||
b.previous,d=a.prevEffect,e={opacity:0.1},c=b.direction;"elastic"===d&&(e["down"===c||"up"===c?"top":"left"]=("up"===c||"left"===c?"-":"+")+"=200px");a.wrap.animate(e,{duration:"none"===d?0:a.prevSpeed,easing:a.prevEasing,complete:function(){f(this).trigger("onReset").remove()}})}};b.helpers.overlay={defaults:{closeClick:!0,speedOut:200,showEarly:!0,css:{},locked:!s,fixed:!0},overlay:null,fixed:!1,el:f("html"),create:function(a){a=f.extend({},this.defaults,a);this.overlay&&this.close();this.overlay=
|
||||
f('<div class="fancybox-overlay"></div>').appendTo(b.coming?b.coming.parent:a.parent);this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(n.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay",function(a){if(f(a.target).hasClass("fancybox-overlay"))return b.isActive?
|
||||
b.close():d.close(),!1});this.overlay.css(a.css).show()},close:function(){var a,b;n.unbind("resize.overlay");this.el.hasClass("fancybox-lock")&&(f(".fancybox-margin").removeClass("fancybox-margin"),a=n.scrollTop(),b=n.scrollLeft(),this.el.removeClass("fancybox-lock"),n.scrollTop(a).scrollLeft(b));f(".fancybox-overlay").remove().hide();f.extend(this,{overlay:null,fixed:!1})},update:function(){var a="100%",b;this.overlay.width(a).height("100%");I?(b=Math.max(G.documentElement.offsetWidth,G.body.offsetWidth),
|
||||
p.width()>b&&(a=p.width())):p.width()>n.width()&&(a=p.width());this.overlay.width(a).height(p.height())},onReady:function(a,b){var e=this.overlay;f(".fancybox-overlay").stop(!0,!0);e||this.create(a);a.locked&&(this.fixed&&b.fixed)&&(e||(this.margin=p.height()>n.height()?f("html").css("margin-right").replace("px",""):!1),b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){var e,c;b.locked&&(!1!==this.margin&&(f("*").filter(function(){return"fixed"===
|
||||
f(this).css("position")&&!f(this).hasClass("fancybox-overlay")&&!f(this).hasClass("fancybox-wrap")}).addClass("fancybox-margin"),this.el.addClass("fancybox-margin")),e=n.scrollTop(),c=n.scrollLeft(),this.el.addClass("fancybox-lock"),n.scrollTop(e).scrollLeft(c));this.open(a)},onUpdate:function(){this.fixed||this.update()},afterClose:function(a){this.overlay&&!b.coming&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(a){var d=
|
||||
b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(q(e)&&""!==f.trim(e)){d=f('<div class="fancybox-title fancybox-title-'+c+'-wrap">'+e+"</div>");switch(c){case "inside":c=b.skin;break;case "outside":c=b.wrap;break;case "over":c=b.inner;break;default:c=b.skin,d.appendTo("body"),I&&d.width(d.width()),d.wrapInner('<span class="child"></span>'),b.current.margin[2]+=Math.abs(l(d.css("margin-bottom")))}d["top"===a.position?"prependTo":"appendTo"](c)}}};f.fn.fancybox=function(a){var d,
|
||||
e=f(this),c=this.selector||"",k=function(g){var h=f(this).blur(),j=d,k,l;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(k=a.groupAttr||"data-fancybox-group",l=h.attr(k),l||(k="rel",l=h.get(0)[k]),l&&(""!==l&&"nofollow"!==l)&&(h=c.length?f(c):e,h=h.filter("["+k+'="'+l+'"]'),j=h.index(this)),a.index=j,!1!==b.open(h,a)&&g.preventDefault())};a=a||{};d=a.index||0;!c||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",k):p.undelegate(c,"click.fb-start").delegate(c+
|
||||
":not('.fancybox-item, .fancybox-nav')","click.fb-start",k);this.filter("[data-fancybox-start=1]").trigger("click");return this};p.ready(function(){var a,d;f.scrollbarWidth===v&&(f.scrollbarWidth=function(){var a=f('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo("body"),b=a.children(),b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});if(f.support.fixedPosition===v){a=f.support;d=f('<div style="position:fixed;top:20px;"></div>').appendTo("body");var e=20===
|
||||
d[0].offsetTop||15===d[0].offsetTop;d.remove();a.fixedPosition=e}f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")});a=f(r).width();J.addClass("fancybox-lock-test");d=f(r).width();J.removeClass("fancybox-lock-test");f("<style type='text/css'>.fancybox-margin{margin-right:"+(d-a)+"px;}</style>").appendTo("head")})})(window,document,jQuery);
|
|
@ -1,665 +0,0 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
// markItUp! Universal MarkUp Engine, JQuery plugin
|
||||
// v 1.1.x
|
||||
// Dual licensed under the MIT and GPL licenses.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright (C) 2007-2012 Jay Salvat
|
||||
// http://markitup.jaysalvat.com/
|
||||
// ----------------------------------------------------------------------------
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
// ----------------------------------------------------------------------------
|
||||
(function($) {
|
||||
$.fn.markItUp = function(settings, extraSettings) {
|
||||
var method, params, options, ctrlKey, shiftKey, altKey; ctrlKey = shiftKey = altKey = false;
|
||||
|
||||
if (typeof settings == 'string') {
|
||||
method = settings;
|
||||
params = extraSettings;
|
||||
}
|
||||
|
||||
options = { id: '',
|
||||
nameSpace: '',
|
||||
root: '',
|
||||
previewHandler: false,
|
||||
previewInWindow: '', // 'width=800, height=600, resizable=yes, scrollbars=yes'
|
||||
previewInElement: '',
|
||||
previewAutoRefresh: true,
|
||||
previewPosition: 'after',
|
||||
previewTemplatePath: chrome.extension.getURL('/includes/preview.html'),
|
||||
previewParser: false,
|
||||
previewParserPath: '',
|
||||
previewParserVar: 'data',
|
||||
resizeHandle: true,
|
||||
beforeInsert: '',
|
||||
afterInsert: '',
|
||||
onEnter: {},
|
||||
onShiftEnter: {},
|
||||
onCtrlEnter: {},
|
||||
onTab: {},
|
||||
markupSet: [ { /* set */ } ]
|
||||
};
|
||||
$.extend(options, settings, extraSettings);
|
||||
|
||||
// compute markItUp! path
|
||||
if (!options.root) {
|
||||
$('script').each(function(a, tag) {
|
||||
miuScript = $(tag).get(0).src.match(/(.*)jquery\.markitup(\.pack)?\.js$/);
|
||||
if (miuScript !== null) {
|
||||
options.root = miuScript[1];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Quick patch to keep compatibility with jQuery 1.9
|
||||
var uaMatch = function(ua) {
|
||||
ua = ua.toLowerCase();
|
||||
|
||||
var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(webkit)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(msie) ([\w.]+)/.exec(ua) ||
|
||||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
|
||||
[];
|
||||
|
||||
return {
|
||||
browser: match[ 1 ] || "",
|
||||
version: match[ 2 ] || "0"
|
||||
};
|
||||
};
|
||||
var matched = uaMatch( navigator.userAgent );
|
||||
var browser = {};
|
||||
|
||||
if (matched.browser) {
|
||||
browser[matched.browser] = true;
|
||||
browser.version = matched.version;
|
||||
}
|
||||
if (browser.chrome) {
|
||||
browser.webkit = true;
|
||||
} else if (browser.webkit) {
|
||||
browser.safari = true;
|
||||
}
|
||||
|
||||
return this.each(function() {
|
||||
var $$, textarea, levels, scrollPosition, caretPosition, caretOffset,
|
||||
clicked, hash, header, footer, previewWindow, template, iFrame, abort;
|
||||
$$ = $(this);
|
||||
textarea = this;
|
||||
levels = [];
|
||||
abort = false;
|
||||
scrollPosition = caretPosition = 0;
|
||||
caretOffset = -1;
|
||||
|
||||
options.previewParserPath = localize(options.previewParserPath);
|
||||
options.previewTemplatePath = localize(options.previewTemplatePath);
|
||||
|
||||
if (method) {
|
||||
switch(method) {
|
||||
case 'remove':
|
||||
remove();
|
||||
break;
|
||||
case 'insert':
|
||||
markup(params);
|
||||
break;
|
||||
default:
|
||||
$.error('Method ' + method + ' does not exist on jQuery.markItUp');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// apply the computed path to ~/
|
||||
function localize(data, inText) {
|
||||
if (inText) {
|
||||
return data.replace(/("|')~\//g, "$1"+options.root);
|
||||
}
|
||||
return data.replace(/^~\//, options.root);
|
||||
}
|
||||
|
||||
// init and build editor
|
||||
function init() {
|
||||
id = ''; nameSpace = '';
|
||||
if (options.id) {
|
||||
id = 'id="'+options.id+'"';
|
||||
} else if ($$.attr("id")) {
|
||||
id = 'id="markItUp'+($$.attr("id").substr(0, 1).toUpperCase())+($$.attr("id").substr(1))+'"';
|
||||
|
||||
}
|
||||
if (options.nameSpace) {
|
||||
nameSpace = 'class="'+options.nameSpace+'"';
|
||||
}
|
||||
$$.wrap('<div '+nameSpace+'></div>');
|
||||
$$.wrap('<div '+id+' class="markItUp"></div>');
|
||||
$$.wrap('<div class="markItUpContainer"></div>');
|
||||
$$.addClass("markItUpEditor");
|
||||
|
||||
// add the header before the textarea
|
||||
header = $('<div class="markItUpHeader"></div>').insertBefore($$);
|
||||
$(dropMenus(options.markupSet)).appendTo(header);
|
||||
|
||||
// add the footer after the textarea
|
||||
footer = $('<div class="markItUpFooter"></div>').insertAfter($$);
|
||||
|
||||
// add the resize handle after textarea
|
||||
if (options.resizeHandle === true && browser.safari !== true) {
|
||||
resizeHandle = $('<div class="markItUpResizeHandle"></div>')
|
||||
.insertAfter($$)
|
||||
.bind("mousedown.markItUp", function(e) {
|
||||
var h = $$.height(), y = e.clientY, mouseMove, mouseUp;
|
||||
mouseMove = function(e) {
|
||||
$$.css("height", Math.max(20, e.clientY+h-y)+"px");
|
||||
return false;
|
||||
};
|
||||
mouseUp = function(e) {
|
||||
$("html").unbind("mousemove.markItUp", mouseMove).unbind("mouseup.markItUp", mouseUp);
|
||||
return false;
|
||||
};
|
||||
$("html").bind("mousemove.markItUp", mouseMove).bind("mouseup.markItUp", mouseUp);
|
||||
});
|
||||
footer.append(resizeHandle);
|
||||
}
|
||||
|
||||
// listen key events
|
||||
$$.bind('keydown.markItUp', keyPressed).bind('keyup', keyPressed);
|
||||
|
||||
// bind an event to catch external calls
|
||||
$$.bind("insertion.markItUp", function(e, settings) {
|
||||
if (settings.target !== false) {
|
||||
get();
|
||||
}
|
||||
if (textarea === $.markItUp.focused) {
|
||||
markup(settings);
|
||||
}
|
||||
});
|
||||
|
||||
// remember the last focus
|
||||
$$.bind('focus.markItUp', function() {
|
||||
$.markItUp.focused = this;
|
||||
});
|
||||
|
||||
if (options.previewInElement) {
|
||||
refreshPreview();
|
||||
}
|
||||
}
|
||||
|
||||
// recursively build header with dropMenus from markupset
|
||||
function dropMenus(markupSet) {
|
||||
var ul = $('<ul></ul>'), i = 0;
|
||||
$('li:hover > ul', ul).css('display', 'block');
|
||||
$.each(markupSet, function() {
|
||||
var button = this, t = '', title, li, j;
|
||||
title = (button.key) ? (button.name||'')+' [Ctrl+'+button.key+']' : (button.name||'');
|
||||
key = (button.key) ? 'accesskey="'+button.key+'"' : '';
|
||||
if (button.separator) {
|
||||
li = $('<li class="markItUpSeparator">'+(button.separator||'')+'</li>').appendTo(ul);
|
||||
} else {
|
||||
i++;
|
||||
for (j = levels.length -1; j >= 0; j--) {
|
||||
t += levels[j]+"-";
|
||||
}
|
||||
li = $('<li class="markItUpButton markItUpButton'+t+(i)+' '+(button.className||'')+'"><a href="" '+key+' title="'+title+'">'+(button.name||'')+'</a></li>')
|
||||
.bind("contextmenu.markItUp", function() { // prevent contextmenu on mac and allow ctrl+click
|
||||
return false;
|
||||
}).bind('click.markItUp', function(e) {
|
||||
e.preventDefault();
|
||||
}).bind("focusin.markItUp", function(){
|
||||
$$.focus();
|
||||
}).bind('mouseup', function() {
|
||||
if (button.call) {
|
||||
eval(button.call)();
|
||||
}
|
||||
setTimeout(function() { markup(button) },1);
|
||||
return false;
|
||||
}).bind('mouseenter.markItUp', function() {
|
||||
$('> ul', this).show();
|
||||
$(document).one('click', function() { // close dropmenu if click outside
|
||||
$('ul ul', header).hide();
|
||||
}
|
||||
);
|
||||
}).bind('mouseleave.markItUp', function() {
|
||||
$('> ul', this).hide();
|
||||
}).appendTo(ul);
|
||||
if (button.dropMenu) {
|
||||
levels.push(i);
|
||||
$(li).addClass('markItUpDropMenu').append(dropMenus(button.dropMenu));
|
||||
}
|
||||
}
|
||||
});
|
||||
levels.pop();
|
||||
return ul;
|
||||
}
|
||||
|
||||
// markItUp! markups
|
||||
function magicMarkups(string) {
|
||||
if (string) {
|
||||
string = string.toString();
|
||||
string = string.replace(/\(\!\(([\s\S]*?)\)\!\)/g,
|
||||
function(x, a) {
|
||||
var b = a.split('|!|');
|
||||
if (altKey === true) {
|
||||
return (b[1] !== undefined) ? b[1] : b[0];
|
||||
} else {
|
||||
return (b[1] === undefined) ? "" : b[0];
|
||||
}
|
||||
}
|
||||
);
|
||||
// [![prompt]!], [![prompt:!:value]!]
|
||||
string = string.replace(/\[\!\[([\s\S]*?)\]\!\]/g,
|
||||
function(x, a) {
|
||||
var b = a.split(':!:');
|
||||
if (abort === true) {
|
||||
return false;
|
||||
}
|
||||
value = prompt(b[0], (b[1]) ? b[1] : '');
|
||||
if (value === null) {
|
||||
abort = true;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
);
|
||||
return string;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
// prepare action
|
||||
function prepare(action) {
|
||||
if ($.isFunction(action)) {
|
||||
action = action(hash);
|
||||
}
|
||||
return magicMarkups(action);
|
||||
}
|
||||
|
||||
// build block to insert
|
||||
function build(string) {
|
||||
var openWith = prepare(clicked.openWith);
|
||||
var placeHolder = prepare(clicked.placeHolder);
|
||||
var replaceWith = prepare(clicked.replaceWith);
|
||||
var closeWith = prepare(clicked.closeWith);
|
||||
var openBlockWith = prepare(clicked.openBlockWith);
|
||||
var closeBlockWith = prepare(clicked.closeBlockWith);
|
||||
var multiline = clicked.multiline;
|
||||
|
||||
if (replaceWith !== "") {
|
||||
block = openWith + replaceWith + closeWith;
|
||||
} else if (selection === '' && placeHolder !== '') {
|
||||
block = openWith + placeHolder + closeWith;
|
||||
} else {
|
||||
string = string || selection;
|
||||
|
||||
var lines = [string], blocks = [];
|
||||
|
||||
if (multiline === true) {
|
||||
lines = string.split(/\r?\n/);
|
||||
}
|
||||
|
||||
for (var l = 0; l < lines.length; l++) {
|
||||
line = lines[l];
|
||||
var trailingSpaces;
|
||||
if (trailingSpaces = line.match(/ *$/)) {
|
||||
blocks.push(openWith + line.replace(/ *$/g, '') + closeWith + trailingSpaces);
|
||||
} else {
|
||||
blocks.push(openWith + line + closeWith);
|
||||
}
|
||||
}
|
||||
|
||||
block = blocks.join("\n");
|
||||
}
|
||||
|
||||
block = openBlockWith + block + closeBlockWith;
|
||||
|
||||
return { block:block,
|
||||
openBlockWith:openBlockWith,
|
||||
openWith:openWith,
|
||||
replaceWith:replaceWith,
|
||||
placeHolder:placeHolder,
|
||||
closeWith:closeWith,
|
||||
closeBlockWith:closeBlockWith
|
||||
};
|
||||
}
|
||||
|
||||
// define markup to insert
|
||||
function markup(button) {
|
||||
var len, j, n, i;
|
||||
hash = clicked = button;
|
||||
get();
|
||||
$.extend(hash, { line:"",
|
||||
root:options.root,
|
||||
textarea:textarea,
|
||||
selection:(selection||''),
|
||||
caretPosition:caretPosition,
|
||||
ctrlKey:ctrlKey,
|
||||
shiftKey:shiftKey,
|
||||
altKey:altKey
|
||||
}
|
||||
);
|
||||
// callbacks before insertion
|
||||
prepare(options.beforeInsert);
|
||||
prepare(clicked.beforeInsert);
|
||||
if ((ctrlKey === true && shiftKey === true) || button.multiline === true) {
|
||||
prepare(clicked.beforeMultiInsert);
|
||||
}
|
||||
$.extend(hash, { line:1 });
|
||||
|
||||
if ((ctrlKey === true && shiftKey === true)) {
|
||||
lines = selection.split(/\r?\n/);
|
||||
for (j = 0, n = lines.length, i = 0; i < n; i++) {
|
||||
if ($.trim(lines[i]) !== '') {
|
||||
$.extend(hash, { line:++j, selection:lines[i] } );
|
||||
lines[i] = build(lines[i]).block;
|
||||
} else {
|
||||
lines[i] = "";
|
||||
}
|
||||
}
|
||||
|
||||
string = { block:lines.join('\n')};
|
||||
start = caretPosition;
|
||||
len = string.block.length + ((browser.opera) ? n-1 : 0);
|
||||
} else if (ctrlKey === true) {
|
||||
string = build(selection);
|
||||
start = caretPosition + string.openWith.length;
|
||||
len = string.block.length - string.openWith.length - string.closeWith.length;
|
||||
len = len - (string.block.match(/ $/) ? 1 : 0);
|
||||
len -= fixIeBug(string.block);
|
||||
} else if (shiftKey === true) {
|
||||
string = build(selection);
|
||||
start = caretPosition;
|
||||
len = string.block.length;
|
||||
len -= fixIeBug(string.block);
|
||||
} else {
|
||||
string = build(selection);
|
||||
start = caretPosition + string.block.length ;
|
||||
len = 0;
|
||||
start -= fixIeBug(string.block);
|
||||
}
|
||||
if ((selection === '' && string.replaceWith === '')) {
|
||||
caretOffset += fixOperaBug(string.block);
|
||||
|
||||
start = caretPosition + string.openBlockWith.length + string.openWith.length;
|
||||
len = string.block.length - string.openBlockWith.length - string.openWith.length - string.closeWith.length - string.closeBlockWith.length;
|
||||
|
||||
caretOffset = $$.val().substring(caretPosition, $$.val().length).length;
|
||||
caretOffset -= fixOperaBug($$.val().substring(0, caretPosition));
|
||||
}
|
||||
$.extend(hash, { caretPosition:caretPosition, scrollPosition:scrollPosition } );
|
||||
|
||||
if (string.block !== selection && abort === false) {
|
||||
insert(string.block);
|
||||
set(start, len);
|
||||
} else {
|
||||
caretOffset = -1;
|
||||
}
|
||||
get();
|
||||
|
||||
$.extend(hash, { line:'', selection:selection });
|
||||
|
||||
// callbacks after insertion
|
||||
if ((ctrlKey === true && shiftKey === true) || button.multiline === true) {
|
||||
prepare(clicked.afterMultiInsert);
|
||||
}
|
||||
prepare(clicked.afterInsert);
|
||||
prepare(options.afterInsert);
|
||||
|
||||
// refresh preview if opened
|
||||
if (previewWindow && options.previewAutoRefresh) {
|
||||
refreshPreview();
|
||||
}
|
||||
|
||||
// reinit keyevent
|
||||
shiftKey = altKey = ctrlKey = abort = false;
|
||||
}
|
||||
|
||||
// Substract linefeed in Opera
|
||||
function fixOperaBug(string) {
|
||||
if (browser.opera) {
|
||||
return string.length - string.replace(/\n*/g, '').length;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
// Substract linefeed in IE
|
||||
function fixIeBug(string) {
|
||||
if (browser.msie) {
|
||||
return string.length - string.replace(/\r*/g, '').length;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// add markup
|
||||
function insert(block) {
|
||||
if (document.selection) {
|
||||
var newSelection = document.selection.createRange();
|
||||
newSelection.text = block;
|
||||
} else {
|
||||
textarea.value = textarea.value.substring(0, caretPosition) + block + textarea.value.substring(caretPosition + selection.length, textarea.value.length);
|
||||
}
|
||||
}
|
||||
|
||||
// set a selection
|
||||
function set(start, len) {
|
||||
if (textarea.createTextRange){
|
||||
// quick fix to make it work on Opera 9.5
|
||||
if (browser.opera && browser.version >= 9.5 && len == 0) {
|
||||
return false;
|
||||
}
|
||||
range = textarea.createTextRange();
|
||||
range.collapse(true);
|
||||
range.moveStart('character', start);
|
||||
range.moveEnd('character', len);
|
||||
range.select();
|
||||
} else if (textarea.setSelectionRange ){
|
||||
textarea.setSelectionRange(start, start + len);
|
||||
}
|
||||
textarea.scrollTop = scrollPosition;
|
||||
textarea.focus();
|
||||
}
|
||||
|
||||
// get the selection
|
||||
function get() {
|
||||
textarea.focus();
|
||||
|
||||
scrollPosition = textarea.scrollTop;
|
||||
if (document.selection) {
|
||||
selection = document.selection.createRange().text;
|
||||
if (browser.msie) { // ie
|
||||
var range = document.selection.createRange(), rangeCopy = range.duplicate();
|
||||
rangeCopy.moveToElementText(textarea);
|
||||
caretPosition = -1;
|
||||
while(rangeCopy.inRange(range)) {
|
||||
rangeCopy.moveStart('character');
|
||||
caretPosition ++;
|
||||
}
|
||||
} else { // opera
|
||||
caretPosition = textarea.selectionStart;
|
||||
}
|
||||
} else { // gecko & webkit
|
||||
caretPosition = textarea.selectionStart;
|
||||
|
||||
selection = textarea.value.substring(caretPosition, textarea.selectionEnd);
|
||||
}
|
||||
return selection;
|
||||
}
|
||||
|
||||
// open preview window
|
||||
function preview() {
|
||||
if (typeof options.previewHandler === 'function') {
|
||||
previewWindow = true;
|
||||
} else if (options.previewInElement) {
|
||||
previewWindow = $(options.previewInElement);
|
||||
} else if (!previewWindow || previewWindow.closed) {
|
||||
if (options.previewInWindow) {
|
||||
previewWindow = window.open('', 'preview', options.previewInWindow);
|
||||
$(window).unload(function() {
|
||||
previewWindow.close();
|
||||
});
|
||||
} else {
|
||||
iFrame = $('<iframe class="markItUpPreviewFrame"></iframe>');
|
||||
if (options.previewPosition == 'after') {
|
||||
iFrame.insertAfter(footer);
|
||||
} else {
|
||||
iFrame.insertBefore(header);
|
||||
}
|
||||
previewWindow = iFrame[iFrame.length - 1].contentWindow || frame[iFrame.length - 1];
|
||||
}
|
||||
} else if (altKey === true) {
|
||||
if (iFrame) {
|
||||
iFrame.remove();
|
||||
} else {
|
||||
previewWindow.close();
|
||||
}
|
||||
previewWindow = iFrame = false;
|
||||
}
|
||||
if (!options.previewAutoRefresh) {
|
||||
refreshPreview();
|
||||
}
|
||||
if (options.previewInWindow) {
|
||||
previewWindow.focus();
|
||||
}
|
||||
}
|
||||
|
||||
// refresh Preview window
|
||||
function refreshPreview() {
|
||||
renderPreview();
|
||||
}
|
||||
|
||||
function renderPreview() {
|
||||
var phtml;
|
||||
if (options.previewHandler && typeof options.previewHandler === 'function') {
|
||||
options.previewHandler( $$.val() );
|
||||
} else if (options.previewParser && typeof options.previewParser === 'function') {
|
||||
var data = options.previewParser( $$.val() );
|
||||
writeInPreview(localize(data, 1) );
|
||||
} else if (options.previewParserPath !== '') {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'text',
|
||||
global: false,
|
||||
url: options.previewParserPath,
|
||||
data: options.previewParserVar+'='+encodeURIComponent($$.val()),
|
||||
success: function(data) {
|
||||
writeInPreview( localize(data, 1) );
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (!template) {
|
||||
$.ajax({
|
||||
url: options.previewTemplatePath,
|
||||
dataType: 'text',
|
||||
global: false,
|
||||
success: function(data) {
|
||||
writeInPreview( localize(data, 1).replace(/<!-- content -->/g, $$.val()) );
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function writeInPreview(data) {
|
||||
if (options.previewInElement) {
|
||||
$(options.previewInElement).html(data);
|
||||
} else if (previewWindow && previewWindow.document) {
|
||||
try {
|
||||
sp = previewWindow.document.documentElement.scrollTop
|
||||
} catch(e) {
|
||||
sp = 0;
|
||||
}
|
||||
previewWindow.document.open();
|
||||
previewWindow.document.write(data);
|
||||
previewWindow.document.close();
|
||||
previewWindow.document.documentElement.scrollTop = sp;
|
||||
}
|
||||
}
|
||||
|
||||
// set keys pressed
|
||||
function keyPressed(e) {
|
||||
shiftKey = e.shiftKey;
|
||||
altKey = e.altKey;
|
||||
ctrlKey = (!(e.altKey && e.ctrlKey)) ? (e.ctrlKey || e.metaKey) : false;
|
||||
|
||||
if (e.type === 'keydown') {
|
||||
if (ctrlKey === true) {
|
||||
li = $('a[accesskey="'+((e.keyCode == 13) ? '\\n' : String.fromCharCode(e.keyCode))+'"]', header).parent('li');
|
||||
if (li.length !== 0) {
|
||||
ctrlKey = false;
|
||||
setTimeout(function() {
|
||||
li.triggerHandler('mouseup');
|
||||
},1);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (e.keyCode === 13 || e.keyCode === 10) { // Enter key
|
||||
if (ctrlKey === true) { // Enter + Ctrl
|
||||
ctrlKey = false;
|
||||
markup(options.onCtrlEnter);
|
||||
return options.onCtrlEnter.keepDefault;
|
||||
} else if (shiftKey === true) { // Enter + Shift
|
||||
shiftKey = false;
|
||||
markup(options.onShiftEnter);
|
||||
return options.onShiftEnter.keepDefault;
|
||||
} else { // only Enter
|
||||
markup(options.onEnter);
|
||||
return options.onEnter.keepDefault;
|
||||
}
|
||||
}
|
||||
if (e.keyCode === 9) { // Tab key
|
||||
if (shiftKey == true || ctrlKey == true || altKey == true) {
|
||||
return false;
|
||||
}
|
||||
if (caretOffset !== -1) {
|
||||
get();
|
||||
caretOffset = $$.val().length - caretOffset;
|
||||
set(caretOffset, 0);
|
||||
caretOffset = -1;
|
||||
return false;
|
||||
} else {
|
||||
markup(options.onTab);
|
||||
return options.onTab.keepDefault;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function remove() {
|
||||
$$.unbind(".markItUp").removeClass('markItUpEditor');
|
||||
$$.parent('div').parent('div.markItUp').parent('div').replaceWith($$);
|
||||
$$.data('markItUp', null);
|
||||
}
|
||||
|
||||
init();
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.markItUpRemove = function() {
|
||||
return this.each(function() {
|
||||
$(this).markItUp('remove');
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
$.markItUp = function(settings) {
|
||||
var options = { target:false };
|
||||
$.extend(options, settings);
|
||||
if (options.target) {
|
||||
return $(options.target).each(function() {
|
||||
$(this).focus();
|
||||
$(this).trigger('insertion', [options]);
|
||||
});
|
||||
} else {
|
||||
$('textarea').trigger('insertion', [options]);
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
|
@ -27,16 +27,24 @@
|
|||
{
|
||||
"matches": ["http://*.point.im/*", "https://*.point.im/*"],
|
||||
"js": [
|
||||
"js/jquery-1.10.1.min.js",
|
||||
"js/jquery.fancybox.pack.js", "js/jquery.fancybox-media.js",
|
||||
"js/markitup/jquery.markitup.js", "js/markitup/sets/markdown/set.js",
|
||||
"vendor/jquery/jquery.min.js",
|
||||
|
||||
"vendor/fancybox/source/jquery.fancybox.pack.js",
|
||||
"vendor/fancybox/source/helpers/jquery.fancybox-media.js",
|
||||
|
||||
"vendor/markitup/markitup/jquery.markitup.js",
|
||||
"js/markitup/sets/markdown/set.js",
|
||||
|
||||
"js/bquery_ajax.js",
|
||||
"js/options.js",
|
||||
"js/point-plus.js"
|
||||
],
|
||||
"css": [
|
||||
"css/jquery.fancybox.css",
|
||||
"css/markitup/skins/markitup/style.css", "css/markitup/sets/markdown/style.css",
|
||||
"vendor/fancybox/source/jquery.fancybox.css",
|
||||
|
||||
"vendor/markitup/markitup/skins/markitup/style.css",
|
||||
"css/markitup/sets/markdown/style.css",
|
||||
|
||||
"css/point-plus.css"
|
||||
],
|
||||
"run_at": "document_end"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<title>Point Plus options</title>
|
||||
|
||||
<link rel="stylesheet" href="css/point-plus.css" type="text/css"/>
|
||||
<script src="js/jquery-1.10.1.min.js"></script>
|
||||
<script src="vendor/jquery/jquery.min.js"></script>
|
||||
<script src="js/jquery.idTabs.min.js"></script>
|
||||
</head>
|
||||
|
||||
|
|
20
package.json
Normal file
20
package.json
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"name": "chrome-point-plus",
|
||||
"version": "1.17.3",
|
||||
"description": "Chrome extension for point.im",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@bitbucket.org:skobkin/chrome_point_plus.git"
|
||||
},
|
||||
"author": "\"Alexey Skobkin\"",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"bower": "^1.3.12",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-contrib-copy": "^0.7.0"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue