Version Description
- Fixed bug with captions loading at top instead of bottom of slide.
Download this release
Release Info
Developer | griffinjt |
Plugin | Slider by Soliloquy – Responsive Image Slider for WordPress |
Version | 2.0.3 |
Comparing to | |
See all releases |
Version 2.0.3
- assets/css/codemirror.css +4 -0
- assets/css/images/blank.gif +0 -0
- assets/css/images/circle-hover.png +0 -0
- assets/css/images/circle-hover@2x.png +0 -0
- assets/css/images/circle.png +0 -0
- assets/css/images/circle@2x.png +0 -0
- assets/css/images/delete.png +0 -0
- assets/css/images/delete@2x.png +0 -0
- assets/css/images/editor-icon.png +0 -0
- assets/css/images/editor-icon@2x.png +0 -0
- assets/css/images/holder.gif +0 -0
- assets/css/images/left.png +0 -0
- assets/css/images/left@2x.png +0 -0
- assets/css/images/menu-icon.png +0 -0
- assets/css/images/menu-icon@2x.png +0 -0
- assets/css/images/meta-active.png +0 -0
- assets/css/images/meta-active@2x.png +0 -0
- assets/css/images/meta.png +0 -0
- assets/css/images/meta@2x.png +0 -0
- assets/css/images/modify.png +0 -0
- assets/css/images/modify@2x.png +0 -0
- assets/css/images/pause.png +0 -0
- assets/css/images/pause@2x.png +0 -0
- assets/css/images/play.png +0 -0
- assets/css/images/play@2x.png +0 -0
- assets/css/images/preloader.gif +0 -0
- assets/css/images/preloader@2x.gif +0 -0
- assets/css/images/right.png +0 -0
- assets/css/images/right@2x.png +0 -0
- assets/css/images/video-mini.png +0 -0
- assets/css/images/video.png +0 -0
- assets/css/images/video@2x.png +0 -0
- assets/css/metabox.css +598 -0
- assets/css/settings.css +196 -0
- assets/css/soliloquy.css +396 -0
- assets/js/codemirror.js +12 -0
- assets/js/editor.js +123 -0
- assets/js/metabox.js +855 -0
- assets/js/settings.js +78 -0
- assets/js/soliloquy-dev-holder.js +1449 -0
- assets/js/soliloquy.js +6 -0
- includes/admin/ajax.php +640 -0
- includes/admin/common.php +270 -0
- includes/admin/editor.php +232 -0
- includes/admin/media.php +249 -0
- includes/admin/metaboxes.php +1312 -0
- includes/admin/posttype.php +209 -0
- includes/admin/settings.php +230 -0
- includes/global/common.php +429 -0
- includes/global/posttype.php +108 -0
- includes/global/shortcode.php +814 -0
- readme.txt +149 -0
- soliloquy-lite.php +508 -0
- themes/classic/images/slider-arrows-horizontal.png +0 -0
- themes/classic/images/slider-arrows-horizontal@2x.png +0 -0
- themes/classic/images/slider-dots.png +0 -0
- themes/classic/images/slider-dots@2x.png +0 -0
- themes/classic/style.css +109 -0
assets/css/codemirror.css
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
/* Base CodeMirror CSS */
|
2 |
+
.CodeMirror{font-family:monospace;height:300px}.CodeMirror-scroll{overflow:auto}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{background-color:white}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999}.CodeMirror div.CodeMirror-cursor{border-left:1px solid black;z-index:3}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor{width:auto;border:0;background:#7e7;z-index:1}.cm-tab{display:inline-block}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable{color:black}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-property{color:black}.cm-s-default .cm-operator{color:black}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-header{color:blue}.cm-s-default .cm-quote{color:#090}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:bold}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-s-default .cm-error{color:red}.cm-invalidchar{color:red}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{line-height:1;position:relative;overflow:hidden;background:white;color:black}.CodeMirror-scroll{margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;padding-right:30px;height:100%;outline:0;position:relative;-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-sizer{position:relative}.CodeMirror-vscrollbar,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;padding-bottom:30px;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;-moz-box-sizing:content-box;box-sizing:content-box;padding-bottom:30px;margin-bottom:-32px;display:inline-block;*zoom:1;*display:inline}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text}.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:transparent;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-code pre{border-right:30px solid transparent;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.CodeMirror-wrap .CodeMirror-code pre{border-right:0;width:auto}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-wrap .CodeMirror-scroll{overflow-x:hidden}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-measure pre{position:static}.CodeMirror div.CodeMirror-cursor{position:absolute;visibility:hidden;border-right:0;width:0}.CodeMirror-focused div.CodeMirror-cursor{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.CodeMirror span{*vertical-align:text-bottom}@media print{.CodeMirror div.CodeMirror-cursor{visibility:hidden}}
|
3 |
+
/* Solarized theme */
|
4 |
+
.solarized.base03{color:#002b36}.solarized.base02{color:#073642}.solarized.base01{color:#586e75}.solarized.base00{color:#657b83}.solarized.base0{color:#839496}.solarized.base1{color:#93a1a1}.solarized.base2{color:#eee8d5}.solarized.base3{color:#fdf6e3}.solarized.solar-yellow{color:#b58900}.solarized.solar-orange{color:#cb4b16}.solarized.solar-red{color:#dc322f}.solarized.solar-magenta{color:#d33682}.solarized.solar-violet{color:#6c71c4}.solarized.solar-blue{color:#268bd2}.solarized.solar-cyan{color:#2aa198}.solarized.solar-green{color:#859900}.cm-s-solarized{line-height:1.45em;font-family:Menlo,Monaco,"Andale Mono","lucida console","Courier New",monospace !important;color-profile:sRGB;rendering-intent:auto}.cm-s-solarized.cm-s-dark{color:#839496;background-color:#002b36;text-shadow:#002b36 0 1px}.cm-s-solarized.cm-s-light{background-color:#fdf6e3;color:#657b83;text-shadow:#eee8d5 0 1px}.cm-s-solarized .CodeMirror-widget{text-shadow:none}.cm-s-solarized .cm-keyword{color:#cb4b16}.cm-s-solarized .cm-atom{color:#d33682}.cm-s-solarized .cm-number{color:#d33682}.cm-s-solarized .cm-def{color:#2aa198}.cm-s-solarized .cm-variable{color:#268bd2}.cm-s-solarized .cm-variable-2{color:#b58900}.cm-s-solarized .cm-variable-3{color:#6c71c4}.cm-s-solarized .cm-property{color:#2aa198}.cm-s-solarized .cm-operator{color:#6c71c4}.cm-s-solarized .cm-comment{color:#586e75;font-style:italic}.cm-s-solarized .cm-string{color:#859900}.cm-s-solarized .cm-string-2{color:#b58900}.cm-s-solarized .cm-meta{color:#859900}.cm-s-solarized .cm-qualifier{color:#b58900}.cm-s-solarized .cm-builtin{color:#d33682}.cm-s-solarized .cm-bracket{color:#cb4b16}.cm-s-solarized .CodeMirror-matchingbracket{color:#859900}.cm-s-solarized .CodeMirror-nonmatchingbracket{color:#dc322f}.cm-s-solarized .cm-tag{color:#93a1a1}.cm-s-solarized .cm-attribute{color:#2aa198}.cm-s-solarized .cm-header{color:#586e75}.cm-s-solarized .cm-quote{color:#93a1a1}.cm-s-solarized .cm-hr{color:transparent;border-top:1px solid #586e75;display:block}.cm-s-solarized .cm-link{color:#93a1a1;cursor:pointer}.cm-s-solarized .cm-special{color:#6c71c4}.cm-s-solarized .cm-em{color:#999;text-decoration:underline;text-decoration-style:dotted}.cm-s-solarized .cm-strong{color:#eee}.cm-s-solarized .cm-tab:before{content:"➤";color:#586e75}.cm-s-solarized .cm-error,.cm-s-solarized .cm-invalidchar{color:#586e75;border-bottom:1px dotted #dc322f}.cm-s-solarized.cm-s-dark .CodeMirror-selected{background:#073642}.cm-s-solarized.cm-s-light .CodeMirror-selected{background:#eee8d5}.cm-s-solarized.CodeMirror{-moz-box-shadow:inset 7px 0 12px -6px #000;-webkit-box-shadow:inset 7px 0 12px -6px #000;box-shadow:inset 7px 0 12px -6px #000}.cm-s-solarized .CodeMirror-gutters{padding:0 15px 0 10px;box-shadow:0 10px 20px black;border-right:1px solid}.cm-s-solarized.cm-s-dark .CodeMirror-gutters{background-color:#073642;border-color:#00232c}.cm-s-solarized.cm-s-dark .CodeMirror-linenumber{text-shadow:#021014 0 -1px}.cm-s-solarized.cm-s-light .CodeMirror-gutters{background-color:#eee8d5;border-color:#eee8d5}.cm-s-solarized .CodeMirror-linenumber{color:#586e75}.cm-s-solarized .CodeMirror-gutter .CodeMirror-gutter-text{color:#586e75}.cm-s-solarized .CodeMirror-lines{padding-left:5px}.cm-s-solarized .CodeMirror-lines .CodeMirror-cursor{border-left:1px solid #819090}.cm-s-solarized.cm-s-dark .CodeMirror-activeline-background{background:rgba(255,255,255,0.10)}.cm-s-solarized.cm-s-light .CodeMirror-activeline-background{background:rgba(0,0,0,0.10)}.cm-s-solarized.CodeMirror,.cm-s-solarized .CodeMirror-gutters{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAQAAAAHUWYVAABFFUlEQVQYGbzBCeDVU/74/6fj9HIcx/FRHx9JCFmzMyGRURhLZIkUsoeRfUjS2FNDtr6WkMhO9sm+S8maJfu+Jcsg+/o/c+Z4z/t97/vezy3z+z8ekGlnYICG/o7gdk+wmSHZ1z4pJItqapjoKXWahm8NmV6eOTbWUOp6/6a/XIg6GQqmenJ2lDHyvCFZ2cBDbmtHA043VFhHwXxClWmeYAdLhV00Bd85go8VmaFCkbVkzlQENzfBDZ5gtN7HwF0KDrTwJ0dypSOzpaKCMwQHKTIreYIxlmhXTzTWkVm+LTynZhiSBT3RZQ7aGfjGEd3qyXQ1FDymqbKxpspERQN2MiRjNZlFFQXfCNFm9nM1zpAsoYjmtRTc5ajwuaXc5xrWskT97RaKzAGe5ARHhVUsDbjKklziiX5WROcJwSNCNI+9w1Jwv4Zb2r7lCMZ4oq5C0EdTx+2GzNuKpJ+iFf38JEWkHJn9DNF7mmBDITrWEg0VWL3pHU20tSZnuqWu+R3BtYa8XxV1HO7GyD32UkOpL/yDloINFTmvtId+nmAjxRw40VMwVKiwrKLE4bK5UOVntYwhOcSSXKrJHKPJedocpGjVz/ZMIbnYUPB10/eKCrs5apqpgVmWzBYWpmtKHecJPjaUuEgRDDaU0oZghCJ6zNMQ5ZhDYx05r5v2muQdM0EILtXUsaKiQX9WMEUotagQzFbUNN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toqd6vFSk/UwdZElYqyjrF4HXUeFspIi9IGKf4j92pKGAdCYMVsbcV3kRF0N+R8LUd5PCsIGWoxDtBkCI0nKofdJQxT+LtZflvuc8Q3CjwWkq8KwUpHzkK/NmSsclCL0nseQdj5FRH5CNHSgtLiW80Of5HU9Hhlsga9bnBq3fEVltKfO5IaSTmGjjc4J0otcP7QsJUSQM8pEj5/wCuUuC2DWz8AAAAAElFTkSuQmCC")}
|
assets/css/images/blank.gif
ADDED
Binary file
|
assets/css/images/circle-hover.png
ADDED
Binary file
|
assets/css/images/circle-hover@2x.png
ADDED
Binary file
|
assets/css/images/circle.png
ADDED
Binary file
|
assets/css/images/circle@2x.png
ADDED
Binary file
|
assets/css/images/delete.png
ADDED
Binary file
|
assets/css/images/delete@2x.png
ADDED
Binary file
|
assets/css/images/editor-icon.png
ADDED
Binary file
|
assets/css/images/editor-icon@2x.png
ADDED
Binary file
|
assets/css/images/holder.gif
ADDED
Binary file
|
assets/css/images/left.png
ADDED
Binary file
|
assets/css/images/left@2x.png
ADDED
Binary file
|
assets/css/images/menu-icon.png
ADDED
Binary file
|
assets/css/images/menu-icon@2x.png
ADDED
Binary file
|
assets/css/images/meta-active.png
ADDED
Binary file
|
assets/css/images/meta-active@2x.png
ADDED
Binary file
|
assets/css/images/meta.png
ADDED
Binary file
|
assets/css/images/meta@2x.png
ADDED
Binary file
|
assets/css/images/modify.png
ADDED
Binary file
|
assets/css/images/modify@2x.png
ADDED
Binary file
|
assets/css/images/pause.png
ADDED
Binary file
|
assets/css/images/pause@2x.png
ADDED
Binary file
|
assets/css/images/play.png
ADDED
Binary file
|
assets/css/images/play@2x.png
ADDED
Binary file
|
assets/css/images/preloader.gif
ADDED
Binary file
|
assets/css/images/preloader@2x.gif
ADDED
Binary file
|
assets/css/images/right.png
ADDED
Binary file
|
assets/css/images/right@2x.png
ADDED
Binary file
|
assets/css/images/video-mini.png
ADDED
Binary file
|
assets/css/images/video.png
ADDED
Binary file
|
assets/css/images/video@2x.png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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* ==========================================================================
|
2 |
+
Metabox Styles
|
3 |
+
========================================================================== */
|
4 |
+
|
5 |
+
.soliloquy-spinner {
|
6 |
+
float: none;
|
7 |
+
display: inline-block;
|
8 |
+
margin-top: 0;
|
9 |
+
}
|
10 |
+
|
11 |
+
.no-margin {
|
12 |
+
margin: 0 !important;
|
13 |
+
}
|
14 |
+
|
15 |
+
.no-margin-top {
|
16 |
+
margin-top: 0 !important;
|
17 |
+
}
|
18 |
+
|
19 |
+
.no-margin-bottom {
|
20 |
+
margin-bottom: 0 !important;
|
21 |
+
}
|
22 |
+
|
23 |
+
#soliloquy {
|
24 |
+
position: relative;
|
25 |
+
}
|
26 |
+
|
27 |
+
#soliloquy .soliloquy-clear {
|
28 |
+
clear: both;
|
29 |
+
}
|
30 |
+
|
31 |
+
#soliloquy .soliloquy-clear:after {
|
32 |
+
clear: both;
|
33 |
+
content: '.';
|
34 |
+
display: block;
|
35 |
+
height: 0;
|
36 |
+
line-height: 0;
|
37 |
+
overflow: auto;
|
38 |
+
visibility: hidden;
|
39 |
+
zoom: 1;
|
40 |
+
}
|
41 |
+
|
42 |
+
#soliloquy p.description {
|
43 |
+
font-size: 13px;
|
44 |
+
}
|
45 |
+
|
46 |
+
#soliloquy .inside {
|
47 |
+
margin: 10px 0;
|
48 |
+
padding: 0 10px;
|
49 |
+
}
|
50 |
+
|
51 |
+
#soliloquy #soliloquy-tabs {
|
52 |
+
position: relative;
|
53 |
+
}
|
54 |
+
|
55 |
+
#soliloquy #soliloquy-tabs-nav {
|
56 |
+
list-style: none;
|
57 |
+
margin: 0 0 10px;
|
58 |
+
padding: 0;
|
59 |
+
border-bottom: 1px solid #cecece;
|
60 |
+
}
|
61 |
+
|
62 |
+
#soliloquy #soliloquy-tabs-nav li {
|
63 |
+
float: left;
|
64 |
+
margin: 0 10px -1px 0;
|
65 |
+
}
|
66 |
+
|
67 |
+
#soliloquy #soliloquy-tabs-nav li a {
|
68 |
+
display: block;
|
69 |
+
padding: 7px 10px 5px;
|
70 |
+
font-size: 14px;
|
71 |
+
color: #aaa;
|
72 |
+
font-weight: 300;
|
73 |
+
text-decoration: none;
|
74 |
+
outline: none;
|
75 |
+
}
|
76 |
+
|
77 |
+
#soliloquy #soliloquy-tabs-nav li.soliloquy-active a {
|
78 |
+
border: 1px solid #cecece;
|
79 |
+
border-bottom-color: #fff;
|
80 |
+
-moz-border-radius: 3px 3px 0 0;
|
81 |
+
-webkit-border-radius: 3px 3px 0 0;
|
82 |
+
border-radius: 3px 3px 0 0;
|
83 |
+
color: #21759b;
|
84 |
+
padding-top: 6px;
|
85 |
+
}
|
86 |
+
|
87 |
+
#soliloquy #soliloquy-tabs-nav li a:hover {
|
88 |
+
color: #21759b;
|
89 |
+
}
|
90 |
+
|
91 |
+
#soliloquy #soliloquy-types-nav {
|
92 |
+
margin: 10px 0;
|
93 |
+
padding: 10px 0;
|
94 |
+
border-top: 1px solid #eee;
|
95 |
+
border-bottom: 1px solid #eee;
|
96 |
+
}
|
97 |
+
|
98 |
+
#soliloquy #soliloquy-types-nav li {
|
99 |
+
float: left;
|
100 |
+
margin: 0 10px 0 0;
|
101 |
+
}
|
102 |
+
|
103 |
+
#soliloquy #soliloquy-types-nav li.soliloquy-type-label {
|
104 |
+
margin-right: 20px;
|
105 |
+
}
|
106 |
+
|
107 |
+
#soliloquy #soliloquy-types-nav li.soliloquy-type-label span {
|
108 |
+
font-weight: 700;
|
109 |
+
font-size: 13px;
|
110 |
+
vertical-align: middle;
|
111 |
+
}
|
112 |
+
|
113 |
+
#soliloquy .soliloquy-meta-close-text {
|
114 |
+
display: none;
|
115 |
+
color: #fff;
|
116 |
+
font-style: italic;
|
117 |
+
font-size: 11px;
|
118 |
+
position: absolute;
|
119 |
+
z-index: 98;
|
120 |
+
top: 6px;
|
121 |
+
right: 27px;
|
122 |
+
}
|
123 |
+
|
124 |
+
#soliloquy .soliloquy-helper-active .soliloquy-meta-close-text {
|
125 |
+
display: inline;
|
126 |
+
}
|
127 |
+
|
128 |
+
#soliloquy .soliloquy-meta-icon {
|
129 |
+
position: absolute;
|
130 |
+
width: 19px;
|
131 |
+
height: 16px;
|
132 |
+
top: 6px;
|
133 |
+
right: 0;
|
134 |
+
background: url(images/meta.png) no-repeat scroll 0 0;
|
135 |
+
display: block;
|
136 |
+
outline: none;
|
137 |
+
z-index: 98;
|
138 |
+
}
|
139 |
+
|
140 |
+
#soliloquy .soliloquy-helper-active .soliloquy-meta-icon {
|
141 |
+
background-image: url(images/meta-active.png);
|
142 |
+
}
|
143 |
+
|
144 |
+
#soliloquy .soliloquy-meta-information {
|
145 |
+
display: none;
|
146 |
+
padding: 0 1em 1em;
|
147 |
+
position: absolute;
|
148 |
+
right: 0;
|
149 |
+
top: 30px;
|
150 |
+
width: 278px;
|
151 |
+
background: #fff;
|
152 |
+
border: 1px solid #e5e5e5;
|
153 |
+
-webkit-box-shadow: 0 5px 15px rgba(0,0,0,.7);
|
154 |
+
box-shadow: 0 5px 15px rgba(0,0,0,.7);
|
155 |
+
z-index: 98;
|
156 |
+
}
|
157 |
+
|
158 |
+
#soliloquy .soliloquy-helper-active .soliloquy-meta-information {
|
159 |
+
display: block;
|
160 |
+
}
|
161 |
+
|
162 |
+
#soliloquy .soliloquy-meta-helper-overlay {
|
163 |
+
position: absolute;
|
164 |
+
z-index: 97;
|
165 |
+
background: #000;
|
166 |
+
opacity: .7;
|
167 |
+
filter: alpha(opacity=70);
|
168 |
+
width: 100%;
|
169 |
+
height: 100%;
|
170 |
+
}
|
171 |
+
|
172 |
+
#soliloquy .soliloquy-tab {
|
173 |
+
display: none;
|
174 |
+
}
|
175 |
+
|
176 |
+
#soliloquy .soliloquy-tab.soliloquy-active {
|
177 |
+
display: block;
|
178 |
+
}
|
179 |
+
|
180 |
+
#soliloquy .soliloquy-tab p.soliloquy-intro {
|
181 |
+
margin: 1.5em 0 .5em;
|
182 |
+
}
|
183 |
+
|
184 |
+
#soliloquy .soliloquy-tab th,
|
185 |
+
#soliloquy .soliloquy-tab input[type="text"],
|
186 |
+
#soliloquy .soliloquy-tab input[type="number"],
|
187 |
+
#soliloquy .soliloquy-tab input[type="password"],
|
188 |
+
#soliloquy .soliloquy-tab select {
|
189 |
+
min-width: 210px;
|
190 |
+
padding-right: 0;
|
191 |
+
}
|
192 |
+
|
193 |
+
#soliloquy .soliloquy-tab {
|
194 |
+
min-height: 320px;
|
195 |
+
}
|
196 |
+
|
197 |
+
#soliloquy #soliloquy-output {
|
198 |
+
margin: 20px 0 10px;
|
199 |
+
padding: 0;
|
200 |
+
list-style: none;
|
201 |
+
}
|
202 |
+
|
203 |
+
#soliloquy #soliloquy-output li {
|
204 |
+
background: #fff;
|
205 |
+
display: block;
|
206 |
+
float: left;
|
207 |
+
margin: 0 10px 10px 0;
|
208 |
+
padding: 4px;
|
209 |
+
list-style: none;
|
210 |
+
border: 1px solid #cecece;
|
211 |
+
-moz-border-radius: 3px;
|
212 |
+
-webkit-border-radius: 3px;
|
213 |
+
border-radius: 3px;
|
214 |
+
-moz-background-clip: padding;
|
215 |
+
-webkit-background-clip: padding-box;
|
216 |
+
background-clip: padding-box;
|
217 |
+
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.06);
|
218 |
+
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.06);
|
219 |
+
box-shadow: 0 1px 2px rgba(0,0,0,.06);
|
220 |
+
cursor: move;
|
221 |
+
position: relative;
|
222 |
+
width: 150px;
|
223 |
+
height: 150px;
|
224 |
+
}
|
225 |
+
|
226 |
+
#soliloquy #soliloquy-output li.soliloquy-status-pending {
|
227 |
+
background-color: #faebcc;
|
228 |
+
border-color: #8a6d3b;
|
229 |
+
}
|
230 |
+
|
231 |
+
#soliloquy #soliloquy-output li.soliloquy-status-active {
|
232 |
+
background-color: #dff0d8;
|
233 |
+
border-color: #3c763d;
|
234 |
+
}
|
235 |
+
|
236 |
+
#soliloquy #soliloquy-output li.dropzone {
|
237 |
+
background: transparent;
|
238 |
+
border: 1px dashed #d5d5d5;
|
239 |
+
-moz-box-shadow: none;
|
240 |
+
-webkit-box-shadow: none;
|
241 |
+
box-shadow: none;
|
242 |
+
}
|
243 |
+
|
244 |
+
#soliloquy #soliloquy-output li img {
|
245 |
+
display: block;
|
246 |
+
margin: auto;
|
247 |
+
position: absolute;
|
248 |
+
top: 0;
|
249 |
+
left: 0;
|
250 |
+
right: 0;
|
251 |
+
bottom: 0;
|
252 |
+
max-width: 150px;
|
253 |
+
max-height: 150px;
|
254 |
+
}
|
255 |
+
|
256 |
+
#soliloquy #soliloquy-output li .soliloquy-remove-slide {
|
257 |
+
background: url(images/delete.png) no-repeat scroll 0 0;
|
258 |
+
display: block;
|
259 |
+
height: 16px;
|
260 |
+
left: -8px;
|
261 |
+
outline: none;
|
262 |
+
position: absolute;
|
263 |
+
top: -8px;
|
264 |
+
width: 16px;
|
265 |
+
z-index: 20;
|
266 |
+
}
|
267 |
+
|
268 |
+
#soliloquy #soliloquy-output li .soliloquy-modify-slide {
|
269 |
+
background: url(images/modify.png) no-repeat scroll 0 0;
|
270 |
+
display: block;
|
271 |
+
height: 16px;
|
272 |
+
left: 12px;
|
273 |
+
outline: none;
|
274 |
+
position: absolute;
|
275 |
+
top: -8px;
|
276 |
+
width: 16px;
|
277 |
+
z-index: 20;
|
278 |
+
}
|
279 |
+
|
280 |
+
#soliloquy #soliloquy-output li .soliloquy-video-wrap,
|
281 |
+
#soliloquy #soliloquy-output li .soliloquy-html-wrap {
|
282 |
+
position: relative;
|
283 |
+
width: 150px;
|
284 |
+
height: 150px;
|
285 |
+
box-shadow: inset 0 0 15px rgba( 0, 0, 0, 0.1 ), inset 0 0 0 1px rgba( 0, 0, 0, 0.05 );
|
286 |
+
background: #f5f5f5;
|
287 |
+
border-radius: 3px;
|
288 |
+
-moz-border-radius: 3px;
|
289 |
+
-webkit-border-radius: 3px;
|
290 |
+
cursor: move;
|
291 |
+
}
|
292 |
+
|
293 |
+
#soliloquy #soliloquy-output li .soliloquy-video-inside,
|
294 |
+
#soliloquy #soliloquy-output li .soliloquy-html-inside {
|
295 |
+
width: 150px;
|
296 |
+
height: 150px;
|
297 |
+
display: table;
|
298 |
+
position: absolute;
|
299 |
+
top: 0;
|
300 |
+
left: 0;
|
301 |
+
margin: 0 auto;
|
302 |
+
overflow: hidden;
|
303 |
+
max-width: 100%;
|
304 |
+
max-height: 100%;
|
305 |
+
cursor: move;
|
306 |
+
}
|
307 |
+
|
308 |
+
#soliloquy #soliloquy-output li .soliloquy-video-table,
|
309 |
+
#soliloquy #soliloquy-output li .soliloquy-html-table {
|
310 |
+
display: table-cell;
|
311 |
+
vertical-align: middle;
|
312 |
+
text-align: center;
|
313 |
+
cursor: move;
|
314 |
+
}
|
315 |
+
|
316 |
+
#media-items .media-item .edit-attachment,
|
317 |
+
.soliloquy-media-frame .upload-flash-bypass {
|
318 |
+
display: none !important;
|
319 |
+
}
|
320 |
+
|
321 |
+
#media-items {
|
322 |
+
margin: 0 0 16px;
|
323 |
+
overflow: hidden;
|
324 |
+
width: 100%;
|
325 |
+
}
|
326 |
+
|
327 |
+
#media-items .media-item {
|
328 |
+
width: auto;
|
329 |
+
float: left;
|
330 |
+
margin: 0 8px 8px 0;
|
331 |
+
}
|
332 |
+
|
333 |
+
#media-items .media-item img {
|
334 |
+
max-width: 150px;
|
335 |
+
max-height: 150px;
|
336 |
+
float: none;
|
337 |
+
margin: 4px;
|
338 |
+
display: block;
|
339 |
+
}
|
340 |
+
|
341 |
+
.soliloquy-slider {
|
342 |
+
padding-left: 7px;
|
343 |
+
}
|
344 |
+
|
345 |
+
.soliloquy-slider .attachment {
|
346 |
+
margin: 8px;
|
347 |
+
}
|
348 |
+
|
349 |
+
.soliloquy-slider .attachment-preview,
|
350 |
+
.soliloquy-slider .attachment-preview .thumbnail {
|
351 |
+
max-width: 150px;
|
352 |
+
max-height: 150px;
|
353 |
+
}
|
354 |
+
|
355 |
+
.soliloquy-media-frame .max-upload-size {
|
356 |
+
display: block;
|
357 |
+
margin: 1em 0;
|
358 |
+
}
|
359 |
+
|
360 |
+
.soliloquy-media-frame .soliloquy-library-toolbar {
|
361 |
+
top: 5px;
|
362 |
+
}
|
363 |
+
|
364 |
+
.soliloquy-media-frame .attachment.soliloquy-in-slider {
|
365 |
+
box-shadow: 0 0 0 1px #fff, 0 0 0 5px #519e0c;
|
366 |
+
}
|
367 |
+
|
368 |
+
.soliloquy-media-frame .attachment.soliloquy-in-slider .attachment-preview,
|
369 |
+
.soliloquy-media-frame .attachment.soliloquy-in-slider .attachment-preview .check {
|
370 |
+
cursor: default;
|
371 |
+
}
|
372 |
+
|
373 |
+
.soliloquy-media-frame .attachment.soliloquy-in-slider .check {
|
374 |
+
box-shadow: 0 0 0 1px #519e0c;
|
375 |
+
background: #519e0c;
|
376 |
+
background-image: -webkit-gradient(linear, left top, left bottom, from(#519e0c), to(#519e0c));
|
377 |
+
background-image: -webkit-linear-gradient(top, #519e0c, #407f08);
|
378 |
+
background-image: -moz-linear-gradient(top, #519e0c, #407f08);
|
379 |
+
background-image: -o-linear-gradient(top, #519e0c, #407f08);
|
380 |
+
background-image: linear-gradient(to bottom, #519e0c, #407f08);
|
381 |
+
}
|
382 |
+
|
383 |
+
.soliloquy-media-frame .attachment.soliloquy-in-slider .check div,
|
384 |
+
.soliloquy-media-frame .attachment.soliloquy-in-slider .check:hover div {
|
385 |
+
background-position: -21px 0;
|
386 |
+
}
|
387 |
+
|
388 |
+
.soliloquy-meta-wrap .soliloquy-meta-sidebar {
|
389 |
+
overflow: auto;
|
390 |
+
position: relative;
|
391 |
+
}
|
392 |
+
|
393 |
+
.soliloquy-media-frame .media-sidebar h3 {
|
394 |
+
margin: 1.1em 0 1em;
|
395 |
+
}
|
396 |
+
|
397 |
+
.soliloquy-media-frame .media-sidebar p {
|
398 |
+
margin: 0 0 1.5em;
|
399 |
+
}
|
400 |
+
|
401 |
+
.soliloquy-meta {
|
402 |
+
overflow: auto;
|
403 |
+
padding: 0 16px;
|
404 |
+
}
|
405 |
+
|
406 |
+
.media-frame.soliloquy-media-frame input:focus,
|
407 |
+
.media-frame.soliloquy-media-frame textarea:focus,
|
408 |
+
.media-frame.soliloquy-media-frame select:focus {
|
409 |
+
border-color: #aaa;
|
410 |
+
}
|
411 |
+
|
412 |
+
.soliloquy-meta-wrap .soliloquy-meta.attachments {
|
413 |
+
top: 0;
|
414 |
+
}
|
415 |
+
|
416 |
+
.soliloquy-ui-content {
|
417 |
+
top: 16px !important;
|
418 |
+
}
|
419 |
+
|
420 |
+
.soliloquy-meta-wrap .form-table {
|
421 |
+
margin: 0;
|
422 |
+
}
|
423 |
+
|
424 |
+
.soliloquy-meta-wrap .form-table input[type=text],
|
425 |
+
.soliloquy-meta-wrap .form-table textarea {
|
426 |
+
width: 100%;
|
427 |
+
}
|
428 |
+
|
429 |
+
#soliloquy .soliloquy-import-form {
|
430 |
+
margin-bottom: 20px;
|
431 |
+
padding-bottom: 20px;
|
432 |
+
border-bottom: 1px solid #ddd;
|
433 |
+
}
|
434 |
+
|
435 |
+
#soliloquy .soliloquy-unit {
|
436 |
+
font-style: normal;
|
437 |
+
font-weight: 700;
|
438 |
+
font-size: 13px;
|
439 |
+
}
|
440 |
+
|
441 |
+
#soliloquy textarea {
|
442 |
+
width: 100%;
|
443 |
+
}
|
444 |
+
|
445 |
+
#soliloquy-html-slides .soliloquy-html-slide-code {
|
446 |
+
width: 100%;
|
447 |
+
position: relative;
|
448 |
+
height: 300px;
|
449 |
+
}
|
450 |
+
|
451 |
+
.soliloquy-video-thumbnail,
|
452 |
+
.soliloquy-html-thumbnail {
|
453 |
+
vertical-align: baseline !important;
|
454 |
+
}
|
455 |
+
|
456 |
+
/* ==========================================================================
|
457 |
+
Plupload Styles
|
458 |
+
========================================================================== */
|
459 |
+
|
460 |
+
#soliloquy-plupload-upload-ui {
|
461 |
+
position: relative;
|
462 |
+
}
|
463 |
+
|
464 |
+
#soliloquy-drag-drop-area {
|
465 |
+
border: 4px dashed #bbb;
|
466 |
+
height: 200px;
|
467 |
+
}
|
468 |
+
|
469 |
+
#soliloquy-plupload-upload-ui.drag-over #soliloquy-drag-drop-area {
|
470 |
+
border-color: #83b4d8;
|
471 |
+
}
|
472 |
+
|
473 |
+
#soliloquy .soliloquy-progress-bar {
|
474 |
+
display: none;
|
475 |
+
width: 100%;
|
476 |
+
position: relative;
|
477 |
+
height: 10px;
|
478 |
+
width: 100%;
|
479 |
+
margin: 10px auto;
|
480 |
+
border-radius: 10px;
|
481 |
+
background: #dfdfdf;
|
482 |
+
background: rgba(0,0,0,.1);
|
483 |
+
}
|
484 |
+
|
485 |
+
#soliloquy .soliloquy-progress-bar div {
|
486 |
+
height: 10px;
|
487 |
+
min-width: 20px;
|
488 |
+
width: 0;
|
489 |
+
background: #aaa;
|
490 |
+
background: rgba(0,0,0,.2);
|
491 |
+
border-radius: 10px;
|
492 |
+
-webkit-transition: width 300ms;
|
493 |
+
-moz-transition: width 300ms;
|
494 |
+
-ms-transition: width 300ms;
|
495 |
+
-o-transition: width 300ms;
|
496 |
+
transition: width 300ms;
|
497 |
+
}
|
498 |
+
|
499 |
+
#soliloquy .upload-flash-bypass {
|
500 |
+
display: none;
|
501 |
+
}
|
502 |
+
|
503 |
+
#soliloquy .max-upload-size {
|
504 |
+
display: block;
|
505 |
+
margin: 10px 0;
|
506 |
+
}
|
507 |
+
|
508 |
+
.soliloquy-media-frame .soliloquy-accepted-urls {
|
509 |
+
clear: both;
|
510 |
+
overflow: hidden;
|
511 |
+
}
|
512 |
+
|
513 |
+
.soliloquy-media-frame .soliloquy-accepted-urls span {
|
514 |
+
display: block;
|
515 |
+
}
|
516 |
+
|
517 |
+
.soliloquy-media-frame .soliloquy-column {
|
518 |
+
float: left;
|
519 |
+
width: 32%;
|
520 |
+
margin-right: 2%;
|
521 |
+
}
|
522 |
+
|
523 |
+
.soliloquy-media-frame .soliloquy-column.soliloquy-last {
|
524 |
+
margin-right: 0;
|
525 |
+
}
|
526 |
+
|
527 |
+
.soliloquy-media-frame .soliloquy-video-info {
|
528 |
+
background-color: #ffffe0;
|
529 |
+
border: 1px solid #e6db55;
|
530 |
+
padding: 15px;
|
531 |
+
margin-bottom: 16px;
|
532 |
+
}
|
533 |
+
|
534 |
+
.soliloquy-media-frame .soliloquy-video-info p {
|
535 |
+
margin-top: 0;
|
536 |
+
}
|
537 |
+
|
538 |
+
.soliloquy-html-slide-holder,
|
539 |
+
.soliloquy-video-slide-holder {
|
540 |
+
border: 5px dashed #eee;
|
541 |
+
padding: 10px;
|
542 |
+
margin-bottom: 1em;
|
543 |
+
}
|
544 |
+
|
545 |
+
#soliloquy-html-slides .soliloquy-delete-html-slide,
|
546 |
+
#soliloquy-video-slides .soliloquy-delete-video-slide {
|
547 |
+
float: right;
|
548 |
+
}
|
549 |
+
|
550 |
+
#soliloquy-video-slides input,
|
551 |
+
#soliloquy-video-slides textarea,
|
552 |
+
#soliloquy-html-slides input,
|
553 |
+
#soliloquy-html-slides textarea {
|
554 |
+
width: 450px;
|
555 |
+
}
|
556 |
+
|
557 |
+
.soliloquy-alert {
|
558 |
+
padding: 15px;
|
559 |
+
margin-bottom: 20px;
|
560 |
+
border: 1px solid #faebcc;
|
561 |
+
border-radius: 4px;
|
562 |
+
background-color: #fcf8e3;
|
563 |
+
color: #8a6d3b;
|
564 |
+
}
|
565 |
+
|
566 |
+
/* ==========================================================================
|
567 |
+
Retina Styles
|
568 |
+
========================================================================== */
|
569 |
+
|
570 |
+
@media
|
571 |
+
only screen and (-webkit-min-device-pixel-ratio: 2),
|
572 |
+
only screen and ( min--moz-device-pixel-ratio: 2),
|
573 |
+
only screen and ( -o-min-device-pixel-ratio: 2/1),
|
574 |
+
only screen and ( min-device-pixel-ratio: 2),
|
575 |
+
only screen and ( min-resolution: 192dpi),
|
576 |
+
only screen and ( min-resolution: 2dppx) {
|
577 |
+
|
578 |
+
#soliloquy .soliloquy-meta-icon {
|
579 |
+
background-image: url(images/meta@2x.png);
|
580 |
+
background-size: 19px 16px;
|
581 |
+
}
|
582 |
+
|
583 |
+
#soliloquy .soliloquy-helper-active .soliloquy-meta-icon {
|
584 |
+
background-image: url(images/meta-active@2x.png);
|
585 |
+
background-size: 19px 16px;
|
586 |
+
}
|
587 |
+
|
588 |
+
#soliloquy #soliloquy-output li .soliloquy-remove-slide {
|
589 |
+
background-image: url(images/delete@2x.png);
|
590 |
+
background-size: 16px 16px;
|
591 |
+
}
|
592 |
+
|
593 |
+
#soliloquy #soliloquy-output li .soliloquy-modify-slide {
|
594 |
+
background-image: url(images/modify@2x.png);
|
595 |
+
background-size: 16px 16px;
|
596 |
+
}
|
597 |
+
|
598 |
+
}
|
assets/css/settings.css
ADDED
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* ==========================================================================
|
2 |
+
Settings Styles
|
3 |
+
========================================================================== */
|
4 |
+
|
5 |
+
#soliloquy-settings .soliloquy-clear {
|
6 |
+
clear: both;
|
7 |
+
}
|
8 |
+
|
9 |
+
#soliloquy-settings .soliloquy-clear:after {
|
10 |
+
clear: both;
|
11 |
+
content: '.';
|
12 |
+
display: block;
|
13 |
+
height: 0;
|
14 |
+
line-height: 0;
|
15 |
+
overflow: auto;
|
16 |
+
visibility: hidden;
|
17 |
+
zoom: 1;
|
18 |
+
}
|
19 |
+
|
20 |
+
#soliloquy-settings .soliloquy {
|
21 |
+
margin: 15px 0 20px;
|
22 |
+
}
|
23 |
+
|
24 |
+
#soliloquy-settings #soliloquy-tabs-nav {
|
25 |
+
list-style: none;
|
26 |
+
margin: 0 0 10px;
|
27 |
+
padding: 0;
|
28 |
+
border-bottom: 1px solid #cecece;
|
29 |
+
}
|
30 |
+
|
31 |
+
#soliloquy-settings #soliloquy-tabs-nav li {
|
32 |
+
float: left;
|
33 |
+
margin: 0 10px -1px 0;
|
34 |
+
}
|
35 |
+
|
36 |
+
#soliloquy-settings #soliloquy-tabs-nav li a {
|
37 |
+
display: block;
|
38 |
+
padding: 10px 12px 7px;
|
39 |
+
font-size: 18px;
|
40 |
+
color: #aaa;
|
41 |
+
font-weight: 300;
|
42 |
+
text-decoration: none;
|
43 |
+
outline: none;
|
44 |
+
}
|
45 |
+
|
46 |
+
#soliloquy-settings #soliloquy-tabs-nav li.soliloquy-active a {
|
47 |
+
border: 1px solid #cecece;
|
48 |
+
border-bottom-color: #f1f1f1;
|
49 |
+
-moz-border-radius: 3px 3px 0 0;
|
50 |
+
-webkit-border-radius: 3px 3px 0 0;
|
51 |
+
border-radius: 3px 3px 0 0;
|
52 |
+
color: #21759b;
|
53 |
+
padding-top: 9px;
|
54 |
+
}
|
55 |
+
|
56 |
+
#soliloquy-settings #soliloquy-tabs-nav li a:hover {
|
57 |
+
color: #21759b;
|
58 |
+
}
|
59 |
+
|
60 |
+
#soliloquy-settings .soliloquy-tab {
|
61 |
+
display: none;
|
62 |
+
}
|
63 |
+
|
64 |
+
#soliloquy-settings .soliloquy-tab.soliloquy-active {
|
65 |
+
display: block;
|
66 |
+
}
|
67 |
+
|
68 |
+
#soliloquy-settings .soliloquy-tab th {
|
69 |
+
width: 210px;
|
70 |
+
padding-right: 0;
|
71 |
+
}
|
72 |
+
|
73 |
+
#soliloquy-settings .soliloquy-tab input[type="text"],
|
74 |
+
#soliloquy-settings .soliloquy-tab input[type="number"],
|
75 |
+
#soliloquy-settings .soliloquy-tab input[type="password"],
|
76 |
+
#soliloquy-settings .soliloquy-tab select,
|
77 |
+
#soliloquy-settings .soliloquy-tab textarea {
|
78 |
+
width: 350px;
|
79 |
+
padding-right: 0;
|
80 |
+
}
|
81 |
+
|
82 |
+
#soliloquy-settings #soliloquy-refresh-submit {
|
83 |
+
vertical-align: baseline;
|
84 |
+
}
|
85 |
+
|
86 |
+
/* ==========================================================================
|
87 |
+
Addons Styles
|
88 |
+
========================================================================== */
|
89 |
+
|
90 |
+
#soliloquy-addons-area {
|
91 |
+
margin-top: 20px;
|
92 |
+
}
|
93 |
+
|
94 |
+
.soliloquy-addon {
|
95 |
+
border: 1px solid #ccc;
|
96 |
+
background: #fff;
|
97 |
+
border-radius: 3px;
|
98 |
+
float: left;
|
99 |
+
margin: 0 2% 2% 0;
|
100 |
+
min-height: 400px;
|
101 |
+
padding: 20px;
|
102 |
+
text-align: center;
|
103 |
+
width: 32%;
|
104 |
+
box-sizing: border-box;
|
105 |
+
-webkit-box-sizing: border-box;
|
106 |
+
-moz-box-sizing: border-box;
|
107 |
+
}
|
108 |
+
|
109 |
+
.soliloquy-addon.last {
|
110 |
+
margin-right: 0;
|
111 |
+
}
|
112 |
+
|
113 |
+
.soliloquy-addon .soliloquy-addon-thumb {
|
114 |
+
border-radius: 3px;
|
115 |
+
box-shadow: 0 0 3px rgba( 0, 0, 0, .35 );
|
116 |
+
height: auto;
|
117 |
+
margin: 0 auto;
|
118 |
+
max-width: 100%;
|
119 |
+
width: auto;
|
120 |
+
}
|
121 |
+
|
122 |
+
.soliloquy-addon .soliloquy-addon-message,
|
123 |
+
.soliloquy-addon .soliloquy-addon-error {
|
124 |
+
-moz-border-radius: 3px;
|
125 |
+
-webkit-border-radius: 3px;
|
126 |
+
border-radius: 3px;
|
127 |
+
padding: 10px 6px;
|
128 |
+
text-align: left;
|
129 |
+
}
|
130 |
+
|
131 |
+
.soliloquy-addon .soliloquy-addon-message span {
|
132 |
+
font-weight: bold;
|
133 |
+
}
|
134 |
+
|
135 |
+
.soliloquy-addon .soliloquy-addon-active {
|
136 |
+
background: #cbeca0;
|
137 |
+
border: 1px solid #97b48a;
|
138 |
+
}
|
139 |
+
|
140 |
+
.soliloquy-addon .soliloquy-addon-inactive {
|
141 |
+
background: #ffffe0;
|
142 |
+
border: 1px solid #e6db55;
|
143 |
+
}
|
144 |
+
|
145 |
+
.soliloquy-addon .soliloquy-addon-not-installed {
|
146 |
+
background: #eaeaea;
|
147 |
+
border: 1px solid #dadada;
|
148 |
+
}
|
149 |
+
|
150 |
+
.soliloquy-addon .soliloquy-addon-action {
|
151 |
+
display: inline;
|
152 |
+
float: right;
|
153 |
+
}
|
154 |
+
|
155 |
+
.soliloquy-addon .soliloquy-addon-action .button-primary {
|
156 |
+
margin-top: -5px;
|
157 |
+
}
|
158 |
+
|
159 |
+
.soliloquy-addon .soliloquy-addon-error {
|
160 |
+
background: #ffebe8;
|
161 |
+
border: 1px solid #c00;
|
162 |
+
margin-top: 10px;
|
163 |
+
}
|
164 |
+
|
165 |
+
.soliloquy-addon .soliloquy-addon-error .wrap {
|
166 |
+
margin: 0;
|
167 |
+
}
|
168 |
+
|
169 |
+
.soliloquy-addon .soliloquy-addon-error .icon32 {
|
170 |
+
display: none;
|
171 |
+
}
|
172 |
+
|
173 |
+
.soliloquy-addon .soliloquy-addon-error h2 {
|
174 |
+
padding: 0;
|
175 |
+
}
|
176 |
+
|
177 |
+
.soliloquy-addon .soliloquy-addon-error .form-table th {
|
178 |
+
padding: 10px 0;
|
179 |
+
width: 30% !important;
|
180 |
+
}
|
181 |
+
|
182 |
+
.soliloquy-addon .soliloquy-addon-error .form-table input[type="text"],
|
183 |
+
.soliloquy-addon .soliloquy-addon-error .form-table input[type="password"] {
|
184 |
+
width: 100% !important;
|
185 |
+
}
|
186 |
+
|
187 |
+
.soliloquy-addon .soliloquy-addon-error p.submit {
|
188 |
+
padding: 0;
|
189 |
+
}
|
190 |
+
|
191 |
+
.soliloquy-addon p {
|
192 |
+
color: #2f2f2f;
|
193 |
+
font-size: 13px;
|
194 |
+
margin: 10px 0 0;
|
195 |
+
text-shadow: 0 1px #fff;
|
196 |
+
}
|
assets/css/soliloquy.css
ADDED
@@ -0,0 +1,396 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* ==========================================================================
|
2 |
+
Soliloquy Styles
|
3 |
+
========================================================================== */
|
4 |
+
|
5 |
+
.soliloquy-container,
|
6 |
+
.soliloquy-container * {
|
7 |
+
background:none;
|
8 |
+
border:0 none;
|
9 |
+
border-radius:0;
|
10 |
+
-webkit-border-radius:0;
|
11 |
+
-moz-border-radius:0;
|
12 |
+
float:none;
|
13 |
+
font-size:100%;
|
14 |
+
height:auto;
|
15 |
+
letter-spacing:normal;
|
16 |
+
list-style:none;
|
17 |
+
outline:none;
|
18 |
+
position:static;
|
19 |
+
text-decoration:none;
|
20 |
+
text-indent:0;
|
21 |
+
text-shadow:none;
|
22 |
+
text-transform:none;
|
23 |
+
width:auto;
|
24 |
+
visibility:visible;
|
25 |
+
overflow:visible;
|
26 |
+
margin:0;
|
27 |
+
padding:0;
|
28 |
+
line-height:1;
|
29 |
+
box-sizing:border-box;
|
30 |
+
-webkit-box-sizing:border-box;
|
31 |
+
-moz-box-sizing:border-box;
|
32 |
+
-webkit-box-shadow:none;
|
33 |
+
-moz-box-shadow:none;
|
34 |
+
-ms-box-shadow:none;
|
35 |
+
-o-box-shadow:none;
|
36 |
+
box-shadow:none;
|
37 |
+
-webkit-appearance:none;
|
38 |
+
}
|
39 |
+
|
40 |
+
.soliloquy-container {
|
41 |
+
position: relative;
|
42 |
+
background: transparent url('images/preloader.gif') no-repeat scroll 50% 50%;
|
43 |
+
z-index: 10;
|
44 |
+
width: 100%;
|
45 |
+
max-width: 100%;
|
46 |
+
opacity: 0;
|
47 |
+
}
|
48 |
+
|
49 |
+
.soliloquy-container:after {
|
50 |
+
display: none;
|
51 |
+
height: 0;
|
52 |
+
line-height: 0;
|
53 |
+
visibility: hidden;
|
54 |
+
content: url('images/left.png') url('images/right.png') url('images/circle.png') url('images/circle-hover.png') url('images/pause.png') url('images/play.png') url('images/video.png');
|
55 |
+
}
|
56 |
+
|
57 |
+
.soliloquy-container .soliloquy-wrap {
|
58 |
+
width: 100%;
|
59 |
+
position: relative;
|
60 |
+
margin: 0;
|
61 |
+
padding: 0;
|
62 |
+
list-style: none !important;
|
63 |
+
height: 100%;
|
64 |
+
}
|
65 |
+
|
66 |
+
.soliloquy-clear {
|
67 |
+
clear: both;
|
68 |
+
}
|
69 |
+
|
70 |
+
.soliloquy-clear:after {
|
71 |
+
clear: both;
|
72 |
+
content: '.';
|
73 |
+
display: block;
|
74 |
+
height: 0;
|
75 |
+
line-height: 0;
|
76 |
+
overflow: auto;
|
77 |
+
visibility: hidden;
|
78 |
+
zoom: 1;
|
79 |
+
}
|
80 |
+
|
81 |
+
.soliloquy-container a {
|
82 |
+
outline: none;
|
83 |
+
}
|
84 |
+
|
85 |
+
.soliloquy-container .soliloquy-wrapper,
|
86 |
+
.soliloquy-container .soliloquy-item {
|
87 |
+
width: 100%;
|
88 |
+
position: relative;
|
89 |
+
margin: 0;
|
90 |
+
padding: 0;
|
91 |
+
list-style: none !important;
|
92 |
+
}
|
93 |
+
|
94 |
+
.soliloquy-container .soliloquy-item {
|
95 |
+
min-height: 1px;
|
96 |
+
min-width: 1px;
|
97 |
+
}
|
98 |
+
|
99 |
+
.soliloquy-container .soliloquy-item:after {
|
100 |
+
content: '.';
|
101 |
+
position: absolute;
|
102 |
+
bottom: 0;
|
103 |
+
left: 0;
|
104 |
+
z-index: -1000;
|
105 |
+
visibility: hidden;
|
106 |
+
opacity: 0;
|
107 |
+
height: 0;
|
108 |
+
line-height: 0;
|
109 |
+
}
|
110 |
+
|
111 |
+
.soliloquy-container .soliloquy-item > a {
|
112 |
+
display: block;
|
113 |
+
outline: none;
|
114 |
+
width: 100%;
|
115 |
+
position: relative;
|
116 |
+
}
|
117 |
+
|
118 |
+
.soliloquy-container .soliloquy-image {
|
119 |
+
max-width: 100%;
|
120 |
+
height: auto;
|
121 |
+
display: block;
|
122 |
+
margin: 0 auto;
|
123 |
+
-webkit-user-drag: none;
|
124 |
+
-moz-user-select: none;
|
125 |
+
-ms-user-select: none;
|
126 |
+
}
|
127 |
+
|
128 |
+
.soliloquy-container .soliloquy-prev {
|
129 |
+
display: block;
|
130 |
+
width: 32px;
|
131 |
+
height: 32px;
|
132 |
+
position: absolute;
|
133 |
+
top: 50%;
|
134 |
+
margin-top: -16px;
|
135 |
+
left: 10px;
|
136 |
+
z-index: 1320;
|
137 |
+
background: rgba(0,0,0,.7) url('images/left.png') no-repeat scroll 50% 50%;
|
138 |
+
}
|
139 |
+
|
140 |
+
.soliloquy-container .soliloquy-next {
|
141 |
+
display: block;
|
142 |
+
width: 32px;
|
143 |
+
height: 32px;
|
144 |
+
position: absolute;
|
145 |
+
top: 50%;
|
146 |
+
margin-top: -16px;
|
147 |
+
right: 10px;
|
148 |
+
z-index: 1320;
|
149 |
+
background: rgba(0,0,0,.7) url('images/right.png') no-repeat scroll 50% 50%;
|
150 |
+
}
|
151 |
+
|
152 |
+
.soliloquy-container .soliloquy-prev.disabled,
|
153 |
+
.soliloquy-container .soliloquy-next.disabled {
|
154 |
+
cursor: default;
|
155 |
+
pointer-events: none;
|
156 |
+
opacity: .3;
|
157 |
+
}
|
158 |
+
|
159 |
+
.soliloquy-container .soliloquy-pager {
|
160 |
+
width: 100%;
|
161 |
+
margin: 0 auto;
|
162 |
+
text-align: center;
|
163 |
+
position: absolute;
|
164 |
+
bottom: 10px;
|
165 |
+
height: 14px;
|
166 |
+
}
|
167 |
+
|
168 |
+
.soliloquy-container .soliloquy-pager-item {
|
169 |
+
display: inline-block;
|
170 |
+
margin: 0 0 0 7px;
|
171 |
+
position: relative;
|
172 |
+
z-index: 1320;
|
173 |
+
}
|
174 |
+
|
175 |
+
.soliloquy-container .soliloquy-pager-item:first-child {
|
176 |
+
margin-left: 0;
|
177 |
+
}
|
178 |
+
|
179 |
+
.soliloquy-container .soliloquy-pager-link {
|
180 |
+
background: url('images/circle.png') no-repeat scroll 0 0;
|
181 |
+
width: 14px;
|
182 |
+
height: 14px;
|
183 |
+
display: block;
|
184 |
+
outline: none;
|
185 |
+
text-indent: -9999px;
|
186 |
+
}
|
187 |
+
|
188 |
+
.soliloquy-container .soliloquy-pager-link:hover,
|
189 |
+
.soliloquy-container .soliloquy-pager-link.active {
|
190 |
+
background-image: url('images/circle-hover.png');
|
191 |
+
}
|
192 |
+
|
193 |
+
.soliloquy-container .soliloquy-controls-auto-item {
|
194 |
+
display: block;
|
195 |
+
width: 32px;
|
196 |
+
height: 32px;
|
197 |
+
position: absolute;
|
198 |
+
bottom: 10px;
|
199 |
+
right: 10px;
|
200 |
+
z-index: 1220;
|
201 |
+
}
|
202 |
+
|
203 |
+
.soliloquy-container .soliloquy-stop {
|
204 |
+
display: block;
|
205 |
+
width: 32px;
|
206 |
+
height: 32px;
|
207 |
+
background: rgba(0,0,0,.7) url('images/pause.png') no-repeat scroll 50% 50%;
|
208 |
+
}
|
209 |
+
|
210 |
+
.soliloquy-container .soliloquy-start {
|
211 |
+
display: block;
|
212 |
+
width: 32px;
|
213 |
+
height: 32px;
|
214 |
+
background: rgba(0,0,0,.7) url('images/play.png') no-repeat scroll 50% 50%;
|
215 |
+
}
|
216 |
+
|
217 |
+
.soliloquy-container .soliloquy-caption {
|
218 |
+
position: absolute;
|
219 |
+
bottom: 0;
|
220 |
+
left: 0;
|
221 |
+
width: 100%;
|
222 |
+
z-index: 1120;
|
223 |
+
background: rgba(0,0,0,.5);
|
224 |
+
}
|
225 |
+
|
226 |
+
.soliloquy-container .soliloquy-caption-inside {
|
227 |
+
font-size: 1em;
|
228 |
+
line-height: 1.25;
|
229 |
+
display: block;
|
230 |
+
color: #fff;
|
231 |
+
text-shadow: 0 1px 1px #000;
|
232 |
+
text-align: center;
|
233 |
+
padding: 10px;
|
234 |
+
}
|
235 |
+
|
236 |
+
.soliloquy-container .soliloquy-controls {
|
237 |
+
opacity: 0;
|
238 |
+
}
|
239 |
+
|
240 |
+
.soliloquy-container .soliloquy-video-icon {
|
241 |
+
margin: 0;
|
242 |
+
padding: 0;
|
243 |
+
position: absolute;
|
244 |
+
display: block;
|
245 |
+
top: 0;
|
246 |
+
left: 0;
|
247 |
+
bottom: 0;
|
248 |
+
right: 0;
|
249 |
+
z-index: 1200;
|
250 |
+
background: transparent url('images/video.png') no-repeat scroll 50% 50%;
|
251 |
+
width: 100%;
|
252 |
+
height: 100%;
|
253 |
+
}
|
254 |
+
|
255 |
+
.soliloquy-container .soliloquy-video-holder {
|
256 |
+
margin: 0;
|
257 |
+
padding: 0;
|
258 |
+
position: absolute;
|
259 |
+
display: none;
|
260 |
+
top: 0;
|
261 |
+
left: 0;
|
262 |
+
bottom: 0;
|
263 |
+
right: 0;
|
264 |
+
z-index: 1200;
|
265 |
+
background: transparent;
|
266 |
+
width: 100%;
|
267 |
+
height: 100%;
|
268 |
+
}
|
269 |
+
|
270 |
+
.soliloquy-container .soliloquy-html-content {
|
271 |
+
position: absolute;
|
272 |
+
width: 100%;
|
273 |
+
height: 100%;
|
274 |
+
top: 0;
|
275 |
+
left: 0;
|
276 |
+
bottom: 0;
|
277 |
+
right: 0;
|
278 |
+
z-index: 1000;
|
279 |
+
}
|
280 |
+
|
281 |
+
/* ==========================================================================
|
282 |
+
Featured Content Styles
|
283 |
+
========================================================================== */
|
284 |
+
|
285 |
+
.soliloquy-fc-slider .soliloquy-caption {
|
286 |
+
width: 40%;
|
287 |
+
right: 52px;
|
288 |
+
left: auto;
|
289 |
+
bottom: 34px;
|
290 |
+
top: auto;
|
291 |
+
}
|
292 |
+
|
293 |
+
.soliloquy-fc-slider .soliloquy-caption-inside {
|
294 |
+
text-align: left;
|
295 |
+
}
|
296 |
+
|
297 |
+
.soliloquy-fc-slider .soliloquy-caption-inside .soliloquy-fc-title,
|
298 |
+
.soliloquy-fc-slider .soliloquy-caption-inside .soliloquy-fc-title-link {
|
299 |
+
font-size: 1.2em;
|
300 |
+
font-weight: 700;
|
301 |
+
margin-bottom: 1em;
|
302 |
+
color: #fff;
|
303 |
+
}
|
304 |
+
|
305 |
+
.soliloquy-fc-slider .soliloquy-caption-inside .soliloquy-fc-title-link {
|
306 |
+
font-size: 1em;
|
307 |
+
}
|
308 |
+
|
309 |
+
.soliloquy-fc-slider .soliloquy-caption-inside .soliloquy-fc-read-more {
|
310 |
+
font-weight: 700;
|
311 |
+
color: #fff;
|
312 |
+
}
|
313 |
+
|
314 |
+
/* ==========================================================================
|
315 |
+
Retina Styles
|
316 |
+
========================================================================== */
|
317 |
+
|
318 |
+
@media
|
319 |
+
only screen and (-webkit-min-device-pixel-ratio: 2),
|
320 |
+
only screen and ( min--moz-device-pixel-ratio: 2),
|
321 |
+
only screen and ( -o-min-device-pixel-ratio: 2/1),
|
322 |
+
only screen and ( min-device-pixel-ratio: 2),
|
323 |
+
only screen and ( min-resolution: 192dpi),
|
324 |
+
only screen and ( min-resolution: 2dppx) {
|
325 |
+
|
326 |
+
.soliloquy-container {
|
327 |
+
background-image: url('images/preloader@2x.gif');
|
328 |
+
background-size: 16px 16px;
|
329 |
+
}
|
330 |
+
|
331 |
+
.soliloquy-container .soliloquy-prev {
|
332 |
+
background-image: url('images/left@2x.png');
|
333 |
+
background-size: 10px 14px;
|
334 |
+
}
|
335 |
+
|
336 |
+
.soliloquy-container .soliloquy-next {
|
337 |
+
background-image: url('images/right@2x.png');
|
338 |
+
background-size: 10px 14px;
|
339 |
+
}
|
340 |
+
|
341 |
+
.soliloquy-container .soliloquy-pager-link {
|
342 |
+
background-image: url('images/circle@2x.png');
|
343 |
+
background-size: 14px 14px;
|
344 |
+
}
|
345 |
+
|
346 |
+
.soliloquy-container .soliloquy-pager-link:hover,
|
347 |
+
.soliloquy-container .soliloquy-pager-link.active {
|
348 |
+
background-image: url('images/circle-hover@2x.png');
|
349 |
+
background-size: 14px 14px;
|
350 |
+
}
|
351 |
+
|
352 |
+
.soliloquy-container .soliloquy-stop {
|
353 |
+
background-image: url('images/pause@2x.png');
|
354 |
+
background-size: 9px 14px;
|
355 |
+
}
|
356 |
+
|
357 |
+
.soliloquy-container .soliloquy-start {
|
358 |
+
background-image: url('images/play@2x.png');
|
359 |
+
background-size: 14px 14px;
|
360 |
+
}
|
361 |
+
|
362 |
+
.soliloquy-container .soliloquy-video-icon {
|
363 |
+
background-image: url('images/video@2x.png');
|
364 |
+
background-size: 50px 50px
|
365 |
+
}
|
366 |
+
|
367 |
+
}
|
368 |
+
|
369 |
+
/* ==========================================================================
|
370 |
+
Responsive Styles
|
371 |
+
========================================================================== */
|
372 |
+
|
373 |
+
@media (max-width: 600px) {
|
374 |
+
|
375 |
+
.soliloquy-container .soliloquy-pager,
|
376 |
+
.soliloquy-container .soliloquy-caption,
|
377 |
+
.soliloquy-container .soliloquy-controls-auto {
|
378 |
+
display: none;
|
379 |
+
}
|
380 |
+
|
381 |
+
@media
|
382 |
+
only screen and (-webkit-min-device-pixel-ratio: 2),
|
383 |
+
only screen and ( min--moz-device-pixel-ratio: 2),
|
384 |
+
only screen and ( -o-min-device-pixel-ratio: 2/1),
|
385 |
+
only screen and ( min-device-pixel-ratio: 2),
|
386 |
+
only screen and ( min-resolution: 192dpi),
|
387 |
+
only screen and ( min-resolution: 2dppx) {
|
388 |
+
|
389 |
+
.soliloquy-container .soliloquy-video-icon {
|
390 |
+
background-image: url('images/video.png');
|
391 |
+
background-size: 25px 25px;
|
392 |
+
}
|
393 |
+
|
394 |
+
}
|
395 |
+
|
396 |
+
}
|
assets/js/codemirror.js
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// CodeMirror base.
|
2 |
+
window.CodeMirror=(function(){var bI=/gecko\/\d/i.test(navigator.userAgent);var cf=/MSIE \d/.test(navigator.userAgent);var bF=cf&&(document.documentMode==null||document.documentMode<8);var bE=cf&&(document.documentMode==null||document.documentMode<9);var dC=/Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent);var cA=cf||dC;var b8=/WebKit\//.test(navigator.userAgent);var cD=b8&&/Qt\/\d+\.\d+/.test(navigator.userAgent);var cg=/Chrome\//.test(navigator.userAgent);var d1=/Opera\//.test(navigator.userAgent);var ag=/Apple Computer/.test(navigator.vendor);var aH=/KHTML\//.test(navigator.userAgent);var bT=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent);var cc=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent);var dY=/PhantomJS/.test(navigator.userAgent);var dy=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent);var cV=dy||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent);var bq=dy||/Mac/.test(navigator.platform);var ao=/win/i.test(navigator.platform);var c8=d1&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);if(c8){c8=Number(c8[1])}if(c8&&c8>=15){d1=false;b8=true}var be=bq&&(cD||d1&&(c8==null||c8<12.11));var bX=bI||(cf&&!bE);var eq=false,aD=false;function B(ew,ex){if(!(this instanceof B)){return new B(ew,ex)}this.options=ex=ex||{};for(var ey in dA){if(!ex.hasOwnProperty(ey)&&dA.hasOwnProperty(ey)){ex[ey]=dA[ey]}}by(ex);var eC=typeof ex.value=="string"?0:ex.value.first;var eB=this.display=f(ew,eC);eB.wrapper.CodeMirror=this;cR(this);if(ex.autofocus&&!cV){db(this)}this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:false,focused:false,suppressEdits:false,pasteIncoming:false,cutIncoming:false,draggingText:false,highlight:new ev()};b2(this);if(ex.lineWrapping){this.display.wrapper.className+=" CodeMirror-wrap"}var eA=ex.value;if(typeof eA=="string"){eA=new aa(ex.value,ex.mode)}b9(this,cQ)(this,eA);if(cf){setTimeout(bO(dU,this,true),20)}ee(this);var eD;try{eD=(document.activeElement==eB.input)}catch(ez){}if(eD||(ex.autofocus&&!cV)){setTimeout(bO(bS,this),20)}else{au(this)}b9(this,function(){for(var eF in aK){if(aK.propertyIsEnumerable(eF)){aK[eF](this,ex[eF],bw)}}for(var eE=0;eE<aE.length;++eE){aE[eE](this)}})()}function f(ew,ey){var ez={};var ex=ez.input=ej("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none; font-size: 4px;");if(b8){ex.style.width="1000px"}else{ex.setAttribute("wrap","off")}if(dy){ex.style.border="1px solid black"}ex.setAttribute("autocorrect","off");ex.setAttribute("autocapitalize","off");ex.setAttribute("spellcheck","false");ez.inputDiv=ej("div",[ex],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");ez.scrollbarH=ej("div",[ej("div",null,null,"height: 1px")],"CodeMirror-hscrollbar");ez.scrollbarV=ej("div",[ej("div",null,null,"width: 1px")],"CodeMirror-vscrollbar");ez.scrollbarFiller=ej("div",null,"CodeMirror-scrollbar-filler");ez.gutterFiller=ej("div",null,"CodeMirror-gutter-filler");ez.lineDiv=ej("div",null,"CodeMirror-code");ez.selectionDiv=ej("div",null,null,"position: relative; z-index: 1");ez.cursor=ej("div","\u00a0","CodeMirror-cursor");ez.otherCursor=ej("div","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor");ez.measure=ej("div",null,"CodeMirror-measure");ez.lineSpace=ej("div",[ez.measure,ez.selectionDiv,ez.lineDiv,ez.cursor,ez.otherCursor],null,"position: relative; outline: none");ez.mover=ej("div",[ej("div",[ez.lineSpace],"CodeMirror-lines")],null,"position: relative");ez.sizer=ej("div",[ez.mover],"CodeMirror-sizer");ez.heightForcer=ej("div",null,null,"position: absolute; height: "+aO+"px; width: 1px;");ez.gutters=ej("div",null,"CodeMirror-gutters");ez.lineGutter=null;ez.scroller=ej("div",[ez.sizer,ez.heightForcer,ez.gutters],"CodeMirror-scroll");ez.scroller.setAttribute("tabIndex","-1");ez.wrapper=ej("div",[ez.inputDiv,ez.scrollbarH,ez.scrollbarV,ez.scrollbarFiller,ez.gutterFiller,ez.scroller],"CodeMirror");if(bF){ez.gutters.style.zIndex=-1;ez.scroller.style.paddingRight=0}if(ew.appendChild){ew.appendChild(ez.wrapper)}else{ew(ez.wrapper)}if(dy){ex.style.width="0px"}if(!b8){ez.scroller.draggable=true}if(aH){ez.inputDiv.style.height="1px";ez.inputDiv.style.position="absolute"}else{if(bF){ez.scrollbarH.style.minWidth=ez.scrollbarV.style.minWidth="18px"}}ez.viewOffset=ez.lastSizeC=0;ez.showingFrom=ez.showingTo=ey;ez.lineNumWidth=ez.lineNumInnerWidth=ez.lineNumChars=null;ez.prevInput="";ez.alignWidgets=false;ez.pollingFast=false;ez.poll=new ev();ez.cachedCharWidth=ez.cachedTextHeight=null;ez.measureLineCache=[];ez.measureLineCachePos=0;ez.inaccurateSelection=false;ez.maxLine=null;ez.maxLineLength=0;ez.maxLineChanged=false;ez.wheelDX=ez.wheelDY=ez.wheelStartX=ez.wheelStartY=null;return ez}function aW(ew){ew.doc.mode=B.getMode(ew.options,ew.doc.modeOption);cZ(ew)}function cZ(ew){ew.doc.iter(function(ex){if(ex.stateAfter){ex.stateAfter=null}if(ex.styles){ex.styles=null}});ew.doc.frontier=ew.doc.first;cU(ew,100);ew.state.modeGen++;if(ew.curOp){Q(ew)}}function dj(ew){if(ew.options.lineWrapping){ew.display.wrapper.className+=" CodeMirror-wrap";ew.display.sizer.style.minWidth=""}else{ew.display.wrapper.className=ew.display.wrapper.className.replace(" CodeMirror-wrap","");em(ew)}L(ew);Q(ew);T(ew);setTimeout(function(){dw(ew)},100)}function aJ(ew){var ey=aw(ew.display),ex=ew.options.lineWrapping;var ez=ex&&Math.max(5,ew.display.scroller.clientWidth/cy(ew.display)-3);return function(eA){if(dZ(ew.doc,eA)){return 0}else{if(ex){return(Math.ceil(eA.text.length/ez)||1)*ey}else{return ey}}}}function L(ew){var ey=ew.doc,ex=aJ(ew);ey.iter(function(ez){var eA=ex(ez);if(eA!=ez.height){eo(ez,eA)}})}function et(ew){var ey=dF[ew.options.keyMap],ex=ey.style;ew.display.wrapper.className=ew.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(ex?" cm-keymap-"+ex:"")}function b2(ew){ew.display.wrapper.className=ew.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+ew.options.theme.replace(/(^|\s)\s*/g," cm-s-");T(ew)}function ct(ew){cR(ew);Q(ew);setTimeout(function(){df(ew)},20)}function cR(ew){var ex=ew.display.gutters,eB=ew.options.gutters;cK(ex);for(var ey=0;ey<eB.length;++ey){var ez=eB[ey];var eA=ex.appendChild(ej("div",null,"CodeMirror-gutter "+ez));if(ez=="CodeMirror-linenumbers"){ew.display.lineGutter=eA;eA.style.width=(ew.display.lineNumWidth||1)+"px"}}ex.style.display=ey?"":"none"}function c0(eA,ey){if(ey.height==0){return 0}var ex=ey.text.length,ew,eB=ey;while(ew=dn(eB)){var ez=ew.find();eB=dJ(eA,ez.from.line);ex+=ez.from.ch-ez.to.ch}eB=ey;while(ew=c5(eB)){var ez=ew.find();ex-=eB.text.length-ez.from.ch;eB=dJ(eA,ez.to.line);ex+=eB.text.length-ez.to.ch}return ex}function em(ew){var ey=ew.display,ex=ew.doc;ey.maxLine=dJ(ex,ex.first);ey.maxLineLength=c0(ex,ey.maxLine);ey.maxLineChanged=true;ex.iter(function(eA){var ez=c0(ex,eA);if(ez>ey.maxLineLength){ey.maxLineLength=ez;ey.maxLine=eA}})}function by(ew){var ex=cl(ew.gutters,"CodeMirror-linenumbers");if(ex==-1&&ew.lineNumbers){ew.gutters=ew.gutters.concat(["CodeMirror-linenumbers"])}else{if(ex>-1&&!ew.lineNumbers){ew.gutters=ew.gutters.slice(0);ew.gutters.splice(ex,1)}}}function dw(ew){var eC=ew.display,ex=ew.doc.height;var ez=ex+a7(eC);eC.sizer.style.minHeight=eC.heightForcer.style.top=ez+"px";eC.gutters.style.height=Math.max(ez,eC.scroller.clientHeight-aO)+"px";var eA=Math.max(ez,eC.scroller.scrollHeight);var eB=eC.scroller.scrollWidth>(eC.scroller.clientWidth+1);var ey=eA>(eC.scroller.clientHeight+1);if(ey){eC.scrollbarV.style.display="block";eC.scrollbarV.style.bottom=eB?i(eC.measure)+"px":"0";eC.scrollbarV.firstChild.style.height=(eA-eC.scroller.clientHeight+eC.scrollbarV.clientHeight)+"px"}else{eC.scrollbarV.style.display="";eC.scrollbarV.firstChild.style.height="0"}if(eB){eC.scrollbarH.style.display="block";eC.scrollbarH.style.right=ey?i(eC.measure)+"px":"0";eC.scrollbarH.firstChild.style.width=(eC.scroller.scrollWidth-eC.scroller.clientWidth+eC.scrollbarH.clientWidth)+"px"}else{eC.scrollbarH.style.display="";eC.scrollbarH.firstChild.style.width="0"}if(eB&&ey){eC.scrollbarFiller.style.display="block";eC.scrollbarFiller.style.height=eC.scrollbarFiller.style.width=i(eC.measure)+"px"}else{eC.scrollbarFiller.style.display=""}if(eB&&ew.options.coverGutterNextToScrollbar&&ew.options.fixedGutter){eC.gutterFiller.style.display="block";eC.gutterFiller.style.height=i(eC.measure)+"px";eC.gutterFiller.style.width=eC.gutters.offsetWidth+"px"}else{eC.gutterFiller.style.display=""}if(bT&&i(eC.measure)===0){eC.scrollbarV.style.minWidth=eC.scrollbarH.style.minHeight=cc?"18px":"12px";eC.scrollbarV.style.pointerEvents=eC.scrollbarH.style.pointerEvents="none"}}function bp(eB,eA,ez){var ey=eB.scroller.scrollTop,ew=eB.wrapper.clientHeight;if(typeof ez=="number"){ey=ez}else{if(ez){ey=ez.top;ew=ez.bottom-ez.top}}ey=Math.floor(ey-dD(eB));var ex=Math.ceil(ey+ew);return{from:a5(eA,ey),to:a5(eA,ex)}}function df(ew){var eC=ew.display;if(!eC.alignWidgets&&(!eC.gutters.firstChild||!ew.options.fixedGutter)){return}var ez=cJ(eC)-eC.scroller.scrollLeft+ew.doc.scrollLeft;var eB=eC.gutters.offsetWidth,ey=ez+"px";for(var eD=eC.lineDiv.firstChild;eD;eD=eD.nextSibling){if(eD.alignable){for(var eA=0,ex=eD.alignable;eA<ex.length;++eA){ex[eA].style.left=ey}}}if(ew.options.fixedGutter){eC.gutters.style.left=(ez+eB)+"px"}}function cM(ew){if(!ew.options.lineNumbers){return false}var eB=ew.doc,ex=c3(ew.options,eB.first+eB.size-1),eA=ew.display;if(ex.length!=eA.lineNumChars){var eC=eA.measure.appendChild(ej("div",[ej("div",ex)],"CodeMirror-linenumber CodeMirror-gutter-elt"));var ey=eC.firstChild.offsetWidth,ez=eC.offsetWidth-ey;eA.lineGutter.style.width="";eA.lineNumInnerWidth=Math.max(ey,eA.lineGutter.offsetWidth-ez);eA.lineNumWidth=eA.lineNumInnerWidth+ez;eA.lineNumChars=eA.lineNumInnerWidth?ex.length:-1;eA.lineGutter.style.width=eA.lineNumWidth+"px";return true}return false}function c3(ew,ex){return String(ew.lineNumberFormatter(ex+ew.firstLineNumber))}function cJ(ew){return an(ew.scroller).left-an(ew.sizer).left}function cB(eB,eA,eE,eF){var eD=eB.display.showingFrom,eC=eB.display.showingTo,ez;var ew=bp(eB.display,eB.doc,eE);for(var ey=true;;ey=false){var ex=eB.display.scroller.clientWidth;if(!cj(eB,eA,ew,eF)){break}ez=true;eA=[];a2(eB);dw(eB);if(ey&&eB.options.lineWrapping&&ex!=eB.display.scroller.clientWidth){eF=true;continue}eF=false;if(eE){eE=Math.min(eB.display.scroller.scrollHeight-eB.display.scroller.clientHeight,typeof eE=="number"?eE:eE.top)}ew=bp(eB.display,eB.doc,eE);if(ew.from>=eB.display.showingFrom&&ew.to<=eB.display.showingTo){break}}if(ez){O(eB,"update",eB);if(eB.display.showingFrom!=eD||eB.display.showingTo!=eC){O(eB,"viewportChange",eB,eB.display.showingFrom,eB.display.showingTo)}}return ez}function cj(eA,eO,ex,eM){var eG=eA.display,eP=eA.doc;if(!eG.wrapper.offsetWidth){eG.showingFrom=eG.showingTo=eP.first;eG.viewOffset=0;return}if(!eM&&eO.length==0&&ex.from>eG.showingFrom&&ex.to<eG.showingTo){return}if(cM(eA)){eO=[{from:eP.first,to:eP.first+eP.size}]}var eL=eG.sizer.style.marginLeft=eG.gutters.offsetWidth+"px";eG.scrollbarH.style.left=eA.options.fixedGutter?eL:"0";var ey=Infinity;if(eA.options.lineNumbers){for(var eH=0;eH<eO.length;++eH){if(eO[eH].diff&&eO[eH].from<ey){ey=eO[eH].from}}}var ez=eP.first+eP.size;var eF=Math.max(ex.from-eA.options.viewportMargin,eP.first);var ew=Math.min(ez,ex.to+eA.options.viewportMargin);if(eG.showingFrom<eF&&eF-eG.showingFrom<20){eF=Math.max(eP.first,eG.showingFrom)}if(eG.showingTo>ew&&eG.showingTo-ew<20){ew=Math.min(ez,eG.showingTo)}if(aD){eF=bc(u(eP,dJ(eP,eF)));while(ew<ez&&dZ(eP,dJ(eP,ew))){++ew}}var eJ=[{from:Math.max(eG.showingFrom,eP.first),to:Math.min(eG.showingTo,ez)}];if(eJ[0].from>=eJ[0].to){eJ=[]}else{eJ=dT(eJ,eO)}if(aD){for(var eH=0;eH<eJ.length;++eH){var eC=eJ[eH],eK;while(eK=c5(dJ(eP,eC.to-1))){var eN=eK.find().from.line;if(eN>eC.from){eC.to=eN}else{eJ.splice(eH--,1);break}}}}var eE=0;for(var eH=0;eH<eJ.length;++eH){var eC=eJ[eH];if(eC.from<eF){eC.from=eF}if(eC.to>ew){eC.to=ew}if(eC.from>=eC.to){eJ.splice(eH--,1)}else{eE+=eC.to-eC.from}}if(!eM&&eE==ew-eF&&eF==eG.showingFrom&&ew==eG.showingTo){h(eA);return}eJ.sort(function(eR,eQ){return eR.from-eQ.from});try{var eB=document.activeElement}catch(eI){}if(eE<(ew-eF)*0.7){eG.lineDiv.style.display="none"}bG(eA,eF,ew,eJ,ey);eG.lineDiv.style.display="";if(eB&&document.activeElement!=eB&&eB.offsetHeight){eB.focus()}var eD=eF!=eG.showingFrom||ew!=eG.showingTo||eG.lastSizeC!=eG.wrapper.clientHeight;if(eD){eG.lastSizeC=eG.wrapper.clientHeight;cU(eA,400)}eG.showingFrom=eF;eG.showingTo=ew;eG.gutters.style.height="";aF(eA);h(eA);return true}function aF(eE){var eB=eE.display;var ex=eB.lineDiv.offsetTop;for(var ew=eB.lineDiv.firstChild,eF;ew;ew=ew.nextSibling){if(ew.lineObj){if(bF){var eA=ew.offsetTop+ew.offsetHeight;eF=eA-ex;ex=eA}else{var ez=an(ew);eF=ez.bottom-ez.top}var eD=ew.lineObj.height-eF;if(eF<2){eF=aw(eB)}if(eD>0.001||eD<-0.001){eo(ew.lineObj,eF);var eC=ew.lineObj.widgets;if(eC){for(var ey=0;ey<eC.length;++ey){eC[ey].height=eC[ey].node.offsetHeight}}}}}}function h(ew){var ex=ew.display.viewOffset=bb(ew,dJ(ew.doc,ew.display.showingFrom));ew.display.mover.style.top=ex+"px"}function dT(eF,eD){for(var eA=0,ey=eD.length||0;eA<ey;++eA){var eC=eD[eA],ew=[],eE=eC.diff||0;for(var ez=0,ex=eF.length;ez<ex;++ez){var eB=eF[ez];if(eC.to<=eB.from&&eC.diff){ew.push({from:eB.from+eE,to:eB.to+eE})}else{if(eC.to<=eB.from||eC.from>=eB.to){ew.push(eB)}else{if(eC.from>eB.from){ew.push({from:eB.from,to:eC.from})}if(eC.to<eB.to){ew.push({from:eC.to+eE,to:eB.to+eE})}}}}eF=ew}return eF}function dG(ew){var eA=ew.display,ez={},ey={};for(var eB=eA.gutters.firstChild,ex=0;eB;eB=eB.nextSibling,++ex){ez[ew.options.gutters[ex]]=eB.offsetLeft;ey[ew.options.gutters[ex]]=eB.offsetWidth}return{fixedPos:cJ(eA),gutterTotalWidth:eA.gutters.offsetWidth,gutterLeft:ez,gutterWidth:ey,wrapperWidth:eA.wrapper.clientWidth}}function bG(eF,eC,eD,eI,ex){var eE=dG(eF);var eB=eF.display,eH=eF.options.lineNumbers;if(!eI.length&&(!b8||!eF.display.currentWheelTarget)){cK(eB.lineDiv)}var ew=eB.lineDiv,eG=ew.firstChild;function eA(eK){var eJ=eK.nextSibling;if(b8&&bq&&eF.display.currentWheelTarget==eK){eK.style.display="none";eK.lineObj=null}else{eK.parentNode.removeChild(eK)}return eJ}var ey=eI.shift(),ez=eC;eF.doc.iter(eC,eD,function(eS){if(ey&&ey.to==ez){ey=eI.shift()}if(dZ(eF.doc,eS)){if(eS.height!=0){eo(eS,0)}if(eS.widgets&&eG&&eG.previousSibling){for(var eN=0;eN<eS.widgets.length;++eN){var eP=eS.widgets[eN];if(eP.showIfHidden){var eL=eG.previousSibling;if(/pre/i.test(eL.nodeName)){var eK=ej("div",null,null,"position: relative");eL.parentNode.replaceChild(eK,eL);eK.appendChild(eL);eL=eK}var eQ=eL.appendChild(ej("div",[eP.node],"CodeMirror-linewidget"));if(!eP.handleMouseEvents){eQ.ignoreEvents=true}a4(eP,eQ,eL,eE)}}}}else{if(ey&&ey.from<=ez&&ey.to>ez){while(eG.lineObj!=eS){eG=eA(eG)}if(eH&&ex<=ez&&eG.lineNumber){l(eG.lineNumber,c3(eF.options,ez))}eG=eG.nextSibling}else{if(eS.widgets){for(var eM=0,eR=eG,eO;eR&&eM<20;++eM,eR=eR.nextSibling){if(eR.lineObj==eS&&/div/i.test(eR.nodeName)){eO=eR;break}}}var eJ=ai(eF,eS,ez,eE,eO);if(eJ!=eO){ew.insertBefore(eJ,eG)}else{while(eG!=eO){eG=eA(eG)}eG=eG.nextSibling}eJ.lineObj=eS}}++ez});while(eG){eG=eA(eG)}}function ai(eD,eF,eG,eJ,ey){var eC=dq(eD,eF),eP=eC.pre;var eS=eF.gutterMarkers,eQ=eD.display,eE;var ex=eC.bgClass?eC.bgClass+" "+(eF.bgClass||""):eF.bgClass;if(!eD.options.lineNumbers&&!eS&&!ex&&!eF.wrapClass&&!eF.widgets){return eP}if(ey){ey.alignable=null;var eT=true,eB=0,ez=null;for(var eL=ey.firstChild,eK;eL;eL=eK){eK=eL.nextSibling;if(!/\bCodeMirror-linewidget\b/.test(eL.className)){ey.removeChild(eL)}else{for(var eR=0;eR<eF.widgets.length;++eR){var eA=eF.widgets[eR];if(eA.node==eL.firstChild){if(!eA.above&&!ez){ez=eL}a4(eA,eL,ey,eJ);++eB;break}}if(eR==eF.widgets.length){eT=false;break}}}ey.insertBefore(eP,ez);if(eT&&eB==eF.widgets.length){eE=ey;ey.className=eF.wrapClass||""}}if(!eE){eE=ej("div",null,eF.wrapClass,"position: relative");eE.appendChild(eP)}if(ex){eE.insertBefore(ej("div",null,ex+" CodeMirror-linebackground"),eE.firstChild)}if(eD.options.lineNumbers||eS){var eN=eE.insertBefore(ej("div",null,"CodeMirror-gutter-wrapper","position: absolute; left: "+(eD.options.fixedGutter?eJ.fixedPos:-eJ.gutterTotalWidth)+"px"),eP);if(eD.options.fixedGutter){(eE.alignable||(eE.alignable=[])).push(eN)}if(eD.options.lineNumbers&&(!eS||!eS["CodeMirror-linenumbers"])){eE.lineNumber=eN.appendChild(ej("div",c3(eD.options,eG),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+eJ.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+eQ.lineNumInnerWidth+"px"))}if(eS){for(var eO=0;eO<eD.options.gutters.length;++eO){var eI=eD.options.gutters[eO],eH=eS.hasOwnProperty(eI)&&eS[eI];if(eH){eN.appendChild(ej("div",[eH],"CodeMirror-gutter-elt","left: "+eJ.gutterLeft[eI]+"px; width: "+eJ.gutterWidth[eI]+"px"))}}}}if(bF){eE.style.zIndex=2}if(eF.widgets&&eE!=ey){for(var eR=0,ew=eF.widgets;eR<ew.length;++eR){var eA=ew[eR],eM=ej("div",[eA.node],"CodeMirror-linewidget");if(!eA.handleMouseEvents){eM.ignoreEvents=true}a4(eA,eM,eE,eJ);if(eA.above){eE.insertBefore(eM,eD.options.lineNumbers&&eF.height!=0?eN:eP)}else{eE.appendChild(eM)}O(eA,"redraw")}}return eE}function a4(ez,ey,ex,eA){if(ez.noHScroll){(ex.alignable||(ex.alignable=[])).push(ey);var ew=eA.wrapperWidth;ey.style.left=eA.fixedPos+"px";if(!ez.coverGutter){ew-=eA.gutterTotalWidth;ey.style.paddingLeft=eA.gutterTotalWidth+"px"}ey.style.width=ew+"px"}if(ez.coverGutter){ey.style.zIndex=5;ey.style.position="relative";if(!ez.noHScroll){ey.style.marginLeft=-eA.gutterTotalWidth+"px"}}}function a2(ew){var ez=ew.display;var eA=d8(ew.doc.sel.from,ew.doc.sel.to);if(eA||ew.options.showCursorWhenSelecting){C(ew)}else{ez.cursor.style.display=ez.otherCursor.style.display="none"}if(!eA){V(ew)}else{ez.selectionDiv.style.display="none"}if(ew.options.moveInputWithCursor){var eB=cH(ew,ew.doc.sel.head,"div");var ex=an(ez.wrapper),ey=an(ez.lineDiv);ez.inputDiv.style.top=Math.max(0,Math.min(ez.wrapper.clientHeight-10,eB.top+ey.top-ex.top))+"px";ez.inputDiv.style.left=Math.max(0,Math.min(ez.wrapper.clientWidth-10,eB.left+ey.left-ex.left))+"px"}}function C(ew){var ex=ew.display,ey=cH(ew,ew.doc.sel.head,"div");ex.cursor.style.left=ey.left+"px";ex.cursor.style.top=ey.top+"px";ex.cursor.style.height=Math.max(0,ey.bottom-ey.top)*ew.options.cursorHeight+"px";ex.cursor.style.display="";if(ey.other){ex.otherCursor.style.display="";ex.otherCursor.style.left=ey.other.left+"px";ex.otherCursor.style.top=ey.other.top+"px";ex.otherCursor.style.height=(ey.other.bottom-ey.other.top)*0.85+"px"}else{ex.otherCursor.style.display="none"}}function V(eH){var eC=eH.display,eG=eH.doc,ew=eH.doc.sel;var eA=document.createDocumentFragment();var eF=eC.lineSpace.offsetWidth,ey=av(eH.display);function eJ(eN,eM,eL,eK){if(eM<0){eM=0}eA.appendChild(ej("div",null,"CodeMirror-selected","position: absolute; left: "+eN+"px; top: "+eM+"px; width: "+(eL==null?eF-eN:eL)+"px; height: "+(eK-eM)+"px"))}function eE(eL,eN,eQ){var eM=dJ(eG,eL);var eO=eM.text.length;var eR,eK;function eP(eT,eS){return bZ(eH,K(eL,eT),"div",eM,eS)}cL(a(eM),eN||0,eQ==null?eO:eQ,function(eZ,eY,eS){var eV=eP(eZ,"left"),eW,eX,eU;if(eZ==eY){eW=eV;eX=eU=eV.left}else{eW=eP(eY-1,"right");if(eS=="rtl"){var eT=eV;eV=eW;eW=eT}eX=eV.left;eU=eW.right}if(eN==null&&eZ==0){eX=ey}if(eW.top-eV.top>3){eJ(eX,eV.top,null,eV.bottom);eX=ey;if(eV.bottom<eW.top){eJ(eX,eV.bottom,null,eW.top)}}if(eQ==null&&eY==eO){eU=eF}if(!eR||eV.top<eR.top||eV.top==eR.top&&eV.left<eR.left){eR=eV}if(!eK||eW.bottom>eK.bottom||eW.bottom==eK.bottom&&eW.right>eK.right){eK=eW}if(eX<ey+1){eX=ey}eJ(eX,eW.top,eU-eX,eW.bottom)});return{start:eR,end:eK}}if(ew.from.line==ew.to.line){eE(ew.from.line,ew.from.ch,ew.to.ch)}else{var ez=dJ(eG,ew.from.line),ex=dJ(eG,ew.to.line);var eB=u(eG,ez)==u(eG,ex);var eI=eE(ew.from.line,ew.from.ch,eB?ez.text.length:null).end;var eD=eE(ew.to.line,eB?0:null,ew.to.ch).start;if(eB){if(eI.top<eD.top-2){eJ(eI.right,eI.top,null,eI.bottom);eJ(ey,eD.top,eD.left,eD.bottom)}else{eJ(eI.right,eI.top,eD.left-eI.right,eI.bottom)}}if(eI.bottom<eD.top){eJ(ey,eI.bottom,null,eD.top)}}bf(eC.selectionDiv,eA);eC.selectionDiv.style.display=""}function k(ew){if(!ew.state.focused){return}var ey=ew.display;clearInterval(ey.blinker);var ex=true;ey.cursor.style.visibility=ey.otherCursor.style.visibility="";if(ew.options.cursorBlinkRate>0){ey.blinker=setInterval(function(){ey.cursor.style.visibility=ey.otherCursor.style.visibility=(ex=!ex)?"":"hidden"},ew.options.cursorBlinkRate)}}function cU(ew,ex){if(ew.doc.mode.startState&&ew.doc.frontier<ew.display.showingTo){ew.state.highlight.set(ex,bO(b3,ew))}}function b3(ew){var ez=ew.doc;if(ez.frontier<ez.first){ez.frontier=ez.first}if(ez.frontier>=ew.display.showingTo){return}var ex=+new Date+ew.options.workTime;var ey=bo(ez.mode,cw(ew,ez.frontier));var eB=[],eA;ez.iter(ez.frontier,Math.min(ez.first+ez.size,ew.display.showingTo+500),function(eC){if(ez.frontier>=ew.display.showingFrom){var eE=eC.styles;eC.styles=d4(ew,eC,ey,true);var eF=!eE||eE.length!=eC.styles.length;for(var eD=0;!eF&&eD<eE.length;++eD){eF=eE[eD]!=eC.styles[eD]}if(eF){if(eA&&eA.end==ez.frontier){eA.end++}else{eB.push(eA={start:ez.frontier,end:ez.frontier+1})}}eC.stateAfter=bo(ez.mode,ey)}else{cu(ew,eC.text,ey);eC.stateAfter=ez.frontier%5==0?bo(ez.mode,ey):null}++ez.frontier;if(+new Date>ex){cU(ew,ew.options.workDelay);return true}});if(eB.length){b9(ew,function(){for(var eC=0;eC<eB.length;++eC){Q(this,eB[eC].start,eB[eC].end)}})()}}function bQ(eC,ew,ez){var ex,eA,eB=eC.doc;var ey=ez?-1:ew-(eC.doc.mode.innerMode?1000:100);for(var eF=ew;eF>ey;--eF){if(eF<=eB.first){return eB.first}var eE=dJ(eB,eF-1);if(eE.stateAfter&&(!ez||eF<=eB.frontier)){return eF}var eD=bg(eE.text,null,eC.options.tabSize);if(eA==null||ex>eD){eA=eF-1;ex=eD}}return eA}function cw(ew,eC,ex){var eA=ew.doc,ez=ew.display;if(!eA.mode.startState){return true}var eB=bQ(ew,eC,ex),ey=eB>eA.first&&dJ(eA,eB-1).stateAfter;if(!ey){ey=bm(eA.mode)}else{ey=bo(eA.mode,ey)}eA.iter(eB,eC,function(eD){cu(ew,eD.text,ey);var eE=eB==eC-1||eB%5==0||eB>=ez.showingFrom&&eB<ez.showingTo;eD.stateAfter=eE?bo(eA.mode,ey):null;++eB});if(ex){eA.frontier=eB}return ey}function dD(ew){return ew.lineSpace.offsetTop}function a7(ew){return ew.mover.offsetHeight-ew.lineSpace.offsetHeight}function av(ex){var ew=bf(ex.measure,ej("pre",null,null,"text-align: left")).appendChild(ej("span","x"));return ew.offsetLeft}function cW(eD,eE,ex,eA,eB){var ez=-1;eA=eA||a8(eD,eE);if(eA.crude){var ey=eA.left+ex*eA.width;return{left:ey,right:ey+eA.width,top:eA.top,bottom:eA.bottom}}for(var eC=ex;;eC+=ez){var ew=eA[eC];if(ew){break}if(ez<0&&eC==0){ez=1}}eB=eC>ex?"left":eC<ex?"right":eB;if(eB=="left"&&ew.leftSide){ew=ew.leftSide}else{if(eB=="right"&&ew.rightSide){ew=ew.rightSide}}return{left:eC<ex?ew.right:ew.left,right:eC>ex?ew.left:ew.right,top:ew.top,bottom:ew.bottom}}function dB(ew,ex){var ez=ew.display.measureLineCache;for(var eA=0;eA<ez.length;++eA){var ey=ez[eA];if(ey.text==ex.text&&ey.markedSpans==ex.markedSpans&&ew.display.scroller.clientWidth==ey.width&&ey.classes==ex.textClass+"|"+ex.wrapClass){return ey}}}function ec(ew,ex){var ey=dB(ew,ex);if(ey){ey.text=ey.measure=ey.markedSpans=null}}function a8(ew,ex){var eB=dB(ew,ex);if(eB){return eB.measure}var eA=ci(ew,ex);var ez=ew.display.measureLineCache;var ey={text:ex.text,width:ew.display.scroller.clientWidth,markedSpans:ex.markedSpans,measure:eA,classes:ex.textClass+"|"+ex.wrapClass};if(ez.length==16){ez[++ew.display.measureLineCachePos%16]=ey}else{ez.push(ey)}return eA}function ci(eD,eF){if(!eD.options.lineWrapping&&eF.text.length>=eD.options.crudeMeasuringFrom){return ek(eD,eF)}var eL=eD.display,eB=U(eF.text.length);var eI=dq(eD,eF,eB,true).pre;if(cf&&!bF&&!eD.options.lineWrapping&&eI.childNodes.length>100){var ey=document.createDocumentFragment();var eG=10,eJ=eI.childNodes.length;for(var eN=0,eH=Math.ceil(eJ/eG);eN<eH;++eN){var eE=ej("div",null,null,"display: inline-block");for(var eM=0;eM<eG&&eJ;++eM){eE.appendChild(eI.firstChild);--eJ}ey.appendChild(eE)}eI.appendChild(ey)}bf(eL.measure,eI);var ex=an(eL.lineDiv);var ew=[],eQ=U(eF.text.length),eP=eI.offsetHeight;if(bE&&eL.measure.first!=eI){bf(eL.measure,eI)}function eO(eT){var eV=eT.top-ex.top,eX=eT.bottom-ex.top;if(eX>eP){eX=eP}if(eV<0){eV=0}for(var eS=ew.length-2;eS>=0;eS-=2){var eU=ew[eS],eW=ew[eS+1];if(eU>eX||eW<eV){continue}if(eU<=eV&&eW>=eX||eV<=eU&&eX>=eW||Math.min(eX,eW)-Math.max(eV,eU)>=(eX-eV)>>1){ew[eS]=Math.min(eV,eU);ew[eS+1]=Math.max(eX,eW);break}}if(eS<0){eS=ew.length;ew.push(eV,eX)}return{left:eT.left-ex.left,right:eT.right-ex.left,top:eS,bottom:null}}function eR(eS){eS.bottom=ew[eS.top+1];eS.top=ew[eS.top]}for(var eN=0,eA;eN<eB.length;++eN){if(eA=eB[eN]){var eK=eA,ez=null;if(/\bCodeMirror-widget\b/.test(eA.className)&&eA.getClientRects){if(eA.firstChild.nodeType==1){eK=eA.firstChild}var eC=eK.getClientRects();if(eC.length>1){ez=eQ[eN]=eO(eC[0]);ez.rightSide=eO(eC[eC.length-1])}}if(!ez){ez=eQ[eN]=eO(an(eK))}if(eA.measureRight){ez.right=an(eA.measureRight).left-ex.left}if(eA.leftSide){ez.leftSide=eO(an(eA.leftSide))}}}cK(eD.display.measure);for(var eN=0,eA;eN<eQ.length;++eN){if(eA=eQ[eN]){eR(eA);if(eA.leftSide){eR(eA.leftSide)}if(eA.rightSide){eR(eA.rightSide)}}}return eQ}function ek(ew,ex){var eB=new en(ex.text.slice(0,100),null);if(ex.textClass){eB.textClass=ex.textClass}var ez=ci(ew,eB);var eA=cW(ew,eB,0,ez,"left");var ey=cW(ew,eB,99,ez,"right");return{crude:true,top:eA.top,left:eA.left,bottom:eA.bottom,width:(ey.right-eA.left)/100}}function dg(ew,ey){var eD=false;if(ey.markedSpans){for(var ez=0;ez<ey.markedSpans;++ez){var eB=ey.markedSpans[ez];if(eB.collapsed&&(eB.to==null||eB.to==ey.text.length)){eD=true}}}var eA=!eD&&dB(ew,ey);if(eA||ey.text.length>=ew.options.crudeMeasuringFrom){return cW(ew,ey,ey.text.length,eA&&eA.measure,"right").right}var eC=dq(ew,ey,null,true).pre;var ex=eC.appendChild(aS(ew.display.measure));bf(ew.display.measure,eC);return an(ex).right-an(ew.display.lineDiv).left}function T(ew){ew.display.measureLineCache.length=ew.display.measureLineCachePos=0;ew.display.cachedCharWidth=ew.display.cachedTextHeight=null;if(!ew.options.lineWrapping){ew.display.maxLineChanged=true}ew.display.lineNumChars=null}function bN(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function bM(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function dp(eC,ez,eB,ex){if(ez.widgets){for(var ey=0;ey<ez.widgets.length;++ey){if(ez.widgets[ey].above){var eE=b6(ez.widgets[ey]);eB.top+=eE;eB.bottom+=eE}}}if(ex=="line"){return eB}if(!ex){ex="local"}var eA=bb(eC,ez);if(ex=="local"){eA+=dD(eC.display)}else{eA-=eC.display.viewOffset}if(ex=="page"||ex=="window"){var ew=an(eC.display.lineSpace);eA+=ew.top+(ex=="window"?0:bM());var eD=ew.left+(ex=="window"?0:bN());eB.left+=eD;eB.right+=eD}eB.top+=eA;eB.bottom+=eA;return eB}function es(ex,eA,ey){if(ey=="div"){return eA}var eC=eA.left,eB=eA.top;if(ey=="page"){eC-=bN();eB-=bM()}else{if(ey=="local"||!ey){var ez=an(ex.display.sizer);eC+=ez.left;eB+=ez.top}}var ew=an(ex.display.lineSpace);return{left:eC-ew.left,top:eB-ew.top}}function bZ(ew,eA,ez,ey,ex){if(!ey){ey=dJ(ew.doc,eA.line)}return dp(ew,ey,cW(ew,ey,eA.ch,null,ex),ez)}function cH(eF,eE,ey,eD,eB){eD=eD||dJ(eF.doc,eE.line);if(!eB){eB=a8(eF,eD)}function eA(eJ,eI){var eH=cW(eF,eD,eJ,eB,eI?"right":"left");if(eI){eH.left=eH.right}else{eH.right=eH.left}return dp(eF,eD,eH,ey)}function eG(eK,eH){var eI=eC[eH],eJ=eI.level%2;if(eK==cv(eI)&&eH&&eI.level<eC[eH-1].level){eI=eC[--eH];eK=er(eI)-(eI.level%2?0:1);eJ=true}else{if(eK==er(eI)&&eH<eC.length-1&&eI.level<eC[eH+1].level){eI=eC[++eH];eK=cv(eI)-eI.level%2;eJ=false}}if(eJ&&eK==eI.to&&eK>eI.from){return eA(eK-1)}return eA(eK,eJ)}var eC=a(eD),ew=eE.ch;if(!eC){return eA(ew)}var ex=aj(eC,ew);var ez=eG(ew,ex);if(dz!=null){ez.other=eG(ew,dz)}return ez}function ei(ew,ex,ey,eA){var ez=new K(ew,ex);ez.xRel=eA;if(ey){ez.outside=true}return ez}function ed(eD,eA,ez){var eC=eD.doc;ez+=eD.display.viewOffset;if(ez<0){return ei(eC.first,0,true,-1)}var ex=a5(eC,ez),eE=eC.first+eC.size-1;if(ex>eE){return ei(eC.first+eC.size-1,dJ(eC,eE).text.length,true,1)}if(eA<0){eA=0}for(;;){var ey=dJ(eC,ex);var eF=b7(eD,ey,ex,eA,ez);var eB=c5(ey);var ew=eB&&eB.find();if(eB&&(eF.ch>ew.from.ch||eF.ch==ew.from.ch&&eF.xRel>0)){ex=ew.to.line}else{return eF}}}function b7(eG,ey,eJ,eI,eH){var eF=eH-bb(eG,ey);var eC=false,eP=2*eG.display.wrapper.clientWidth;var eO=a8(eG,ey);function eT(eV){var eW=cH(eG,K(eJ,eV),"line",ey,eO);eC=true;if(eF>eW.bottom){return eW.left-eP}else{if(eF<eW.top){return eW.left+eP}else{eC=false}}return eW.left}var eL=a(ey),eN=ey.text.length;var eQ=bU(ey),ez=b4(ey);var eM=eT(eQ),ew=eC,ex=eT(ez),eB=eC;if(eI>ex){return ei(eJ,ez,eB,1)}for(;;){if(eL?ez==eQ||ez==q(ey,eQ,1):ez-eQ<=1){var eK=eI<eM||eI-eM<=ex-eI?eQ:ez;var eS=eI-(eK==eQ?eM:ex);while(dV(ey.text.charAt(eK))){++eK}var eE=ei(eJ,eK,eK==eQ?ew:eB,eS<0?-1:eS?1:0);return eE}var eD=Math.ceil(eN/2),eU=eQ+eD;if(eL){eU=eQ;for(var eR=0;eR<eD;++eR){eU=q(ey,eU,1)}}var eA=eT(eU);if(eA>eI){ez=eU;ex=eA;if(eB=eC){ex+=1000}eN=eD}else{eQ=eU;eM=eA;ew=eC;eN-=eD}}}var ak;function aw(ey){if(ey.cachedTextHeight!=null){return ey.cachedTextHeight}if(ak==null){ak=ej("pre");for(var ex=0;ex<49;++ex){ak.appendChild(document.createTextNode("x"));ak.appendChild(ej("br"))}ak.appendChild(document.createTextNode("x"))}bf(ey.measure,ak);var ew=ak.offsetHeight/50;if(ew>3){ey.cachedTextHeight=ew}cK(ey.measure);return ew||1}function cy(ez){if(ez.cachedCharWidth!=null){return ez.cachedCharWidth}var ew=ej("span","x");var ey=ej("pre",[ew]);bf(ez.measure,ey);var ex=ew.offsetWidth;if(ex>2){ez.cachedCharWidth=ex}return ex||10}var cO=0;function bY(ew){ew.curOp={changes:[],forceUpdate:false,updateInput:null,userSelChange:null,textChanged:null,selectionChanged:false,cursorActivity:false,updateMaxLine:false,updateScrollPos:false,id:++cO};if(!bL++){aT=[]}}function W(eK){var eE=eK.curOp,eJ=eK.doc,eF=eK.display;eK.curOp=null;if(eE.updateMaxLine){em(eK)}if(eF.maxLineChanged&&!eK.options.lineWrapping&&eF.maxLine){var ex=dg(eK,eF.maxLine);eF.sizer.style.minWidth=Math.max(0,ex+3+aO)+"px";eF.maxLineChanged=false;var eH=Math.max(0,eF.sizer.offsetLeft+eF.sizer.offsetWidth-eF.scroller.clientWidth);if(eH<eJ.scrollLeft&&!eE.updateScrollPos){a3(eK,Math.min(eF.scroller.scrollLeft,eH),true)}}var ey,eC;if(eE.updateScrollPos){ey=eE.updateScrollPos}else{if(eE.selectionChanged&&eF.scroller.clientHeight){var eI=cH(eK,eJ.sel.head);ey=A(eK,eI.left,eI.top,eI.left,eI.bottom)}}if(eE.changes.length||eE.forceUpdate||ey&&ey.scrollTop!=null){eC=cB(eK,eE.changes,ey&&ey.scrollTop,eE.forceUpdate);if(eK.display.scroller.offsetHeight){eK.doc.scrollTop=eK.display.scroller.scrollTop}}if(!eC&&eE.selectionChanged){a2(eK)}if(eE.updateScrollPos){var eG=Math.max(0,Math.min(eF.scroller.scrollHeight-eF.scroller.clientHeight,ey.scrollTop));var ez=Math.max(0,Math.min(eF.scroller.scrollWidth-eF.scroller.clientWidth,ey.scrollLeft));eF.scroller.scrollTop=eF.scrollbarV.scrollTop=eJ.scrollTop=eG;eF.scroller.scrollLeft=eF.scrollbarH.scrollLeft=eJ.scrollLeft=ez;df(eK);if(eE.scrollToPos){x(eK,d9(eK.doc,eE.scrollToPos.from),d9(eK.doc,eE.scrollToPos.to),eE.scrollToPos.margin)}}else{if(ey){ae(eK)}}if(eE.selectionChanged){k(eK)}if(eK.state.focused&&eE.updateInput){dU(eK,eE.userSelChange)}var eD=eE.maybeHiddenMarkers,ew=eE.maybeUnhiddenMarkers;if(eD){for(var eB=0;eB<eD.length;++eB){if(!eD[eB].lines.length){ah(eD[eB],"hide")}}}if(ew){for(var eB=0;eB<ew.length;++eB){if(ew[eB].lines.length){ah(ew[eB],"unhide")}}}var eA;if(!--bL){eA=aT;aT=null}if(eE.textChanged){ah(eK,"change",eK,eE.textChanged)}if(eE.cursorActivity){ah(eK,"cursorActivity",eK)}if(eA){for(var eB=0;eB<eA.length;++eB){eA[eB]()}}}function b9(ew,ex){return function(){var ez=ew||this,eA=!ez.curOp;if(eA){bY(ez)}try{var ey=ex.apply(ez,arguments)}finally{if(eA){W(ez)}}return ey}}function d3(ew){return function(){var ey=this.cm&&!this.cm.curOp,ex;if(ey){bY(this.cm)}try{ex=ew.apply(this,arguments)}finally{if(ey){W(this.cm)}}return ex}}function b1(ex,ez){var ey=!ex.curOp,ew;if(ey){bY(ex)}try{ew=ez()}finally{if(ey){W(ex)}}return ew}function Q(ew,ez,ey,ex){if(ez==null){ez=ew.doc.first}if(ey==null){ey=ew.doc.first+ew.doc.size}ew.curOp.changes.push({from:ez,to:ey,diff:ex})}function aR(ew){if(ew.display.pollingFast){return}ew.display.poll.set(ew.options.pollInterval,function(){bB(ew);if(ew.state.focused){aR(ew)}})}function w(ew){var ex=false;ew.display.pollingFast=true;function ey(){var ez=bB(ew);if(!ez&&!ex){ex=true;ew.display.poll.set(60,ey)}else{ew.display.pollingFast=false;aR(ew)}}ew.display.poll.set(20,ey)}function bB(eK){var eF=eK.display.input,eC=eK.display.prevInput,eJ=eK.doc,ew=eJ.sel;if(!eK.state.focused||aX(eF)||S(eK)||eK.options.disableInput){return false}if(eK.state.pasteIncoming&&eK.state.fakedLastChar){eF.value=eF.value.substring(0,eF.value.length-1);eK.state.fakedLastChar=false}var eL=eF.value;if(eL==eC&&d8(ew.from,ew.to)){return false}if(cA&&!bE&&eK.display.inputHasSelection===eL){dU(eK,true);return false}var ey=!eK.curOp;if(ey){bY(eK)}ew.shift=false;var eE=0,ex=Math.min(eC.length,eL.length);while(eE<ex&&eC.charCodeAt(eE)==eL.charCodeAt(eE)){++eE}var eI=ew.from,eH=ew.to;var eA=eL.slice(eE);if(eE<eC.length){eI=K(eI.line,eI.ch-(eC.length-eE))}else{if(eK.state.overwrite&&d8(eI,eH)&&!eK.state.pasteIncoming){eH=K(eH.line,Math.min(dJ(eJ,eH.line).text.length,eH.ch+eA.length))}}var eD=eK.curOp.updateInput;var eG={from:eI,to:eH,text:ay(eA),origin:eK.state.pasteIncoming?"paste":eK.state.cutIncoming?"cut":"+input"};aL(eK.doc,eG,"end");eK.curOp.updateInput=eD;O(eK,"inputRead",eK,eG);if(eA&&!eK.state.pasteIncoming&&eK.options.electricChars&&eK.options.smartIndent&&ew.head.ch<100){var ez=eK.getModeAt(ew.head).electricChars;if(ez){for(var eB=0;eB<ez.length;eB++){if(eA.indexOf(ez.charAt(eB))>-1){N(eK,ew.head.line,"smart");break}}}}if(eL.length>1000||eL.indexOf("\n")>-1){eF.value=eK.display.prevInput=""}else{eK.display.prevInput=eL}if(ey){W(eK)}eK.state.pasteIncoming=eK.state.cutIncoming=false;return true}function dU(ew,ey){var ex,ez,eB=ew.doc;if(!d8(eB.sel.from,eB.sel.to)){ew.display.prevInput="";ex=ce&&(eB.sel.to.line-eB.sel.from.line>100||(ez=ew.getSelection()).length>1000);var eA=ex?"-":ez||ew.getSelection();ew.display.input.value=eA;if(ew.state.focused){cC(ew.display.input)}if(cA&&!bE){ew.display.inputHasSelection=eA}}else{if(ey){ew.display.prevInput=ew.display.input.value="";if(cA&&!bE){ew.display.inputHasSelection=null}}}ew.display.inaccurateSelection=ex}function db(ew){if(ew.options.readOnly!="nocursor"&&(!cV||document.activeElement!=ew.display.input)){ew.display.input.focus()}}function S(ew){return ew.options.readOnly||ew.doc.cantEdit}function ee(ex){var eC=ex.display;bk(eC.scroller,"mousedown",b9(ex,c4));if(cf){bk(eC.scroller,"dblclick",b9(ex,function(eF){if(ar(ex,eF)){return}var eG=bH(ex,eF);if(!eG||j(ex,eF)||aG(ex.display,eF)){return}bV(eF);var eE=ab(dJ(ex.doc,eG.line).text,eG);eg(ex.doc,eE.from,eE.to)}))}else{bk(eC.scroller,"dblclick",function(eE){ar(ex,eE)||bV(eE)})}bk(eC.lineSpace,"selectstart",function(eE){if(!aG(eC,eE)){bV(eE)}});if(!bX){bk(eC.scroller,"contextmenu",function(eE){ad(ex,eE)})}bk(eC.scroller,"scroll",function(){if(eC.scroller.clientHeight){F(ex,eC.scroller.scrollTop);a3(ex,eC.scroller.scrollLeft,true);ah(ex,"scroll",ex)}});bk(eC.scrollbarV,"scroll",function(){if(eC.scroller.clientHeight){F(ex,eC.scrollbarV.scrollTop)}});bk(eC.scrollbarH,"scroll",function(){if(eC.scroller.clientHeight){a3(ex,eC.scrollbarH.scrollLeft)}});bk(eC.scroller,"mousewheel",function(eE){b(ex,eE)});bk(eC.scroller,"DOMMouseScroll",function(eE){b(ex,eE)});function eD(){if(ex.state.focused){setTimeout(bO(db,ex),0)}}bk(eC.scrollbarH,"mousedown",eD);bk(eC.scrollbarV,"mousedown",eD);bk(eC.wrapper,"scroll",function(){eC.wrapper.scrollTop=eC.wrapper.scrollLeft=0});var ew;function eA(){if(ew==null){ew=setTimeout(function(){ew=null;eC.cachedCharWidth=eC.cachedTextHeight=c6=null;T(ex);b1(ex,bO(Q,ex))},100)}}bk(window,"resize",eA);function ez(){for(var eE=eC.wrapper.parentNode;eE&&eE!=document.body;eE=eE.parentNode){}if(eE){setTimeout(ez,5000)}else{cT(window,"resize",eA)}}setTimeout(ez,5000);bk(eC.input,"keyup",b9(ex,function(eE){if(ar(ex,eE)||ex.options.onKeyEvent&&ex.options.onKeyEvent(ex,Y(eE))){return}if(eE.keyCode==16){ex.doc.sel.shift=false}}));bk(eC.input,"input",function(){if(cA&&!bE&&ex.display.inputHasSelection){ex.display.inputHasSelection=null}w(ex)});bk(eC.input,"keydown",b9(ex,m));bk(eC.input,"keypress",b9(ex,bP));bk(eC.input,"focus",bO(bS,ex));bk(eC.input,"blur",bO(au,ex));function ey(eE){if(ar(ex,eE)||ex.options.onDragEvent&&ex.options.onDragEvent(ex,Y(eE))){return}c2(eE)}if(ex.options.dragDrop){bk(eC.scroller,"dragstart",function(eE){I(ex,eE)});bk(eC.scroller,"dragenter",ey);bk(eC.scroller,"dragover",ey);bk(eC.scroller,"drop",b9(ex,aN))}bk(eC.scroller,"paste",function(eE){if(aG(eC,eE)){return}db(ex);w(ex)});bk(eC.input,"paste",function(){if(b8&&!ex.state.fakedLastChar&&!(new Date-ex.state.lastMiddleDown<200)){var eF=eC.input.selectionStart,eE=eC.input.selectionEnd;eC.input.value+="$";eC.input.selectionStart=eF;eC.input.selectionEnd=eE;ex.state.fakedLastChar=true}ex.state.pasteIncoming=true;w(ex)});function eB(eE){if(eC.inaccurateSelection){eC.prevInput="";eC.inaccurateSelection=false;eC.input.value=ex.getSelection();cC(eC.input)}if(eE.type=="cut"){ex.state.cutIncoming=true}}bk(eC.input,"cut",eB);bk(eC.input,"copy",eB);if(aH){bk(eC.sizer,"mouseup",function(){if(document.activeElement==eC.input){eC.input.blur()}db(ex)})}}function aG(ex,ew){for(var ey=D(ew);ey!=ex.wrapper;ey=ey.parentNode){if(!ey||ey.ignoreEvents||ey.parentNode==ex.sizer&&ey!=ex.mover){return true}}}function bH(ex,eC,ez){var eB=ex.display;if(!ez){var eA=D(eC);if(eA==eB.scrollbarH||eA==eB.scrollbarH.firstChild||eA==eB.scrollbarV||eA==eB.scrollbarV.firstChild||eA==eB.scrollbarFiller||eA==eB.gutterFiller){return null}}var ew,eD,ey=an(eB.lineSpace);try{ew=eC.clientX;eD=eC.clientY}catch(eC){return null}return ed(ex,ew-ey.left,eD-ey.top)}var cn,ch;function c4(eO){if(ar(this,eO)){return}var ez=this,eJ=ez.display,eQ=ez.doc,eH=eQ.sel;eH.shift=eO.shiftKey;if(aG(eJ,eO)){if(!b8){eJ.scroller.draggable=false;setTimeout(function(){eJ.scroller.draggable=true},100)}return}if(j(ez,eO)){return}var ey=bH(ez,eO);switch(eb(eO)){case 3:if(bX){ad.call(ez,ez,eO)}return;case 2:if(b8){ez.state.lastMiddleDown=+new Date}if(ey){eg(ez.doc,ey)}setTimeout(bO(db,ez),20);bV(eO);return}if(!ey){if(D(eO)==eJ.scroller){bV(eO)}return}if(!ez.state.focused){bS(ez)}var ew=+new Date,ex="single";if(ch&&ch.time>ew-400&&d8(ch.pos,ey)){ex="triple";bV(eO);setTimeout(bO(db,ez),20);aQ(ez,ey.line)}else{if(cn&&cn.time>ew-400&&d8(cn.pos,ey)){ex="double";ch={time:ew,pos:ey};bV(eO);var eL=ab(dJ(eQ,ey.line).text,ey);eg(ez.doc,eL.from,eL.to)}else{cn={time:ew,pos:ey}}}var eA=ey;if(ez.options.dragDrop&&dm&&!S(ez)&&!d8(eH.from,eH.to)&&!dK(ey,eH.from)&&!dK(eH.to,ey)&&ex=="single"){var eK=b9(ez,function(eR){if(b8){eJ.scroller.draggable=false}ez.state.draggingText=false;cT(document,"mouseup",eK);cT(eJ.scroller,"drop",eK);if(Math.abs(eO.clientX-eR.clientX)+Math.abs(eO.clientY-eR.clientY)<10){bV(eR);eg(ez.doc,ey);db(ez);if(cf&&!bE){setTimeout(function(){document.body.focus();db(ez)},20)}}});if(b8){eJ.scroller.draggable=true}ez.state.draggingText=eK;if(eJ.scroller.dragDrop){eJ.scroller.dragDrop()}bk(document,"mouseup",eK);bk(eJ.scroller,"drop",eK);return}bV(eO);if(ex=="single"){eg(ez.doc,d9(eQ,ey))}var eP=eH.from,eE=eH.to,eI=ey;function eM(eS){if(d8(eI,eS)){return}eI=eS;if(ex=="single"){eg(ez.doc,d9(eQ,ey),eS);return}eP=d9(eQ,eP);eE=d9(eQ,eE);if(ex=="double"){var eR=ab(dJ(eQ,eS.line).text,eS);if(dK(eS,eP)){eg(ez.doc,eR.from,eE)}else{eg(ez.doc,eP,eR.to)}}else{if(ex=="triple"){if(dK(eS,eP)){eg(ez.doc,eE,d9(eQ,K(eS.line,0)))}else{eg(ez.doc,eP,d9(eQ,K(eS.line+1,0)))}}}}var eF=an(eJ.wrapper);var eB=0;function eN(eT){var eR=++eB;var eV=bH(ez,eT,true);if(!eV){return}if(!d8(eV,eA)){if(!ez.state.focused){bS(ez)}eA=eV;eM(eV);var eU=bp(eJ,eQ);if(eV.line>=eU.to||eV.line<eU.from){setTimeout(b9(ez,function(){if(eB==eR){eN(eT)}}),150)}}else{var eS=eT.clientY<eF.top?-20:eT.clientY>eF.bottom?20:0;if(eS){setTimeout(b9(ez,function(){if(eB!=eR){return}eJ.scroller.scrollTop+=eS;eN(eT)}),50)}}}function eD(eR){eB=Infinity;bV(eR);db(ez);cT(document,"mousemove",eG);cT(document,"mouseup",eC)}var eG=b9(ez,function(eR){if(!cf&&!eb(eR)){eD(eR)}else{eN(eR)}});var eC=b9(ez,eD);bk(document,"mousemove",eG);bk(document,"mouseup",eC)}function eu(eH,eD,eF,eG,ez){try{var ex=eD.clientX,ew=eD.clientY}catch(eD){return false}if(ex>=Math.floor(an(eH.display.gutters).right)){return false}if(eG){bV(eD)}var eE=eH.display;var eC=an(eE.lineDiv);if(ew>eC.bottom||!dP(eH,eF)){return ba(eD)}ew-=eC.top-eE.viewOffset;for(var eA=0;eA<eH.options.gutters.length;++eA){var eB=eE.gutters.childNodes[eA];if(eB&&an(eB).right>=ex){var eI=a5(eH.doc,ew);var ey=eH.options.gutters[eA];ez(eH,eF,eH,eI,ey,eD);return ba(eD)}}}function ck(ew,ex){if(!dP(ew,"gutterContextMenu")){return false}return eu(ew,ex,"gutterContextMenu",false,ah)}function j(ew,ex){return eu(ew,ex,"gutterClick",true,O)}var P=0;function aN(eC){var eE=this;if(ar(eE,eC)||aG(eE.display,eC)||(eE.options.onDragEvent&&eE.options.onDragEvent(eE,Y(eC)))){return}bV(eC);if(cA){P=+new Date}var eD=bH(eE,eC,true),ew=eC.dataTransfer.files;if(!eD||S(eE)){return}if(ew&&ew.length&&window.FileReader&&window.File){var ey=ew.length,eG=Array(ey),ex=0;var ez=function(eJ,eI){var eH=new FileReader;eH.onload=function(){eG[eI]=eH.result;if(++ex==ey){eD=d9(eE.doc,eD);aL(eE.doc,{from:eD,to:eD,text:ay(eG.join("\n")),origin:"paste"},"around")}};eH.readAsText(eJ)};for(var eA=0;eA<ey;++eA){ez(ew[eA],eA)}}else{if(eE.state.draggingText&&!(dK(eD,eE.doc.sel.from)||dK(eE.doc.sel.to,eD))){eE.state.draggingText(eC);setTimeout(bO(db,eE),20);return}try{var eG=eC.dataTransfer.getData("Text");if(eG){var eF=eE.doc.sel.from,eB=eE.doc.sel.to;bh(eE.doc,eD,eD);if(eE.state.draggingText){az(eE.doc,"",eF,eB,"paste")}eE.replaceSelection(eG,null,"paste");db(eE)}}catch(eC){}}}function I(ex,ez){if(cA&&(!ex.state.draggingText||+new Date-P<100)){c2(ez);return}if(ar(ex,ez)||aG(ex.display,ez)){return}var ew=ex.getSelection();ez.dataTransfer.setData("Text",ew);if(ez.dataTransfer.setDragImage&&!ag){var ey=ej("img",null,null,"position: fixed; left: 0; top: 0;");ey.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";if(d1){ey.width=ey.height=1;ex.display.wrapper.appendChild(ey);ey._top=ey.offsetTop}ez.dataTransfer.setDragImage(ey,0,0);if(d1){ey.parentNode.removeChild(ey)}}}function F(ew,ex){if(Math.abs(ew.doc.scrollTop-ex)<2){return}ew.doc.scrollTop=ex;if(!bI){cB(ew,[],ex)}if(ew.display.scroller.scrollTop!=ex){ew.display.scroller.scrollTop=ex}if(ew.display.scrollbarV.scrollTop!=ex){ew.display.scrollbarV.scrollTop=ex}if(bI){cB(ew,[])}cU(ew,100)}function a3(ew,ey,ex){if(ex?ey==ew.doc.scrollLeft:Math.abs(ew.doc.scrollLeft-ey)<2){return}ey=Math.min(ey,ew.display.scroller.scrollWidth-ew.display.scroller.clientWidth);ew.doc.scrollLeft=ey;df(ew);if(ew.display.scroller.scrollLeft!=ey){ew.display.scroller.scrollLeft=ey}if(ew.display.scrollbarH.scrollLeft!=ey){ew.display.scrollbarH.scrollLeft=ey}}var dQ=0,bA=null;if(cf){bA=-0.53}else{if(bI){bA=15}else{if(cg){bA=-0.7}else{if(ag){bA=-1/3}}}}function b(eC,ex){var eF=ex.wheelDeltaX,eE=ex.wheelDeltaY;if(eF==null&&ex.detail&&ex.axis==ex.HORIZONTAL_AXIS){eF=ex.detail}if(eE==null&&ex.detail&&ex.axis==ex.VERTICAL_AXIS){eE=ex.detail}else{if(eE==null){eE=ex.wheelDelta}}var ez=eC.display,eB=ez.scroller;if(!(eF&&eB.scrollWidth>eB.clientWidth||eE&&eB.scrollHeight>eB.clientHeight)){return}if(eE&&bq&&b8){for(var eD=ex.target;eD!=eB;eD=eD.parentNode){if(eD.lineObj){eC.display.currentWheelTarget=eD;break}}}if(eF&&!bI&&!d1&&bA!=null){if(eE){F(eC,Math.max(0,Math.min(eB.scrollTop+eE*bA,eB.scrollHeight-eB.clientHeight)))}a3(eC,Math.max(0,Math.min(eB.scrollLeft+eF*bA,eB.scrollWidth-eB.clientWidth)));bV(ex);ez.wheelStartX=null;return}if(eE&&bA!=null){var ew=eE*bA;var eA=eC.doc.scrollTop,ey=eA+ez.wrapper.clientHeight;if(ew<0){eA=Math.max(0,eA+ew-50)}else{ey=Math.min(eC.doc.height,ey+ew+50)}cB(eC,[],{top:eA,bottom:ey})}if(dQ<20){if(ez.wheelStartX==null){ez.wheelStartX=eB.scrollLeft;ez.wheelStartY=eB.scrollTop;ez.wheelDX=eF;ez.wheelDY=eE;setTimeout(function(){if(ez.wheelStartX==null){return}var eG=eB.scrollLeft-ez.wheelStartX;var eI=eB.scrollTop-ez.wheelStartY;var eH=(eI&&ez.wheelDY&&eI/ez.wheelDY)||(eG&&ez.wheelDX&&eG/ez.wheelDX);ez.wheelStartX=ez.wheelStartY=null;if(!eH){return}bA=(bA*dQ+eH)/(dQ+1);++dQ},200)}else{ez.wheelDX+=eF;ez.wheelDY+=eE}}}function ef(ex,eA,ew){if(typeof eA=="string"){eA=dd[eA];if(!eA){return false}}if(ex.display.pollingFast&&bB(ex)){ex.display.pollingFast=false}var eB=ex.doc,ez=eB.sel.shift,ey=false;try{if(S(ex)){ex.state.suppressEdits=true}if(ew){eB.sel.shift=false}ey=eA(ex)!=bv}finally{eB.sel.shift=ez;ex.state.suppressEdits=false}return ey}function cr(ew){var ex=ew.state.keyMaps.slice(0);if(ew.options.extraKeys){ex.push(ew.options.extraKeys)}ex.push(ew.options.keyMap);return ex}var Z;function dN(ew,eC){var ex=eh(ew.options.keyMap),eA=ex.auto;clearTimeout(Z);if(eA&&!dc(eC)){Z=setTimeout(function(){if(eh(ew.options.keyMap)==ex){ew.options.keyMap=(eA.call?eA.call(null,ew):eA);et(ew)}},50)}var ez=dW(eC,true),eB=false;if(!ez){return false}var ey=cr(ew);if(eC.shiftKey){eB=g("Shift-"+ez,ey,function(eD){return ef(ew,eD,true)})||g(ez,ey,function(eD){if(typeof eD=="string"?/^go[A-Z]/.test(eD):eD.motion){return ef(ew,eD)}})}else{eB=g(ez,ey,function(eD){return ef(ew,eD)})}if(eB){bV(eC);k(ew);if(bE){eC.oldKeyCode=eC.keyCode;eC.keyCode=0}O(ew,"keyHandled",ew,ez,eC)}return eB}function cX(ew,ez,ex){var ey=g("'"+ex+"'",cr(ew),function(eA){return ef(ew,eA,true)});if(ey){bV(ez);k(ew);O(ew,"keyHandled",ew,"'"+ex+"'",ez)}return ey}var cm=null;function m(ez){var ew=this;if(!ew.state.focused){bS(ew)}if(ar(ew,ez)||ew.options.onKeyEvent&&ew.options.onKeyEvent(ew,Y(ez))){return}if(cf&&ez.keyCode==27){ez.returnValue=false}var ex=ez.keyCode;ew.doc.sel.shift=ex==16||ez.shiftKey;var ey=dN(ew,ez);if(d1){cm=ey?ex:null;if(!ey&&ex==88&&!ce&&(bq?ez.metaKey:ez.ctrlKey)){ew.replaceSelection("")}}}function bP(eA){var ew=this;if(ar(ew,eA)||ew.options.onKeyEvent&&ew.options.onKeyEvent(ew,Y(eA))){return}var ez=eA.keyCode,ex=eA.charCode;if(d1&&ez==cm){cm=null;bV(eA);return}if(((d1&&(!eA.which||eA.which<10))||aH)&&dN(ew,eA)){return}var ey=String.fromCharCode(ex==null?ez:ex);if(cX(ew,eA,ey)){return}if(cA&&!bE){ew.display.inputHasSelection=null}w(ew)}function bS(ew){if(ew.options.readOnly=="nocursor"){return}if(!ew.state.focused){ah(ew,"focus",ew);ew.state.focused=true;if(ew.display.wrapper.className.search(/\bCodeMirror-focused\b/)==-1){ew.display.wrapper.className+=" CodeMirror-focused"}if(!ew.curOp){dU(ew,true);if(b8){setTimeout(bO(dU,ew,true),0)}}}aR(ew);k(ew)}function au(ew){if(ew.state.focused){ah(ew,"blur",ew);ew.state.focused=false;ew.display.wrapper.className=ew.display.wrapper.className.replace(" CodeMirror-focused","")}clearInterval(ew.display.blinker);setTimeout(function(){if(!ew.state.focused){ew.doc.sel.shift=false}},150)}var d5;function ad(eG,eB){if(ar(eG,eB,"contextmenu")){return}var eD=eG.display,ex=eG.doc.sel;if(aG(eD,eB)||ck(eG,eB)){return}var eF=bH(eG,eB),ew=eD.scroller.scrollTop;if(!eF||d1){return}var eA=eG.options.resetSelectionOnContextMenu;if(eA&&(d8(ex.from,ex.to)||dK(eF,ex.from)||!dK(eF,ex.to))){b9(eG,bh)(eG.doc,eF,eF)}var eC=eD.input.style.cssText;eD.inputDiv.style.position="absolute";eD.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(eB.clientY-5)+"px; left: "+(eB.clientX-5)+"px; z-index: 1000; background: transparent; outline: none;border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);";db(eG);dU(eG,true);if(d8(ex.from,ex.to)){eD.input.value=eD.prevInput=" "}function ez(){if(eD.input.selectionStart!=null){var eH=eD.input.value="\u200b"+(d8(ex.from,ex.to)?"":eD.input.value);eD.prevInput="\u200b";eD.input.selectionStart=1;eD.input.selectionEnd=eH.length}}function eE(){eD.inputDiv.style.position="relative";eD.input.style.cssText=eC;if(bE){eD.scrollbarV.scrollTop=eD.scroller.scrollTop=ew}aR(eG);if(eD.input.selectionStart!=null){if(!cf||bE){ez()}clearTimeout(d5);var eH=0,eI=function(){if(eD.prevInput=="\u200b"&&eD.input.selectionStart==0){b9(eG,dd.selectAll)(eG)}else{if(eH++<10){d5=setTimeout(eI,500)}else{dU(eG)}}};d5=setTimeout(eI,200)}}if(cf&&!bE){ez()}if(bX){c2(eB);var ey=function(){cT(window,"mouseup",ey);setTimeout(eE,20)};bk(window,"mouseup",ey)}else{setTimeout(eE,50)}}var b5=B.changeEnd=function(ew){if(!ew.text){return ew.to}return K(ew.from.line+ew.text.length-1,d7(ew.text).length+(ew.text.length==1?ew.from.ch:0))};function de(eA,eC,eB){if(!dK(eC.from,eB)){return d9(eA,eB)}var ez=(eC.text.length-1)-(eC.to.line-eC.from.line);if(eB.line>eC.to.line+ez){var ey=eB.line-ez,ex=eA.first+eA.size-1;if(ey>ex){return K(ex,dJ(eA,ex).text.length)}return dX(eB,dJ(eA,ey).text.length)}if(eB.line==eC.to.line+ez){return dX(eB,d7(eC.text).length+(eC.text.length==1?eC.from.ch:0)+dJ(eA,eC.to.line).text.length-eC.to.ch)}var ew=eB.line-eC.from.line;return dX(eB,eC.text[ew].length+(ew?0:eC.from.ch))}function dO(ex,eA,ey){if(ey&&typeof ey=="object"){return{anchor:de(ex,eA,ey.anchor),head:de(ex,eA,ey.head)}}if(ey=="start"){return{anchor:eA.from,head:eA.from}}var ew=b5(eA);if(ey=="around"){return{anchor:eA.from,head:ew}}if(ey=="end"){return{anchor:ew,head:ew}}var ez=function(eD){if(dK(eD,eA.from)){return eD}if(!dK(eA.to,eD)){return ew}var eB=eD.line+eA.text.length-(eA.to.line-eA.from.line)-1,eC=eD.ch;if(eD.line==eA.to.line){eC+=ew.ch-eA.to.ch}return K(eB,eC)};return{anchor:ez(ex.sel.anchor),head:ez(ex.sel.head)}}function cG(ex,ez,ey){var ew={canceled:false,from:ez.from,to:ez.to,text:ez.text,origin:ez.origin,cancel:function(){this.canceled=true}};if(ey){ew.update=function(eD,eC,eB,eA){if(eD){this.from=d9(ex,eD)}if(eC){this.to=d9(ex,eC)}if(eB){this.text=eB}if(eA!==undefined){this.origin=eA}}}ah(ex,"beforeChange",ex,ew);if(ex.cm){ah(ex.cm,"beforeChange",ex.cm,ew)}if(ew.canceled){return null}return{from:ew.from,to:ew.to,text:ew.text,origin:ew.origin}}function aL(ez,eB,eA,ey){if(ez.cm){if(!ez.cm.curOp){return b9(ez.cm,aL)(ez,eB,eA,ey)}if(ez.cm.state.suppressEdits){return}}if(dP(ez,"beforeChange")||ez.cm&&dP(ez.cm,"beforeChange")){eB=cG(ez,eB,true);if(!eB){return}}var ex=eq&&!ey&&bW(ez,eB.from,eB.to);if(ex){for(var ew=ex.length-1;ew>=1;--ew){ap(ez,{from:ex[ew].from,to:ex[ew].to,text:[""]})}if(ex.length){ap(ez,{from:ex[0].from,to:ex[0].to,text:eB.text},eA)}}else{ap(ez,eB,eA)}}function ap(ey,eA,ez){if(eA.text.length==1&&eA.text[0]==""&&d8(eA.from,eA.to)){return}var ex=dO(ey,eA,ez);di(ey,eA,ex,ey.cm?ey.cm.curOp.id:NaN);cS(ey,eA,ex,cY(ey,eA));var ew=[];cN(ey,function(eC,eB){if(!eB&&cl(ew,eC.history)==-1){cz(eC.history,eA);ew.push(eC.history)}cS(eC,eA,null,cY(eC,eA))})}function bs(eF,eC){if(eF.cm&&eF.cm.state.suppressEdits){return}var eB=eF.history;var ex=(eC=="undo"?eB.done:eB.undone).pop();if(!ex){return}var eD={changes:[],anchorBefore:ex.anchorAfter,headBefore:ex.headAfter,anchorAfter:ex.anchorBefore,headAfter:ex.headBefore,generation:eB.generation};(eC=="undo"?eB.undone:eB.done).push(eD);eB.generation=ex.generation||++eB.maxGeneration;var ey=dP(eF,"beforeChange")||eF.cm&&dP(eF.cm,"beforeChange");for(var ez=ex.changes.length-1;ez>=0;--ez){var eE=ex.changes[ez];eE.origin=eC;if(ey&&!cG(eF,eE,false)){(eC=="undo"?eB.done:eB.undone).length=0;return}eD.changes.push(cs(eF,eE));var ew=ez?dO(eF,eE,null):{anchor:ex.anchorBefore,head:ex.headBefore};cS(eF,eE,ew,cP(eF,eE));var eA=[];cN(eF,function(eH,eG){if(!eG&&cl(eA,eH.history)==-1){cz(eH.history,eE);eA.push(eH.history)}cS(eH,eE,null,cP(eH,eE))})}}function dR(ew,ey){function ex(ez){return K(ez.line+ey,ez.ch)}ew.first+=ey;if(ew.cm){Q(ew.cm,ew.first,ew.first,ey)}ew.sel.head=ex(ew.sel.head);ew.sel.anchor=ex(ew.sel.anchor);ew.sel.from=ex(ew.sel.from);ew.sel.to=ex(ew.sel.to)}function cS(eA,eB,ez,ex){if(eA.cm&&!eA.cm.curOp){return b9(eA.cm,cS)(eA,eB,ez,ex)}if(eB.to.line<eA.first){dR(eA,eB.text.length-1-(eB.to.line-eB.from.line));return}if(eB.from.line>eA.lastLine()){return}if(eB.from.line<eA.first){var ew=eB.text.length-1-(eA.first-eB.from.line);dR(eA,ew);eB={from:K(eA.first,0),to:K(eB.to.line+ew,eB.to.ch),text:[d7(eB.text)],origin:eB.origin}}var ey=eA.lastLine();if(eB.to.line>ey){eB={from:eB.from,to:K(ey,dJ(eA,ey).text.length),text:[eB.text[0]],origin:eB.origin}}eB.removed=el(eA,eB.from,eB.to);if(!ez){ez=dO(eA,eB,null)}if(eA.cm){al(eA.cm,eB,ex,ez)}else{d2(eA,eB,ex,ez)}}function al(eG,eC,ez,ew){var eF=eG.doc,eB=eG.display,eD=eC.from,eE=eC.to;var ex=false,ey=eD.line;if(!eG.options.lineWrapping){ey=bc(u(eF,dJ(eF,eD.line)));eF.iter(ey,eE.line+1,function(eJ){if(eJ==eB.maxLine){ex=true;return true}})}if(!dK(eF.sel.head,eC.from)&&!dK(eC.to,eF.sel.head)){eG.curOp.cursorActivity=true}d2(eF,eC,ez,ew,aJ(eG));if(!eG.options.lineWrapping){eF.iter(ey,eD.line+eC.text.length,function(eK){var eJ=c0(eF,eK);if(eJ>eB.maxLineLength){eB.maxLine=eK;eB.maxLineLength=eJ;eB.maxLineChanged=true;ex=false}});if(ex){eG.curOp.updateMaxLine=true}}eF.frontier=Math.min(eF.frontier,eD.line);cU(eG,400);var eI=eC.text.length-(eE.line-eD.line)-1;Q(eG,eD.line,eE.line+1,eI);if(dP(eG,"change")){var eA={from:eD,to:eE,text:eC.text,removed:eC.removed,origin:eC.origin};if(eG.curOp.textChanged){for(var eH=eG.curOp.textChanged;eH.next;eH=eH.next){}eH.next=eA}else{eG.curOp.textChanged=eA}}}function az(ez,ey,eB,eA,ew){if(!eA){eA=eB}if(dK(eA,eB)){var ex=eA;eA=eB;eB=ex}if(typeof ey=="string"){ey=ay(ey)}aL(ez,{from:eB,to:eA,text:ey,origin:ew},null)}function K(ew,ex){if(!(this instanceof K)){return new K(ew,ex)}this.line=ew;this.ch=ex}B.Pos=K;function d8(ex,ew){return ex.line==ew.line&&ex.ch==ew.ch}function dK(ex,ew){return ex.line<ew.line||(ex.line==ew.line&&ex.ch<ew.ch)}function bz(ex,ew){return ex.line-ew.line||ex.ch-ew.ch}function bC(ew){return K(ew.line,ew.ch)}function cb(ew,ex){return Math.max(ew.first,Math.min(ex,ew.first+ew.size-1))}function d9(ex,ey){if(ey.line<ex.first){return K(ex.first,0)}var ew=ex.first+ex.size-1;if(ey.line>ew){return K(ew,dJ(ex,ew).text.length)}return dX(ey,dJ(ex,ey.line).text.length)}function dX(ey,ex){var ew=ey.ch;if(ew==null||ew>ex){return K(ey.line,ex)}else{if(ew<0){return K(ey.line,0)}else{return ey}}}function bt(ex,ew){return ew>=ex.first&&ew<ex.first+ex.size}function eg(eA,eB,ew,ex){if(eA.sel.shift||eA.sel.extend){var ez=eA.sel.anchor;if(ew){var ey=dK(eB,ez);if(ey!=dK(ew,ez)){ez=eB;eB=ew}else{if(ey!=dK(eB,ew)){eB=ew}}}bh(eA,ez,eB,ex)}else{bh(eA,eB,ew||eB,ex)}if(eA.cm){eA.cm.curOp.userSelChange=true}}function c(ez,ew,ex){var ey={anchor:ew,head:ex};ah(ez,"beforeSelectionChange",ez,ey);if(ez.cm){ah(ez.cm,"beforeSelectionChange",ez.cm,ey)}ey.anchor=d9(ez,ey.anchor);ey.head=d9(ez,ey.head);return ey}function bh(eD,eA,eB,ey,ex){if(!ex&&dP(eD,"beforeSelectionChange")||eD.cm&&dP(eD.cm,"beforeSelectionChange")){var ez=c(eD,eA,eB);eB=ez.head;eA=ez.anchor}var eC=eD.sel;eC.goalColumn=null;if(ey==null){ey=dK(eB,eC.head)?-1:1}if(ex||!d8(eA,eC.anchor)){eA=bi(eD,eA,ey,ex!="push")}if(ex||!d8(eB,eC.head)){eB=bi(eD,eB,ey,ex!="push")}if(d8(eC.anchor,eA)&&d8(eC.head,eB)){return}eC.anchor=eA;eC.head=eB;var ew=dK(eB,eA);eC.from=ew?eB:eA;eC.to=ew?eA:eB;if(eD.cm){eD.cm.curOp.updateInput=eD.cm.curOp.selectionChanged=eD.cm.curOp.cursorActivity=true}O(eD,"cursorActivity",eD)}function c7(ew){bh(ew.doc,ew.doc.sel.from,ew.doc.sel.to,null,"push")}function bi(eF,eE,eB,eC){var eG=false,ey=eE;var ez=eB||1;eF.cantEdit=false;search:for(;;){var eH=dJ(eF,ey.line);if(eH.markedSpans){for(var eA=0;eA<eH.markedSpans.length;++eA){var ew=eH.markedSpans[eA],ex=ew.marker;if((ew.from==null||(ex.inclusiveLeft?ew.from<=ey.ch:ew.from<ey.ch))&&(ew.to==null||(ex.inclusiveRight?ew.to>=ey.ch:ew.to>ey.ch))){if(eC){ah(ex,"beforeCursorEnter");if(ex.explicitlyCleared){if(!eH.markedSpans){break}else{--eA;continue}}}if(!ex.atomic){continue}var eD=ex.find()[ez<0?"from":"to"];if(d8(eD,ey)){eD.ch+=ez;if(eD.ch<0){if(eD.line>eF.first){eD=d9(eF,K(eD.line-1))}else{eD=null}}else{if(eD.ch>eH.text.length){if(eD.line<eF.first+eF.size-1){eD=K(eD.line+1,0)}else{eD=null}}}if(!eD){if(eG){if(!eC){return bi(eF,eE,eB,true)}eF.cantEdit=true;return K(eF.first,0)}eG=true;eD=eE;ez=-ez}}ey=eD;continue search}}}return ey}}function ae(ex){var eA=x(ex,ex.doc.sel.head,null,ex.options.cursorScrollMargin);if(!ex.state.focused){return}var eB=ex.display,ey=an(eB.sizer),ew=null;if(eA.top+ey.top<0){ew=true}else{if(eA.bottom+ey.top>(window.innerHeight||document.documentElement.clientHeight)){ew=false}}if(ew!=null&&!dY){var ez=ej("div","\u200b",null,"position: absolute; top: "+(eA.top-eB.viewOffset)+"px; height: "+(eA.bottom-eA.top+aO)+"px; left: "+eA.left+"px; width: 2px;");ex.display.lineSpace.appendChild(ez);ez.scrollIntoView(ew);ex.display.lineSpace.removeChild(ez)}}function x(eF,eD,eA,ez){if(ez==null){ez=0}for(;;){var eB=false,eE=cH(eF,eD);var ew=!eA||eA==eD?eE:cH(eF,eA);var ey=A(eF,Math.min(eE.left,ew.left),Math.min(eE.top,ew.top)-ez,Math.max(eE.left,ew.left),Math.max(eE.bottom,ew.bottom)+ez);var eC=eF.doc.scrollTop,ex=eF.doc.scrollLeft;if(ey.scrollTop!=null){F(eF,ey.scrollTop);if(Math.abs(eF.doc.scrollTop-eC)>1){eB=true}}if(ey.scrollLeft!=null){a3(eF,ey.scrollLeft);if(Math.abs(eF.doc.scrollLeft-ex)>1){eB=true}}if(!eB){return eE}}}function z(ew,ey,eA,ex,ez){var eB=A(ew,ey,eA,ex,ez);if(eB.scrollTop!=null){F(ew,eB.scrollTop)}if(eB.scrollLeft!=null){a3(ew,eB.scrollLeft)}}function A(eC,eK,ez,eJ,ey){var eH=eC.display,eG=aw(eC.display);if(ez<0){ez=0}var ex=eH.scroller.clientHeight-aO,eF=eH.scroller.scrollTop,eE={};var eM=eC.doc.height+a7(eH);var eN=ez<eG,eI=ey>eM-eG;if(ez<eF){eE.scrollTop=eN?0:ez}else{if(ey>eF+ex){var eD=Math.min(ez,(eI?eM:ey)-ex);if(eD!=eF){eE.scrollTop=eD}}}var eB=eH.scroller.clientWidth-aO,ew=eH.scroller.scrollLeft;eK+=eH.gutters.offsetWidth;eJ+=eH.gutters.offsetWidth;var eA=eH.gutters.offsetWidth;var eL=eK<eA+10;if(eK<ew+eA||eL){if(eL){eK=0}eE.scrollLeft=Math.max(0,eK-10-eA)}else{if(eJ>eB+ew-3){eE.scrollLeft=eJ+10-eB}}return eE}function y(ew,ey,ex){ew.curOp.updateScrollPos={scrollLeft:ey==null?ew.doc.scrollLeft:ey,scrollTop:ex==null?ew.doc.scrollTop:ex}}function b0(ex,ez,ey){var eA=ex.curOp.updateScrollPos||(ex.curOp.updateScrollPos={scrollLeft:ex.doc.scrollLeft,scrollTop:ex.doc.scrollTop});var ew=ex.display.scroller;eA.scrollTop=Math.max(0,Math.min(ew.scrollHeight-ew.clientHeight,eA.scrollTop+ey));eA.scrollLeft=Math.max(0,Math.min(ew.scrollWidth-ew.clientWidth,eA.scrollLeft+ez))}function N(eI,ez,eH,ey){var eG=eI.doc;if(eH==null){eH="add"}if(eH=="smart"){if(!eI.doc.mode.indent){eH="prev"}else{var ex=cw(eI,ez)}}var eC=eI.options.tabSize;var eJ=dJ(eG,ez),eB=bg(eJ.text,null,eC);var ew=eJ.text.match(/^\s*/)[0],eE;if(!ey&&!/\S/.test(eJ.text)){eE=0;eH="not"}else{if(eH=="smart"){eE=eI.doc.mode.indent(ex,eJ.text.slice(ew.length),eJ.text);if(eE==bv){if(!ey){return}eH="prev"}}}if(eH=="prev"){if(ez>eG.first){eE=bg(dJ(eG,ez-1).text,null,eC)}else{eE=0}}else{if(eH=="add"){eE=eB+eI.options.indentUnit}else{if(eH=="subtract"){eE=eB-eI.options.indentUnit}else{if(typeof eH=="number"){eE=eB+eH}}}}eE=Math.max(0,eE);var eF="",eD=0;if(eI.options.indentWithTabs){for(var eA=Math.floor(eE/eC);eA;--eA){eD+=eC;eF+="\t"}}if(eD<eE){eF+=bJ(eE-eD)}if(eF!=ew){az(eI.doc,eF,K(ez,0),K(ez,ew.length),"+input")}else{if(eG.sel.head.line==ez&&eG.sel.head.ch<ew.length){bh(eG,K(ez,ew.length),K(ez,ew.length),1)}}eJ.stateAfter=null}function c9(ew,ey,eB){var eA=ey,ex=ey,ez=ew.doc;if(typeof ey=="number"){ex=dJ(ez,cb(ez,ey))}else{eA=bc(ey)}if(eA==null){return null}if(eB(ex,eA)){Q(ew,eA,eA+1)}else{return null}return ex}function aZ(eN,ez,eH,eG,eB){var eE=ez.line,eF=ez.ch,eM=eH;var ew=dJ(eN,eE);var eK=true;function eL(){var eO=eE+eH;if(eO<eN.first||eO>=eN.first+eN.size){return(eK=false)}eE=eO;return ew=dJ(eN,eO)}function eJ(eP){var eO=(eB?q:R)(ew,eF,eH,true);if(eO==null){if(!eP&&eL()){if(eB){eF=(eH<0?b4:bU)(ew)}else{eF=eH<0?ew.text.length:0}}else{return(eK=false)}}else{eF=eO}return true}if(eG=="char"){eJ()}else{if(eG=="column"){eJ(true)}else{if(eG=="word"||eG=="group"){var eI=null,eC=eG=="group";for(var eA=true;;eA=false){if(eH<0&&!eJ(!eA)){break}var ex=ew.text.charAt(eF)||"\n";var ey=bR(ex)?"w":!eC?null:/\s/.test(ex)?null:"p";if(eI&&eI!=ey){if(eH<0){eH=1;eJ()}break}if(ey){eI=ey}if(eH>0&&!eJ(!eA)){break}}}}}var eD=bi(eN,K(eE,eF),eM,true);if(!eK){eD.hitSide=true}return eD}function aV(eE,ez,ew,eD){var eC=eE.doc,eB=ez.left,eA;if(eD=="page"){var ey=Math.min(eE.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);eA=ez.top+ew*(ey-(ew<0?1.5:0.5)*aw(eE.display))}else{if(eD=="line"){eA=ew>0?ez.bottom+3:ez.top-3}}for(;;){var ex=ed(eE,eB,eA);if(!ex.outside){break}if(ew<0?eA<=0:eA>=eC.height){ex.hitSide=true;break}eA+=ew*5}return ex}function ab(ez,eB){var eA=eB.ch,ey=eB.ch;if(ez){if((eB.xRel<0||ey==ez.length)&&eA){--eA}else{++ey}var ex=ez.charAt(eA);var ew=bR(ex)?bR:/\s/.test(ex)?function(eC){return/\s/.test(eC)}:function(eC){return !/\s/.test(eC)&&!bR(eC)};while(eA>0&&ew(ez.charAt(eA-1))){--eA}while(ey<ez.length&&ew(ez.charAt(ey))){++ey}}return{from:K(eB.line,eA),to:K(eB.line,ey)}}function aQ(ew,ex){eg(ew.doc,K(ex,0),d9(ew.doc,K(ex+1,0)))}B.prototype={constructor:B,focus:function(){window.focus();db(this);w(this)},setOption:function(ey,ez){var ex=this.options,ew=ex[ey];if(ex[ey]==ez&&ey!="mode"){return}ex[ey]=ez;if(aK.hasOwnProperty(ey)){b9(this,aK[ey])(this,ez,ew)}},getOption:function(ew){return this.options[ew]},getDoc:function(){return this.doc},addKeyMap:function(ex,ew){this.state.keyMaps[ew?"push":"unshift"](ex)},removeKeyMap:function(ex){var ey=this.state.keyMaps;for(var ew=0;ew<ey.length;++ew){if(ey[ew]==ex||(typeof ey[ew]!="string"&&ey[ew].name==ex)){ey.splice(ew,1);return true}}},addOverlay:b9(null,function(ew,ex){var ey=ew.token?ew:B.getMode(this.options,ew);if(ey.startState){throw new Error("Overlays may not be stateful.")}this.state.overlays.push({mode:ey,modeSpec:ew,opaque:ex&&ex.opaque});this.state.modeGen++;Q(this)}),removeOverlay:b9(null,function(ew){var ey=this.state.overlays;for(var ex=0;ex<ey.length;++ex){var ez=ey[ex].modeSpec;if(ez==ew||typeof ew=="string"&&ez.name==ew){ey.splice(ex,1);this.state.modeGen++;Q(this);return}}}),indentLine:b9(null,function(ey,ew,ex){if(typeof ew!="string"&&typeof ew!="number"){if(ew==null){ew=this.options.smartIndent?"smart":"prev"}else{ew=ew?"add":"subtract"}}if(bt(this.doc,ey)){N(this,ey,ew,ex)}}),indentSelection:b9(null,function(ex){var ey=this.doc.sel;if(d8(ey.from,ey.to)){return N(this,ey.from.line,ex,true)}var ez=ey.to.line-(ey.to.ch?0:1);for(var ew=ey.from.line;ew<=ez;++ew){N(this,ew,ex)}}),getTokenAt:function(eD,ex){var eA=this.doc;eD=d9(eA,eD);var ez=cw(this,eD.line,ex),eC=this.doc.mode;var ew=dJ(eA,eD.line);var eB=new ds(ew.text,this.options.tabSize);while(eB.pos<eD.ch&&!eB.eol()){eB.start=eB.pos;var ey=eC.token(eB,ez)}return{start:eB.start,end:eB.pos,string:eB.current(),className:ey||null,type:ey||null,state:ez}},getTokenTypeAt:function(eB){eB=d9(this.doc,eB);var ey=cd(this,dJ(this.doc,eB.line));var ez=0,eA=(ey.length-1)/2,ex=eB.ch;if(ex==0){return ey[2]}for(;;){var ew=(ez+eA)>>1;if((ew?ey[ew*2-1]:0)>=ex){eA=ew}else{if(ey[ew*2+1]<ex){ez=ew+1}else{return ey[ew*2+2]}}}},getModeAt:function(ex){var ew=this.doc.mode;if(!ew.innerMode){return ew}return B.innerMode(ew,this.getTokenAt(ex).state).mode},getHelper:function(ex,ew){return this.getHelpers(ex,ew)[0]},getHelpers:function(eD,ey){var ez=[];if(!dS.hasOwnProperty(ey)){return dS}var ew=dS[ey],eC=this.getModeAt(eD);if(typeof eC[ey]=="string"){if(ew[eC[ey]]){ez.push(ew[eC[ey]])}}else{if(eC[ey]){for(var ex=0;ex<eC[ey].length;ex++){var eB=ew[eC[ey][ex]];if(eB){ez.push(eB)}}}else{if(eC.helperType&&ew[eC.helperType]){ez.push(ew[eC.helperType])}else{if(ew[eC.name]){ez.push(ew[eC.name])}}}}for(var ex=0;ex<ew._global.length;ex++){var eA=ew._global[ex];if(eA.pred(eC,this)&&cl(ez,eA.val)==-1){ez.push(eA.val)}}return ez},getStateAfter:function(ex,ew){var ey=this.doc;ex=cb(ey,ex==null?ey.first+ey.size-1:ex);return cw(this,ex+1,ew)},cursorCoords:function(ez,ex){var ey,ew=this.doc.sel;if(ez==null){ey=ew.head}else{if(typeof ez=="object"){ey=d9(this.doc,ez)}else{ey=ez?ew.from:ew.to}}return cH(this,ey,ex||"page")},charCoords:function(ex,ew){return bZ(this,d9(this.doc,ex),ew||"page")},coordsChar:function(ew,ex){ew=es(this,ew,ex||"page");return ed(this,ew.left,ew.top)},lineAtHeight:function(ew,ex){ew=es(this,{top:ew,left:0},ex||"page").top;return a5(this.doc,ew+this.display.viewOffset)},heightAtLine:function(ex,eA){var ew=false,ez=this.doc.first+this.doc.size-1;if(ex<this.doc.first){ex=this.doc.first}else{if(ex>ez){ex=ez;ew=true}}var ey=dJ(this.doc,ex);return dp(this,dJ(this.doc,ex),{top:0,left:0},eA||"page").top+(ew?ey.height:0)},defaultTextHeight:function(){return aw(this.display)},defaultCharWidth:function(){return cy(this.display)},setGutterMarker:b9(null,function(ew,ex,ey){return c9(this,ew,function(ez){var eA=ez.gutterMarkers||(ez.gutterMarkers={});eA[ex]=ey;if(!ey&&dt(eA)){ez.gutterMarkers=null}return true})}),clearGutter:b9(null,function(ey){var ew=this,ez=ew.doc,ex=ez.first;ez.iter(function(eA){if(eA.gutterMarkers&&eA.gutterMarkers[ey]){eA.gutterMarkers[ey]=null;Q(ew,ex,ex+1);if(dt(eA.gutterMarkers)){eA.gutterMarkers=null}}++ex})}),addLineClass:b9(null,function(ey,ex,ew){return c9(this,ey,function(ez){var eA=ex=="text"?"textClass":ex=="background"?"bgClass":"wrapClass";if(!ez[eA]){ez[eA]=ew}else{if(new RegExp("(?:^|\\s)"+ew+"(?:$|\\s)").test(ez[eA])){return false}else{ez[eA]+=" "+ew}}return true})}),removeLineClass:b9(null,function(ey,ex,ew){return c9(this,ey,function(eA){var eD=ex=="text"?"textClass":ex=="background"?"bgClass":"wrapClass";var eC=eA[eD];if(!eC){return false}else{if(ew==null){eA[eD]=null}else{var eB=eC.match(new RegExp("(?:^|\\s+)"+ew+"(?:$|\\s+)"));if(!eB){return false}var ez=eB.index+eB[0].length;eA[eD]=eC.slice(0,eB.index)+(!eB.index||ez==eC.length?"":" ")+eC.slice(ez)||null}}return true})}),addLineWidget:b9(null,function(ey,ex,ew){return a6(this,ey,ex,ew)}),removeLineWidget:function(ew){ew.clear()},lineInfo:function(ew){if(typeof ew=="number"){if(!bt(this.doc,ew)){return null}var ex=ew;ew=dJ(this.doc,ew);if(!ew){return null}}else{var ex=bc(ew);if(ex==null){return null}}return{line:ex,handle:ew,text:ew.text,gutterMarkers:ew.gutterMarkers,textClass:ew.textClass,bgClass:ew.bgClass,wrapClass:ew.wrapClass,widgets:ew.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(eB,ey,eD,ez,eF){var eA=this.display;eB=cH(this,d9(this.doc,eB));var eC=eB.bottom,ex=eB.left;ey.style.position="absolute";eA.sizer.appendChild(ey);if(ez=="over"){eC=eB.top}else{if(ez=="above"||ez=="near"){var ew=Math.max(eA.wrapper.clientHeight,this.doc.height),eE=Math.max(eA.sizer.clientWidth,eA.lineSpace.clientWidth);if((ez=="above"||eB.bottom+ey.offsetHeight>ew)&&eB.top>ey.offsetHeight){eC=eB.top-ey.offsetHeight}else{if(eB.bottom+ey.offsetHeight<=ew){eC=eB.bottom}}if(ex+ey.offsetWidth>eE){ex=eE-ey.offsetWidth}}}ey.style.top=eC+"px";ey.style.left=ey.style.right="";if(eF=="right"){ex=eA.sizer.clientWidth-ey.offsetWidth;ey.style.right="0px"}else{if(eF=="left"){ex=0}else{if(eF=="middle"){ex=(eA.sizer.clientWidth-ey.offsetWidth)/2}}ey.style.left=ex+"px"}if(eD){z(this,ex,eC,ex+ey.offsetWidth,eC+ey.offsetHeight)}},triggerOnKeyDown:b9(null,m),execCommand:function(ew){if(dd.hasOwnProperty(ew)){return dd[ew](this)}},findPosH:function(eC,ez,eA,ex){var ew=1;if(ez<0){ew=-1;ez=-ez}for(var ey=0,eB=d9(this.doc,eC);ey<ez;++ey){eB=aZ(this.doc,eB,ew,eA,ex);if(eB.hitSide){break}}return eB},moveH:b9(null,function(ew,ex){var ey=this.doc.sel,ez;if(ey.shift||ey.extend||d8(ey.from,ey.to)){ez=aZ(this.doc,ey.head,ew,ex,this.options.rtlMoveVisually)}else{ez=ew<0?ey.from:ey.to}eg(this.doc,ez,ez,ew)}),deleteH:b9(null,function(ew,ex){var ey=this.doc.sel;if(!d8(ey.from,ey.to)){az(this.doc,"",ey.from,ey.to,"+delete")}else{az(this.doc,"",ey.from,aZ(this.doc,ey.head,ew,ex,false),"+delete")}this.curOp.userSelChange=true}),findPosV:function(eB,ey,eC,eE){var ew=1,eA=eE;if(ey<0){ew=-1;ey=-ey}for(var ex=0,eD=d9(this.doc,eB);ex<ey;++ex){var ez=cH(this,eD,"div");if(eA==null){eA=ez.left}else{ez.left=eA}eD=aV(this,ez,ew,eC);if(eD.hitSide){break}}return eD},moveV:b9(null,function(ex,ey){var ez=this.doc.sel,eA,ew;if(ez.shift||ez.extend||d8(ez.from,ez.to)){var eB=cH(this,ez.head,"div");if(ez.goalColumn!=null){eB.left=ez.goalColumn}eA=aV(this,eB,ex,ey);if(ey=="page"){b0(this,0,bZ(this,eA,"div").top-eB.top)}ew=eB.left}else{eA=ex<0?ez.from:ez.to}eg(this.doc,eA,eA,ex);if(ew!=null){ez.goalColumn=ew}}),toggleOverwrite:function(ew){if(ew!=null&&ew==this.state.overwrite){return}if(this.state.overwrite=!this.state.overwrite){this.display.cursor.className+=" CodeMirror-overwrite"}else{this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror-overwrite","")}},hasFocus:function(){return this.state.focused},scrollTo:b9(null,function(ew,ex){y(this,ew,ex)}),getScrollInfo:function(){var ew=this.display.scroller,ex=aO;return{left:ew.scrollLeft,top:ew.scrollTop,height:ew.scrollHeight-ex,width:ew.scrollWidth-ex,clientHeight:ew.clientHeight-ex,clientWidth:ew.clientWidth-ex}},scrollIntoView:b9(null,function(ex,ez){if(ex==null){ex={from:this.doc.sel.head,to:null}}else{if(typeof ex=="number"){ex={from:K(ex,0),to:null}}else{if(ex.from==null){ex={from:ex,to:null}}}}if(!ex.to){ex.to=ex.from}if(!ez){ez=0}var ey=ex;if(ex.from.line!=null){this.curOp.scrollToPos={from:ex.from,to:ex.to,margin:ez};ey={from:cH(this,ex.from),to:cH(this,ex.to)}}var ew=A(this,Math.min(ey.from.left,ey.to.left),Math.min(ey.from.top,ey.to.top)-ez,Math.max(ey.from.right,ey.to.right),Math.max(ey.from.bottom,ey.to.bottom)+ez);y(this,ew.scrollLeft,ew.scrollTop)}),setSize:b9(null,function(ey,ew){function ex(ez){return typeof ez=="number"||/^\d+$/.test(String(ez))?ez+"px":ez}if(ey!=null){this.display.wrapper.style.width=ex(ey)}if(ew!=null){this.display.wrapper.style.height=ex(ew)}if(this.options.lineWrapping){this.display.measureLineCache.length=this.display.measureLineCachePos=0}this.curOp.forceUpdate=true}),operation:function(ew){return b1(this,ew)},refresh:b9(null,function(){var ew=this.display.cachedTextHeight==null;T(this);y(this,this.doc.scrollLeft,this.doc.scrollTop);Q(this);if(ew){L(this)}}),swapDoc:b9(null,function(ex){var ew=this.doc;ew.cm=null;cQ(this,ex);T(this);dU(this,true);y(this,ex.scrollLeft,ex.scrollTop);O(this,"swapDoc",this,ew);return ew}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};a0(B);var aK=B.optionHandlers={};var dA=B.defaults={};function o(ew,ez,ey,ex){B.defaults[ew]=ez;if(ey){aK[ew]=ex?function(eA,eC,eB){if(eB!=bw){ey(eA,eC,eB)}}:ey}}var bw=B.Init={toString:function(){return"CodeMirror.Init"}};o("value","",function(ew,ex){ew.setValue(ex)},true);o("mode",null,function(ew,ex){ew.doc.modeOption=ex;aW(ew)},true);o("indentUnit",2,aW,true);o("indentWithTabs",false);o("smartIndent",true);o("tabSize",4,function(ew){cZ(ew);T(ew);Q(ew)},true);o("specialChars",/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/g,function(ew,ex){ew.options.specialChars=new RegExp(ex.source+(ex.test("\t")?"":"|\t"),"g");ew.refresh()},true);o("specialCharPlaceholder",dH,function(ew){ew.refresh()},true);o("electricChars",true);o("rtlMoveVisually",!ao);o("wholeLineUpdateBefore",true);o("theme","default",function(ew){b2(ew);ct(ew)},true);o("keyMap","default",et);o("extraKeys",null);o("onKeyEvent",null);o("onDragEvent",null);o("lineWrapping",false,dj,true);o("gutters",[],function(ew){by(ew.options);ct(ew)},true);o("fixedGutter",true,function(ew,ex){ew.display.gutters.style.left=ex?cJ(ew.display)+"px":"0";ew.refresh()},true);o("coverGutterNextToScrollbar",false,dw,true);o("lineNumbers",false,function(ew){by(ew.options);ct(ew)},true);o("firstLineNumber",1,ct,true);o("lineNumberFormatter",function(ew){return ew},ct,true);o("showCursorWhenSelecting",false,a2,true);o("resetSelectionOnContextMenu",true);o("readOnly",false,function(ew,ex){if(ex=="nocursor"){au(ew);ew.display.input.blur();ew.display.disabled=true}else{ew.display.disabled=false;if(!ex){dU(ew,true)}}});o("disableInput",false,function(ew,ex){if(!ex){dU(ew,true)}},true);o("dragDrop",true);o("cursorBlinkRate",530);o("cursorScrollMargin",0);o("cursorHeight",1);o("workTime",100);o("workDelay",100);o("flattenSpans",true,cZ,true);o("addModeClass",false,cZ,true);o("pollInterval",100);o("undoDepth",40,function(ew,ex){ew.doc.history.undoDepth=ex});o("historyEventDelay",500);o("viewportMargin",10,function(ew){ew.refresh()},true);o("maxHighlightLength",10000,cZ,true);o("crudeMeasuringFrom",10000);o("moveInputWithCursor",true,function(ew,ex){if(!ex){ew.display.inputDiv.style.top=ew.display.inputDiv.style.left=0}});o("tabindex",null,function(ew,ex){ew.display.input.tabIndex=ex||""});o("autofocus",null);var cq=B.modes={},at=B.mimeModes={};B.defineMode=function(ew,ey){if(!B.defaults.mode&&ew!="null"){B.defaults.mode=ew}if(arguments.length>2){ey.dependencies=[];for(var ex=2;ex<arguments.length;++ex){ey.dependencies.push(arguments[ex])}}cq[ew]=ey};B.defineMIME=function(ex,ew){at[ex]=ew};B.resolveMode=function(ew){if(typeof ew=="string"&&at.hasOwnProperty(ew)){ew=at[ew]}else{if(ew&&typeof ew.name=="string"&&at.hasOwnProperty(ew.name)){var ex=at[ew.name];ew=bD(ex,ew);ew.name=ex.name}else{if(typeof ew=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(ew)){return B.resolveMode("application/xml")}}}if(typeof ew=="string"){return{name:ew}}else{return ew||{name:"null"}}};B.getMode=function(ex,ew){var ew=B.resolveMode(ew);var ez=cq[ew.name];if(!ez){return B.getMode(ex,"text/plain")}var eA=ez(ex,ew);if(co.hasOwnProperty(ew.name)){var ey=co[ew.name];for(var eB in ey){if(!ey.hasOwnProperty(eB)){continue}if(eA.hasOwnProperty(eB)){eA["_"+eB]=eA[eB]}eA[eB]=ey[eB]}}eA.name=ew.name;if(ew.helperType){eA.helperType=ew.helperType}if(ew.modeProps){for(var eB in ew.modeProps){eA[eB]=ew.modeProps[eB]}}return eA};B.defineMode("null",function(){return{token:function(ew){ew.skipToEnd()}}});B.defineMIME("text/plain","null");var co=B.modeExtensions={};B.extendMode=function(ey,ex){var ew=co.hasOwnProperty(ey)?co[ey]:(co[ey]={});am(ex,ew)};B.defineExtension=function(ew,ex){B.prototype[ew]=ex};B.defineDocExtension=function(ew,ex){aa.prototype[ew]=ex};B.defineOption=o;var aE=[];B.defineInitHook=function(ew){aE.push(ew)};var dS=B.helpers={};B.registerHelper=function(ex,ew,ey){if(!dS.hasOwnProperty(ex)){dS[ex]=B[ex]={_global:[]}}dS[ex][ew]=ey};B.registerGlobalHelper=function(ey,ex,ew,ez){B.registerHelper(ey,ex,ez);dS[ey]._global.push({pred:ew,val:ez})};B.isWordChar=bR;function bo(ez,ew){if(ew===true){return ew}if(ez.copyState){return ez.copyState(ew)}var ey={};for(var eA in ew){var ex=ew[eA];if(ex instanceof Array){ex=ex.concat([])}ey[eA]=ex}return ey}B.copyState=bo;function bm(ey,ex,ew){return ey.startState?ey.startState(ex,ew):true}B.startState=bm;B.innerMode=function(ey,ew){while(ey.innerMode){var ex=ey.innerMode(ew);if(!ex||ex.mode==ey){break}ew=ex.state;ey=ex.mode}return ex||{mode:ey,state:ew}};var dd=B.commands={selectAll:function(ew){ew.setSelection(K(ew.firstLine(),0),K(ew.lastLine()))},killLine:function(ew){var ez=ew.getCursor(true),ey=ew.getCursor(false),ex=!d8(ez,ey);if(!ex&&ew.getLine(ez.line).length==ez.ch){ew.replaceRange("",ez,K(ez.line+1,0),"+delete")}else{ew.replaceRange("",ez,ex?ey:K(ez.line),"+delete")}},deleteLine:function(ew){var ex=ew.getCursor().line;ew.replaceRange("",K(ex,0),K(ex),"+delete")},delLineLeft:function(ew){var ex=ew.getCursor();ew.replaceRange("",K(ex.line,0),ex,"+delete")},undo:function(ew){ew.undo()},redo:function(ew){ew.redo()},goDocStart:function(ew){ew.extendSelection(K(ew.firstLine(),0))},goDocEnd:function(ew){ew.extendSelection(K(ew.lastLine()))},goLineStart:function(ew){ew.extendSelection(aY(ew,ew.getCursor().line))},goLineStartSmart:function(ex){var eB=ex.getCursor(),eC=aY(ex,eB.line);var ey=ex.getLineHandle(eC.line);var ew=a(ey);if(!ew||ew[0].level==0){var eA=Math.max(0,ey.text.search(/\S/));var ez=eB.line==eC.line&&eB.ch<=eA&&eB.ch;ex.extendSelection(K(eC.line,ez?0:eA))}else{ex.extendSelection(eC)}},goLineEnd:function(ew){ew.extendSelection(cE(ew,ew.getCursor().line))},goLineRight:function(ew){var ex=ew.charCoords(ew.getCursor(),"div").top+5;ew.extendSelection(ew.coordsChar({left:ew.display.lineDiv.offsetWidth+100,top:ex},"div"))},goLineLeft:function(ew){var ex=ew.charCoords(ew.getCursor(),"div").top+5;ew.extendSelection(ew.coordsChar({left:0,top:ex},"div"))},goLineUp:function(ew){ew.moveV(-1,"line")},goLineDown:function(ew){ew.moveV(1,"line")},goPageUp:function(ew){ew.moveV(-1,"page")},goPageDown:function(ew){ew.moveV(1,"page")},goCharLeft:function(ew){ew.moveH(-1,"char")},goCharRight:function(ew){ew.moveH(1,"char")},goColumnLeft:function(ew){ew.moveH(-1,"column")},goColumnRight:function(ew){ew.moveH(1,"column")},goWordLeft:function(ew){ew.moveH(-1,"word")},goGroupRight:function(ew){ew.moveH(1,"group")},goGroupLeft:function(ew){ew.moveH(-1,"group")},goWordRight:function(ew){ew.moveH(1,"word")},delCharBefore:function(ew){ew.deleteH(-1,"char")},delCharAfter:function(ew){ew.deleteH(1,"char")},delWordBefore:function(ew){ew.deleteH(-1,"word")},delWordAfter:function(ew){ew.deleteH(1,"word")},delGroupBefore:function(ew){ew.deleteH(-1,"group")},delGroupAfter:function(ew){ew.deleteH(1,"group")},indentAuto:function(ew){ew.indentSelection("smart")},indentMore:function(ew){ew.indentSelection("add")},indentLess:function(ew){ew.indentSelection("subtract")},insertTab:function(ew){ew.replaceSelection("\t","end","+input")},defaultTab:function(ew){if(ew.somethingSelected()){ew.indentSelection("add")}else{ew.replaceSelection("\t","end","+input")}},transposeChars:function(ew){var ey=ew.getCursor(),ex=ew.getLine(ey.line);if(ey.ch>0&&ey.ch<ex.length-1){ew.replaceRange(ex.charAt(ey.ch)+ex.charAt(ey.ch-1),K(ey.line,ey.ch-1),K(ey.line,ey.ch+1))}},newlineAndIndent:function(ew){b9(ew,function(){ew.replaceSelection("\n","end","+input");ew.indentLine(ew.getCursor().line,null,true)})()},toggleOverwrite:function(ew){ew.toggleOverwrite()}};var dF=B.keyMap={};dF.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite"};dF.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore",fallthrough:"basic"};dF.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delLineLeft",fallthrough:["basic","emacsy"]};dF["default"]=bq?dF.macDefault:dF.pcDefault;dF.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"};function eh(ew){if(typeof ew=="string"){return dF[ew]}else{return ew}}function g(ex,eB,ez){function eA(eH){eH=eh(eH);var eF=eH[ex];if(eF===false){return"stop"}if(eF!=null&&ez(eF)){return true}if(eH.nofallthrough){return"stop"}var eE=eH.fallthrough;if(eE==null){return false}if(Object.prototype.toString.call(eE)!="[object Array]"){return eA(eE)}for(var eD=0,eG=eE.length;eD<eG;++eD){var eC=eA(eE[eD]);if(eC){return eC}}return false}for(var ey=0;ey<eB.length;++ey){var ew=eA(eB[ey]);if(ew){return ew!="stop"}}}function dc(ex){var ew=dL[ex.keyCode];return ew=="Ctrl"||ew=="Alt"||ew=="Shift"||ew=="Mod"}function dW(ex,ey){if(d1&&ex.keyCode==34&&ex["char"]){return false}var ew=dL[ex.keyCode];if(ew==null||ex.altGraphKey){return false}if(ex.altKey){ew="Alt-"+ew}if(be?ex.metaKey:ex.ctrlKey){ew="Ctrl-"+ew}if(be?ex.ctrlKey:ex.metaKey){ew="Cmd-"+ew}if(!ey&&ex.shiftKey){ew="Shift-"+ew}return ew}B.lookupKey=g;B.isModifierKey=dc;B.keyName=dW;B.fromTextArea=function(eD,eE){if(!eE){eE={}}eE.value=eD.value;if(!eE.tabindex&&eD.tabindex){eE.tabindex=eD.tabindex}if(!eE.placeholder&&eD.placeholder){eE.placeholder=eD.placeholder}if(eE.autofocus==null){var ew=document.body;try{ew=document.activeElement}catch(ey){}eE.autofocus=ew==eD||eD.getAttribute("autofocus")!=null&&ew==document.body}function eA(){eD.value=eC.getValue()}if(eD.form){bk(eD.form,"submit",eA);if(!eE.leaveSubmitMethodAlone){var ex=eD.form,eB=ex.submit;try{var ez=ex.submit=function(){eA();ex.submit=eB;ex.submit();ex.submit=ez}}catch(ey){}}}eD.style.display="none";var eC=B(function(eF){eD.parentNode.insertBefore(eF,eD.nextSibling)},eE);eC.save=eA;eC.getTextArea=function(){return eD};eC.toTextArea=function(){eA();eD.parentNode.removeChild(eC.getWrapperElement());eD.style.display="";if(eD.form){cT(eD.form,"submit",eA);if(typeof eD.form.submit=="function"){eD.form.submit=eB}}};return eC};function ds(ew,ex){this.pos=this.start=0;this.string=ew;this.tabSize=ex||8;this.lastColumnPos=this.lastColumnValue=0;this.lineStart=0}ds.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||undefined},next:function(){if(this.pos<this.string.length){return this.string.charAt(this.pos++)}},eat:function(ew){var ey=this.string.charAt(this.pos);if(typeof ew=="string"){var ex=ey==ew}else{var ex=ey&&(ew.test?ew.test(ey):ew(ey))}if(ex){++this.pos;return ey}},eatWhile:function(ew){var ex=this.pos;while(this.eat(ew)){}return this.pos>ex},eatSpace:function(){var ew=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos))){++this.pos}return this.pos>ew},skipToEnd:function(){this.pos=this.string.length},skipTo:function(ew){var ex=this.string.indexOf(ew,this.pos);if(ex>-1){this.pos=ex;return true}},backUp:function(ew){this.pos-=ew},column:function(){if(this.lastColumnPos<this.start){this.lastColumnValue=bg(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue);this.lastColumnPos=this.start}return this.lastColumnValue-(this.lineStart?bg(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return bg(this.string,null,this.tabSize)-(this.lineStart?bg(this.string,this.lineStart,this.tabSize):0)},match:function(eA,ex,ew){if(typeof eA=="string"){var eB=function(eC){return ew?eC.toLowerCase():eC};var ez=this.string.substr(this.pos,eA.length);if(eB(ez)==eB(eA)){if(ex!==false){this.pos+=eA.length}return true}}else{var ey=this.string.slice(this.pos).match(eA);if(ey&&ey.index>0){return null}if(ey&&ex!==false){this.pos+=ey[0].length}return ey}},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(ex,ew){this.lineStart+=ex;try{return ew()}finally{this.lineStart-=ex}}};B.StringStream=ds;function H(ex,ew){this.lines=[];this.type=ew;this.doc=ex}B.TextMarker=H;a0(H);H.prototype.clear=function(){if(this.explicitlyCleared){return}var eD=this.doc.cm,ex=eD&&!eD.curOp;if(ex){bY(eD)}if(dP(this,"clear")){var eE=this.find();if(eE){O(this,"clear",eE.from,eE.to)}}var ey=null,eB=null;for(var ez=0;ez<this.lines.length;++ez){var eF=this.lines[ez];var eC=dE(eF.markedSpans,this);if(eC.to!=null){eB=bc(eF)}eF.markedSpans=dk(eF.markedSpans,eC);if(eC.from!=null){ey=bc(eF)}else{if(this.collapsed&&!dZ(this.doc,eF)&&eD){eo(eF,aw(eD.display))}}}if(eD&&this.collapsed&&!eD.options.lineWrapping){for(var ez=0;ez<this.lines.length;++ez){var ew=u(eD.doc,this.lines[ez]),eA=c0(eD.doc,ew);if(eA>eD.display.maxLineLength){eD.display.maxLine=ew;eD.display.maxLineLength=eA;eD.display.maxLineChanged=true}}}if(ey!=null&&eD){Q(eD,ey,eB+1)}this.lines.length=0;this.explicitlyCleared=true;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=false;if(eD){c7(eD)}}if(ex){W(eD)}};H.prototype.find=function(eA){var eC,eB;for(var ex=0;ex<this.lines.length;++ex){var ew=this.lines[ex];var ey=dE(ew.markedSpans,this);if(ey.from!=null||ey.to!=null){var ez=bc(ew);if(ey.from!=null){eC=K(ez,ey.from)}if(ey.to!=null){eB=K(ez,ey.to)}}}if(this.type=="bookmark"&&!eA){return eC}return eC&&{from:eC,to:eB}};H.prototype.changed=function(){var ez=this.find(),ew=this.doc.cm;if(!ez||!ew){return}if(this.type!="bookmark"){ez=ez.from}var ex=dJ(this.doc,ez.line);ec(ew,ex);if(ez.line>=ew.display.showingFrom&&ez.line<ew.display.showingTo){for(var ey=ew.display.lineDiv.firstChild;ey;ey=ey.nextSibling){if(ey.lineObj==ex){if(ey.offsetHeight!=ex.height){eo(ex,ey.offsetHeight)}break}}b1(ew,function(){ew.curOp.selectionChanged=ew.curOp.forceUpdate=ew.curOp.updateMaxLine=true})}};H.prototype.attachLine=function(ew){if(!this.lines.length&&this.doc.cm){var ex=this.doc.cm.curOp;if(!ex.maybeHiddenMarkers||cl(ex.maybeHiddenMarkers,this)==-1){(ex.maybeUnhiddenMarkers||(ex.maybeUnhiddenMarkers=[])).push(this)}}this.lines.push(ew)};H.prototype.detachLine=function(ew){this.lines.splice(cl(this.lines,ew),1);if(!this.lines.length&&this.doc.cm){var ex=this.doc.cm.curOp;(ex.maybeHiddenMarkers||(ex.maybeHiddenMarkers=[])).push(this)}};var aB=0;function dh(eC,eA,eB,eE,ez){if(eE&&eE.shared){return G(eC,eA,eB,eE,ez)}if(eC.cm&&!eC.cm.curOp){return b9(eC.cm,dh)(eC,eA,eB,eE,ez)}var ey=new H(eC,ez);if(eE){am(eE,ey)}if(dK(eB,eA)||d8(eA,eB)&&ey.clearWhenEmpty!==false){return ey}if(ey.replacedWith){ey.collapsed=true;ey.replacedWith=ej("span",[ey.replacedWith],"CodeMirror-widget");if(!eE.handleMouseEvents){ey.replacedWith.ignoreEvents=true}}if(ey.collapsed){if(v(eC,eA.line,eA,eB,ey)||eA.line!=eB.line&&v(eC,eB.line,eA,eB,ey)){throw new Error("Inserting collapsed marker partially overlapping an existing one")}aD=true}if(ey.addToHistory){di(eC,{from:eA,to:eB,origin:"markText"},{head:eC.sel.head,anchor:eC.sel.anchor},NaN)}var ex=eA.line,eD=eC.cm,ew;eC.iter(ex,eB.line+1,function(eF){if(eD&&ey.collapsed&&!eD.options.lineWrapping&&u(eC,eF)==eD.display.maxLine){ew=true}var eG={from:null,to:null,marker:ey};if(ex==eA.line){eG.from=eA.ch}if(ex==eB.line){eG.to=eB.ch}if(ey.collapsed&&ex!=eA.line){eo(eF,0)}bx(eF,eG);++ex});if(ey.collapsed){eC.iter(eA.line,eB.line+1,function(eF){if(dZ(eC,eF)){eo(eF,0)}})}if(ey.clearOnEnter){bk(ey,"beforeCursorEnter",function(){ey.clear()})}if(ey.readOnly){eq=true;if(eC.history.done.length||eC.history.undone.length){eC.clearHistory()}}if(ey.collapsed){ey.id=++aB;ey.atomic=true}if(eD){if(ew){eD.curOp.updateMaxLine=true}if(ey.className||ey.title||ey.startStyle||ey.endStyle||ey.collapsed){Q(eD,eA.line,eB.line+1)}if(ey.atomic){c7(eD)}}return ey}function t(ez,ex){this.markers=ez;this.primary=ex;for(var ew=0,ey=this;ew<ez.length;++ew){ez[ew].parent=this;bk(ez[ew],"clear",function(){ey.clear()})}}B.SharedTextMarker=t;a0(t);t.prototype.clear=function(){if(this.explicitlyCleared){return}this.explicitlyCleared=true;for(var ew=0;ew<this.markers.length;++ew){this.markers[ew].clear()}O(this,"clear")};t.prototype.find=function(){return this.primary.find()};function G(eA,eD,eC,ew,ey){ew=am(ew);ew.shared=false;var eB=[dh(eA,eD,eC,ew,ey)],ex=eB[0];var ez=ew.replacedWith;cN(eA,function(eF){if(ez){ew.replacedWith=ez.cloneNode(true)}eB.push(dh(eF,d9(eF,eD),d9(eF,eC),ew,ey));for(var eE=0;eE<eF.linked.length;++eE){if(eF.linked[eE].isParent){return}}ex=d7(eB)});return new t(eB,ex)}function dE(ey,ew){if(ey){for(var ex=0;ex<ey.length;++ex){var ez=ey[ex];if(ez.marker==ew){return ez}}}}function dk(ex,ey){for(var ez,ew=0;ew<ex.length;++ew){if(ex[ew]!=ey){(ez||(ez=[])).push(ex[ew])}}return ez}function bx(ew,ex){ew.markedSpans=ew.markedSpans?ew.markedSpans.concat([ex]):[ex];ex.marker.attachLine(ew)}function aq(ex,ey,eC){if(ex){for(var eA=0,eD;eA<ex.length;++eA){var eE=ex[eA],eB=eE.marker;var ew=eE.from==null||(eB.inclusiveLeft?eE.from<=ey:eE.from<ey);if(ew||eE.from==ey&&eB.type=="bookmark"&&(!eC||!eE.marker.insertLeft)){var ez=eE.to==null||(eB.inclusiveRight?eE.to>=ey:eE.to>ey);(eD||(eD=[])).push({from:eE.from,to:ez?null:eE.to,marker:eB})}}}return eD}function af(ex,ez,eC){if(ex){for(var eA=0,eD;eA<ex.length;++eA){var eE=ex[eA],eB=eE.marker;var ey=eE.to==null||(eB.inclusiveRight?eE.to>=ez:eE.to>ez);if(ey||eE.from==ez&&eB.type=="bookmark"&&(!eC||eE.marker.insertLeft)){var ew=eE.from==null||(eB.inclusiveLeft?eE.from<=ez:eE.from<ez);(eD||(eD=[])).push({from:ew?null:eE.from-ez,to:eE.to==null?null:eE.to-ez,marker:eB})}}}return eD}function cY(eI,eF){var eE=bt(eI,eF.from.line)&&dJ(eI,eF.from.line).markedSpans;var eL=bt(eI,eF.to.line)&&dJ(eI,eF.to.line).markedSpans;if(!eE&&!eL){return null}var ex=eF.from.ch,eA=eF.to.ch,eD=d8(eF.from,eF.to);var eC=aq(eE,ex,eD);var eK=af(eL,eA,eD);var eJ=eF.text.length==1,ey=d7(eF.text).length+(eJ?ex:0);if(eC){for(var ez=0;ez<eC.length;++ez){var eH=eC[ez];if(eH.to==null){var eM=dE(eK,eH.marker);if(!eM){eH.to=ex}else{if(eJ){eH.to=eM.to==null?null:eM.to+ey}}}}}if(eK){for(var ez=0;ez<eK.length;++ez){var eH=eK[ez];if(eH.to!=null){eH.to+=ey}if(eH.from==null){var eM=dE(eC,eH.marker);if(!eM){eH.from=ey;if(eJ){(eC||(eC=[])).push(eH)}}}else{eH.from+=ey;if(eJ){(eC||(eC=[])).push(eH)}}}}if(eC){eC=n(eC)}if(eK&&eK!=eC){eK=n(eK)}var eB=[eC];if(!eJ){var eG=eF.text.length-2,ew;if(eG>0&&eC){for(var ez=0;ez<eC.length;++ez){if(eC[ez].to==null){(ew||(ew=[])).push({from:null,to:null,marker:eC[ez].marker})}}}for(var ez=0;ez<eG;++ez){eB.push(ew)}eB.push(eK)}return eB}function n(ex){for(var ew=0;ew<ex.length;++ew){var ey=ex[ew];if(ey.from!=null&&ey.from==ey.to&&ey.marker.clearWhenEmpty!==false){ex.splice(ew--,1)}}if(!ex.length){return null}return ex}function cP(eE,eC){var ew=br(eE,eC);var eF=cY(eE,eC);if(!ew){return eF}if(!eF){return ew}for(var ez=0;ez<ew.length;++ez){var eA=ew[ez],eB=eF[ez];if(eA&&eB){spans:for(var ey=0;ey<eB.length;++ey){var eD=eB[ey];for(var ex=0;ex<eA.length;++ex){if(eA[ex].marker==eD.marker){continue spans}}eA.push(eD)}}else{if(eB){ew[ez]=eB}}}return ew}function bW(eG,eE,eF){var ez=null;eG.iter(eE.line,eF.line+1,function(eH){if(eH.markedSpans){for(var eI=0;eI<eH.markedSpans.length;++eI){var eJ=eH.markedSpans[eI].marker;if(eJ.readOnly&&(!ez||cl(ez,eJ)==-1)){(ez||(ez=[])).push(eJ)}}}});if(!ez){return null}var eA=[{from:eE,to:eF}];for(var eB=0;eB<ez.length;++eB){var eC=ez[eB],ex=eC.find();for(var ey=0;ey<eA.length;++ey){var ew=eA[ey];if(dK(ew.to,ex.from)||dK(ex.to,ew.from)){continue}var eD=[ey,1];if(dK(ew.from,ex.from)||!eC.inclusiveLeft&&d8(ew.from,ex.from)){eD.push({from:ew.from,to:ex.from})}if(dK(ex.to,ew.to)||!eC.inclusiveRight&&d8(ew.to,ex.to)){eD.push({from:ex.to,to:ew.to})}eA.splice.apply(eA,eD);ey+=eD.length-1}}return eA}function r(ew){return ew.inclusiveLeft?-1:0}function bj(ew){return ew.inclusiveRight?1:0}function cF(ez,ex){var eB=ez.lines.length-ex.lines.length;if(eB!=0){return eB}var ey=ez.find(),eC=ex.find();var ew=bz(ey.from,eC.from)||r(ez)-r(ex);if(ew){return -ew}var eA=bz(ey.to,eC.to)||bj(ez)-bj(ex);if(eA){return eA}return ex.id-ez.id}function aC(ex,eB){var ew=aD&&ex.markedSpans,eA;if(ew){for(var ez,ey=0;ey<ew.length;++ey){ez=ew[ey];if(ez.marker.collapsed&&(eB?ez.from:ez.to)==null&&(!eA||cF(eA,ez.marker)<0)){eA=ez.marker}}}return eA}function dn(ew){return aC(ew,true)}function c5(ew){return aC(ew,false)}function v(eE,ey,eC,eD,eA){var eH=dJ(eE,ey);var ew=aD&&eH.markedSpans;if(ew){for(var ez=0;ez<ew.length;++ez){var ex=ew[ez];if(!ex.marker.collapsed){continue}var eG=ex.marker.find(true);var eF=bz(eG.from,eC)||r(ex.marker)-r(eA);var eB=bz(eG.to,eD)||bj(ex.marker)-bj(eA);if(eF>=0&&eB<=0||eF<=0&&eB>=0){continue}if(eF<=0&&(bz(eG.to,eC)||bj(ex.marker)-r(eA))>0||eF>=0&&(bz(eG.from,eD)||r(ex.marker)-bj(eA))<0){return true}}}}function u(ey,ex){var ew;while(ew=dn(ex)){ex=dJ(ey,ew.find().from.line)}return ex}function dZ(eA,ex){var ew=aD&&ex.markedSpans;if(ew){for(var ez,ey=0;ey<ew.length;++ey){ez=ew[ey];if(!ez.marker.collapsed){continue}if(ez.from==null){return true}if(ez.marker.replacedWith){continue}if(ez.from==0&&ez.marker.inclusiveLeft&&J(eA,ex,ez)){return true}}}}function J(eC,ex,ez){if(ez.to==null){var ew=ez.marker.find().to,eA=dJ(eC,ew.line);return J(eC,eA,dE(eA.markedSpans,ez.marker))}if(ez.marker.inclusiveRight&&ez.to==ex.text.length){return true}for(var eB,ey=0;ey<ex.markedSpans.length;++ey){eB=ex.markedSpans[ey];if(eB.marker.collapsed&&!eB.marker.replacedWith&&eB.from==ez.to&&(eB.to==null||eB.to!=ez.from)&&(eB.marker.inclusiveLeft||ez.marker.inclusiveRight)&&J(eC,ex,eB)){return true}}}function ep(ew){var ey=ew.markedSpans;if(!ey){return}for(var ex=0;ex<ey.length;++ex){ey[ex].marker.detachLine(ew)}ew.markedSpans=null}function ca(ew,ey){if(!ey){return}for(var ex=0;ex<ey.length;++ex){ey[ex].marker.attachLine(ew)}ew.markedSpans=ey}var cx=B.LineWidget=function(ew,ez,ex){if(ex){for(var ey in ex){if(ex.hasOwnProperty(ey)){this[ey]=ex[ey]}}}this.cm=ew;this.node=ez};a0(cx);function E(ew){return function(){var ey=!this.cm.curOp;if(ey){bY(this.cm)}try{var ex=ew.apply(this,arguments)}finally{if(ey){W(this.cm)}}return ex}}cx.prototype.clear=E(function(){var ex=this.line.widgets,ez=bc(this.line);if(ez==null||!ex){return}for(var ey=0;ey<ex.length;++ey){if(ex[ey]==this){ex.splice(ey--,1)}}if(!ex.length){this.line.widgets=null}var ew=bb(this.cm,this.line)<this.cm.doc.scrollTop;eo(this.line,Math.max(0,this.line.height-b6(this)));if(ew){b0(this.cm,0,-this.height)}Q(this.cm,ez,ez+1)});cx.prototype.changed=E(function(){var ew=this.height;this.height=null;var ex=b6(this)-ew;if(!ex){return}eo(this.line,this.line.height+ex);var ey=bc(this.line);Q(this.cm,ey,ey+1)});function b6(ew){if(ew.height!=null){return ew.height}if(!ew.node.parentNode||ew.node.parentNode.nodeType!=1){bf(ew.cm.display.measure,ej("div",[ew.node],null,"position: relative"))}return ew.height=ew.node.offsetHeight}function a6(ew,eA,ey,ex){var ez=new cx(ew,ey,ex);if(ez.noHScroll){ew.display.alignWidgets=true}c9(ew,eA,function(eC){var eD=eC.widgets||(eC.widgets=[]);if(ez.insertAt==null){eD.push(ez)}else{eD.splice(Math.min(eD.length-1,Math.max(0,ez.insertAt)),0,ez)}ez.line=eC;if(!dZ(ew.doc,eC)||ez.showIfHidden){var eB=bb(ew,eC)<ew.doc.scrollTop;eo(eC,eC.height+b6(ez));if(eB){b0(ew,0,ez.height)}}return true});return ez}var en=B.Line=function(ey,ex,ew){this.text=ey;ca(this,ex);this.height=ew?ew(this):1};a0(en);en.prototype.lineNo=function(){return bc(this)};function c1(ex,eA,ey,ew){ex.text=eA;if(ex.stateAfter){ex.stateAfter=null}if(ex.styles){ex.styles=null}if(ex.order!=null){ex.order=null}ep(ex);ca(ex,ey);var ez=ew?ew(ex):1;if(ez!=ex.height){eo(ex,ez)}}function a1(ew){ew.parent=null;ep(ew)}function s(eF,eH,eA,ex,eB,ez){var ey=eA.flattenSpans;if(ey==null){ey=eF.options.flattenSpans}var eD=0,eC=null;var eG=new ds(eH,eF.options.tabSize),ew;if(eH==""&&eA.blankLine){eA.blankLine(ex)}while(!eG.eol()){if(eG.pos>eF.options.maxHighlightLength){ey=false;if(ez){cu(eF,eH,ex,eG.pos)}eG.pos=eH.length;ew=null}else{ew=eA.token(eG,ex)}if(eF.options.addModeClass){var eI=B.innerMode(eA,ex).mode.name;if(eI){ew="m-"+(ew?eI+" "+ew:eI)}}if(!ey||eC!=ew){if(eD<eG.start){eB(eG.start,eC)}eD=eG.start;eC=ew}eG.start=eG.pos}while(eD<eG.pos){var eE=Math.min(eG.pos,eD+50000);eB(eE,eC);eD=eE}}function d4(eC,eE,ew,ez){var eD=[eC.state.modeGen];s(eC,eE.text,eC.doc.mode,ew,function(eF,eG){eD.push(eF,eG)},ez);for(var ex=0;ex<eC.state.overlays.length;++ex){var eA=eC.state.overlays[ex],eB=1,ey=0;s(eC,eE.text,eA.mode,true,function(eF,eH){var eJ=eB;while(ey<eF){var eG=eD[eB];if(eG>eF){eD.splice(eB,1,eF,eD[eB+1],eG)}eB+=2;ey=Math.min(eF,eG)}if(!eH){return}if(eA.opaque){eD.splice(eJ,eB-eJ,eF,eH);eB=eJ+2}else{for(;eJ<eB;eJ+=2){var eI=eD[eJ+1];eD[eJ+1]=eI?eI+" "+eH:eH}}})}return eD}function cd(ew,ex){if(!ex.styles||ex.styles[0]!=ew.state.modeGen){ex.styles=d4(ew,ex,ex.stateAfter=cw(ew,bc(ex)))}return ex.styles}function cu(ew,eB,ey,ex){var eA=ew.doc.mode;var ez=new ds(eB,ew.options.tabSize);ez.start=ez.pos=ex||0;if(eB==""&&eA.blankLine){eA.blankLine(ey)}while(!ez.eol()&&ez.pos<=ew.options.maxHighlightLength){eA.token(ez,ey);ez.start=ez.pos}}var cI={},bn={};function du(ez,ey){if(!ez){return null}for(;;){var ex=ez.match(/(?:^|\s)line-(background-)?(\S+)/);if(!ex){break}ez=ez.slice(0,ex.index)+ez.slice(ex.index+ex[0].length);var eA=ex[1]?"bgClass":"textClass";if(ey[eA]==null){ey[eA]=ex[2]}else{if(!(new RegExp("(?:^|s)"+ex[2]+"(?:$|s)")).test(ey[eA])){ey[eA]+=" "+ex[2]}}}var ew=ey.cm.options.addModeClass?bn:cI;return ew[ez]||(ew[ez]="cm-"+ez.replace(/ +/g," cm-"))}function dq(eF,eJ,ew,eI){var eG,eK=eJ,eB=true;while(eG=dn(eK)){eK=dJ(eF.doc,eG.find().from.line)}var eC={pre:ej("pre"),col:0,pos:0,measure:null,measuredSomething:false,cm:eF,copyWidgets:eI};do{if(eK.text){eB=false}eC.measure=eK==eJ&&ew;eC.pos=0;eC.addToken=eC.measure?e:p;if((cf||b8)&&eF.getOption("lineWrapping")){eC.addToken=d6(eC.addToken)}var eA=aU(eK,eC,cd(eF,eK));if(ew&&eK==eJ&&!eC.measuredSomething){ew[0]=eC.pre.appendChild(aS(eF.display.measure));eC.measuredSomething=true}if(eA){eK=dJ(eF.doc,eA.to.line)}}while(eA);if(ew&&!eC.measuredSomething&&!ew[0]){ew[0]=eC.pre.appendChild(eB?ej("span","\u00a0"):aS(eF.display.measure))}if(!eC.pre.firstChild&&!dZ(eF.doc,eJ)){eC.pre.appendChild(document.createTextNode("\u00a0"))}var ex;if(ew&&cA&&(ex=a(eK))){var ez=ex.length-1;if(ex[ez].from==ex[ez].to){--ez}var eH=ex[ez],ey=ex[ez-1];if(eH.from+1==eH.to&&ey&&eH.level<ey.level){var eE=ew[eC.pos-1];if(eE){eE.parentNode.insertBefore(eE.measureRight=aS(eF.display.measure),eE.nextSibling)}}}var eD=eC.textClass?eC.textClass+" "+(eJ.textClass||""):eJ.textClass;if(eD){eC.pre.className=eD}ah(eF,"renderLine",eF,eJ,eC.pre);return eC}function dH(ex){var ew=ej("span","\u2022","cm-invalidchar");ew.title="\\u"+ex.charCodeAt(0).toString(16);return ew}function p(eA,eJ,ew,ez,eK,eI){if(!eJ){return}var eE=eA.cm.options.specialChars;if(!eE.test(eJ)){eA.col+=eJ.length;var eD=document.createTextNode(eJ)}else{var eD=document.createDocumentFragment(),eG=0;while(true){eE.lastIndex=eG;var ex=eE.exec(eJ);var eC=ex?ex.index-eG:eJ.length-eG;if(eC){eD.appendChild(document.createTextNode(eJ.slice(eG,eG+eC)));eA.col+=eC}if(!ex){break}eG+=eC+1;if(ex[0]=="\t"){var eB=eA.cm.options.tabSize,eF=eB-eA.col%eB;eD.appendChild(ej("span",bJ(eF),"cm-tab"));eA.col+=eF}else{var ey=eA.cm.options.specialCharPlaceholder(ex[0]);eD.appendChild(ey);eA.col+=1}}}if(ew||ez||eK||eA.measure){var eH=ew||"";if(ez){eH+=ez}if(eK){eH+=eK}var ey=ej("span",[eD],eH);if(eI){ey.title=eI}return eA.pre.appendChild(ey)}eA.pre.appendChild(eD)}function e(eD,eG,ex,eA,eH){var eC=eD.cm.options.lineWrapping;for(var eB=0;eB<eG.length;++eB){var ey=eB==0,eF=eB+1;while(eF<eG.length&&dV(eG.charAt(eF))){++eF}var ew=eG.slice(eB,eF);eB=eF-1;if(eB&&eC&&bu(eG,eB)){eD.pre.appendChild(ej("wbr"))}var ez=eD.measure[eD.pos];var eE=eD.measure[eD.pos]=p(eD,ew,ex,ey&&eA,eB==eG.length-1&&eH);if(ez){eE.leftSide=ez.leftSide||ez}if(cf&&eC&&ew==" "&&eB&&!/\s/.test(eG.charAt(eB-1))&&eB<eG.length-1&&!/\s/.test(eG.charAt(eB+1))){eE.style.whiteSpace="normal"}eD.pos+=ew.length}if(eG.length){eD.measuredSomething=true}}function d6(ew){function ex(ey){var ez=" ";for(var eA=0;eA<ey.length-2;++eA){ez+=eA%2?" ":"\u00a0"}ez+=" ";return ez}return function(ez,eD,eA,ey,eC,eB){return ew(ez,eD.replace(/ {3,}/g,ex),eA,ey,eC,eB)}}function M(ex,eA,ew,ez){var eB=!ez&&ew.replacedWith;if(eB){if(ex.copyWidgets){eB=eB.cloneNode(true)}ex.pre.appendChild(eB);if(ex.measure){if(eA){ex.measure[ex.pos]=eB}else{var ey=aS(ex.cm.display.measure);if(ew.type=="bookmark"&&!ew.insertLeft){ex.measure[ex.pos]=ex.pre.appendChild(ey)}else{if(ex.measure[ex.pos]){return}else{ex.measure[ex.pos]=ex.pre.insertBefore(ey,eB)}}}ex.measuredSomething=true}}ex.pos+=eA}function aU(eF,eL,eE){var eB=eF.markedSpans,eD=eF.text,eJ=0;if(!eB){for(var eO=1;eO<eE.length;eO+=2){eL.addToken(eL,eD.slice(eJ,eJ=eE[eO]),du(eE[eO+1],eL))}return}var eP=eD.length,eA=0,eO=1,eH="",eQ;var eS=0,ew,eR,eI,eT,ey;for(;;){if(eS==eA){ew=eR=eI=eT="";ey=null;eS=Infinity;var eC=[];for(var eM=0;eM<eB.length;++eM){var eN=eB[eM],eK=eN.marker;if(eN.from<=eA&&(eN.to==null||eN.to>eA)){if(eN.to!=null&&eS>eN.to){eS=eN.to;eR=""}if(eK.className){ew+=" "+eK.className}if(eK.startStyle&&eN.from==eA){eI+=" "+eK.startStyle}if(eK.endStyle&&eN.to==eS){eR+=" "+eK.endStyle}if(eK.title&&!eT){eT=eK.title}if(eK.collapsed&&(!ey||cF(ey.marker,eK)<0)){ey=eN}}else{if(eN.from>eA&&eS>eN.from){eS=eN.from}}if(eK.type=="bookmark"&&eN.from==eA&&eK.replacedWith){eC.push(eK)}}if(ey&&(ey.from||0)==eA){M(eL,(ey.to==null?eP:ey.to)-eA,ey.marker,ey.from==null);if(ey.to==null){return ey.marker.find()}}if(!ey&&eC.length){for(var eM=0;eM<eC.length;++eM){M(eL,0,eC[eM])}}}if(eA>=eP){break}var eG=Math.min(eP,eS);while(true){if(eH){var ex=eA+eH.length;if(!ey){var ez=ex>eG?eH.slice(0,eG-eA):eH;eL.addToken(eL,ez,eQ?eQ+ew:ew,eI,eA+ez.length==eS?eR:"",eT)}if(ex>=eG){eH=eH.slice(eG-eA);eA=eG;break}eA=ex;eI=""}eH=eD.slice(eJ,eJ=eE[eO++]);eQ=du(eE[eO++],eL)}}}function d2(eN,eE,eA,eI,eC){function ez(eO){return eA?eA[eO]:null}function eD(eO,eQ,eP){c1(eO,eQ,eP,eC);O(eO,"change",eO,eE)}var eJ=eE.from,ex=eE.to,eG=eE.text;var eF=dJ(eN,eJ.line),ew=dJ(eN,ex.line);var ey=d7(eG),eL=ez(eG.length-1),eH=ex.line-eJ.line;if(eJ.ch==0&&ex.ch==0&&ey==""&&(!eN.cm||eN.cm.options.wholeLineUpdateBefore)){for(var eK=0,eM=eG.length-1,eB=[];eK<eM;++eK){eB.push(new en(eG[eK],ez(eK),eC))}eD(ew,ew.text,eL);if(eH){eN.remove(eJ.line,eH)}if(eB.length){eN.insert(eJ.line,eB)}}else{if(eF==ew){if(eG.length==1){eD(eF,eF.text.slice(0,eJ.ch)+ey+eF.text.slice(ex.ch),eL)}else{for(var eB=[],eK=1,eM=eG.length-1;eK<eM;++eK){eB.push(new en(eG[eK],ez(eK),eC))}eB.push(new en(ey+eF.text.slice(ex.ch),eL,eC));eD(eF,eF.text.slice(0,eJ.ch)+eG[0],ez(0));eN.insert(eJ.line+1,eB)}}else{if(eG.length==1){eD(eF,eF.text.slice(0,eJ.ch)+eG[0]+ew.text.slice(ex.ch),ez(0));eN.remove(eJ.line+1,eH)}else{eD(eF,eF.text.slice(0,eJ.ch)+eG[0],ez(0));eD(ew,ey+ew.text.slice(ex.ch),eL);for(var eK=1,eM=eG.length-1,eB=[];eK<eM;++eK){eB.push(new en(eG[eK],ez(eK),eC))}if(eH>1){eN.remove(eJ.line+1,eH-1)}eN.insert(eJ.line+1,eB)}}}O(eN,"change",eN,eE);bh(eN,eI.anchor,eI.head,null,true)}function dx(ex){this.lines=ex;this.parent=null;for(var ey=0,ez=ex.length,ew=0;ey<ez;++ey){ex[ey].parent=this;ew+=ex[ey].height}this.height=ew}dx.prototype={chunkSize:function(){return this.lines.length},removeInner:function(ew,eA){for(var ey=ew,ez=ew+eA;ey<ez;++ey){var ex=this.lines[ey];this.height-=ex.height;a1(ex);O(ex,"delete")}this.lines.splice(ew,eA)},collapse:function(ew){ew.splice.apply(ew,[ew.length,0].concat(this.lines))},insertInner:function(ex,ey,ew){this.height+=ew;this.lines=this.lines.slice(0,ex).concat(ey).concat(this.lines.slice(ex));for(var ez=0,eA=ey.length;ez<eA;++ez){ey[ez].parent=this}},iterN:function(ew,ez,ey){for(var ex=ew+ez;ew<ex;++ew){if(ey(this.lines[ew])){return true}}}};function d0(ez){this.children=ez;var ey=0,ew=0;for(var ex=0,eB=ez.length;ex<eB;++ex){var eA=ez[ex];ey+=eA.chunkSize();ew+=eA.height;eA.parent=this}this.size=ey;this.height=ew;this.parent=null}d0.prototype={chunkSize:function(){return this.size},removeInner:function(ew,eD){this.size-=eD;for(var ey=0;ey<this.children.length;++ey){var eC=this.children[ey],eA=eC.chunkSize();if(ew<eA){var ez=Math.min(eD,eA-ew),eB=eC.height;eC.removeInner(ew,ez);this.height-=eB-eC.height;if(eA==ez){this.children.splice(ey--,1);eC.parent=null}if((eD-=ez)==0){break}ew=0}else{ew-=eA}}if(this.size-eD<25){var ex=[];this.collapse(ex);this.children=[new dx(ex)];this.children[0].parent=this}},collapse:function(ew){for(var ex=0,ey=this.children.length;ex<ey;++ex){this.children[ex].collapse(ew)}},insertInner:function(ex,eE,eD){this.size+=eE.length;this.height+=eD;for(var ey=0,eA=this.children.length;ey<eA;++ey){var ew=this.children[ey],eB=ew.chunkSize();if(ex<=eB){ew.insertInner(ex,eE,eD);if(ew.lines&&ew.lines.length>50){while(ew.lines.length>50){var ez=ew.lines.splice(ew.lines.length-25,25);var eC=new dx(ez);ew.height-=eC.height;this.children.splice(ey+1,0,eC);eC.parent=this}this.maybeSpill()}break}ex-=eB}},maybeSpill:function(){if(this.children.length<=10){return}var ez=this;do{var ex=ez.children.splice(ez.children.length-5,5);var ey=new d0(ex);if(!ez.parent){var eA=new d0(ez.children);eA.parent=ez;ez.children=[eA,ey];ez=eA}else{ez.size-=ey.size;ez.height-=ey.height;var ew=cl(ez.parent.children,ez);ez.parent.children.splice(ew+1,0,ey)}ey.parent=ez.parent}while(ez.children.length>10);ez.parent.maybeSpill()},iterN:function(ew,eD,eC){for(var ex=0,eA=this.children.length;ex<eA;++ex){var eB=this.children[ex],ez=eB.chunkSize();if(ew<ez){var ey=Math.min(eD,ez-ew);if(eB.iterN(ew,ey,eC)){return true}if((eD-=ey)==0){break}ew=0}else{ew-=ez}}}};var bK=0;var aa=B.Doc=function(ey,ex,ew){if(!(this instanceof aa)){return new aa(ey,ex,ew)}if(ew==null){ew=0}d0.call(this,[new dx([new en("",null)])]);this.first=ew;this.scrollTop=this.scrollLeft=0;this.cantEdit=false;this.history=ac();this.cleanGeneration=1;this.frontier=ew;var ez=K(ew,0);this.sel={from:ez,to:ez,head:ez,anchor:ez,shift:false,extend:false,goalColumn:null};this.id=++bK;this.modeOption=ex;if(typeof ey=="string"){ey=ay(ey)}d2(this,{from:ez,to:ez,text:ey},null,{head:ez,anchor:ez})};aa.prototype=bD(d0.prototype,{constructor:aa,iter:function(ey,ex,ew){if(ew){this.iterN(ey-this.first,ex-ey,ew)}else{this.iterN(this.first,this.first+this.size,ey)}},insert:function(ex,ey){var ew=0;for(var ez=0,eA=ey.length;ez<eA;++ez){ew+=ey[ez].height}this.insertInner(ex-this.first,ey,ew)},remove:function(ew,ex){this.removeInner(ew-this.first,ex)},getValue:function(ex){var ew=aA(this,this.first,this.first+this.size);if(ex===false){return ew}return ew.join(ex||"\n")},setValue:function(ex){var ey=K(this.first,0),ew=this.first+this.size-1;aL(this,{from:ey,to:K(ew,dJ(this,ew).text.length),text:ay(ex),origin:"setValue"},{head:ey,anchor:ey},true)},replaceRange:function(ex,ez,ey,ew){ez=d9(this,ez);ey=ey?d9(this,ey):ez;az(this,ex,ez,ey,ew)},getRange:function(ez,ey,ex){var ew=el(this,d9(this,ez),d9(this,ey));if(ex===false){return ew}return ew.join(ex||"\n")},getLine:function(ex){var ew=this.getLineHandle(ex);return ew&&ew.text},setLine:function(ew,ex){if(bt(this,ew)){az(this,ex,K(ew,0),d9(this,K(ew)))}},removeLine:function(ew){if(ew){az(this,"",d9(this,K(ew-1)),d9(this,K(ew)))}else{az(this,"",K(0,0),d9(this,K(1,0)))}},getLineHandle:function(ew){if(bt(this,ew)){return dJ(this,ew)}},getLineNumber:function(ew){return bc(ew)},getLineHandleVisualStart:function(ew){if(typeof ew=="number"){ew=dJ(this,ew)}return u(this,ew)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(ew){return d9(this,ew)},getCursor:function(ey){var ew=this.sel,ex;if(ey==null||ey=="head"){ex=ew.head}else{if(ey=="anchor"){ex=ew.anchor}else{if(ey=="end"||ey===false){ex=ew.to}else{ex=ew.from}}}return bC(ex)},somethingSelected:function(){return !d8(this.sel.head,this.sel.anchor)},setCursor:d3(function(ew,ex,ez){var ey=d9(this,typeof ew=="number"?K(ew,ex||0):ew);if(ez){eg(this,ey)}else{bh(this,ey,ey)}}),setSelection:d3(function(ex,ey,ew){bh(this,d9(this,ex),d9(this,ey||ex),ew)}),extendSelection:d3(function(ey,ex,ew){eg(this,d9(this,ey),ex&&d9(this,ex),ew)}),getSelection:function(ew){return this.getRange(this.sel.from,this.sel.to,ew)},replaceSelection:function(ex,ey,ew){aL(this,{from:this.sel.from,to:this.sel.to,text:ay(ex),origin:ew},ey||"around")},undo:d3(function(){bs(this,"undo")}),redo:d3(function(){bs(this,"redo")}),setExtending:function(ew){this.sel.extend=ew},historySize:function(){var ew=this.history;return{undo:ew.done.length,redo:ew.undone.length}},clearHistory:function(){this.history=ac(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(true)},changeGeneration:function(ew){if(ew){this.history.lastOp=this.history.lastOrigin=null}return this.history.generation},isClean:function(ew){return this.history.generation==(ew||this.cleanGeneration)},getHistory:function(){return{done:bd(this.history.done),undone:bd(this.history.undone)}},setHistory:function(ex){var ew=this.history=ac(this.history.maxGeneration);ew.done=ex.done.slice(0);ew.undone=ex.undone.slice(0)},markText:function(ey,ex,ew){return dh(this,d9(this,ey),d9(this,ex),ew,"range")},setBookmark:function(ey,ew){var ex={replacedWith:ew&&(ew.nodeType==null?ew.widget:ew),insertLeft:ew&&ew.insertLeft,clearWhenEmpty:false};ey=d9(this,ey);return dh(this,ey,ey,ex,"bookmark")},findMarksAt:function(eA){eA=d9(this,eA);var ez=[],ex=dJ(this,eA.line).markedSpans;if(ex){for(var ew=0;ew<ex.length;++ew){var ey=ex[ew];if((ey.from==null||ey.from<=eA.ch)&&(ey.to==null||ey.to>=eA.ch)){ez.push(ey.marker.parent||ey.marker)}}}return ez},getAllMarks:function(){var ew=[];this.iter(function(ey){var ex=ey.markedSpans;if(ex){for(var ez=0;ez<ex.length;++ez){if(ex[ez].from!=null){ew.push(ex[ez].marker)}}}});return ew},posFromIndex:function(ex){var ew,ey=this.first;this.iter(function(ez){var eA=ez.text.length+1;if(eA>ex){ew=ex;return true}ex-=eA;++ey});return d9(this,K(ey,ew))},indexFromPos:function(ex){ex=d9(this,ex);var ew=ex.ch;if(ex.line<this.first||ex.ch<0){return 0}this.iter(this.first,ex.line,function(ey){ew+=ey.text.length+1});return ew},copy:function(ew){var ex=new aa(aA(this,this.first,this.first+this.size),this.modeOption,this.first);ex.scrollTop=this.scrollTop;ex.scrollLeft=this.scrollLeft;ex.sel={from:this.sel.from,to:this.sel.to,head:this.sel.head,anchor:this.sel.anchor,shift:this.sel.shift,extend:false,goalColumn:this.sel.goalColumn};if(ew){ex.history.undoDepth=this.history.undoDepth;ex.setHistory(this.getHistory())}return ex},linkedDoc:function(ew){if(!ew){ew={}}var ez=this.first,ey=this.first+this.size;if(ew.from!=null&&ew.from>ez){ez=ew.from}if(ew.to!=null&&ew.to<ey){ey=ew.to}var ex=new aa(aA(this,ez,ey),ew.mode||this.modeOption,ez);if(ew.sharedHist){ex.history=this.history}(this.linked||(this.linked=[])).push({doc:ex,sharedHist:ew.sharedHist});ex.linked=[{doc:this,isParent:true,sharedHist:ew.sharedHist}];return ex},unlinkDoc:function(ex){if(ex instanceof B){ex=ex.doc}if(this.linked){for(var ey=0;ey<this.linked.length;++ey){var ez=this.linked[ey];if(ez.doc!=ex){continue}this.linked.splice(ey,1);ex.unlinkDoc(this);break}}if(ex.history==this.history){var ew=[ex.id];cN(ex,function(eA){ew.push(eA.id)},true);ex.history=ac();ex.history.done=bd(this.history.done,ew);ex.history.undone=bd(this.history.undone,ew)}},iterLinkedDocs:function(ew){cN(this,ew)},getMode:function(){return this.mode},getEditor:function(){return this.cm}});aa.prototype.eachLine=aa.prototype.iter;var d="iter insert remove copy getEditor".split(" ");for(var a9 in aa.prototype){if(aa.prototype.hasOwnProperty(a9)&&cl(d,a9)<0){B.prototype[a9]=(function(ew){return function(){return ew.apply(this.doc,arguments)}})(aa.prototype[a9])}}a0(aa);function cN(ez,ey,ex){function ew(eF,eD,eB){if(eF.linked){for(var eC=0;eC<eF.linked.length;++eC){var eA=eF.linked[eC];if(eA.doc==eD){continue}var eE=eB&&eA.sharedHist;if(ex&&!eE){continue}ey(eA.doc,eE);ew(eA.doc,eF,eE)}}}ew(ez,null,true)}function cQ(ew,ex){if(ex.cm){throw new Error("This document is already in use.")}ew.doc=ex;ex.cm=ew;L(ew);aW(ew);if(!ew.options.lineWrapping){em(ew)}ew.options.mode=ex.modeOption;Q(ew)}function dJ(ew,eA){eA-=ew.first;while(!ew.lines){for(var ex=0;;++ex){var ez=ew.children[ex],ey=ez.chunkSize();if(eA<ey){ew=ez;break}eA-=ey}}return ew.lines[eA]}function el(ey,eA,ew){var ex=[],ez=eA.line;ey.iter(eA.line,ew.line+1,function(eB){var eC=eB.text;if(ez==ew.line){eC=eC.slice(0,ew.ch)}if(ez==eA.line){eC=eC.slice(eA.ch)}ex.push(eC);++ez});return ex}function aA(ex,ez,ey){var ew=[];ex.iter(ez,ey,function(eA){ew.push(eA.text)});return ew}function eo(ex,ew){var ey=ew-ex.height;for(var ez=ex;ez;ez=ez.parent){ez.height+=ey}}function bc(ew){if(ew.parent==null){return null}var eA=ew.parent,ez=cl(eA.lines,ew);for(var ex=eA.parent;ex;eA=ex,ex=ex.parent){for(var ey=0;;++ey){if(ex.children[ey]==eA){break}ez+=ex.children[ey].chunkSize()}}return ez+eA.first}function a5(eC,eA){var ey=eC.first;outer:do{for(var ez=0,eB=eC.children.length;ez<eB;++ez){var ex=eC.children[ez],ew=ex.height;if(eA<ew){eC=ex;continue outer}eA-=ew;ey+=ex.chunkSize()}return ey}while(!eC.lines);for(var ez=0,eB=eC.lines.length;ez<eB;++ez){var eE=eC.lines[ez],eD=eE.height;if(eA<eD){break}eA-=eD}return ey+ez}function bb(ew,ez){ez=u(ew.doc,ez);var eB=0,ey=ez.parent;for(var eA=0;eA<ey.lines.length;++eA){var ex=ey.lines[eA];if(ex==ez){break}else{eB+=ex.height}}for(var eC=ey.parent;eC;ey=eC,eC=ey.parent){for(var eA=0;eA<eC.children.length;++eA){var eD=eC.children[eA];if(eD==ey){break}else{eB+=eD.height}}}return eB}function a(ex){var ew=ex.order;if(ew==null){ew=ex.order=aM(ex.text)}return ew}function ac(ew){return{done:[],undone:[],undoDepth:Infinity,lastTime:0,lastOp:null,lastOrigin:null,generation:ew||1,maxGeneration:ew||1}}function bl(ex,eB,eA,ez){var ew=eB["spans_"+ex.id],ey=0;ex.iter(Math.max(ex.first,eA),Math.min(ex.first+ex.size,ez),function(eC){if(eC.markedSpans){(ew||(ew=eB["spans_"+ex.id]={}))[ey]=eC.markedSpans}++ey})}function cs(ew,ez){var ey={line:ez.from.line,ch:ez.from.ch};var ex={from:ey,to:b5(ez),text:el(ew,ez.from,ez.to)};bl(ew,ex,ez.from.line,ez.to.line+1);cN(ew,function(eA){bl(eA,ex,ez.from.line,ez.to.line+1)},true);return ex}function di(eB,eD,eA,ew){var ez=eB.history;ez.undone.length=0;var ey=+new Date,eC=d7(ez.done);if(eC&&(ez.lastOp==ew||ez.lastOrigin==eD.origin&&eD.origin&&((eD.origin.charAt(0)=="+"&&eB.cm&&ez.lastTime>ey-eB.cm.options.historyEventDelay)||eD.origin.charAt(0)=="*"))){var ex=d7(eC.changes);if(d8(eD.from,eD.to)&&d8(eD.from,ex.to)){ex.to=b5(eD)}else{eC.changes.push(cs(eB,eD))}eC.anchorAfter=eA.anchor;eC.headAfter=eA.head}else{eC={changes:[cs(eB,eD)],generation:ez.generation,anchorBefore:eB.sel.anchor,headBefore:eB.sel.head,anchorAfter:eA.anchor,headAfter:eA.head};ez.done.push(eC);while(ez.done.length>ez.undoDepth){ez.done.shift()}}ez.generation=++ez.maxGeneration;ez.lastTime=ey;ez.lastOp=ew;ez.lastOrigin=eD.origin}function aP(ey){if(!ey){return null}for(var ex=0,ew;ex<ey.length;++ex){if(ey[ex].marker.explicitlyCleared){if(!ew){ew=ey.slice(0,ex)}}else{if(ew){ew.push(ey[ex])}}}return !ew?ey:ew.length?ew:null}function br(ez,eA){var ey=eA["spans_"+ez.id];if(!ey){return null}for(var ex=0,ew=[];ex<eA.text.length;++ex){ew.push(aP(ey[ex]))}return ew}function bd(eG,ez){for(var eC=0,ex=[];eC<eG.length;++eC){var ey=eG[eC],eE=ey.changes,eF=[];ex.push({changes:eF,anchorBefore:ey.anchorBefore,headBefore:ey.headBefore,anchorAfter:ey.anchorAfter,headAfter:ey.headAfter});for(var eB=0;eB<eE.length;++eB){var eD=eE[eB],eA;eF.push({from:eD.from,to:eD.to,text:eD.text});if(ez){for(var ew in eD){if(eA=ew.match(/^spans_(\d+)$/)){if(cl(ez,Number(eA[1]))>-1){d7(eF)[ew]=eD[ew];delete eD[ew]}}}}}}return ex}function dv(ez,ey,ex,ew){if(ex<ez.line){ez.line+=ew}else{if(ey<ez.line){ez.line=ey;ez.ch=0}}}function dM(ez,eB,eC,eD){for(var ey=0;ey<ez.length;++ey){var ew=ez[ey],eA=true;for(var ex=0;ex<ew.changes.length;++ex){var eE=ew.changes[ex];if(!ew.copied){eE.from=bC(eE.from);eE.to=bC(eE.to)}if(eC<eE.from.line){eE.from.line+=eD;eE.to.line+=eD}else{if(eB<=eE.to.line){eA=false;break}}}if(!ew.copied){ew.anchorBefore=bC(ew.anchorBefore);ew.headBefore=bC(ew.headBefore);ew.anchorAfter=bC(ew.anchorAfter);ew.readAfter=bC(ew.headAfter);ew.copied=true}if(!eA){ez.splice(0,ey+1);ey=0}else{dv(ew.anchorBefore);dv(ew.headBefore);dv(ew.anchorAfter);dv(ew.headAfter)}}}function cz(ex,eA){var ez=eA.from.line,ey=eA.to.line,ew=eA.text.length-(ey-ez)-1;dM(ex.done,ez,ey,ew);dM(ex.undone,ez,ey,ew)}function dr(){c2(this)}function Y(ew){if(!ew.stop){ew.stop=dr}return ew}function bV(ew){if(ew.preventDefault){ew.preventDefault()}else{ew.returnValue=false}}function cp(ew){if(ew.stopPropagation){ew.stopPropagation()}else{ew.cancelBubble=true}}function ba(ew){return ew.defaultPrevented!=null?ew.defaultPrevented:ew.returnValue==false}function c2(ew){bV(ew);cp(ew)}B.e_stop=c2;B.e_preventDefault=bV;B.e_stopPropagation=cp;function D(ew){return ew.target||ew.srcElement}function eb(ex){var ew=ex.which;if(ew==null){if(ex.button&1){ew=1}else{if(ex.button&2){ew=3}else{if(ex.button&4){ew=2}}}}if(bq&&ex.ctrlKey&&ew==1){ew=3}return ew}function bk(ez,ex,ey){if(ez.addEventListener){ez.addEventListener(ex,ey,false)}else{if(ez.attachEvent){ez.attachEvent("on"+ex,ey)}else{var eA=ez._handlers||(ez._handlers={});var ew=eA[ex]||(eA[ex]=[]);ew.push(ey)}}}function cT(eA,ey,ez){if(eA.removeEventListener){eA.removeEventListener(ey,ez,false)}else{if(eA.detachEvent){eA.detachEvent("on"+ey,ez)}else{var ew=eA._handlers&&eA._handlers[ey];if(!ew){return}for(var ex=0;ex<ew.length;++ex){if(ew[ex]==ez){ew.splice(ex,1);break}}}}}function ah(eA,ez){var ew=eA._handlers&&eA._handlers[ez];if(!ew){return}var ex=Array.prototype.slice.call(arguments,2);for(var ey=0;ey<ew.length;++ey){ew[ey].apply(null,ex)}}var aT,bL=0;function O(eB,eA){var ew=eB._handlers&&eB._handlers[eA];if(!ew){return}var ey=Array.prototype.slice.call(arguments,2);if(!aT){++bL;aT=[];setTimeout(da,0)}function ex(eC){return function(){eC.apply(null,ey)}}for(var ez=0;ez<ew.length;++ez){aT.push(ex(ew[ez]))}}function ar(ew,ey,ex){ah(ew,ex||ey.type,ew,ey);return ba(ey)||ey.codemirrorIgnore}function da(){--bL;var ew=aT;aT=null;for(var ex=0;ex<ew.length;++ex){ew[ex]()}}function dP(ey,ex){var ew=ey._handlers&&ey._handlers[ex];return ew&&ew.length>0}B.on=bk;B.off=cT;B.signal=ah;function a0(ew){ew.prototype.on=function(ex,ey){bk(this,ex,ey)};ew.prototype.off=function(ex,ey){cT(this,ex,ey)}}var aO=30;var bv=B.Pass={toString:function(){return"CodeMirror.Pass"}};function ev(){this.id=null}ev.prototype={set:function(ew,ex){clearTimeout(this.id);this.id=setTimeout(ex,ew)}};function bg(ey,ew,eA,eB,ex){if(ew==null){ew=ey.search(/[^\s\u00a0]/);if(ew==-1){ew=ey.length}}for(var ez=eB||0,eC=ex||0;ez<ew;++ez){if(ey.charAt(ez)=="\t"){eC+=eA-(eC%eA)}else{++eC}}return eC}B.countColumn=bg;var ax=[""];function bJ(ew){while(ax.length<=ew){ax.push(d7(ax)+" ")}return ax[ew]}function d7(ew){return ew[ew.length-1]}function cC(ex){if(dy){ex.selectionStart=0;ex.selectionEnd=ex.value.length}else{try{ex.select()}catch(ew){}}}function cl(ez,ew){if(ez.indexOf){return ez.indexOf(ew)}for(var ex=0,ey=ez.length;ex<ey;++ex){if(ez[ex]==ew){return ex}}return -1}function bD(ez,ex){function ew(){}ew.prototype=ez;var ey=new ew();if(ex){am(ex,ey)}return ey}function am(ex,ew){if(!ew){ew={}}for(var ey in ex){if(ex.hasOwnProperty(ey)){ew[ey]=ex[ey]}}return ew}function U(ey){for(var ew=[],ex=0;ex<ey;++ex){ew.push(undefined)}return ew}function bO(ex){var ew=Array.prototype.slice.call(arguments,1);return function(){return ex.apply(null,ew)}}var aI=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function bR(ew){return/\w/.test(ew)||ew>"\x80"&&(ew.toUpperCase()!=ew.toLowerCase()||aI.test(ew))}function dt(ew){for(var ex in ew){if(ew.hasOwnProperty(ex)&&ew[ex]){return false}}return true}var dl=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function dV(ew){return ew.charCodeAt(0)>=768&&dl.test(ew)}function ej(ew,eA,ez,ey){var eB=document.createElement(ew);if(ez){eB.className=ez}if(ey){eB.style.cssText=ey}if(typeof eA=="string"){l(eB,eA)}else{if(eA){for(var ex=0;ex<eA.length;++ex){eB.appendChild(eA[ex])}}}return eB}function cK(ex){for(var ew=ex.childNodes.length;ew>0;--ew){ex.removeChild(ex.firstChild)}return ex}function bf(ew,ex){return cK(ew).appendChild(ex)}function l(ew,ex){if(bE){ew.innerHTML="";ew.appendChild(document.createTextNode(ex))}else{ew.textContent=ex}}function an(ew){return ew.getBoundingClientRect()}B.replaceGetRect=function(ew){an=ew};var dm=function(){if(bE){return false}var ew=ej("div");return"draggable" in ew||"dragDrop" in ew}();function bu(){return false}if(bI){bu=function(ex,ew){return ex.charCodeAt(ew-1)==36&&ex.charCodeAt(ew)==39}}else{if(ag&&!/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent)){bu=function(ex,ew){return/\-[^ \-?]|\?[^ !\'\"\),.\-\/:;\?\]\}]/.test(ex.slice(ew-1,ew+1))}}else{if(b8&&/Chrome\/(?:29|[3-9]\d|\d\d\d)\./.test(navigator.userAgent)){bu=function(ey,ew){var ex=ey.charCodeAt(ew-1);return ex>=8208&&ex<=8212}}else{if(b8){bu=function(ex,ew){if(ew>1&&ex.charCodeAt(ew-1)==45){if(/\w/.test(ex.charAt(ew-2))&&/[^\-?\.]/.test(ex.charAt(ew))){return true}if(ew>2&&/[\d\.,]/.test(ex.charAt(ew-2))&&/[\d\.,]/.test(ex.charAt(ew))){return false}}return/[~!#%&*)=+}\]\\|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|\u2026[\w~`@#$%\^&*(_=+{[><]/.test(ex.slice(ew-1,ew+1))}}}}}var c6;function i(ew){if(c6!=null){return c6}var ex=ej("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");bf(ew,ex);if(ex.offsetWidth){c6=ex.offsetHeight-ex.clientHeight}return c6||0}var ea;function aS(ew){if(ea==null){var ex=ej("span","\u200b");bf(ew,ej("span",[ex,document.createTextNode("x")]));if(ew.firstChild.offsetHeight!=0){ea=ex.offsetWidth<=1&&ex.offsetHeight>2&&!bF}}if(ea){return ej("span","\u200b")}else{return ej("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px")}}var ay="\n\nb".split(/\n/).length!=3?function(eB){var eC=0,ew=[],eA=eB.length;while(eC<=eA){var ez=eB.indexOf("\n",eC);if(ez==-1){ez=eB.length}var ey=eB.slice(eC,eB.charAt(ez-1)=="\r"?ez-1:ez);var ex=ey.indexOf("\r");if(ex!=-1){ew.push(ey.slice(0,ex));eC+=ex+1}else{ew.push(ey);eC=ez+1}}return ew}:function(ew){return ew.split(/\r\n?|\n/)};B.splitLines=ay;var aX=window.getSelection?function(ex){try{return ex.selectionStart!=ex.selectionEnd}catch(ew){return false}}:function(ey){try{var ew=ey.ownerDocument.selection.createRange()}catch(ex){}if(!ew||ew.parentElement()!=ey){return false}return ew.compareEndPoints("StartToEnd",ew)!=0};var ce=(function(){var ew=ej("div");if("oncopy" in ew){return true}ew.setAttribute("oncopy","return;");return typeof ew.oncopy=="function"})();var dL={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};B.keyNames=dL;(function(){for(var ew=0;ew<10;ew++){dL[ew+48]=dL[ew+96]=String(ew)}for(var ew=65;ew<=90;ew++){dL[ew]=String.fromCharCode(ew)}for(var ew=1;ew<=12;ew++){dL[ew+111]=dL[ew+63235]="F"+ew}})();function cL(ew,eC,eB,eA){if(!ew){return eA(eC,eB,"ltr")}var ez=false;for(var ey=0;ey<ew.length;++ey){var ex=ew[ey];if(ex.from<eB&&ex.to>eC||eC==eB&&ex.to==eC){eA(Math.max(ex.from,eC),Math.min(ex.to,eB),ex.level==1?"rtl":"ltr");ez=true}}if(!ez){eA(eC,eB,"ltr")}}function cv(ew){return ew.level%2?ew.to:ew.from}function er(ew){return ew.level%2?ew.from:ew.to}function bU(ex){var ew=a(ex);return ew?cv(ew[0]):0}function b4(ex){var ew=a(ex);if(!ew){return ex.text.length}return er(d7(ew))}function aY(ex,eA){var ey=dJ(ex.doc,eA);var eB=u(ex.doc,ey);if(eB!=ey){eA=bc(eB)}var ew=a(eB);var ez=!ew?0:ew[0].level%2?b4(eB):bU(eB);return K(eA,ez)}function cE(ey,eB){var ex,ez;while(ex=c5(ez=dJ(ey.doc,eB))){eB=ex.find().to.line}var ew=a(ez);var eA=!ew?ez.text.length:ew[0].level%2?bU(ez):b4(ez);return K(eB,eA)}function X(ex,ey,ew){var ez=ex[0].level;if(ey==ez){return true}if(ew==ez){return false}return ey<ew}var dz;function aj(ew,eA){dz=null;for(var ex=0,ey;ex<ew.length;++ex){var ez=ew[ex];if(ez.from<eA&&ez.to>eA){return ex}if((ez.from==eA||ez.to==eA)){if(ey==null){ey=ex}else{if(X(ew,ez.level,ew[ey].level)){if(ez.from!=ez.to){dz=ey}return ex}else{if(ez.from!=ez.to){dz=ex}return ey}}}}return ey}function dI(ew,ez,ex,ey){if(!ey){return ez+ex}do{ez+=ex}while(ez>0&&dV(ew.text.charAt(ez)));return ez}function q(ew,eD,ey,ez){var eA=a(ew);if(!eA){return R(ew,eD,ey,ez)}var eC=aj(eA,eD),ex=eA[eC];var eB=dI(ew,eD,ex.level%2?-ey:ey,ez);for(;;){if(eB>ex.from&&eB<ex.to){return eB}if(eB==ex.from||eB==ex.to){if(aj(eA,eB)==eC){return eB}ex=eA[eC+=ey];return(ey>0)==ex.level%2?ex.to:ex.from}else{ex=eA[eC+=ey];if(!ex){return null}if((ey>0)==ex.level%2){eB=dI(ew,ex.to,-1,ez)}else{eB=dI(ew,ex.from,1,ez)}}}}function R(ew,eA,ex,ey){var ez=eA+ex;if(ey){while(ez>0&&dV(ew.text.charAt(ez))){ez+=ex}}return ez<0||ez>ew.text.length?null:ez}var aM=(function(){var eC="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL";var eA="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr";function ez(eF){if(eF<=255){return eC.charAt(eF)}else{if(1424<=eF&&eF<=1524){return"R"}else{if(1536<=eF&&eF<=1791){return eA.charAt(eF-1536)}else{if(1792<=eF&&eF<=2220){return"r"}else{return"L"}}}}}var ew=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;var eE=/[stwN]/,ey=/[LRr]/,ex=/[Lb1n]/,eB=/[1n]/;var eD="L";return function(eP){if(!ew.test(eP)){return false}var eV=eP.length,eL=[];for(var eU=0,eH;eU<eV;++eU){eL.push(eH=ez(eP.charCodeAt(eU)))}for(var eU=0,eO=eD;eU<eV;++eU){var eH=eL[eU];if(eH=="m"){eL[eU]=eO}else{eO=eH}}for(var eU=0,eF=eD;eU<eV;++eU){var eH=eL[eU];if(eH=="1"&&eF=="r"){eL[eU]="n"}else{if(ey.test(eH)){eF=eH;if(eH=="r"){eL[eU]="R"}}}}for(var eU=1,eO=eL[0];eU<eV-1;++eU){var eH=eL[eU];if(eH=="+"&&eO=="1"&&eL[eU+1]=="1"){eL[eU]="1"}else{if(eH==","&&eO==eL[eU+1]&&(eO=="1"||eO=="n")){eL[eU]=eO}}eO=eH}for(var eU=0;eU<eV;++eU){var eH=eL[eU];if(eH==","){eL[eU]="N"}else{if(eH=="%"){for(var eI=eU+1;eI<eV&&eL[eI]=="%";++eI){}var eW=(eU&&eL[eU-1]=="!")||(eI<eV&&eL[eI]=="1")?"1":"N";for(var eS=eU;eS<eI;++eS){eL[eS]=eW}eU=eI-1}}}for(var eU=0,eF=eD;eU<eV;++eU){var eH=eL[eU];if(eF=="L"&&eH=="1"){eL[eU]="L"}else{if(ey.test(eH)){eF=eH}}}for(var eU=0;eU<eV;++eU){if(eE.test(eL[eU])){for(var eI=eU+1;eI<eV&&eE.test(eL[eI]);++eI){}var eM=(eU?eL[eU-1]:eD)=="L";var eG=(eI<eV?eL[eI]:eD)=="L";var eW=eM||eG?"L":"R";for(var eS=eU;eS<eI;++eS){eL[eS]=eW}eU=eI-1}}var eT=[],eQ;for(var eU=0;eU<eV;){if(ex.test(eL[eU])){var eJ=eU;for(++eU;eU<eV&&ex.test(eL[eU]);++eU){}eT.push({from:eJ,to:eU,level:0})}else{var eK=eU,eN=eT.length;for(++eU;eU<eV&&eL[eU]!="L";++eU){}for(var eS=eK;eS<eU;){if(eB.test(eL[eS])){if(eK<eS){eT.splice(eN,0,{from:eK,to:eS,level:1})}var eR=eS;for(++eS;eS<eU&&eB.test(eL[eS]);++eS){}eT.splice(eN,0,{from:eR,to:eS,level:2});eK=eS}else{++eS}}if(eK<eU){eT.splice(eN,0,{from:eK,to:eU,level:1})}}}if(eT[0].level==1&&(eQ=eP.match(/^\s+/))){eT[0].from=eQ[0].length;eT.unshift({from:0,to:eQ[0].length,level:0})}if(d7(eT).level==1&&(eQ=eP.match(/\s+$/))){d7(eT).to-=eQ[0].length;eT.push({from:eV-eQ[0].length,to:eV,level:0})}if(eT[0].level!=d7(eT).level){eT.push({from:eV,to:eV,level:eT[0].level})}return eT}})();B.version="3.21.0";return B})();
|
3 |
+
// CodeMirror XML.
|
4 |
+
CodeMirror.defineMode("xml",function(w,j){var p=w.indentUnit;var v=j.multilineTagIndentFactor||1;var b=j.multilineTagIndentPastTag||true;var u=j.htmlMode?{autoSelfClosers:{area:true,base:true,br:true,col:true,command:true,embed:true,frame:true,hr:true,img:true,input:true,keygen:true,link:true,meta:true,param:true,source:true,track:true,wbr:true},implicitlyClosed:{dd:true,li:true,optgroup:true,option:true,p:true,rp:true,rt:true,tbody:true,td:true,tfoot:true,th:true,tr:true},contextGrabbers:{dd:{dd:true,dt:true},dt:{dd:true,dt:true},li:{li:true},option:{option:true,optgroup:true},optgroup:{optgroup:true},p:{address:true,article:true,aside:true,blockquote:true,dir:true,div:true,dl:true,fieldset:true,footer:true,form:true,h1:true,h2:true,h3:true,h4:true,h5:true,h6:true,header:true,hgroup:true,hr:true,menu:true,nav:true,ol:true,p:true,pre:true,section:true,table:true,ul:true},rp:{rp:true,rt:true},rt:{rp:true,rt:true},tbody:{tbody:true,tfoot:true},td:{td:true,th:true},tfoot:{tbody:true},th:{td:true,th:true},thead:{tbody:true,tfoot:true},tr:{tr:true}},doNotIndent:{pre:true},allowUnquoted:true,allowMissing:true}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:false,allowMissing:false};var a=j.alignCDATA;var d,e,f;function m(E,D){function B(G){D.tokenize=G;return G(E,D)}var C=E.next();if(C=="<"){if(E.eat("!")){if(E.eat("[")){if(E.match("CDATA[")){return B(t("atom","]]>"))}else{return null}}else{if(E.match("--")){return B(t("comment","-->"))}else{if(E.match("DOCTYPE",true,true)){E.eatWhile(/[\w\._\-]/);return B(x(1))}else{return null}}}}else{if(E.eat("?")){E.eatWhile(/[\w\._\-]/);D.tokenize=t("meta","?>");return"meta"}else{var z=E.eat("/");d="";var F;while((F=E.eat(/[^\s\u00a0=<>\"\'\/?]/))){d+=F}if(!d){return"tag error"}e=z?"closeTag":"openTag";D.tokenize=l;return"tag"}}}else{if(C=="&"){var A;if(E.eat("#")){if(E.eat("x")){A=E.eatWhile(/[a-fA-F\d]/)&&E.eat(";")}else{A=E.eatWhile(/[\d]/)&&E.eat(";")}}else{A=E.eatWhile(/[\w\.\-:]/)&&E.eat(";")}return A?"atom":"error"}else{E.eatWhile(/[^&<]/);return null}}}function l(C,B){var A=C.next();if(A==">"||(A=="/"&&C.eat(">"))){B.tokenize=m;e=A==">"?"endTag":"selfcloseTag";return"tag"}else{if(A=="="){e="equals";return null}else{if(A=="<"){B.tokenize=m;B.state=k;B.tagName=B.tagStart=null;var z=B.tokenize(C,B);return z?z+" error":"error"}else{if(/[\'\"]/.test(A)){B.tokenize=i(A);B.stringStartCol=C.column();return B.tokenize(C,B)}else{C.eatWhile(/[^\s\u00a0=<>\"\']/);return"word"}}}}}function i(z){var A=function(C,B){while(!C.eol()){if(C.next()==z){B.tokenize=l;break}}return"string"};A.isInAttribute=true;return A}function t(A,z){return function(C,B){while(!C.eol()){if(C.match(z)){B.tokenize=m;break}C.next()}return A}}function x(z){return function(C,B){var A;while((A=C.next())!=null){if(A=="<"){B.tokenize=x(z+1);return B.tokenize(C,B)}else{if(A==">"){if(z==1){B.tokenize=m;break}else{B.tokenize=x(z-1);return B.tokenize(C,B)}}}}return"meta"}}function q(A,z,B){this.prev=A.context;this.tagName=z;this.indent=A.indented;this.startOfLine=B;if(u.doNotIndent.hasOwnProperty(z)||(A.context&&A.context.noIndent)){this.noIndent=true}}function s(z){if(z.context){z.context=z.context.prev}}function o(B,A){var z;while(true){if(!B.context){return}z=B.context.tagName.toLowerCase();if(!u.contextGrabbers.hasOwnProperty(z)||!u.contextGrabbers[z].hasOwnProperty(A)){return}s(B)}}function k(z,C,B){if(z=="openTag"){B.tagName=d;B.tagStart=C.column();return c}else{if(z=="closeTag"){var A=false;if(B.context){if(B.context.tagName!=d){if(u.implicitlyClosed.hasOwnProperty(B.context.tagName.toLowerCase())){s(B)}A=!B.context||B.context.tagName!=d}}else{A=true}if(A){f="error"}return A?y:r}else{return k}}}function r(A,z,B){if(A!="endTag"){f="error";return r}s(B);return k}function y(z,B,A){f="error";return r(z,B,A)}function c(C,A,D){if(C=="word"){f="attribute";return h}else{if(C=="endTag"||C=="selfcloseTag"){var B=D.tagName,z=D.tagStart;D.tagName=D.tagStart=null;if(C=="selfcloseTag"||u.autoSelfClosers.hasOwnProperty(B.toLowerCase())){o(D,B.toLowerCase())}else{o(D,B.toLowerCase());D.context=new q(D,B,z==D.indented)}return k}}f="error";return c}function h(z,B,A){if(z=="equals"){return n}if(!u.allowMissing){f="error"}return c(z,B,A)}function n(z,B,A){if(z=="string"){return g}if(z=="word"&&u.allowUnquoted){f="string";return c}f="error";return c(z,B,A)}function g(z,B,A){if(z=="string"){return g}return c(z,B,A)}return{startState:function(){return{tokenize:m,state:k,indented:0,tagName:null,tagStart:null,context:null}},token:function(B,A){if(!A.tagName&&B.sol()){A.indented=B.indentation()}if(B.eatSpace()){return null}d=e=null;var z=A.tokenize(B,A);if((z||e)&&z!="comment"){f=null;A.state=A.state(e||z,B,A);if(f){z=f=="error"?z+" error":f}}return z},indent:function(C,z,B){var A=C.context;if(C.tokenize.isInAttribute){return C.stringStartCol+1}if(A&&A.noIndent){return CodeMirror.Pass}if(C.tokenize!=l&&C.tokenize!=m){return B?B.match(/^(\s*)/)[0].length:0}if(C.tagName){if(b){return C.tagStart+C.tagName.length+2}else{return C.tagStart+p*v}}if(a&&/<!\[CDATA\[/.test(z)){return 0}if(A&&/^<\//.test(z)){A=A.prev}while(A&&!A.startOfLine){A=A.prev}if(A){return A.indent+p}else{return 0}},electricChars:"/",blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:j.htmlMode?"html":"xml",helperType:j.htmlMode?"html":"xml"}});CodeMirror.defineMIME("text/xml","xml");CodeMirror.defineMIME("application/xml","xml");if(!CodeMirror.mimeModes.hasOwnProperty("text/html")){CodeMirror.defineMIME("text/html",{name:"xml",htmlMode:true})};
|
5 |
+
// CodeMirror JS.
|
6 |
+
CodeMirror.defineMode("javascript",function(W,ag){var i=W.indentUnit;var w=ag.statementIndent;var v=ag.json;var e=ag.typescript;var am=function(){function aJ(aL){return{type:aL,style:"keyword"}}var aE=aJ("keyword a"),aC=aJ("keyword b"),aB=aJ("keyword c");var aD=aJ("operator"),aH={type:"atom",style:"atom"};var aF={"if":aJ("if"),"while":aE,"with":aE,"else":aC,"do":aC,"try":aC,"finally":aC,"return":aB,"break":aB,"continue":aB,"new":aB,"delete":aB,"throw":aB,"debugger":aB,"var":aJ("var"),"const":aJ("var"),let:aJ("var"),"function":aJ("function"),"catch":aJ("catch"),"for":aJ("for"),"switch":aJ("switch"),"case":aJ("case"),"default":aJ("default"),"in":aD,"typeof":aD,"instanceof":aD,"true":aH,"false":aH,"null":aH,"undefined":aH,"NaN":aH,"Infinity":aH,"this":aJ("this"),module:aJ("module"),"class":aJ("class"),"super":aJ("atom"),yield:aB,"export":aJ("export"),"import":aJ("import"),"extends":aB};if(e){var aK={type:"variable",style:"variable-3"};var aG={"interface":aJ("interface"),"extends":aJ("extends"),constructor:aJ("constructor"),"public":aJ("public"),"private":aJ("private"),"protected":aJ("protected"),"static":aJ("static"),string:aK,number:aK,bool:aK,any:aK};for(var aI in aG){aF[aI]=aG[aI]}}return aF}();var L=/[+\-*&%=<>!?|~^]/;function B(aE){var aC=false,aB,aD=false;while((aB=aE.next())!=null){if(!aC){if(aB=="/"&&!aD){return}if(aB=="["){aD=true}else{if(aD&&aB=="]"){aD=false}}}aC=!aC&&aB=="\\"}}var O,C;function H(aD,aC,aB){O=aD;C=aB;return aC}function Q(aF,aD){var aB=aF.next();if(aB=='"'||aB=="'"){aD.tokenize=N(aB);return aD.tokenize(aF,aD)}else{if(aB=="."&&aF.match(/^\d+(?:[eE][+\-]?\d+)?/)){return H("number","number")}else{if(aB=="."&&aF.match("..")){return H("spread","meta")}else{if(/[\[\]{}\(\),;\:\.]/.test(aB)){return H(aB)}else{if(aB=="="&&aF.eat(">")){return H("=>","operator")}else{if(aB=="0"&&aF.eat(/x/i)){aF.eatWhile(/[\da-f]/i);return H("number","number")}else{if(/\d/.test(aB)){aF.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);return H("number","number")}else{if(aB=="/"){if(aF.eat("*")){aD.tokenize=at;return at(aF,aD)}else{if(aF.eat("/")){aF.skipToEnd();return H("comment","comment")}else{if(aD.lastType=="operator"||aD.lastType=="keyword c"||aD.lastType=="sof"||/^[\[{}\(,;:]$/.test(aD.lastType)){B(aF);aF.eatWhile(/[gimy]/);return H("regexp","string-2")}else{aF.eatWhile(L);return H("operator","operator",aF.current())}}}}else{if(aB=="`"){aD.tokenize=au;return au(aF,aD)}else{if(aB=="#"){aF.skipToEnd();return H("error","error")}else{if(L.test(aB)){aF.eatWhile(L);return H("operator","operator",aF.current())}else{aF.eatWhile(/[\w\$_]/);var aE=aF.current(),aC=am.propertyIsEnumerable(aE)&&am[aE];return(aC&&aD.lastType!=".")?H(aC.type,aC.style,aE):H("variable","variable",aE)}}}}}}}}}}}}function N(aB){return function(aF,aD){var aE=false,aC;while((aC=aF.next())!=null){if(aC==aB&&!aE){break}aE=!aE&&aC=="\\"}if(!aE){aD.tokenize=Q}return H("string","string")}}function at(aE,aD){var aB=false,aC;while(aC=aE.next()){if(aC=="/"&&aB){aD.tokenize=Q;break}aB=(aC=="*")}return H("comment","comment")}function au(aE,aC){var aD=false,aB;while((aB=aE.next())!=null){if(!aD&&(aB=="`"||aB=="$"&&aE.eat("{"))){aC.tokenize=Q;break}aD=!aD&&aB=="\\"}return H("quasi","string-2",aE.current())}var j="([{}])";function ap(aH,aE){if(aE.fatArrowAt){aE.fatArrowAt=null}var aD=aH.string.indexOf("=>",aH.start);if(aD<0){return}var aG=0,aC=false;for(var aI=aD-1;aI>=0;--aI){var aB=aH.string.charAt(aI);var aF=j.indexOf(aB);if(aF>=0&&aF<3){if(!aG){++aI;break}if(--aG==0){break}}else{if(aF>=3&&aF<6){++aG}else{if(/[$\w]/.test(aB)){aC=true}else{if(aC&&!aG){++aI;break}}}}}if(aC&&!aG){aE.fatArrowAt=aI}}var a={atom:true,number:true,variable:true,string:true,regexp:true,"this":true};function F(aG,aC,aB,aF,aD,aE){this.indented=aG;this.column=aC;this.type=aB;this.prev=aD;this.info=aE;if(aF!=null){this.align=aF}}function o(aE,aD){for(var aC=aE.localVars;aC;aC=aC.next){if(aC.name==aD){return true}}for(var aB=aE.context;aB;aB=aB.prev){for(var aC=aB.vars;aC;aC=aC.next){if(aC.name==aD){return true}}}}function d(aF,aC,aB,aE,aG){var aH=aF.cc;z.state=aF;z.stream=aG;z.marked=null,z.cc=aH;if(!aF.lexical.hasOwnProperty("align")){aF.lexical.align=true}while(true){var aD=aH.length?aH.pop():v?ak:az;if(aD(aB,aE)){while(aH.length&&aH[aH.length-1].lex){aH.pop()()}if(z.marked){return z.marked}if(aB=="variable"&&o(aF,aE)){return"variable-2"}return aC}}}var z={state:null,column:null,marked:null,cc:null};function X(){for(var aB=arguments.length-1;aB>=0;aB--){z.cc.push(arguments[aB])}}function ab(){X.apply(null,arguments);return true}function ao(aC){function aB(aF){for(var aE=aF;aE;aE=aE.next){if(aE.name==aC){return true}}return false}var aD=z.state;if(aD.context){z.marked="def";if(aB(aD.localVars)){return}aD.localVars={name:aC,next:aD.localVars}}else{if(aB(aD.globalVars)){return}if(ag.globalVars){aD.globalVars={name:aC,next:aD.globalVars}}}}var m={name:"this",next:{name:"arguments"}};function s(){z.state.context={prev:z.state.context,vars:z.state.localVars};z.state.localVars=m}function t(){z.state.localVars=z.state.context.vars;z.state.context=z.state.context.prev}function ax(aC,aD){var aB=function(){var aF=z.state,aE=aF.indented;if(aF.lexical.type=="stat"){aE=aF.lexical.indented}aF.lexical=new F(aE,z.stream.column(),aC,null,aF.lexical,aD)};aB.lex=true;return aB}function f(){var aB=z.state;if(aB.lexical.prev){if(aB.lexical.type==")"){aB.indented=aB.lexical.indented}aB.lexical=aB.lexical.prev}}f.lex=true;function n(aB){return function(aC){if(aC==aB){return ab()}else{if(aB==";"){return X()}else{return ab(arguments.callee)}}}}function az(aB,aC){if(aB=="var"){return ab(ax("vardef",aC.length),b,n(";"),f)}if(aB=="keyword a"){return ab(ax("form"),ak,az,f)}if(aB=="keyword b"){return ab(ax("form"),az,f)}if(aB=="{"){return ab(ax("}"),u,f)}if(aB==";"){return ab()}if(aB=="if"){return ab(ax("form"),ak,az,f,c)}if(aB=="function"){return ab(I)}if(aB=="for"){return ab(ax("form"),q,az,f)}if(aB=="variable"){return ab(ax("stat"),aA)}if(aB=="switch"){return ab(ax("form"),ak,ax("}","switch"),n("{"),u,f,f)}if(aB=="case"){return ab(ak,n(":"))}if(aB=="default"){return ab(n(":"))}if(aB=="catch"){return ab(ax("form"),s,n("("),ac,n(")"),az,f,t)}if(aB=="module"){return ab(ax("form"),s,D,t,f)}if(aB=="class"){return ab(ax("form"),S,R,f)}if(aB=="export"){return ab(ax("form"),ay,f)}if(aB=="import"){return ab(ax("form"),ad,f)}return X(ax("stat"),ak,n(";"),f)}function ak(aB){return V(aB,false)}function aw(aB){return V(aB,true)}function V(aC,aE){if(z.state.fatArrowAt==z.stream.start){var aB=aE?J:T;if(aC=="("){return ab(s,ax(")"),an(g,")"),f,n("=>"),aB,t)}else{if(aC=="variable"){return X(s,g,n("=>"),aB,t)}}}var aD=aE?h:Y;if(a.hasOwnProperty(aC)){return ab(aD)}if(aC=="function"){return ab(I)}if(aC=="keyword c"){return ab(aE?ah:af)}if(aC=="("){return ab(ax(")"),af,ar,n(")"),f,aD)}if(aC=="operator"||aC=="spread"){return ab(aE?aw:ak)}if(aC=="["){return ab(ax("]"),k,f,aD)}if(aC=="{"){return aq(p,"}",null,aD)}return ab()}function af(aB){if(aB.match(/[;\}\)\],]/)){return X()}return X(ak)}function ah(aB){if(aB.match(/[;\}\)\],]/)){return X()}return X(aw)}function Y(aB,aC){if(aB==","){return ab(ak)}return h(aB,aC,false)}function h(aB,aD,aF){var aC=aF==false?Y:h;var aE=aF==false?ak:aw;if(aD=="=>"){return ab(s,aF?J:T,t)}if(aB=="operator"){if(/\+\+|--/.test(aD)){return ab(aC)}if(aD=="?"){return ab(ak,n(":"),aE)}return ab(aE)}if(aB=="quasi"){z.cc.push(aC);return M(aD)}if(aB==";"){return}if(aB=="("){return aq(aw,")","call",aC)}if(aB=="."){return ab(ai,aC)}if(aB=="["){return ab(ax("]"),af,n("]"),f,aC)}}function M(aB){if(aB.slice(aB.length-2)!="${"){return ab()}return ab(ak,l)}function l(aB){if(aB=="}"){z.marked="string-2";z.state.tokenize=au;return ab()}}function T(aB){ap(z.stream,z.state);if(aB=="{"){return X(az)}return X(ak)}function J(aB){ap(z.stream,z.state);if(aB=="{"){return X(az)}return X(aw)}function aA(aB){if(aB==":"){return ab(f,az)}return X(Y,n(";"),f)}function ai(aB){if(aB=="variable"){z.marked="property";return ab()}}function p(aB,aC){if(aB=="variable"){z.marked="property";if(aC=="get"||aC=="set"){return ab(E)}}else{if(aB=="number"||aB=="string"){z.marked=aB+" property"}else{if(aB=="["){return ab(ak,n("]"),G)}}}if(a.hasOwnProperty(aB)){return ab(G)}}function E(aB){if(aB!="variable"){return X(G)}z.marked="property";return ab(I)}function G(aB){if(aB==":"){return ab(aw)}if(aB=="("){return X(I)}}function an(aD,aB){function aC(aF){if(aF==","){var aE=z.state.lexical;if(aE.info=="call"){aE.pos=(aE.pos||0)+1}return ab(aD,aC)}if(aF==aB){return ab()}return ab(n(aB))}return function(aE){if(aE==aB){return ab()}return X(aD,aC)}}function aq(aE,aB,aD){for(var aC=3;aC<arguments.length;aC++){z.cc.push(arguments[aC])}return ab(ax(aB,aD),an(aE,aB),f)}function u(aB){if(aB=="}"){return ab()}return X(az,u)}function P(aB){if(e&&aB==":"){return ab(aa)}}function aa(aB){if(aB=="variable"){z.marked="variable-3";return ab()}}function b(){return X(g,P,Z,U)}function g(aB,aC){if(aB=="variable"){ao(aC);return ab()}if(aB=="["){return aq(g,"]")}if(aB=="{"){return aq(av,"}")}}function av(aB,aC){if(aB=="variable"&&!z.stream.match(/^\s*:/,false)){ao(aC);return ab(Z)}if(aB=="variable"){z.marked="property"}return ab(n(":"),g,Z)}function Z(aB,aC){if(aC=="="){return ab(aw)}}function U(aB){if(aB==","){return ab(b)}}function c(aB,aC){if(aB=="keyword b"&&aC=="else"){return ab(ax("form"),az,f)}}function q(aB){if(aB=="("){return ab(ax(")"),A,n(")"),f)}}function A(aB){if(aB=="var"){return ab(b,n(";"),y)}if(aB==";"){return ab(y)}if(aB=="variable"){return ab(r)}return X(ak,n(";"),y)}function r(aB,aC){if(aC=="in"||aC=="of"){z.marked="keyword";return ab(ak)}return ab(Y,y)}function y(aB,aC){if(aB==";"){return ab(x)}if(aC=="in"||aC=="of"){z.marked="keyword";return ab(ak)}return X(ak,n(";"),x)}function x(aB){if(aB!=")"){ab(ak)}}function I(aB,aC){if(aC=="*"){z.marked="keyword";return ab(I)}if(aB=="variable"){ao(aC);return ab(I)}if(aB=="("){return ab(s,ax(")"),an(ac,")"),f,az,t)}}function ac(aB){if(aB=="spread"){return ab(ac)}return X(g,P)}function S(aB,aC){if(aB=="variable"){ao(aC);return ab(K)}}function K(aB,aC){if(aC=="extends"){return ab(ak)}}function R(aB){if(aB=="{"){return aq(p,"}")}}function D(aB,aC){if(aB=="string"){return ab(az)}if(aB=="variable"){ao(aC);return ab(ae)}}function ay(aB,aC){if(aC=="*"){z.marked="keyword";return ab(ae,n(";"))}if(aC=="default"){z.marked="keyword";return ab(ak,n(";"))}return X(az)}function ad(aB){if(aB=="string"){return ab()}return X(al,ae)}function al(aB,aC){if(aB=="{"){return aq(al,"}")}if(aB=="variable"){ao(aC)}return ab()}function ae(aB,aC){if(aC=="from"){z.marked="keyword";return ab(ak)}}function k(aB){if(aB=="]"){return ab()}return X(aw,aj)}function aj(aB){if(aB=="for"){return X(ar,n("]"))}if(aB==","){return ab(an(aw,"]"))}return X(an(aw,"]"))}function ar(aB){if(aB=="for"){return ab(q,ar)}if(aB=="if"){return ab(ak,ar)}}return{startState:function(aC){var aB={tokenize:Q,lastType:"sof",cc:[],lexical:new F((aC||0)-i,0,"block",false),localVars:ag.localVars,context:ag.localVars&&{vars:ag.localVars},indented:0};if(ag.globalVars){aB.globalVars=ag.globalVars}return aB},token:function(aD,aC){if(aD.sol()){if(!aC.lexical.hasOwnProperty("align")){aC.lexical.align=false}aC.indented=aD.indentation();ap(aD,aC)}if(aC.tokenize!=at&&aD.eatSpace()){return null}var aB=aC.tokenize(aD,aC);if(O=="comment"){return aB}aC.lastType=O=="operator"&&(C=="++"||C=="--")?"incdec":O;return d(aC,aB,O,C,aD)},indent:function(aH,aB){if(aH.tokenize==at){return CodeMirror.Pass}if(aH.tokenize!=Q){return 0}var aG=aB&&aB.charAt(0),aE=aH.lexical;for(var aD=aH.cc.length-1;aD>=0;--aD){var aI=aH.cc[aD];if(aI==f){aE=aE.prev}else{if(aI!=c){break}}}if(aE.type=="stat"&&aG=="}"){aE=aE.prev}if(w&&aE.type==")"&&aE.prev.type=="stat"){aE=aE.prev}var aF=aE.type,aC=aG==aF;if(aF=="vardef"){return aE.indented+(aH.lastType=="operator"||aH.lastType==","?aE.info+1:0)}else{if(aF=="form"&&aG=="{"){return aE.indented}else{if(aF=="form"){return aE.indented+i}else{if(aF=="stat"){return aE.indented+(aH.lastType=="operator"||aH.lastType==","?w||i:0)}else{if(aE.info=="switch"&&!aC&&ag.doubleIndentSwitch!=false){return aE.indented+(/^(?:case|default)\b/.test(aB)?i:2*i)}else{if(aE.align){return aE.column+(aC?0:1)}else{return aE.indented+(aC?0:i)}}}}}}},electricChars:":{}",blockCommentStart:v?null:"/*",blockCommentEnd:v?null:"*/",lineComment:v?null:"//",fold:"brace",helperType:v?"json":"javascript",jsonMode:v}});CodeMirror.defineMIME("text/javascript","javascript");CodeMirror.defineMIME("text/ecmascript","javascript");CodeMirror.defineMIME("application/javascript","javascript");CodeMirror.defineMIME("application/ecmascript","javascript");CodeMirror.defineMIME("application/json",{name:"javascript",json:true});CodeMirror.defineMIME("application/x-json",{name:"javascript",json:true});CodeMirror.defineMIME("text/typescript",{name:"javascript",typescript:true});CodeMirror.defineMIME("application/typescript",{name:"javascript",typescript:true});
|
7 |
+
// CodeMirror CSS.
|
8 |
+
CodeMirror.defineMode("css",function(u,i){if(!i.propertyKeywords){i=CodeMirror.resolveMode("text/css")}var o=u.indentUnit,b=i.tokenHooks,t=i.mediaTypes||{},k=i.mediaFeatures||{},h=i.propertyKeywords||{},n=i.colorKeywords||{},q=i.valueKeywords||{},d=i.fontProperties||{},l=i.allowNested;var c,m;function v(y,z){c=z;return y}function x(B,A){var z=B.next();if(b[z]){var y=b[z](B,A);if(y!==false){return y}}if(z=="@"){B.eatWhile(/[\w\\\-]/);return v("def",B.current())}else{if(z=="="||(z=="~"||z=="|")&&B.eat("=")){return v(null,"compare")}else{if(z=='"'||z=="'"){A.tokenize=j(z);return A.tokenize(B,A)}else{if(z=="#"){B.eatWhile(/[\w\\\-]/);return v("atom","hash")}else{if(z=="!"){B.match(/^\s*\w*/);return v("keyword","important")}else{if(/\d/.test(z)||z=="."&&B.eat(/\d/)){B.eatWhile(/[\w.%]/);return v("number","unit")}else{if(z==="-"){if(/[\d.]/.test(B.peek())){B.eatWhile(/[\w.%]/);return v("number","unit")}else{if(B.match(/^[^-]+-/)){return v("meta","meta")}}}else{if(/[,+>*\/]/.test(z)){return v(null,"select-op")}else{if(z=="."&&B.match(/^-?[_a-z][_a-z0-9-]*/i)){return v("qualifier","qualifier")}else{if(/[:;{}\[\]\(\)]/.test(z)){return v(null,z)}else{if(z=="u"&&B.match("rl(")){B.backUp(1);A.tokenize=w;return v("property","word")}else{if(/[\w\\\-]/.test(z)){B.eatWhile(/[\w\\\-]/);return v("property","word")}else{return v(null,null)}}}}}}}}}}}}}function j(y){return function(C,A){var B=false,z;while((z=C.next())!=null){if(z==y&&!B){if(y==")"){C.backUp(1)}break}B=!B&&z=="\\"}if(z==y||!B&&y!=")"){A.tokenize=null}return v("string","string")}}function w(z,y){z.next();if(!z.match(/\s*[\"\']/,false)){y.tokenize=j(")")}else{y.tokenize=null}return v(null,"(")}function p(z,y,A){this.type=z;this.indent=y;this.prev=A}function f(z,A,y){z.context=new p(y,A.indentation()+o,z.context);return y}function r(y){y.context=y.context.prev;return y.context.type}function a(y,A,z){return e[z.context.type](y,A,z)}function s(z,B,A,C){for(var y=C||1;y>0;y--){A.context=A.context.prev}return a(z,B,A)}function g(z){var y=z.current().toLowerCase();if(q.hasOwnProperty(y)){m="atom"}else{if(n.hasOwnProperty(y)){m="keyword"}else{m="variable"}}}var e={};e.top=function(y,A,z){if(y=="{"){return f(z,A,"block")}else{if(y=="}"&&z.context.prev){return r(z)}else{if(y=="@media"){return f(z,A,"media")}else{if(y=="@font-face"){return"font_face_before"}else{if(y&&y.charAt(0)=="@"){return f(z,A,"at")}else{if(y=="hash"){m="builtin"}else{if(y=="word"){m="tag"}else{if(y=="variable-definition"){return"maybeprop"}else{if(y=="interpolation"){return f(z,A,"interpolation")}else{if(y==":"){return"pseudo"}else{if(l&&y=="("){return f(z,A,"params")}}}}}}}}}}}return z.context.type};e.block=function(y,A,z){if(y=="word"){if(h.hasOwnProperty(A.current().toLowerCase())){m="property";return"maybeprop"}else{if(l){m=A.match(/^\s*:/,false)?"property":"tag";return"block"}else{m+=" error";return"maybeprop"}}}else{if(y=="meta"){return"block"}else{if(!l&&(y=="hash"||y=="qualifier")){m="error";return"block"}else{return e.top(y,A,z)}}}};e.maybeprop=function(y,A,z){if(y==":"){return f(z,A,"prop")}return a(y,A,z)};e.prop=function(y,A,z){if(y==";"){return r(z)}if(y=="{"&&l){return f(z,A,"propBlock")}if(y=="}"||y=="{"){return s(y,A,z)}if(y=="("){return f(z,A,"parens")}if(y=="hash"&&!/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(A.current())){m+=" error"}else{if(y=="word"){g(A)}else{if(y=="interpolation"){return f(z,A,"interpolation")}}}return"prop"};e.propBlock=function(z,y,A){if(z=="}"){return r(A)}if(z=="word"){m="property";return"maybeprop"}return A.context.type};e.parens=function(y,A,z){if(y=="{"||y=="}"){return s(y,A,z)}if(y==")"){return r(z)}return"parens"};e.pseudo=function(y,A,z){if(y=="word"){m="variable-3";return z.context.type}return a(y,A,z)};e.media=function(y,B,z){if(y=="("){return f(z,B,"media_parens")}if(y=="}"){return s(y,B,z)}if(y=="{"){return r(z)&&f(z,B,l?"block":"top")}if(y=="word"){var A=B.current().toLowerCase();if(A=="only"||A=="not"||A=="and"){m="keyword"}else{if(t.hasOwnProperty(A)){m="attribute"}else{if(k.hasOwnProperty(A)){m="property"}else{m="error"}}}}return z.context.type};e.media_parens=function(y,A,z){if(y==")"){return r(z)}if(y=="{"||y=="}"){return s(y,A,z,2)}return e.media(y,A,z)};e.font_face_before=function(y,A,z){if(y=="{"){return f(z,A,"font_face")}return a(y,A,z)};e.font_face=function(y,A,z){if(y=="}"){return r(z)}if(y=="word"){if(!d.hasOwnProperty(A.current().toLowerCase())){m="error"}else{m="property"}return"maybeprop"}return"font_face"};e.at=function(y,A,z){if(y==";"){return r(z)}if(y=="{"||y=="}"){return s(y,A,z)}if(y=="word"){m="tag"}else{if(y=="hash"){m="builtin"}}return"at"};e.interpolation=function(y,A,z){if(y=="}"){return r(z)}if(y=="{"||y==";"){return s(y,A,z)}if(y!="variable"){m="error"}return"interpolation"};e.params=function(y,A,z){if(y==")"){return r(z)}if(y=="{"||y=="}"){return s(y,A,z)}if(y=="word"){g(A)}return"params"};return{startState:function(y){return{tokenize:null,state:"top",context:new p("top",y||0,null)}},token:function(A,z){if(!z.tokenize&&A.eatSpace()){return null}var y=(z.tokenize||x)(A,z);if(y&&typeof y=="object"){c=y[1];y=y[0]}m=y;z.state=e[z.state](c,A,z);return m},indent:function(C,A){var z=C.context,B=A&&A.charAt(0);var y=z.indent;if(z.prev&&(B=="}"&&(z.type=="block"||z.type=="top"||z.type=="interpolation"||z.type=="font_face")||B==")"&&(z.type=="parens"||z.type=="params"||z.type=="media_parens")||B=="{"&&(z.type=="at"||z.type=="media"))){y=z.indent-o;z=z.prev}return y},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});(function(){function d(s){var r={};for(var q=0;q<s.length;++q){r[s[q]]=true}return r}var m=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],f=d(m);var g=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"],l=d(g);var e=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid-cell","grid-column","grid-column-align","grid-column-sizing","grid-column-span","grid-columns","grid-flow","grid-row","grid-row-align","grid-row-sizing","grid-row-span","grid-rows","grid-template","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-inside","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","zoom","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-profile","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","kerning","text-anchor","writing-mode"],n=d(e);var k=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],o=d(k);var b=["above","absolute","activeborder","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","cover","crop","cross","crosshair","currentcolor","cursive","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ew-resize","expanded","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-table","inset","inside","intrinsic","invert","italic","justify","kannada","katakana","katakana-iroha","keep-all","khmer","landscape","lao","large","larger","left","level","lighter","line-through","linear","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","single","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","x-large","x-small","xor","xx-large","xx-small"],h=d(b);var j=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],a=d(j);var i=m.concat(g).concat(e).concat(k).concat(b);CodeMirror.registerHelper("hintWords","css",i);function p(t,s){var q=false,r;while((r=t.next())!=null){if(q&&r=="/"){s.tokenize=null;break}q=(r=="*")}return["comment","comment"]}function c(r,q){if(r.skipTo("-->")){r.match("-->");q.tokenize=null}else{r.skipToEnd()}return["comment","comment"]}CodeMirror.defineMIME("text/css",{mediaTypes:f,mediaFeatures:l,propertyKeywords:n,colorKeywords:o,valueKeywords:h,fontProperties:a,tokenHooks:{"<":function(r,q){if(!r.match("!--")){return false}q.tokenize=c;return c(r,q)},"/":function(r,q){if(!r.eat("*")){return false}q.tokenize=p;return p(r,q)}},name:"css"});CodeMirror.defineMIME("text/x-scss",{mediaTypes:f,mediaFeatures:l,propertyKeywords:n,colorKeywords:o,valueKeywords:h,fontProperties:a,allowNested:true,tokenHooks:{"/":function(r,q){if(r.eat("/")){r.skipToEnd();return["comment","comment"]}else{if(r.eat("*")){q.tokenize=p;return p(r,q)}else{return["operator","operator"]}}},":":function(q){if(q.match(/\s*{/)){return[null,"{"]}return false},"$":function(q){q.match(/^[\w-]+/);if(q.match(/^\s*:/,false)){return["variable-2","variable-definition"]}return["variable-2","variable"]},"#":function(q){if(!q.eat("{")){return false}return[null,"interpolation"]}},name:"css",helperType:"scss"});CodeMirror.defineMIME("text/x-less",{mediaTypes:f,mediaFeatures:l,propertyKeywords:n,colorKeywords:o,valueKeywords:h,fontProperties:a,allowNested:true,tokenHooks:{"/":function(r,q){if(r.eat("/")){r.skipToEnd();return["comment","comment"]}else{if(r.eat("*")){q.tokenize=p;return p(r,q)}else{return["operator","operator"]}}},"@":function(q){if(q.match(/^(charset|document|font-face|import|keyframes|media|namespace|page|supports)\b/,false)){return false}q.eatWhile(/[\w\\\-]/);if(q.match(/^\s*:/,false)){return["variable-2","variable-definition"]}return["variable-2","variable"]},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"})})();
|
9 |
+
// CodeMirror HTML.
|
10 |
+
CodeMirror.defineMode("htmlmixed",function(b,c){var a=CodeMirror.getMode(b,{name:"xml",htmlMode:true});var m=CodeMirror.getMode(b,"css");var k=[],j=c&&c.scriptTypes;k.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:CodeMirror.getMode(b,"javascript")});if(j){for(var d=0;d<j.length;++d){var h=j[d];k.push({matches:h.matches,mode:h.mode&&CodeMirror.getMode(b,h.mode)})}}k.push({matches:/./,mode:CodeMirror.getMode(b,"text/plain")});function e(s,q){var o=q.htmlState.tagName;var p=a.token(s,q.htmlState);if(o=="script"&&/\btag\b/.test(p)&&s.current()==">"){var t=s.string.slice(Math.max(0,s.pos-100),s.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);t=t?t[1]:"";if(t&&/[\"\']/.test(t.charAt(0))){t=t.slice(1,t.length-1)}for(var n=0;n<k.length;++n){var r=k[n];if(typeof r.matches=="string"?t==r.matches:r.matches.test(t)){if(r.mode){q.token=l;q.localMode=r.mode;q.localState=r.mode.startState&&r.mode.startState(a.indent(q.htmlState,""))}break}}}else{if(o=="style"&&/\btag\b/.test(p)&&s.current()==">"){q.token=f;q.localMode=m;q.localState=m.startState(a.indent(q.htmlState,""))}}return p}function g(r,n,o){var q=r.current();var p=q.search(n),i;if(p>-1){r.backUp(q.length-p)}else{if(i=q.match(/<\/?$/)){r.backUp(q.length);if(!r.match(n,false)){r.match(q)}}}return o}function l(n,i){if(n.match(/^<\/\s*script\s*>/i,false)){i.token=e;i.localState=i.localMode=null;return e(n,i)}return g(n,/<\/\s*script\s*>/,i.localMode.token(n,i.localState))}function f(n,i){if(n.match(/^<\/\s*style\s*>/i,false)){i.token=e;i.localState=i.localMode=null;return e(n,i)}return g(n,/<\/\s*style\s*>/,m.token(n,i.localState))}return{startState:function(){var i=a.startState();return{token:e,localMode:null,localState:null,htmlState:i}},copyState:function(n){if(n.localState){var i=CodeMirror.copyState(n.localMode,n.localState)}return{token:n.token,localMode:n.localMode,localState:i,htmlState:CodeMirror.copyState(a,n.htmlState)}},token:function(n,i){return i.token(n,i)},indent:function(n,i){if(!n.localMode||/^\s*<\//.test(i)){return a.indent(n.htmlState,i)}else{if(n.localMode.indent){return n.localMode.indent(n.localState,i)}else{return CodeMirror.Pass}}},innerMode:function(i){return{state:i.localState||i.htmlState,mode:i.localMode||a}}}},"xml","javascript","css");CodeMirror.defineMIME("text/html","htmlmixed");
|
11 |
+
// CodeMirror PHP.
|
12 |
+
(function(){function c(g){var e={},f=g.split(" ");for(var d=0;d<f.length;++d){e[f[d]]=true}return e}function a(d){return function(f,e){if(f.match(d)){e.tokenize=null}else{f.skipToEnd()}return"string"}}var b={name:"clike",keywords:c("abstract and array as break case catch class clone const continue declare default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global goto if implements interface instanceof namespace new or private protected public static switch throw trait try use var while xor die echo empty exit eval include include_once isset list require require_once return print unset __halt_compiler self static parent yield insteadof finally"),blockKeywords:c("catch do else elseif for foreach if switch try while finally"),atoms:c("true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__"),builtin:c("func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once"),multiLineStrings:true,hooks:{"$":function(d){d.eatWhile(/[\w\$_]/);return"variable-2"},"<":function(e,d){if(e.match(/<</)){e.eatWhile(/[\w\.]/);d.tokenize=a(e.current().slice(3));return d.tokenize(e,d)}return false},"#":function(d){while(!d.eol()&&!d.match("?>",false)){d.next()}return"comment"},"/":function(d){if(d.eat("/")){while(!d.eol()&&!d.match("?>",false)){d.next()}return"comment"}return false}}};CodeMirror.defineMode("php",function(f,g){var h=CodeMirror.getMode(f,"text/html");var d=CodeMirror.getMode(f,b);function e(p,n){var l=n.curMode==d;if(p.sol()&&n.pending&&n.pending!='"'&&n.pending!="'"){n.pending=null}if(!l){if(p.match(/^<\?\w*/)){n.curMode=d;n.curState=n.php;return"meta"}if(n.pending=='"'||n.pending=="'"){while(!p.eol()&&p.next()!=n.pending){}var k="string"}else{if(n.pending&&p.pos<n.pending.end){p.pos=n.pending.end;var k=n.pending.style}else{var k=h.token(p,n.curState)}}if(n.pending){n.pending=null}var o=p.current(),j=o.search(/<\?/),i;if(j!=-1){if(k=="string"&&(i=o.match(/[\'\"]$/))&&!/\?>/.test(o)){n.pending=i[0]}else{n.pending={end:p.pos,style:k}}p.backUp(o.length-j)}return k}else{if(l&&n.php.tokenize==null&&p.match("?>")){n.curMode=h;n.curState=n.html;return"meta"}else{return d.token(p,n.curState)}}}return{startState:function(){var i=CodeMirror.startState(h),j=CodeMirror.startState(d);return{html:i,php:j,curMode:g.startOpen?d:h,curState:g.startOpen?j:i,pending:null}},copyState:function(l){var j=l.html,k=CodeMirror.copyState(h,j),n=l.php,i=CodeMirror.copyState(d,n),m;if(l.curMode==h){m=k}else{m=i}return{html:k,php:i,curMode:l.curMode,curState:m,pending:l.pending}},token:e,indent:function(j,i){if((j.curMode!=d&&/^\s*<\//.test(i))||(j.curMode==d&&/^\?>/.test(i))){return h.indent(j.html,i)}return j.curMode.indent(j.curState,i)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(i){return{state:i.curState,mode:i.curMode}}}},"htmlmixed","clike");CodeMirror.defineMIME("application/x-httpd-php","php");CodeMirror.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:true});CodeMirror.defineMIME("text/x-php",b)})();
|
assets/js/editor.js
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* ==========================================================
|
2 |
+
* editor.js
|
3 |
+
* http://soliloquywp.com/
|
4 |
+
*
|
5 |
+
* This file can be used by 3rd party plugins to integrate
|
6 |
+
* with their custom field systems. It allows the selection
|
7 |
+
* process to be standardized so that 3rd party plugins can
|
8 |
+
* trigger modal selection windows and receive the corresponding
|
9 |
+
* selected data objects.
|
10 |
+
*
|
11 |
+
* Using this file requires three actions for the 3rd party plugin.
|
12 |
+
*
|
13 |
+
* 1. The media modal HTML output needs to be inserted directly
|
14 |
+
* after the option/dropdown/button that is to be used to
|
15 |
+
* trigger the modal. This can be done by placing the following
|
16 |
+
* code after the output (first to return, latter to echo):
|
17 |
+
*
|
18 |
+
* Soliloquy_Editor::get_instance()->slider_selection_modal();
|
19 |
+
*
|
20 |
+
* 2. This file should be enqueued on the page where the field resides.
|
21 |
+
* You should add the class ".soliloquy-modal-trigger" to the
|
22 |
+
* option/dropdown/button that will trigger the modal. This will
|
23 |
+
* be used as a reference point for showing, hiding and passing data
|
24 |
+
* between the modal and your plugin.
|
25 |
+
*
|
26 |
+
* 3. Attaching to a global event that is fired once the data for the
|
27 |
+
* selection has been retrieved. You should listen on the document
|
28 |
+
* object for the "soliloquySliderModalData" event, like this:
|
29 |
+
*
|
30 |
+
* $(document).on("soliloquySliderModalData", function(e){
|
31 |
+
* console.log(e.slider);
|
32 |
+
* });
|
33 |
+
*
|
34 |
+
* This will give you access to the entire array of slider data that
|
35 |
+
* the user has selected, including ID, title, slug and settings.
|
36 |
+
* ==========================================================
|
37 |
+
* Copyright 2013 Thomas Griffin.
|
38 |
+
*
|
39 |
+
* Licensed under the GPL License, Version 2.0 or later (the "License");
|
40 |
+
* you may not use this file except in compliance with the License.
|
41 |
+
* You may obtain a copy of the License at
|
42 |
+
*
|
43 |
+
* http://www.gnu.org/licenses/gpl-2.0.html
|
44 |
+
*
|
45 |
+
* Unless required by applicable law or agreed to in writing, software
|
46 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
47 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
48 |
+
* See the License for the specific language governing permissions and
|
49 |
+
* limitations under the License.
|
50 |
+
* ========================================================== */
|
51 |
+
;(function($){
|
52 |
+
$(function(){
|
53 |
+
// Close the modal window on user action.
|
54 |
+
var soliloquy_trigger_target = soliloquy_editor_frame = false;
|
55 |
+
var soliloquy_append_and_hide = function(e){
|
56 |
+
e.preventDefault();
|
57 |
+
$('.soliloquy-default-ui .selected').removeClass('details selected');
|
58 |
+
$('.soliloquy-default-ui').appendTo('.soliloquy-default-ui-wrapper').hide();
|
59 |
+
soliloquy_trigger_target = soliloquy_editor_frame = false;
|
60 |
+
};
|
61 |
+
|
62 |
+
$(document).on('click', '.soliloquy-choose-slider, .soliloquy-modal-trigger', function(e){
|
63 |
+
e.preventDefault();
|
64 |
+
|
65 |
+
// Store the trigger target.
|
66 |
+
soliloquy_trigger_target = e.target;
|
67 |
+
|
68 |
+
// Show the modal.
|
69 |
+
soliloquy_editor_frame = true;
|
70 |
+
$('.soliloquy-default-ui').appendTo('body').show();
|
71 |
+
|
72 |
+
$(document).on('click', '.media-modal-close, .media-modal-backdrop, .soliloquy-cancel-insertion', soliloquy_append_and_hide);
|
73 |
+
$(document).on('keydown', function(e){
|
74 |
+
if ( 27 == e.keyCode && soliloquy_editor_frame ) {
|
75 |
+
soliloquy_append_and_hide(e);
|
76 |
+
}
|
77 |
+
});
|
78 |
+
});
|
79 |
+
|
80 |
+
$(document).on('click', '.soliloquy-default-ui .thumbnail, .soliloquy-default-ui .check, .soliloquy-default-ui .media-modal-icon', function(e){
|
81 |
+
e.preventDefault();
|
82 |
+
if ( $(this).parent().parent().hasClass('selected') ) {
|
83 |
+
$(this).parent().parent().removeClass('details selected');
|
84 |
+
$('.soliloquy-insert-slider').attr('disabled', 'disabled');
|
85 |
+
} else {
|
86 |
+
$(this).parent().parent().parent().find('.selected').removeClass('details selected');
|
87 |
+
$(this).parent().parent().addClass('details selected');
|
88 |
+
$('.soliloquy-insert-slider').removeAttr('disabled');
|
89 |
+
}
|
90 |
+
});
|
91 |
+
|
92 |
+
$(document).on('click', '.soliloquy-default-ui .check', function(e){
|
93 |
+
e.preventDefault();
|
94 |
+
$(this).parent().parent().removeClass('details selected');
|
95 |
+
$('.soliloquy-insert-slider').attr('disabled', 'disabled');
|
96 |
+
});
|
97 |
+
|
98 |
+
$(document).on('click', '.soliloquy-default-ui .soliloquy-insert-slider', function(e){
|
99 |
+
e.preventDefault();
|
100 |
+
|
101 |
+
// Either insert into an editor or make an ajax request.
|
102 |
+
if ( $(soliloquy_trigger_target).hasClass('soliloquy-choose-slider') ) {
|
103 |
+
wp.media.editor.insert('[soliloquy id="' + $('.soliloquy-default-ui .selected').data('soliloquy-id') + '"]');
|
104 |
+
} else {
|
105 |
+
// Make the ajax request.
|
106 |
+
var req_data = {
|
107 |
+
action: 'soliloquy_load_slider_data',
|
108 |
+
id: $('.soliloquy-default-ui:first .selected').data('soliloquy-id')
|
109 |
+
};
|
110 |
+
$.post(ajaxurl, req_data, function(res){
|
111 |
+
// Trigger the event.
|
112 |
+
$(document).trigger({ type: 'soliloquySliderModalData', slider: res });
|
113 |
+
|
114 |
+
// Close the modal.
|
115 |
+
soliloquy_append_and_hide(e);
|
116 |
+
}, 'json');
|
117 |
+
}
|
118 |
+
|
119 |
+
// Hide the modal.
|
120 |
+
soliloquy_append_and_hide(e);
|
121 |
+
});
|
122 |
+
});
|
123 |
+
}(jQuery));
|
assets/js/metabox.js
ADDED
@@ -0,0 +1,855 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* ==========================================================
|
2 |
+
* metabox.js
|
3 |
+
* http://soliloquywp.com/
|
4 |
+
* ==========================================================
|
5 |
+
* Copyright 2014 Thomas Griffin.
|
6 |
+
*
|
7 |
+
* Licensed under the GPL License, Version 2.0 or later (the "License");
|
8 |
+
* you may not use this file except in compliance with the License.
|
9 |
+
* You may obtain a copy of the License at
|
10 |
+
*
|
11 |
+
* http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
+
*
|
13 |
+
* Unless required by applicable law or agreed to in writing, software
|
14 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
15 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16 |
+
* See the License for the specific language governing permissions and
|
17 |
+
* limitations under the License.
|
18 |
+
* ========================================================== */
|
19 |
+
;(function($){
|
20 |
+
$(function(){
|
21 |
+
// Initialize the slider tabs.
|
22 |
+
var soliloquy_tabs = $('#soliloquy-tabs'),
|
23 |
+
soliloquy_tabs_nav = $('#soliloquy-tabs-nav'),
|
24 |
+
soliloquy_tabs_hash = window.location.hash,
|
25 |
+
soliloquy_tabs_hash_sani = window.location.hash.replace('!', '');
|
26 |
+
|
27 |
+
// If we have a hash and it begins with "soliloquy-tab", set the proper tab to be opened.
|
28 |
+
if ( soliloquy_tabs_hash && soliloquy_tabs_hash.indexOf('soliloquy-tab-') >= 0 ) {
|
29 |
+
$('.soliloquy-active').removeClass('soliloquy-active');
|
30 |
+
soliloquy_tabs_nav.find('li a[href="' + soliloquy_tabs_hash_sani + '"]').parent().addClass('soliloquy-active');
|
31 |
+
soliloquy_tabs.find(soliloquy_tabs_hash_sani).addClass('soliloquy-active').show();
|
32 |
+
|
33 |
+
// Update the post action to contain our hash so the proper tab can be loaded on save.
|
34 |
+
var post_action = $('#post').attr('action');
|
35 |
+
if ( post_action ) {
|
36 |
+
post_action = post_action.split('#')[0];
|
37 |
+
$('#post').attr('action', post_action + soliloquy_tabs_hash);
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
// Change tabs on click.
|
42 |
+
$(document).on('click', '#soliloquy-tabs-nav li a', function(e){
|
43 |
+
e.preventDefault();
|
44 |
+
var $this = $(this);
|
45 |
+
if ( $this.parent().hasClass('soliloquy-active') ) {
|
46 |
+
return;
|
47 |
+
} else {
|
48 |
+
window.location.hash = soliloquy_tabs_hash = this.hash.split('#').join('#!');
|
49 |
+
var current = soliloquy_tabs_nav.find('.soliloquy-active').removeClass('soliloquy-active').find('a').attr('href');
|
50 |
+
$this.parent().addClass('soliloquy-active');
|
51 |
+
soliloquy_tabs.find(current).removeClass('soliloquy-active').hide();
|
52 |
+
soliloquy_tabs.find($this.attr('href')).addClass('soliloquy-active').show();
|
53 |
+
|
54 |
+
// Update the post action to contain our hash so the proper tab can be loaded on save.
|
55 |
+
var post_action = $('#post').attr('action');
|
56 |
+
if ( post_action ) {
|
57 |
+
post_action = post_action.split('#')[0];
|
58 |
+
$('#post').attr('action', post_action + soliloquy_tabs_hash);
|
59 |
+
}
|
60 |
+
}
|
61 |
+
});
|
62 |
+
|
63 |
+
// Load plupload if necessary.
|
64 |
+
var soliloquy_uploader;
|
65 |
+
if ( $('input[name="_soliloquy[type]"]').length > 0 && 'default' == $('input[name="_soliloquy[type]"]:checked').val() ) {
|
66 |
+
soliloquyPlupload();
|
67 |
+
}
|
68 |
+
|
69 |
+
// Conditionally show necessary fields.
|
70 |
+
soliloquyConditionals();
|
71 |
+
|
72 |
+
// Handle the meta icon helper.
|
73 |
+
if ( 0 !== $('.soliloquy-helper-needed').length ) {
|
74 |
+
$('<div class="soliloquy-meta-helper-overlay" />').prependTo('#soliloquy');
|
75 |
+
}
|
76 |
+
|
77 |
+
$(document).on('click', '.soliloquy-meta-icon', function(e){
|
78 |
+
e.preventDefault();
|
79 |
+
var $this = $(this),
|
80 |
+
container = $this.parent(),
|
81 |
+
helper = $this.next();
|
82 |
+
if ( helper.is(':visible') ) {
|
83 |
+
$('.soliloquy-meta-helper-overlay').remove();
|
84 |
+
container.removeClass('soliloquy-helper-active');
|
85 |
+
} else {
|
86 |
+
if ( 0 === $('.soliloquy-meta-helper-overlay').length ) {
|
87 |
+
$('<div class="soliloquy-meta-helper-overlay" />').prependTo('#soliloquy');
|
88 |
+
}
|
89 |
+
container.addClass('soliloquy-helper-active');
|
90 |
+
}
|
91 |
+
});
|
92 |
+
|
93 |
+
// Handle switching between different slider types.
|
94 |
+
$(document).on('change', 'input[name="_soliloquy[type]"]:radio', function(e){
|
95 |
+
var $this = $(this);
|
96 |
+
$('.soliloquy-type-spinner .soliloquy-spinner').css({'display' : 'inline-block', 'margin-top' : '-1px'});
|
97 |
+
|
98 |
+
// Prepare our data to be sent via Ajax.
|
99 |
+
var change = {
|
100 |
+
action: 'soliloquy_change_type',
|
101 |
+
post_id: soliloquy_metabox.id,
|
102 |
+
type: $this.val(),
|
103 |
+
nonce: soliloquy_metabox.change_nonce
|
104 |
+
};
|
105 |
+
|
106 |
+
// Process the Ajax response and output all the necessary data.
|
107 |
+
$.post(
|
108 |
+
soliloquy_metabox.ajax,
|
109 |
+
change,
|
110 |
+
function(response) {
|
111 |
+
// Append the response data.
|
112 |
+
if ( 'default' == response.type ) {
|
113 |
+
$('#soliloquy-slider-main').html(response.html);
|
114 |
+
soliloquyPlupload();
|
115 |
+
} else {
|
116 |
+
$('#soliloquy-slider-main').html(response.html);
|
117 |
+
}
|
118 |
+
|
119 |
+
// Fire an event to attach to.
|
120 |
+
$(document).trigger('soliloquySliderType', response);
|
121 |
+
|
122 |
+
// Remove the spinner.
|
123 |
+
$('.soliloquy-type-spinner .soliloquy-spinner').hide();
|
124 |
+
},
|
125 |
+
'json'
|
126 |
+
);
|
127 |
+
});
|
128 |
+
|
129 |
+
// Open up the media manager modal.
|
130 |
+
$(document).on('click', '.soliloquy-media-library', function(e){
|
131 |
+
e.preventDefault();
|
132 |
+
|
133 |
+
// Show the modal.
|
134 |
+
soliloquy_main_frame = true;
|
135 |
+
$('#soliloquy-upload-ui').appendTo('body').show();
|
136 |
+
});
|
137 |
+
|
138 |
+
// Add the selected state to images when selected from the library view.
|
139 |
+
$('.soliloquy-slider').on('click', '.thumbnail, .check, .media-modal-icon', function(e){
|
140 |
+
e.preventDefault();
|
141 |
+
if ( $(this).parent().parent().hasClass('soliloquy-in-slider') )
|
142 |
+
return;
|
143 |
+
if ( $(this).parent().parent().hasClass('selected') )
|
144 |
+
$(this).parent().parent().removeClass('details selected');
|
145 |
+
else
|
146 |
+
$(this).parent().parent().addClass('details selected');
|
147 |
+
});
|
148 |
+
|
149 |
+
// Load more images into the library view.
|
150 |
+
$(document).on('click', '.soliloquy-load-library', function(e){
|
151 |
+
e.preventDefault();
|
152 |
+
var $this = $(this);
|
153 |
+
$this.next().css({'display' : 'inline-block', 'margin-top' : '14px', 'margin-left' : '-5px'});
|
154 |
+
|
155 |
+
// Prepare our data to be sent via Ajax.
|
156 |
+
var load = {
|
157 |
+
action: 'soliloquy_load_library',
|
158 |
+
offset: parseInt($this.attr('data-soliloquy-offset')),
|
159 |
+
post_id: soliloquy_metabox.id,
|
160 |
+
nonce: soliloquy_metabox.load_slider
|
161 |
+
};
|
162 |
+
|
163 |
+
// Process the Ajax response and output all the necessary data.
|
164 |
+
$.post(
|
165 |
+
soliloquy_metabox.ajax,
|
166 |
+
load,
|
167 |
+
function(response) {
|
168 |
+
$this.attr('data-soliloquy-offset', parseInt($this.attr('data-soliloquy-offset')) + 20);
|
169 |
+
|
170 |
+
// Append the response data.
|
171 |
+
if ( response && response.html && $this.hasClass('has-search') ) {
|
172 |
+
$('.soliloquy-slider').html(response.html);
|
173 |
+
$this.removeClass('has-search');
|
174 |
+
} else {
|
175 |
+
$('.soliloquy-slider').append(response.html);
|
176 |
+
}
|
177 |
+
|
178 |
+
// Remove the spinner.
|
179 |
+
$this.next().hide();
|
180 |
+
},
|
181 |
+
'json'
|
182 |
+
);
|
183 |
+
});
|
184 |
+
|
185 |
+
// Load images related to the search term specified
|
186 |
+
$(document).on('keyup keydown', '#soliloquy-slider-search', function(){
|
187 |
+
var $this = $(this);
|
188 |
+
$this.prev().css({'display' : 'inline-block', 'margin-top' : '1px', 'vertical-align' : 'middle', 'margin-right' : '4px'});
|
189 |
+
|
190 |
+
var text = $(this).val();
|
191 |
+
var search = {
|
192 |
+
action: 'soliloquy_library_search',
|
193 |
+
nonce: soliloquy_metabox.library_search,
|
194 |
+
post_id: soliloquy_metabox.id,
|
195 |
+
search: text
|
196 |
+
};
|
197 |
+
|
198 |
+
// Send the ajax request with a delay (500ms after the user stops typing).
|
199 |
+
delay(function() {
|
200 |
+
// Process the Ajax response and output all the necessary data.
|
201 |
+
$.post(
|
202 |
+
soliloquy_metabox.ajax,
|
203 |
+
search,
|
204 |
+
function(response) {
|
205 |
+
// Notify the load button that we have entered a search and reset the offset counter.
|
206 |
+
$('.soliloquy-load-library').addClass('has-search').attr('data-soliloquy-offset', parseInt(0));
|
207 |
+
|
208 |
+
// Append the response data.
|
209 |
+
if ( response )
|
210 |
+
$('.soliloquy-slider').html(response.html);
|
211 |
+
|
212 |
+
// Remove the spinner.
|
213 |
+
$this.prev().hide();
|
214 |
+
},
|
215 |
+
'json'
|
216 |
+
);
|
217 |
+
}, '500');
|
218 |
+
});
|
219 |
+
|
220 |
+
// Process inserting slides into slider when the Insert button is pressed.
|
221 |
+
$(document).on('click', '.soliloquy-media-insert', function(e){
|
222 |
+
e.preventDefault();
|
223 |
+
var $this = $(this),
|
224 |
+
text = $this.text(),
|
225 |
+
data = {
|
226 |
+
action: 'soliloquy_insert_slides',
|
227 |
+
nonce: soliloquy_metabox.insert_nonce,
|
228 |
+
post_id: soliloquy_metabox.id,
|
229 |
+
images: {},
|
230 |
+
videos: {},
|
231 |
+
html: {}
|
232 |
+
},
|
233 |
+
selected = false,
|
234 |
+
video = false,
|
235 |
+
html = false,
|
236 |
+
insert_e = e;
|
237 |
+
$this.text(soliloquy_metabox.inserting);
|
238 |
+
|
239 |
+
// Loop through potential data to send when inserting images.
|
240 |
+
// First, we loop through the selected items and add them to the data var.
|
241 |
+
$('.soliloquy-media-frame').find('.attachment.selected:not(.soliloquy-in-slider)').each(function(i, el){
|
242 |
+
data.images[i] = $(el).attr('data-attachment-id');
|
243 |
+
selected = true;
|
244 |
+
});
|
245 |
+
|
246 |
+
// Next, we loop through any video slides that have been created.
|
247 |
+
$('.soliloquy-media-frame').find('.soliloquy-video-slide-holder').each(function(i, el){
|
248 |
+
data.videos[i] = {
|
249 |
+
title: $(el).find('.soliloquy-video-slide-title').val(),
|
250 |
+
url: $(el).find('.soliloquy-video-slide-url').val(),
|
251 |
+
thumb: $(el).find('.soliloquy-video-slide-thumbnail').val(),
|
252 |
+
caption: $(el).find('.soliloquy-video-slide-caption').val()
|
253 |
+
};
|
254 |
+
video = true;
|
255 |
+
});
|
256 |
+
|
257 |
+
// Finally, we loop through any HTML slides that have been created.
|
258 |
+
$('.soliloquy-media-frame').find('.soliloquy-html-slide-holder').each(function(i, el){
|
259 |
+
data.html[i] = {
|
260 |
+
title: $(el).find('.soliloquy-html-slide-title').val(),
|
261 |
+
code: $(el).find('.soliloquy-html-slide-code').val(),
|
262 |
+
thumb: $(el).find('.soliloquy-html-slide-thumbnail').val()
|
263 |
+
};
|
264 |
+
html = true;
|
265 |
+
});
|
266 |
+
|
267 |
+
// Send the ajax request with our data to be processed.
|
268 |
+
$.post(
|
269 |
+
soliloquy_metabox.ajax,
|
270 |
+
data,
|
271 |
+
function(response){
|
272 |
+
// Set small delay before closing modal.
|
273 |
+
setTimeout(function(){
|
274 |
+
// Re-append modal to correct spot and revert text back to default.
|
275 |
+
append_and_hide(insert_e);
|
276 |
+
$this.text(text);
|
277 |
+
|
278 |
+
// If we have selected items, be sure to properly load first images back into view.
|
279 |
+
if ( selected )
|
280 |
+
$('.soliloquy-load-library').attr('data-soliloquy-offset', 0).addClass('has-search').trigger('click');
|
281 |
+
}, 500);
|
282 |
+
},
|
283 |
+
'json'
|
284 |
+
);
|
285 |
+
|
286 |
+
});
|
287 |
+
|
288 |
+
// Change content areas and active menu states on media router click.
|
289 |
+
$(document).on('click', '.soliloquy-media-frame .media-menu-item', function(e){
|
290 |
+
e.preventDefault();
|
291 |
+
var $this = $(this),
|
292 |
+
old_content = $this.parent().find('.active').removeClass('active').data('soliloquy-content'),
|
293 |
+
new_content = $this.addClass('active').data('soliloquy-content');
|
294 |
+
$('#soliloquy-' + old_content).hide();
|
295 |
+
$('#soliloquy-' + new_content).show();
|
296 |
+
});
|
297 |
+
|
298 |
+
// Load in new video slides when the add video slide button is clicked.
|
299 |
+
$(document).on('click', '.soliloquy-add-video-slide', function(e){
|
300 |
+
e.preventDefault();
|
301 |
+
var number = parseInt($(this).attr('data-soliloquy-video-number')),
|
302 |
+
id = 'soliloquy-video-slide-' + $(this).attr('data-soliloquy-html-number');
|
303 |
+
$(this).attr('data-soliloquy-video-number', number + 1 ).parent().before(soliloquyGetVideoSlideMarkup(number));
|
304 |
+
});
|
305 |
+
|
306 |
+
function soliloquyGetVideoSlideMarkup(number) {
|
307 |
+
var html = '';
|
308 |
+
html += '<div class="soliloquy-video-slide-holder"><p class="no-margin-top"><a href="#" class="button button-secondary soliloquy-delete-video-slide" title="' + soliloquy_metabox.removeslide + '">' + soliloquy_metabox.removeslide + '</a><label for="soliloquy-video-slide-' + number + '-title"><strong>' + soliloquy_metabox.videoslide + '</strong></label><br /><input type="text" class="soliloquy-video-slide-title" id="soliloquy-video-slide-' + number + '-title" value="" placeholder="' + soliloquy_metabox.videoplace + '" /></p><p><label for="soliloquy-video-slide-' + number + '"><strong>' + soliloquy_metabox.videotitle + '</strong></label><br /><input type="text" class="soliloquy-video-slide-url" id="soliloquy-video-slide-' + number + '" value="" placeholder="' + soliloquy_metabox.videooutput + '" /></p><p><label for="soliloquy-video-slide-' + number + '-thumbnail"><strong>' + soliloquy_metabox.videothumb + '</strong></label><br /><input type="text" class="soliloquy-video-slide-thumbnail" id="soliloquy-video-slide-' + number + '-thumbnail" value="" placeholder="' + soliloquy_metabox.videosrc + '" /> <span><a href="#" class="soliloquy-video-thumbnail button button-primary">' + soliloquy_metabox.videoselect + '</a> <a href="#" class="soliloquy-video-thumbnail-delete button button-secondary">' + soliloquy_metabox.videodelete + '</a></span></p><p class="no-margin-bottom"><label for="soliloquy-video-slide-' + number + '-caption"><strong>' + soliloquy_metabox.videocaption + '</strong></label><br /><textarea class="soliloquy-video-slide-caption" id="soliloquy-video-slide-' + number + '-caption"></textarea></p></div>';
|
309 |
+
return html;
|
310 |
+
}
|
311 |
+
|
312 |
+
// Enable easy video thumbnail selection.
|
313 |
+
$(document).on('click', '.soliloquy-video-thumbnail', function(e){
|
314 |
+
e.preventDefault();
|
315 |
+
|
316 |
+
var soliloquy_media_frame = wp.media.frames.soliloquy_media_frame = wp.media({
|
317 |
+
className: 'media-frame soliloquy-media-frame',
|
318 |
+
frame: 'select',
|
319 |
+
multiple: false,
|
320 |
+
title: soliloquy_metabox.videoframe,
|
321 |
+
library: {
|
322 |
+
type: 'image'
|
323 |
+
},
|
324 |
+
button: {
|
325 |
+
text: soliloquy_metabox.videouse
|
326 |
+
}
|
327 |
+
}),
|
328 |
+
$this = $(this);
|
329 |
+
|
330 |
+
soliloquy_media_frame.on('select', function(){
|
331 |
+
// Grab our attachment selection and construct a JSON representation of the model.
|
332 |
+
var thumbnail = soliloquy_media_frame.state().get('selection').first().toJSON();
|
333 |
+
|
334 |
+
// Send the attachment URL to our custom input field via jQuery.
|
335 |
+
$this.parent().prev().val(thumbnail.url);
|
336 |
+
});
|
337 |
+
|
338 |
+
// Now that everything has been set, let's open up the frame.
|
339 |
+
soliloquy_media_frame.open();
|
340 |
+
});
|
341 |
+
|
342 |
+
// Empty the video thumbnail field.
|
343 |
+
$(document).on('click', '.soliloquy-video-thumbnail-delete', function(e){
|
344 |
+
e.preventDefault();
|
345 |
+
$(this).parent().prev().val('');
|
346 |
+
});
|
347 |
+
|
348 |
+
// Delete a video slide from the DOM when the user clicks to remove it.
|
349 |
+
$(document).on('click', '#soliloquy-video-slides .soliloquy-delete-video-slide', function(e){
|
350 |
+
e.preventDefault();
|
351 |
+
$(this).parent().parent().remove();
|
352 |
+
});
|
353 |
+
|
354 |
+
var soliloquy_html_holder = {};
|
355 |
+
|
356 |
+
// Initialize the code editor for HTML slides.
|
357 |
+
$('.soliloquy-html').find('.soliloquy-html-code').each(function(i, el){
|
358 |
+
var id = $(el).attr('id');
|
359 |
+
soliloquy_html_holder[id] = CodeMirror.fromTextArea(el, {
|
360 |
+
enterMode: 'keep',
|
361 |
+
indentUnit: 4,
|
362 |
+
electricChars: false,
|
363 |
+
lineNumbers: true,
|
364 |
+
lineWrapping: true,
|
365 |
+
matchBrackets: true,
|
366 |
+
mode: 'php',
|
367 |
+
smartIndent: false,
|
368 |
+
tabMode: 'shift',
|
369 |
+
theme: 'solarized dark'
|
370 |
+
});
|
371 |
+
soliloquy_html_holder[id].on('blur', function(obj){
|
372 |
+
$('#' + id).text(obj.getValue());
|
373 |
+
});
|
374 |
+
soliloquy_html_holder[id].refresh();
|
375 |
+
});
|
376 |
+
|
377 |
+
// Load in new HTML slides when the add HTML slide button is clicked.
|
378 |
+
$(document).on('click', '.soliloquy-add-html-slide', function(e){
|
379 |
+
e.preventDefault();
|
380 |
+
var number = parseInt($(this).attr('data-soliloquy-html-number')),
|
381 |
+
id = 'soliloquy-html-slide-' + $(this).attr('data-soliloquy-html-number');
|
382 |
+
$(this).attr('data-soliloquy-html-number', number + 1 ).parent().before(soliloquyGetHtmlSlideMarkup(number));
|
383 |
+
soliloquy_html_holder[id] = CodeMirror.fromTextArea(document.getElementById(id), {
|
384 |
+
enterMode: 'keep',
|
385 |
+
indentUnit: 4,
|
386 |
+
electricChars: false,
|
387 |
+
lineNumbers: true,
|
388 |
+
lineWrapping: true,
|
389 |
+
matchBrackets: true,
|
390 |
+
mode: 'php',
|
391 |
+
smartIndent: false,
|
392 |
+
tabMode: 'shift',
|
393 |
+
theme: 'solarized dark'
|
394 |
+
});
|
395 |
+
soliloquy_html_holder[id].on('blur', function(obj){
|
396 |
+
$('#' + id).text(obj.getValue());
|
397 |
+
});
|
398 |
+
soliloquy_html_holder[id].refresh();
|
399 |
+
});
|
400 |
+
|
401 |
+
function soliloquyGetHtmlSlideMarkup(number) {
|
402 |
+
var html = '';
|
403 |
+
html += '<div class="soliloquy-html-slide-holder"><p class="no-margin-top"><a href="#" class="button button-secondary soliloquy-delete-html-slide" title="' + soliloquy_metabox.removeslide + '">' + soliloquy_metabox.removeslide + '</a><label for="soliloquy-html-slide-' + number + '-title"><strong>' + soliloquy_metabox.htmlslide + '</strong></label><br /><input type="text" class="soliloquy-html-slide-title" id="soliloquy-html-slide-' + number + '-title" value="" placeholder="' + soliloquy_metabox.htmlplace + '" /></p><p class="no-margin-bottom"><label for="soliloquy-html-slide-' + number + '"><strong>' + soliloquy_metabox.htmlcode + '</strong></label><br /><textarea class="soliloquy-html-slide-code" id="soliloquy-html-slide-' + number + '">' + soliloquy_metabox.htmlstart + '</textarea><p><label for="soliloquy-html-slide-' + number + '-thumbnail"><strong>' + soliloquy_metabox.htmlthumb + '</strong></label><br /><input type="text" class="soliloquy-html-slide-thumbnail" id="soliloquy-html-slide-' + number + '-thumbnail" value="" placeholder="' + soliloquy_metabox.htmlsrc + '" /> <span><a href="#" class="soliloquy-html-thumbnail button button-primary">' + soliloquy_metabox.htmlselect + '</a> <a href="#" class="soliloquy-html-thumbnail-delete button button-secondary">' + soliloquy_metabox.htmldelete + '</a></span></p></div>';
|
404 |
+
return html;
|
405 |
+
}
|
406 |
+
|
407 |
+
// Enable easy HTML thumbnail selection.
|
408 |
+
$(document).on('click', '.soliloquy-html-thumbnail', function(e){
|
409 |
+
e.preventDefault();
|
410 |
+
|
411 |
+
var soliloquy_media_frame = wp.media.frames.soliloquy_media_frame = wp.media({
|
412 |
+
className: 'media-frame soliloquy-media-frame',
|
413 |
+
frame: 'select',
|
414 |
+
multiple: false,
|
415 |
+
title: soliloquy_metabox.htmlframe,
|
416 |
+
library: {
|
417 |
+
type: 'image'
|
418 |
+
},
|
419 |
+
button: {
|
420 |
+
text: soliloquy_metabox.htmluse
|
421 |
+
}
|
422 |
+
}),
|
423 |
+
$this = $(this);
|
424 |
+
|
425 |
+
soliloquy_media_frame.on('select', function(){
|
426 |
+
// Grab our attachment selection and construct a JSON representation of the model.
|
427 |
+
var thumbnail = soliloquy_media_frame.state().get('selection').first().toJSON();
|
428 |
+
|
429 |
+
// Send the attachment URL to our custom input field via jQuery.
|
430 |
+
$this.parent().prev().val(thumbnail.url);
|
431 |
+
});
|
432 |
+
|
433 |
+
// Now that everything has been set, let's open up the frame.
|
434 |
+
soliloquy_media_frame.open();
|
435 |
+
});
|
436 |
+
|
437 |
+
// Delete an HTML slide from the DOM when the user clicks to remove it.
|
438 |
+
$(document).on('click', '#soliloquy-html-slides .soliloquy-delete-html-slide', function(e){
|
439 |
+
e.preventDefault();
|
440 |
+
$(this).parent().parent().remove();
|
441 |
+
});
|
442 |
+
|
443 |
+
// Empty the HTML thumbnail field.
|
444 |
+
$(document).on('click', '.soliloquy-html-thumbnail-delete', function(e){
|
445 |
+
e.preventDefault();
|
446 |
+
$(this).parent().prev().val('');
|
447 |
+
});
|
448 |
+
|
449 |
+
// Make slider items sortable.
|
450 |
+
var slider = $('#soliloquy-output');
|
451 |
+
|
452 |
+
// Use ajax to make the images sortable.
|
453 |
+
slider.sortable({
|
454 |
+
containment: '#soliloquy',
|
455 |
+
items: 'li',
|
456 |
+
cursor: 'move',
|
457 |
+
forcePlaceholderSize: true,
|
458 |
+
placeholder: 'dropzone',
|
459 |
+
update: function(event, ui) {
|
460 |
+
// Make ajax request to sort out items.
|
461 |
+
var opts = {
|
462 |
+
url: soliloquy_metabox.ajax,
|
463 |
+
type: 'post',
|
464 |
+
async: true,
|
465 |
+
cache: false,
|
466 |
+
dataType: 'json',
|
467 |
+
data: {
|
468 |
+
action: 'soliloquy_sort_images',
|
469 |
+
order: slider.sortable('toArray').toString(),
|
470 |
+
post_id: soliloquy_metabox.id,
|
471 |
+
nonce: soliloquy_metabox.sort
|
472 |
+
},
|
473 |
+
success: function(response) {
|
474 |
+
return;
|
475 |
+
},
|
476 |
+
error: function(xhr, textStatus ,e) {
|
477 |
+
return;
|
478 |
+
}
|
479 |
+
};
|
480 |
+
$.ajax(opts);
|
481 |
+
}
|
482 |
+
});
|
483 |
+
|
484 |
+
// Process image removal from a slider.
|
485 |
+
$(document).on('click', '#soliloquy .soliloquy-remove-slide', function(e){
|
486 |
+
e.preventDefault();
|
487 |
+
|
488 |
+
// Bail out if the user does not actually want to remove the image.
|
489 |
+
var confirm_delete = confirm(soliloquy_metabox.remove);
|
490 |
+
if ( ! confirm_delete )
|
491 |
+
return;
|
492 |
+
|
493 |
+
// Prepare our data to be sent via Ajax.
|
494 |
+
var attach_id = $(this).parent().attr('id'),
|
495 |
+
remove = {
|
496 |
+
action: 'soliloquy_remove_slide',
|
497 |
+
attachment_id: attach_id,
|
498 |
+
post_id: soliloquy_metabox.id,
|
499 |
+
nonce: soliloquy_metabox.remove_nonce
|
500 |
+
};
|
501 |
+
|
502 |
+
// Process the Ajax response and output all the necessary data.
|
503 |
+
$.post(
|
504 |
+
soliloquy_metabox.ajax,
|
505 |
+
remove,
|
506 |
+
function(response) {
|
507 |
+
$('#' + attach_id).fadeOut('normal', function() {
|
508 |
+
$(this).remove();
|
509 |
+
|
510 |
+
// Refresh the modal view to ensure no items are still checked if they have been removed.
|
511 |
+
$('.soliloquy-load-library').attr('data-soliloquy-offset', 0).addClass('has-search').trigger('click');
|
512 |
+
});
|
513 |
+
},
|
514 |
+
'json'
|
515 |
+
);
|
516 |
+
});
|
517 |
+
|
518 |
+
// Open up the media modal area for modifying slider metadata.
|
519 |
+
$(document).on('click.soliloquyModify', '#soliloquy .soliloquy-modify-slide', function(e){
|
520 |
+
e.preventDefault();
|
521 |
+
var attach_id = $(this).parent().data('soliloquy-slide'),
|
522 |
+
formfield = 'soliloquy-meta-' + attach_id;
|
523 |
+
|
524 |
+
// Show the modal.
|
525 |
+
soliloquy_main_frame = true;
|
526 |
+
$('#' + formfield).appendTo('body').show();
|
527 |
+
|
528 |
+
// Refresh any HTML slides.
|
529 |
+
$.each(soliloquy_html_holder, function(){
|
530 |
+
this.refresh();
|
531 |
+
});
|
532 |
+
|
533 |
+
// Close the modal window on user action
|
534 |
+
var append_and_hide = function(e){
|
535 |
+
e.preventDefault();
|
536 |
+
$('#' + formfield).appendTo('#' + attach_id).hide();
|
537 |
+
soliloquy_main_frame = false;
|
538 |
+
};
|
539 |
+
$(document).on('click.soliloquyIframe', '.media-modal-close, .media-modal-backdrop', append_and_hide);
|
540 |
+
$(document).on('keydown.soliloquyIframe', function(e){
|
541 |
+
if ( 27 == e.keyCode && soliloquy_main_frame )
|
542 |
+
append_and_hide(e);
|
543 |
+
});
|
544 |
+
});
|
545 |
+
|
546 |
+
// Save the slider metadata.
|
547 |
+
$(document).on('click', '.soliloquy-meta-submit', function(e){
|
548 |
+
e.preventDefault();
|
549 |
+
var $this = $(this),
|
550 |
+
default_t = $this.text(),
|
551 |
+
attach_id = $this.data('soliloquy-item'),
|
552 |
+
formfield = 'soliloquy-meta-' + attach_id,
|
553 |
+
meta = {};
|
554 |
+
|
555 |
+
// Output saving text...
|
556 |
+
$this.text(soliloquy_metabox.saving);
|
557 |
+
|
558 |
+
// Add the title since it is a special field.
|
559 |
+
meta.caption = $('#soliloquy-meta-table-' + attach_id).find('textarea[name="_soliloquy[meta_caption]"]').val();
|
560 |
+
|
561 |
+
// Get all meta fields and values.
|
562 |
+
$('#soliloquy-meta-table-' + attach_id).find(':input').not('.ed_button').each(function(i, el){
|
563 |
+
if ( $(this).data('soliloquy-meta') )
|
564 |
+
meta[$(this).data('soliloquy-meta')] = $(this).val();
|
565 |
+
});
|
566 |
+
|
567 |
+
// Prepare the data to be sent.
|
568 |
+
var data = {
|
569 |
+
action: 'soliloquy_save_meta',
|
570 |
+
nonce: soliloquy_metabox.save_nonce,
|
571 |
+
attach_id: attach_id,
|
572 |
+
post_id: soliloquy_metabox.id,
|
573 |
+
meta: meta
|
574 |
+
};
|
575 |
+
|
576 |
+
$.post(
|
577 |
+
soliloquy_metabox.ajax,
|
578 |
+
data,
|
579 |
+
function(res){
|
580 |
+
setTimeout(function(){
|
581 |
+
$('#' + formfield).appendTo('#' + attach_id).hide();
|
582 |
+
$this.text(default_t);
|
583 |
+
}, 500);
|
584 |
+
},
|
585 |
+
'json'
|
586 |
+
);
|
587 |
+
});
|
588 |
+
|
589 |
+
// Append spinner when importing a slider.
|
590 |
+
$(document).on('click', '#soliloquy-import-submit', function(e){
|
591 |
+
$(this).next().css('display', 'inline-block');
|
592 |
+
if ( $('#soliloquy-config-import-slider').val().length === 0 ) {
|
593 |
+
e.preventDefault();
|
594 |
+
$(this).next().hide();
|
595 |
+
alert(soliloquy_metabox.import);
|
596 |
+
}
|
597 |
+
});
|
598 |
+
|
599 |
+
// Polling function for typing and other user centric items.
|
600 |
+
var delay = (function() {
|
601 |
+
var timer = 0;
|
602 |
+
return function(callback, ms) {
|
603 |
+
clearTimeout(timer);
|
604 |
+
timer = setTimeout(callback, ms);
|
605 |
+
};
|
606 |
+
})();
|
607 |
+
|
608 |
+
// Close the modal window on user action.
|
609 |
+
var soliloquy_main_frame = false;
|
610 |
+
var append_and_hide = function(e){
|
611 |
+
e.preventDefault();
|
612 |
+
$('#soliloquy-upload-ui').appendTo('#soliloquy-upload-ui-wrapper').hide();
|
613 |
+
soliloquyRefresh();
|
614 |
+
soliloquy_main_frame = false;
|
615 |
+
};
|
616 |
+
$(document).on('click', '#soliloquy-upload-ui .media-modal-close, #soliloquy-upload-ui .media-modal-backdrop', append_and_hide);
|
617 |
+
$(document).on('keydown', function(e){
|
618 |
+
if ( 27 == e.keyCode && soliloquy_main_frame )
|
619 |
+
append_and_hide(e);
|
620 |
+
});
|
621 |
+
|
622 |
+
// Function to refresh images in the slider.
|
623 |
+
function soliloquyRefresh(){
|
624 |
+
var data = {
|
625 |
+
action: 'soliloquy_refresh',
|
626 |
+
post_id: soliloquy_metabox.id,
|
627 |
+
nonce: soliloquy_metabox.refresh_nonce
|
628 |
+
};
|
629 |
+
|
630 |
+
$('.max-upload-size').after('<span class="spinner soliloquy-spinner soliloquy-spinner-refresh"></span>');
|
631 |
+
$('.soliloquy-spinner-refresh').css({'display' : 'inline-block', 'margin-top' : '-3px'});
|
632 |
+
|
633 |
+
$.post(
|
634 |
+
soliloquy_metabox.ajax,
|
635 |
+
data,
|
636 |
+
function(res){
|
637 |
+
if ( res && res.success ) {
|
638 |
+
$('#soliloquy-output').html(res.success);
|
639 |
+
$('#soliloquy-output').find('.wp-editor-wrap').each(function(i, el){
|
640 |
+
var qt = $(el).find('.quicktags-toolbar');
|
641 |
+
if ( qt.length > 0 ) {
|
642 |
+
return;
|
643 |
+
}
|
644 |
+
|
645 |
+
var arr = $(el).attr('id').split('-'),
|
646 |
+
id = arr.slice(3, -1).join('-');
|
647 |
+
quicktags({id: 'soliloquy-caption-' + id, buttons: 'strong,em,link,ul,ol,li,close'});
|
648 |
+
QTags._buttonsInit(); // Force buttons to initialize.
|
649 |
+
});
|
650 |
+
|
651 |
+
// Initialize any code editors that have been generated with HTML slides.
|
652 |
+
$('.soliloquy-html').find('.soliloquy-html-code').each(function(i, el){
|
653 |
+
var id = $(el).attr('id');
|
654 |
+
soliloquy_html_holder[id] = CodeMirror.fromTextArea(el, {
|
655 |
+
enterMode: 'keep',
|
656 |
+
indentUnit: 4,
|
657 |
+
electricChars: false,
|
658 |
+
lineNumbers: true,
|
659 |
+
lineWrapping: true,
|
660 |
+
matchBrackets: true,
|
661 |
+
mode: 'php',
|
662 |
+
smartIndent: false,
|
663 |
+
tabMode: 'shift',
|
664 |
+
theme: 'solarized dark'
|
665 |
+
});
|
666 |
+
soliloquy_html_holder[id].on('blur', function(obj){
|
667 |
+
$('#' + id).text(obj.getValue());
|
668 |
+
});
|
669 |
+
soliloquy_html_holder[id].refresh();
|
670 |
+
});
|
671 |
+
|
672 |
+
// Trigger a custom event for 3rd party scripts.
|
673 |
+
$('#soliloquy-output').trigger({ type: 'soliloquyRefreshed', html: res.success, id: soliloquy_metabox.id });
|
674 |
+
}
|
675 |
+
|
676 |
+
// Remove the spinner.
|
677 |
+
$('.soliloquy-spinner-refresh').fadeOut(300, function(){
|
678 |
+
$(this).remove();
|
679 |
+
});
|
680 |
+
},
|
681 |
+
'json'
|
682 |
+
);
|
683 |
+
}
|
684 |
+
|
685 |
+
// Function to show conditional fields.
|
686 |
+
function soliloquyConditionals() {
|
687 |
+
var soliloquy_mobile_option = $('#soliloquy-config-mobile');
|
688 |
+
if ( soliloquy_mobile_option.is(':checked') )
|
689 |
+
$('#soliloquy-config-mobile-size-box').fadeIn(300);
|
690 |
+
soliloquy_mobile_option.on('change', function(){
|
691 |
+
if ( $(this).is(':checked') )
|
692 |
+
$('#soliloquy-config-mobile-size-box').fadeIn(300);
|
693 |
+
else
|
694 |
+
$('#soliloquy-config-mobile-size-box').fadeOut(300);
|
695 |
+
});
|
696 |
+
}
|
697 |
+
|
698 |
+
// Function to initialize plupload.
|
699 |
+
function soliloquyPlupload() {
|
700 |
+
// Append the custom loading progress bar.
|
701 |
+
$('#soliloquy .drag-drop-inside').append('<div class="soliloquy-progress-bar"><div></div></div>');
|
702 |
+
|
703 |
+
// Prepare variables.
|
704 |
+
soliloquy_uploader = new plupload.Uploader(soliloquy_metabox.plupload);
|
705 |
+
var soliloquy_bar = $('#soliloquy .soliloquy-progress-bar'),
|
706 |
+
soliloquy_progress = $('#soliloquy .soliloquy-progress-bar div'),
|
707 |
+
soliloquy_output = $('#soliloquy-output');
|
708 |
+
|
709 |
+
// Only move forward if the uploader is present.
|
710 |
+
if ( soliloquy_uploader ) {
|
711 |
+
soliloquy_uploader.bind('Init', function(up) {
|
712 |
+
var uploaddiv = $('#soliloquy-plupload-upload-ui');
|
713 |
+
|
714 |
+
// If drag and drop, make that happen.
|
715 |
+
if ( up.features.dragdrop && ! $(document.body).hasClass('mobile') ) {
|
716 |
+
uploaddiv.addClass('drag-drop');
|
717 |
+
$('#soliloquy-drag-drop-area').bind('dragover.wp-uploader', function(){
|
718 |
+
uploaddiv.addClass('drag-over');
|
719 |
+
}).bind('dragleave.wp-uploader, drop.wp-uploader', function(){
|
720 |
+
uploaddiv.removeClass('drag-over');
|
721 |
+
});
|
722 |
+
} else {
|
723 |
+
uploaddiv.removeClass('drag-drop');
|
724 |
+
$('#soliloquy-drag-drop-area').unbind('.wp-uploader');
|
725 |
+
}
|
726 |
+
|
727 |
+
// If we have an HTML4 runtime, hide the flash bypass.
|
728 |
+
if ( up.runtime == 'html4' )
|
729 |
+
$('.upload-flash-bypass').hide();
|
730 |
+
});
|
731 |
+
|
732 |
+
// Initialize the uploader.
|
733 |
+
soliloquy_uploader.init();
|
734 |
+
|
735 |
+
// Bind to the FilesAdded event to show the progess bar.
|
736 |
+
soliloquy_uploader.bind('FilesAdded', function(up, files){
|
737 |
+
var hundredmb = 100 * 1024 * 1024,
|
738 |
+
max = parseInt(up.settings.max_file_size, 10);
|
739 |
+
|
740 |
+
// Remove any errors.
|
741 |
+
$('#soliloquy-upload-error').html('');
|
742 |
+
|
743 |
+
// Show the progress bar.
|
744 |
+
$(soliloquy_bar).show().css('display', 'block');
|
745 |
+
|
746 |
+
// Upload the files.
|
747 |
+
plupload.each(files, function(file){
|
748 |
+
if ( max > hundredmb && file.size > hundredmb && up.runtime != 'html5' ) {
|
749 |
+
soliloquyUploadError( up, file, true );
|
750 |
+
}
|
751 |
+
});
|
752 |
+
|
753 |
+
// Refresh and start.
|
754 |
+
up.refresh();
|
755 |
+
up.start();
|
756 |
+
});
|
757 |
+
|
758 |
+
// Bind to the UploadProgress event to manipulate the progress bar.
|
759 |
+
soliloquy_uploader.bind('UploadProgress', function(up, file){
|
760 |
+
$(soliloquy_progress).css('width', up.total.percent + '%');
|
761 |
+
});
|
762 |
+
|
763 |
+
// Bind to the FileUploaded event to set proper UI display for slider.
|
764 |
+
soliloquy_uploader.bind('FileUploaded', function(up, file, info){
|
765 |
+
// Make an ajax request to generate and output the image in the slider UI.
|
766 |
+
$.post(
|
767 |
+
soliloquy_metabox.ajax,
|
768 |
+
{
|
769 |
+
action: 'soliloquy_load_image',
|
770 |
+
nonce: soliloquy_metabox.load_image,
|
771 |
+
id: info.response,
|
772 |
+
post_id: soliloquy_metabox.id
|
773 |
+
},
|
774 |
+
function(res){
|
775 |
+
$(soliloquy_output).append(res);
|
776 |
+
$(res).find('.wp-editor-container').each(function(i, el){
|
777 |
+
var id = $(el).attr('id').split('-')[3];
|
778 |
+
quicktags({id: 'soliloquy-caption-' + id, buttons: 'strong,em,link,ul,ol,li,close'});
|
779 |
+
QTags._buttonsInit(); // Force buttons to initialize.
|
780 |
+
});
|
781 |
+
},
|
782 |
+
'json'
|
783 |
+
);
|
784 |
+
});
|
785 |
+
|
786 |
+
// Bind to the UploadComplete event to hide and reset the progress bar.
|
787 |
+
soliloquy_uploader.bind('UploadComplete', function(){
|
788 |
+
$(soliloquy_bar).hide().css('display', 'none');
|
789 |
+
$(soliloquy_progress).removeAttr('style');
|
790 |
+
});
|
791 |
+
|
792 |
+
// Bind to any errors and output them on the screen.
|
793 |
+
soliloquy_uploader.bind('Error', function(up, error) {
|
794 |
+
var hundredmb = 100 * 1024 * 1024,
|
795 |
+
error_el = $('#soliloquy-upload-error'),
|
796 |
+
max;
|
797 |
+
switch (error) {
|
798 |
+
case plupload.FAILED:
|
799 |
+
case plupload.FILE_EXTENSION_ERROR:
|
800 |
+
error_el.html('<p class="error">' + pluploadL10n.upload_failed + '</p>');
|
801 |
+
break;
|
802 |
+
case plupload.FILE_SIZE_ERROR:
|
803 |
+
soliloquyUploadError(up, error.file);
|
804 |
+
break;
|
805 |
+
case plupload.IMAGE_FORMAT_ERROR:
|
806 |
+
wpFileError(fileObj, pluploadL10n.not_an_image);
|
807 |
+
break;
|
808 |
+
case plupload.IMAGE_MEMORY_ERROR:
|
809 |
+
wpFileError(fileObj, pluploadL10n.image_memory_exceeded);
|
810 |
+
break;
|
811 |
+
case plupload.IMAGE_DIMENSIONS_ERROR:
|
812 |
+
wpFileError(fileObj, pluploadL10n.image_dimensions_exceeded);
|
813 |
+
break;
|
814 |
+
case plupload.GENERIC_ERROR:
|
815 |
+
wpQueueError(pluploadL10n.upload_failed);
|
816 |
+
break;
|
817 |
+
case plupload.IO_ERROR:
|
818 |
+
max = parseInt(uploader.settings.max_file_size, 10);
|
819 |
+
|
820 |
+
if ( max > hundredmb && fileObj.size > hundredmb )
|
821 |
+
wpFileError(fileObj, pluploadL10n.big_upload_failed.replace('%1$s', '<a class="uploader-html" href="#">').replace('%2$s', '</a>'));
|
822 |
+
else
|
823 |
+
wpQueueError(pluploadL10n.io_error);
|
824 |
+
break;
|
825 |
+
case plupload.HTTP_ERROR:
|
826 |
+
wpQueueError(pluploadL10n.http_error);
|
827 |
+
break;
|
828 |
+
case plupload.INIT_ERROR:
|
829 |
+
$('.media-upload-form').addClass('html-uploader');
|
830 |
+
break;
|
831 |
+
case plupload.SECURITY_ERROR:
|
832 |
+
wpQueueError(pluploadL10n.security_error);
|
833 |
+
break;
|
834 |
+
default:
|
835 |
+
wpFileError(fileObj, pluploadL10n.default_error);
|
836 |
+
}
|
837 |
+
up.refresh();
|
838 |
+
});
|
839 |
+
}
|
840 |
+
}
|
841 |
+
|
842 |
+
// Function for displaying file upload errors.
|
843 |
+
function soliloquyUploadError( up, file, over100mb ) {
|
844 |
+
var message;
|
845 |
+
|
846 |
+
if ( over100mb )
|
847 |
+
message = pluploadL10n.big_upload_queued.replace('%s', file.name) + ' ' + pluploadL10n.big_upload_failed.replace('%1$s', '<a class="uploader-html" href="#">').replace('%2$s', '</a>');
|
848 |
+
else
|
849 |
+
message = pluploadL10n.file_exceeds_size_limit.replace('%s', file.name);
|
850 |
+
|
851 |
+
$('#soliloquy-upload-error').html('<p class="error">' + message + '</p>');
|
852 |
+
up.removeFile(file);
|
853 |
+
}
|
854 |
+
});
|
855 |
+
}(jQuery));
|
assets/js/settings.js
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* ==========================================================
|
2 |
+
* settings.js
|
3 |
+
* http://soliloquywp.com/
|
4 |
+
* ==========================================================
|
5 |
+
* Copyright 2013 Thomas Griffin.
|
6 |
+
*
|
7 |
+
* Licensed under the GPL License, Version 2.0 or later (the "License");
|
8 |
+
* you may not use this file except in compliance with the License.
|
9 |
+
* You may obtain a copy of the License at
|
10 |
+
*
|
11 |
+
* http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
+
*
|
13 |
+
* Unless required by applicable law or agreed to in writing, software
|
14 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
15 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16 |
+
* See the License for the specific language governing permissions and
|
17 |
+
* limitations under the License.
|
18 |
+
* ========================================================== */
|
19 |
+
;(function($){
|
20 |
+
$(function(){
|
21 |
+
// Initialize the slider tabs.
|
22 |
+
var soliloquy_tabs = $('#soliloquy-tabs'),
|
23 |
+
soliloquy_tabs_nav = $('#soliloquy-tabs-nav'),
|
24 |
+
soliloquy_tabs_hash = window.location.hash,
|
25 |
+
soliloquy_tabs_hash_sani = window.location.hash.replace('!', '');
|
26 |
+
|
27 |
+
// If we have a hash and it begins with "soliloquy-tab", set the proper tab to be opened.
|
28 |
+
if ( soliloquy_tabs_hash && soliloquy_tabs_hash.indexOf('soliloquy-tab-') >= 0 ) {
|
29 |
+
$('.soliloquy-active').removeClass('soliloquy-active nav-tab-active');
|
30 |
+
soliloquy_tabs_nav.find('a[href="' + soliloquy_tabs_hash_sani + '"]').addClass('soliloquy-active nav-tab-active');
|
31 |
+
soliloquy_tabs.find(soliloquy_tabs_hash_sani).addClass('soliloquy-active').show();
|
32 |
+
}
|
33 |
+
|
34 |
+
// Change tabs on click.
|
35 |
+
$('#soliloquy-tabs-nav a').on('click', function(e){
|
36 |
+
e.preventDefault();
|
37 |
+
var $this = $(this);
|
38 |
+
if ( $this.hasClass('soliloquy-active') ) {
|
39 |
+
return;
|
40 |
+
} else {
|
41 |
+
window.location.hash = soliloquy_tabs_hash = this.hash.split('#').join('#!');
|
42 |
+
var current = soliloquy_tabs_nav.find('.soliloquy-active').removeClass('soliloquy-active nav-tab-active').attr('href');
|
43 |
+
$this.addClass('soliloquy-active nav-tab-active');
|
44 |
+
soliloquy_tabs.find(current).removeClass('soliloquy-active').hide();
|
45 |
+
soliloquy_tabs.find($this.attr('href')).addClass('soliloquy-active').show();
|
46 |
+
}
|
47 |
+
});
|
48 |
+
|
49 |
+
// Start the upgrade process.
|
50 |
+
$('.soliloquy-start-upgrade').on('click', function(e){
|
51 |
+
e.preventDefault();
|
52 |
+
var $this = $(this);
|
53 |
+
|
54 |
+
// Show the spinner.
|
55 |
+
$('.soliloquy-spinner').css({ 'display' : 'inline-block', 'float' : 'none', 'vertical-align' : 'text-bottom' });
|
56 |
+
|
57 |
+
// Prepare our data to be sent via Ajax.
|
58 |
+
var upgrade = {
|
59 |
+
action: 'soliloquy_upgrade_sliders',
|
60 |
+
nonce: soliloquy_settings.upgrade_nonce
|
61 |
+
};
|
62 |
+
|
63 |
+
// Process the Ajax response and output all the necessary data.
|
64 |
+
$.post(
|
65 |
+
soliloquy_settings.ajax,
|
66 |
+
upgrade,
|
67 |
+
function(response) {
|
68 |
+
// Hide the spinner.
|
69 |
+
$('.soliloquy-spinner').hide();
|
70 |
+
|
71 |
+
// Redirect back to Soliloquy screen.
|
72 |
+
window.location.replace(soliloquy_settings.redirect);
|
73 |
+
},
|
74 |
+
'json'
|
75 |
+
);
|
76 |
+
});
|
77 |
+
});
|
78 |
+
}(jQuery));
|
assets/js/soliloquy-dev-holder.js
ADDED
@@ -0,0 +1,1449 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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: 'horizontal',
|
9 |
+
slideSelector: '',
|
10 |
+
infiniteLoop: true,
|
11 |
+
hideControlOnEnd: false,
|
12 |
+
speed: 500,
|
13 |
+
easing: null,
|
14 |
+
slideMargin: 0,
|
15 |
+
startSlide: 0,
|
16 |
+
randomStart: false,
|
17 |
+
captions: false,
|
18 |
+
ticker: false,
|
19 |
+
tickerHover: false,
|
20 |
+
adaptiveHeight: false,
|
21 |
+
adaptiveHeightSpeed: 500,
|
22 |
+
video: false,
|
23 |
+
useCSS: true,
|
24 |
+
preloadImages: 'visible',
|
25 |
+
responsive: true,
|
26 |
+
|
27 |
+
// TOUCH
|
28 |
+
touchEnabled: true,
|
29 |
+
swipeThreshold: 50,
|
30 |
+
oneToOneTouch: true,
|
31 |
+
preventDefaultSwipeX: true,
|
32 |
+
preventDefaultSwipeY: false,
|
33 |
+
|
34 |
+
// PAGER
|
35 |
+
pager: true,
|
36 |
+
pagerType: 'full',
|
37 |
+
pagerShortSeparator: ' / ',
|
38 |
+
pagerSelector: null,
|
39 |
+
buildPager: null,
|
40 |
+
pagerCustom: null,
|
41 |
+
|
42 |
+
// CONTROLS
|
43 |
+
controls: true,
|
44 |
+
nextText: 'Next',
|
45 |
+
prevText: 'Prev',
|
46 |
+
nextSelector: null,
|
47 |
+
prevSelector: null,
|
48 |
+
autoControls: false,
|
49 |
+
startText: 'Start',
|
50 |
+
stopText: 'Stop',
|
51 |
+
autoControlsCombine: false,
|
52 |
+
autoControlsSelector: null,
|
53 |
+
keyboard: false,
|
54 |
+
|
55 |
+
// AUTO
|
56 |
+
auto: false,
|
57 |
+
pause: 4000,
|
58 |
+
autoStart: true,
|
59 |
+
autoDirection: 'next',
|
60 |
+
autoHover: false,
|
61 |
+
autoDelay: 0,
|
62 |
+
|
63 |
+
// CAROUSEL
|
64 |
+
minSlides: 1,
|
65 |
+
maxSlides: 1,
|
66 |
+
moveSlides: 0,
|
67 |
+
slideWidth: 0,
|
68 |
+
|
69 |
+
// CALLBACKS
|
70 |
+
onSliderLoad: function() {},
|
71 |
+
onSlideBefore: function() {},
|
72 |
+
onSlideAfter: function() {},
|
73 |
+
onSlideNext: function() {},
|
74 |
+
onSlidePrev: function() {}
|
75 |
+
}
|
76 |
+
|
77 |
+
$.fn.soliloquy = function(options){
|
78 |
+
|
79 |
+
if(this.length == 0) return this;
|
80 |
+
|
81 |
+
// support mutltiple elements
|
82 |
+
if(this.length > 1){
|
83 |
+
this.each(function(){$(this).soliloquy(options)});
|
84 |
+
return this;
|
85 |
+
}
|
86 |
+
|
87 |
+
// create a namespace to be used throughout the plugin
|
88 |
+
var slider = {};
|
89 |
+
// set a reference to our slider element
|
90 |
+
var el = this;
|
91 |
+
plugin.el = this;
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Makes slideshow responsive
|
95 |
+
*/
|
96 |
+
// first get the original window dimens (thanks alot IE)
|
97 |
+
var windowWidth = $(window).width();
|
98 |
+
var windowHeight = $(window).height();
|
99 |
+
|
100 |
+
|
101 |
+
|
102 |
+
/**
|
103 |
+
* ===================================================================================
|
104 |
+
* = PRIVATE FUNCTIONS
|
105 |
+
* ===================================================================================
|
106 |
+
*/
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Initializes namespace settings to be used throughout plugin
|
110 |
+
*/
|
111 |
+
var init = function(){
|
112 |
+
// merge user-supplied options with the defaults
|
113 |
+
slider.settings = $.extend({}, defaults, options);
|
114 |
+
// parse slideWidth setting
|
115 |
+
slider.settings.slideWidth = parseInt(slider.settings.slideWidth);
|
116 |
+
// store the original children
|
117 |
+
slider.children = el.children(slider.settings.slideSelector);
|
118 |
+
// check if actual number of slides is less than minSlides / maxSlides
|
119 |
+
if(slider.children.length < slider.settings.minSlides) slider.settings.minSlides = slider.children.length;
|
120 |
+
if(slider.children.length < slider.settings.maxSlides) slider.settings.maxSlides = slider.children.length;
|
121 |
+
// if random start, set the startSlide setting to random number
|
122 |
+
if(slider.settings.randomStart) slider.settings.startSlide = Math.floor(Math.random() * slider.children.length);
|
123 |
+
// store active slide information
|
124 |
+
slider.active = { index: slider.settings.startSlide }
|
125 |
+
// store if the slider is in carousel mode (displaying / moving multiple slides)
|
126 |
+
slider.carousel = slider.settings.minSlides > 1 || slider.settings.maxSlides > 1;
|
127 |
+
// if carousel, force preloadImages = 'all'
|
128 |
+
if(slider.carousel) slider.settings.preloadImages = 'all';
|
129 |
+
// calculate the min / max width thresholds based on min / max number of slides
|
130 |
+
// used to setup and update carousel slides dimensions
|
131 |
+
slider.minThreshold = (slider.settings.minSlides * slider.settings.slideWidth) + ((slider.settings.minSlides - 1) * slider.settings.slideMargin);
|
132 |
+
slider.maxThreshold = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
|
133 |
+
// store the current state of the slider (if currently animating, working is true)
|
134 |
+
slider.working = false;
|
135 |
+
// initialize the controls object
|
136 |
+
slider.controls = {};
|
137 |
+
// initialize an auto interval
|
138 |
+
slider.interval = null;
|
139 |
+
// determine which property to use for transitions
|
140 |
+
slider.animProp = slider.settings.mode == 'vertical' ? 'top' : 'left';
|
141 |
+
// determine if hardware acceleration can be used
|
142 |
+
slider.usingCSS = slider.settings.useCSS && slider.settings.mode != 'fade' && (function(){
|
143 |
+
// create our test div element
|
144 |
+
var div = document.createElement('div');
|
145 |
+
// css transition properties
|
146 |
+
var props = ['WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
|
147 |
+
// test for each property
|
148 |
+
for(var i in props){
|
149 |
+
if(div.style[props[i]] !== undefined){
|
150 |
+
slider.cssPrefix = props[i].replace('Perspective', '').toLowerCase();
|
151 |
+
slider.animProp = '-' + slider.cssPrefix + '-transform';
|
152 |
+
return true;
|
153 |
+
}
|
154 |
+
}
|
155 |
+
return false;
|
156 |
+
}());
|
157 |
+
// if vertical mode always make maxSlides and minSlides equal
|
158 |
+
if(slider.settings.mode == 'vertical') slider.settings.maxSlides = slider.settings.minSlides;
|
159 |
+
// save original style data
|
160 |
+
el.data("origStyle", el.attr("style"));
|
161 |
+
el.children(slider.settings.slideSelector).each(function() {
|
162 |
+
$(this).data("origStyle", $(this).attr("style"));
|
163 |
+
});
|
164 |
+
// perform all DOM / CSS modifications
|
165 |
+
setup();
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Performs all DOM and CSS modifications
|
170 |
+
*/
|
171 |
+
var setup = function(){
|
172 |
+
// wrap el in a wrapper
|
173 |
+
el.wrap('<div class="soliloquy-wrapper"><div class="soliloquy-viewport"></div></div>');
|
174 |
+
// store a namspace reference to .soliloquy-viewport
|
175 |
+
slider.viewport = el.parent();
|
176 |
+
// add a loading div to display while images are loading
|
177 |
+
slider.loader = $('<div class="soliloquy-loading" />');
|
178 |
+
slider.viewport.prepend(slider.loader);
|
179 |
+
// set el to a massive width, to hold any needed slides
|
180 |
+
// also strip any margin and padding from el
|
181 |
+
el.css({
|
182 |
+
width: slider.settings.mode == 'horizontal' ? (slider.children.length * 100 + 215) + '%' : 'auto',
|
183 |
+
position: 'relative'
|
184 |
+
});
|
185 |
+
// if using CSS, add the easing property
|
186 |
+
if(slider.usingCSS && slider.settings.easing){
|
187 |
+
el.css('-' + slider.cssPrefix + '-transition-timing-function', slider.settings.easing);
|
188 |
+
// if not using CSS and no easing value was supplied, use the default JS animation easing (swing)
|
189 |
+
}else if(!slider.settings.easing){
|
190 |
+
slider.settings.easing = 'swing';
|
191 |
+
}
|
192 |
+
var slidesShowing = getNumberSlidesShowing();
|
193 |
+
// make modifications to the viewport (.soliloquy-viewport)
|
194 |
+
slider.viewport.css({
|
195 |
+
width: '100%',
|
196 |
+
position: 'relative'
|
197 |
+
});
|
198 |
+
if(slider.settings.mode != 'fade'){
|
199 |
+
slider.viewport.css({overflow:'hidden'});
|
200 |
+
}
|
201 |
+
slider.viewport.parent().css({
|
202 |
+
maxWidth: getViewportMaxWidth()
|
203 |
+
});
|
204 |
+
// make modification to the wrapper (.soliloquy-wrapper)
|
205 |
+
if(!slider.settings.pager) {
|
206 |
+
slider.viewport.parent().css({
|
207 |
+
margin: '0 auto 0px'
|
208 |
+
});
|
209 |
+
}
|
210 |
+
// apply css to all slider children
|
211 |
+
slider.children.css({
|
212 |
+
'float': slider.settings.mode == 'horizontal' ? 'left' : 'none',
|
213 |
+
listStyle: 'none',
|
214 |
+
position: 'relative'
|
215 |
+
});
|
216 |
+
// apply the calculated width after the float is applied to prevent scrollbar interference
|
217 |
+
slider.children.css('width', getSlideWidth());
|
218 |
+
// if slideMargin is supplied, add the css
|
219 |
+
if(slider.settings.mode == 'horizontal' && slider.settings.slideMargin > 0) slider.children.css('marginRight', slider.settings.slideMargin);
|
220 |
+
if(slider.settings.mode == 'vertical' && slider.settings.slideMargin > 0) slider.children.css('marginBottom', slider.settings.slideMargin);
|
221 |
+
// if "fade" mode, add positioning and z-index CSS
|
222 |
+
if(slider.settings.mode == 'fade'){
|
223 |
+
slider.children.css({
|
224 |
+
position: 'absolute',
|
225 |
+
zIndex: 0,
|
226 |
+
display: 'none'
|
227 |
+
});
|
228 |
+
// prepare the z-index on the showing element
|
229 |
+
slider.children.eq(slider.settings.startSlide).css({zIndex: 50, display: 'block'});
|
230 |
+
}
|
231 |
+
// create an element to contain all slider controls (pager, start / stop, etc)
|
232 |
+
slider.controls.el = $('<div class="soliloquy-controls" />');
|
233 |
+
// if captions are requested, add them
|
234 |
+
if(slider.settings.captions) appendCaptions();
|
235 |
+
// check if startSlide is last slide
|
236 |
+
slider.active.last = slider.settings.startSlide == getPagerQty() - 1;
|
237 |
+
// if video is true, set up the soliloquyVids plugin
|
238 |
+
if(slider.settings.video) el.soliloquyVids();
|
239 |
+
// set the default preload selector (visible)
|
240 |
+
var preloadSelector = slider.children.eq(slider.settings.startSlide);
|
241 |
+
if (slider.settings.preloadImages == "all") preloadSelector = slider.children;
|
242 |
+
// only check for control addition if not in "ticker" mode
|
243 |
+
if(!slider.settings.ticker){
|
244 |
+
// if pager is requested, add it
|
245 |
+
if(slider.settings.pager) appendPager();
|
246 |
+
// if controls are requested, add them
|
247 |
+
if(slider.settings.controls) appendControls();
|
248 |
+
// if auto is true, and auto controls are requested, add them
|
249 |
+
if(slider.settings.auto && slider.settings.autoControls) appendControlsAuto();
|
250 |
+
// if any control option is requested, add the controls wrapper
|
251 |
+
if(slider.settings.controls || slider.settings.autoControls || slider.settings.pager) slider.viewport.after(slider.controls.el);
|
252 |
+
// if ticker mode, do not allow a pager
|
253 |
+
}else{
|
254 |
+
slider.settings.pager = false;
|
255 |
+
}
|
256 |
+
// preload all images, then perform final DOM / CSS modifications that depend on images being loaded
|
257 |
+
loadElements(preloadSelector, start);
|
258 |
+
}
|
259 |
+
|
260 |
+
var loadElements = function(selector, callback){
|
261 |
+
var total = selector.find('img, iframe').length;
|
262 |
+
if (total == 0){
|
263 |
+
callback();
|
264 |
+
return;
|
265 |
+
}
|
266 |
+
var count = 0;
|
267 |
+
selector.find('img, iframe').each(function(){
|
268 |
+
$(this).one('load', function() {
|
269 |
+
if(++count == total) callback();
|
270 |
+
}).each(function() {
|
271 |
+
if(this.complete) $(this).load();
|
272 |
+
});
|
273 |
+
});
|
274 |
+
}
|
275 |
+
|
276 |
+
/**
|
277 |
+
* Start the slider
|
278 |
+
*/
|
279 |
+
var start = function(){
|
280 |
+
// if infinite loop, prepare additional slides
|
281 |
+
if(slider.settings.infiniteLoop && slider.settings.mode != 'fade' && !slider.settings.ticker){
|
282 |
+
var slice = slider.settings.mode == 'vertical' ? slider.settings.minSlides : slider.settings.maxSlides;
|
283 |
+
var sliceAppend = slider.children.slice(0, slice).clone().addClass('soliloquy-clone');
|
284 |
+
var slicePrepend = slider.children.slice(-slice).clone().addClass('soliloquy-clone');
|
285 |
+
el.append(sliceAppend).prepend(slicePrepend);
|
286 |
+
}
|
287 |
+
// remove the loading DOM element
|
288 |
+
slider.loader.remove();
|
289 |
+
// set the left / top position of "el"
|
290 |
+
setSlidePosition();
|
291 |
+
// if "vertical" mode, always use adaptiveHeight to prevent odd behavior
|
292 |
+
if (slider.settings.mode == 'vertical') slider.settings.adaptiveHeight = true;
|
293 |
+
// set the viewport height
|
294 |
+
slider.viewport.height(getViewportHeight());
|
295 |
+
// make sure everything is positioned just right (same as a window resize)
|
296 |
+
el.redrawSlider();
|
297 |
+
// onSliderLoad callback
|
298 |
+
slider.settings.onSliderLoad(slider.active.index);
|
299 |
+
// slider has been fully initialized
|
300 |
+
slider.initialized = true;
|
301 |
+
// bind the resize call to the window
|
302 |
+
if (slider.settings.responsive) $(window).bind('resize', resizeWindow);
|
303 |
+
// if auto is true, start the show
|
304 |
+
if (slider.settings.auto && slider.settings.autoStart) initAuto();
|
305 |
+
// if ticker is true, start the ticker
|
306 |
+
if (slider.settings.ticker) initTicker();
|
307 |
+
// if pager is requested, make the appropriate pager link active
|
308 |
+
if (slider.settings.pager) updatePagerActive(slider.settings.startSlide);
|
309 |
+
// check for any updates to the controls (like hideControlOnEnd updates)
|
310 |
+
if (slider.settings.controls) updateDirectionControls();
|
311 |
+
// if touchEnabled is true, setup the touch events
|
312 |
+
if (slider.settings.touchEnabled && !slider.settings.ticker) initTouch();
|
313 |
+
// if keyboardEnabled is true, setup the keyboard events
|
314 |
+
if (slider.settings.keyboard && !slider.settings.ticker) {
|
315 |
+
$(document).on('keydown', function(e){
|
316 |
+
if (e.keyCode == 39) {
|
317 |
+
clickNextBind(e);
|
318 |
+
return false;
|
319 |
+
}
|
320 |
+
else if (e.keyCode == 37) {
|
321 |
+
clickPrevBind(e);
|
322 |
+
return false;
|
323 |
+
}
|
324 |
+
});
|
325 |
+
}
|
326 |
+
}
|
327 |
+
|
328 |
+
/**
|
329 |
+
* Returns the calculated height of the viewport, used to determine either adaptiveHeight or the maxHeight value
|
330 |
+
*/
|
331 |
+
var getViewportHeight = function(){
|
332 |
+
var height = 0;
|
333 |
+
// first determine which children (slides) should be used in our height calculation
|
334 |
+
var children = $();
|
335 |
+
// if mode is not "vertical" and adaptiveHeight is false, include all children
|
336 |
+
if(slider.settings.mode != 'vertical' && !slider.settings.adaptiveHeight){
|
337 |
+
children = slider.children;
|
338 |
+
}else{
|
339 |
+
// if not carousel, return the single active child
|
340 |
+
if(!slider.carousel){
|
341 |
+
children = slider.children.eq(slider.active.index);
|
342 |
+
// if carousel, return a slice of children
|
343 |
+
}else{
|
344 |
+
// get the individual slide index
|
345 |
+
var currentIndex = slider.settings.moveSlides == 1 ? slider.active.index : slider.active.index * getMoveBy();
|
346 |
+
// add the current slide to the children
|
347 |
+
children = slider.children.eq(currentIndex);
|
348 |
+
// cycle through the remaining "showing" slides
|
349 |
+
for (i = 1; i <= slider.settings.maxSlides - 1; i++){
|
350 |
+
// if looped back to the start
|
351 |
+
if(currentIndex + i >= slider.children.length){
|
352 |
+
children = children.add(slider.children.eq(i - 1));
|
353 |
+
}else{
|
354 |
+
children = children.add(slider.children.eq(currentIndex + i));
|
355 |
+
}
|
356 |
+
}
|
357 |
+
}
|
358 |
+
}
|
359 |
+
// if "vertical" mode, calculate the sum of the heights of the children
|
360 |
+
if(slider.settings.mode == 'vertical'){
|
361 |
+
children.each(function(index) {
|
362 |
+
height += $(this).outerHeight();
|
363 |
+
});
|
364 |
+
// add user-supplied margins
|
365 |
+
if(slider.settings.slideMargin > 0){
|
366 |
+
height += slider.settings.slideMargin * (slider.settings.minSlides - 1);
|
367 |
+
}
|
368 |
+
// if not "vertical" mode, calculate the max height of the children
|
369 |
+
}else{
|
370 |
+
height = Math.max.apply(Math, children.map(function(){
|
371 |
+
return $(this).outerHeight(false);
|
372 |
+
}).get());
|
373 |
+
}
|
374 |
+
return height;
|
375 |
+
}
|
376 |
+
|
377 |
+
/**
|
378 |
+
* Returns the calculated width to be used for the outer wrapper / viewport
|
379 |
+
*/
|
380 |
+
var getViewportMaxWidth = function(){
|
381 |
+
var width = '100%';
|
382 |
+
if(slider.settings.slideWidth > 0){
|
383 |
+
if(slider.settings.mode == 'horizontal'){
|
384 |
+
width = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
|
385 |
+
}else{
|
386 |
+
width = slider.settings.slideWidth;
|
387 |
+
}
|
388 |
+
}
|
389 |
+
return width;
|
390 |
+
}
|
391 |
+
|
392 |
+
/**
|
393 |
+
* Returns the calculated width to be applied to each slide
|
394 |
+
*/
|
395 |
+
var getSlideWidth = function(){
|
396 |
+
// start with any user-supplied slide width
|
397 |
+
var newElWidth = slider.settings.slideWidth;
|
398 |
+
// get the current viewport width
|
399 |
+
var wrapWidth = slider.viewport.width();
|
400 |
+
// if slide width was not supplied, or is larger than the viewport use the viewport width
|
401 |
+
if(slider.settings.slideWidth == 0 ||
|
402 |
+
(slider.settings.slideWidth > wrapWidth && !slider.carousel) ||
|
403 |
+
slider.settings.mode == 'vertical'){
|
404 |
+
newElWidth = wrapWidth;
|
405 |
+
// if carousel, use the thresholds to determine the width
|
406 |
+
}else if(slider.settings.maxSlides > 1 && slider.settings.mode == 'horizontal'){
|
407 |
+
if(wrapWidth > slider.maxThreshold){
|
408 |
+
// newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.maxSlides - 1))) / slider.settings.maxSlides;
|
409 |
+
}else if(wrapWidth < slider.minThreshold){
|
410 |
+
newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.minSlides - 1))) / slider.settings.minSlides;
|
411 |
+
}
|
412 |
+
}
|
413 |
+
return newElWidth;
|
414 |
+
}
|
415 |
+
|
416 |
+
/**
|
417 |
+
* Returns the number of slides currently visible in the viewport (includes partially visible slides)
|
418 |
+
*/
|
419 |
+
var getNumberSlidesShowing = function(){
|
420 |
+
var slidesShowing = 1;
|
421 |
+
if(slider.settings.mode == 'horizontal' && slider.settings.slideWidth > 0){
|
422 |
+
// if viewport is smaller than minThreshold, return minSlides
|
423 |
+
if(slider.viewport.width() < slider.minThreshold){
|
424 |
+
slidesShowing = slider.settings.minSlides;
|
425 |
+
// if viewport is larger than minThreshold, return maxSlides
|
426 |
+
}else if(slider.viewport.width() > slider.maxThreshold){
|
427 |
+
slidesShowing = slider.settings.maxSlides;
|
428 |
+
// if viewport is between min / max thresholds, divide viewport width by first child width
|
429 |
+
}else{
|
430 |
+
var childWidth = slider.children.first().width();
|
431 |
+
slidesShowing = Math.floor(slider.viewport.width() / childWidth);
|
432 |
+
}
|
433 |
+
// if "vertical" mode, slides showing will always be minSlides
|
434 |
+
}else if(slider.settings.mode == 'vertical'){
|
435 |
+
slidesShowing = slider.settings.minSlides;
|
436 |
+
}
|
437 |
+
return slidesShowing;
|
438 |
+
}
|
439 |
+
|
440 |
+
/**
|
441 |
+
* Returns the number of pages (one full viewport of slides is one "page")
|
442 |
+
*/
|
443 |
+
var getPagerQty = function(){
|
444 |
+
var pagerQty = 0;
|
445 |
+
// if moveSlides is specified by the user
|
446 |
+
if(slider.settings.moveSlides > 0){
|
447 |
+
if(slider.settings.infiniteLoop){
|
448 |
+
pagerQty = slider.children.length / getMoveBy();
|
449 |
+
}else{
|
450 |
+
// use a while loop to determine pages
|
451 |
+
var breakPoint = 0;
|
452 |
+
var counter = 0
|
453 |
+
// when breakpoint goes above children length, counter is the number of pages
|
454 |
+
while (breakPoint < slider.children.length){
|
455 |
+
++pagerQty;
|
456 |
+
breakPoint = counter + getNumberSlidesShowing();
|
457 |
+
counter += slider.settings.moveSlides <= getNumberSlidesShowing() ? slider.settings.moveSlides : getNumberSlidesShowing();
|
458 |
+
}
|
459 |
+
}
|
460 |
+
// if moveSlides is 0 (auto) divide children length by sides showing, then round up
|
461 |
+
}else{
|
462 |
+
pagerQty = Math.ceil(slider.children.length / getNumberSlidesShowing());
|
463 |
+
}
|
464 |
+
return pagerQty;
|
465 |
+
}
|
466 |
+
|
467 |
+
/**
|
468 |
+
* Returns the number of indivual slides by which to shift the slider
|
469 |
+
*/
|
470 |
+
var getMoveBy = function(){
|
471 |
+
// if moveSlides was set by the user and moveSlides is less than number of slides showing
|
472 |
+
if(slider.settings.moveSlides > 0 && slider.settings.moveSlides <= getNumberSlidesShowing()){
|
473 |
+
return slider.settings.moveSlides;
|
474 |
+
}
|
475 |
+
// if moveSlides is 0 (auto)
|
476 |
+
return getNumberSlidesShowing();
|
477 |
+
}
|
478 |
+
|
479 |
+
/**
|
480 |
+
* Sets the slider's (el) left or top position
|
481 |
+
*/
|
482 |
+
var setSlidePosition = function(){
|
483 |
+
// if last slide, not infinite loop, and number of children is larger than specified maxSlides
|
484 |
+
if(slider.children.length > slider.settings.maxSlides && slider.active.last && !slider.settings.infiniteLoop){
|
485 |
+
if (slider.settings.mode == 'horizontal'){
|
486 |
+
// get the last child's position
|
487 |
+
var lastChild = slider.children.last();
|
488 |
+
var position = lastChild.position();
|
489 |
+
// set the left position
|
490 |
+
setPositionProperty(-(position.left - (slider.viewport.width() - lastChild.width())), 'reset', 0);
|
491 |
+
}else if(slider.settings.mode == 'vertical'){
|
492 |
+
// get the last showing index's position
|
493 |
+
var lastShowingIndex = slider.children.length - slider.settings.minSlides;
|
494 |
+
var position = slider.children.eq(lastShowingIndex).position();
|
495 |
+
// set the top position
|
496 |
+
setPositionProperty(-position.top, 'reset', 0);
|
497 |
+
}
|
498 |
+
// if not last slide
|
499 |
+
}else{
|
500 |
+
// get the position of the first showing slide
|
501 |
+
var position = slider.children.eq(slider.active.index * getMoveBy()).position();
|
502 |
+
// check for last slide
|
503 |
+
if (slider.active.index == getPagerQty() - 1) slider.active.last = true;
|
504 |
+
// set the repective position
|
505 |
+
if (position != undefined){
|
506 |
+
if (slider.settings.mode == 'horizontal') setPositionProperty(-position.left, 'reset', 0);
|
507 |
+
else if (slider.settings.mode == 'vertical') setPositionProperty(-position.top, 'reset', 0);
|
508 |
+
}
|
509 |
+
}
|
510 |
+
}
|
511 |
+
|
512 |
+
/**
|
513 |
+
* Sets the el's animating property position (which in turn will sometimes animate el).
|
514 |
+
* If using CSS, sets the transform property. If not using CSS, sets the top / left property.
|
515 |
+
*
|
516 |
+
* @param value (int)
|
517 |
+
* - the animating property's value
|
518 |
+
*
|
519 |
+
* @param type (string) 'slider', 'reset', 'ticker'
|
520 |
+
* - the type of instance for which the function is being
|
521 |
+
*
|
522 |
+
* @param duration (int)
|
523 |
+
* - the amount of time (in ms) the transition should occupy
|
524 |
+
*
|
525 |
+
* @param params (array) optional
|
526 |
+
* - an optional parameter containing any variables that need to be passed in
|
527 |
+
*/
|
528 |
+
var setPositionProperty = function(value, type, duration, params){
|
529 |
+
// use CSS transform
|
530 |
+
if(slider.usingCSS){
|
531 |
+
// determine the translate3d value
|
532 |
+
var propValue = slider.settings.mode == 'vertical' ? 'translate3d(0, ' + value + 'px, 0)' : 'translate3d(' + value + 'px, 0, 0)';
|
533 |
+
// add the CSS transition-duration
|
534 |
+
el.css('-' + slider.cssPrefix + '-transition-duration', duration / 1000 + 's');
|
535 |
+
if(type == 'slide'){
|
536 |
+
// set the property value
|
537 |
+
el.css(slider.animProp, propValue);
|
538 |
+
// bind a callback method - executes when CSS transition completes
|
539 |
+
el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(){
|
540 |
+
// unbind the callback
|
541 |
+
el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
|
542 |
+
updateAfterSlideTransition();
|
543 |
+
});
|
544 |
+
}else if(type == 'reset'){
|
545 |
+
el.css(slider.animProp, propValue);
|
546 |
+
}else if(type == 'ticker'){
|
547 |
+
// make the transition use 'linear'
|
548 |
+
el.css('-' + slider.cssPrefix + '-transition-timing-function', 'linear');
|
549 |
+
el.css(slider.animProp, propValue);
|
550 |
+
// bind a callback method - executes when CSS transition completes
|
551 |
+
el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(){
|
552 |
+
// unbind the callback
|
553 |
+
el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
|
554 |
+
// reset the position
|
555 |
+
setPositionProperty(params['resetValue'], 'reset', 0);
|
556 |
+
// start the loop again
|
557 |
+
tickerLoop();
|
558 |
+
});
|
559 |
+
}
|
560 |
+
// use JS animate
|
561 |
+
}else{
|
562 |
+
var animateObj = {};
|
563 |
+
animateObj[slider.animProp] = value;
|
564 |
+
if(type == 'slide'){
|
565 |
+
el.animate(animateObj, duration, slider.settings.easing, function(){
|
566 |
+
updateAfterSlideTransition();
|
567 |
+
});
|
568 |
+
}else if(type == 'reset'){
|
569 |
+
el.css(slider.animProp, value)
|
570 |
+
}else if(type == 'ticker'){
|
571 |
+
el.animate(animateObj, speed, 'linear', function(){
|
572 |
+
setPositionProperty(params['resetValue'], 'reset', 0);
|
573 |
+
// run the recursive loop after animation
|
574 |
+
tickerLoop();
|
575 |
+
});
|
576 |
+
}
|
577 |
+
}
|
578 |
+
}
|
579 |
+
|
580 |
+
/**
|
581 |
+
* Populates the pager with proper amount of pages
|
582 |
+
*/
|
583 |
+
var populatePager = function(){
|
584 |
+
var pagerHtml = '';
|
585 |
+
var pagerQty = getPagerQty();
|
586 |
+
// loop through each pager item
|
587 |
+
for(var i=0; i < pagerQty; i++){
|
588 |
+
var linkContent = '';
|
589 |
+
// if a buildPager function is supplied, use it to get pager link value, else use index + 1
|
590 |
+
if(slider.settings.buildPager && $.isFunction(slider.settings.buildPager)){
|
591 |
+
linkContent = slider.settings.buildPager(i);
|
592 |
+
slider.pagerEl.addClass('soliloquy-custom-pager');
|
593 |
+
}else{
|
594 |
+
linkContent = i + 1;
|
595 |
+
slider.pagerEl.addClass('soliloquy-default-pager');
|
596 |
+
}
|
597 |
+
// var linkContent = slider.settings.buildPager && $.isFunction(slider.settings.buildPager) ? slider.settings.buildPager(i) : i + 1;
|
598 |
+
// add the markup to the string
|
599 |
+
pagerHtml += '<div class="soliloquy-pager-item"><a href="" data-slide-index="' + i + '" class="soliloquy-pager-link"><span>' + linkContent + '</span></a></div>';
|
600 |
+
};
|
601 |
+
// populate the pager element with pager links
|
602 |
+
slider.pagerEl.html(pagerHtml);
|
603 |
+
}
|
604 |
+
|
605 |
+
/**
|
606 |
+
* Appends the pager to the controls element
|
607 |
+
*/
|
608 |
+
var appendPager = function(){
|
609 |
+
if(!slider.settings.pagerCustom){
|
610 |
+
// create the pager DOM element
|
611 |
+
slider.pagerEl = $('<div class="soliloquy-pager" />');
|
612 |
+
// if a pager selector was supplied, populate it with the pager
|
613 |
+
if(slider.settings.pagerSelector){
|
614 |
+
$(slider.settings.pagerSelector).html(slider.pagerEl);
|
615 |
+
// if no pager selector was supplied, add it after the wrapper
|
616 |
+
}else{
|
617 |
+
slider.controls.el.addClass('soliloquy-has-pager').append(slider.pagerEl);
|
618 |
+
}
|
619 |
+
// populate the pager
|
620 |
+
populatePager();
|
621 |
+
}else{
|
622 |
+
slider.pagerEl = $(slider.settings.pagerCustom);
|
623 |
+
}
|
624 |
+
// assign the pager click binding
|
625 |
+
slider.pagerEl.delegate('a', 'click', clickPagerBind);
|
626 |
+
}
|
627 |
+
|
628 |
+
/**
|
629 |
+
* Appends prev / next controls to the controls element
|
630 |
+
*/
|
631 |
+
var appendControls = function(){
|
632 |
+
slider.controls.next = $('<a class="soliloquy-next" href=""><span>' + slider.settings.nextText + '</span></a>');
|
633 |
+
slider.controls.prev = $('<a class="soliloquy-prev" href=""><span>' + slider.settings.prevText + '</span></a>');
|
634 |
+
// bind click actions to the controls
|
635 |
+
slider.controls.next.bind('click', clickNextBind);
|
636 |
+
slider.controls.prev.bind('click', clickPrevBind);
|
637 |
+
// if nextSlector was supplied, populate it
|
638 |
+
if(slider.settings.nextSelector){
|
639 |
+
$(slider.settings.nextSelector).append(slider.controls.next);
|
640 |
+
}
|
641 |
+
// if prevSlector was supplied, populate it
|
642 |
+
if(slider.settings.prevSelector){
|
643 |
+
$(slider.settings.prevSelector).append(slider.controls.prev);
|
644 |
+
}
|
645 |
+
// if no custom selectors were supplied
|
646 |
+
if(!slider.settings.nextSelector && !slider.settings.prevSelector){
|
647 |
+
// add the controls to the DOM
|
648 |
+
slider.controls.directionEl = $('<div class="soliloquy-controls-direction" />');
|
649 |
+
// add the control elements to the directionEl
|
650 |
+
slider.controls.directionEl.append(slider.controls.prev).append(slider.controls.next);
|
651 |
+
// slider.viewport.append(slider.controls.directionEl);
|
652 |
+
slider.controls.el.addClass('soliloquy-has-controls-direction').append(slider.controls.directionEl);
|
653 |
+
}
|
654 |
+
}
|
655 |
+
|
656 |
+
/**
|
657 |
+
* Appends start / stop auto controls to the controls element
|
658 |
+
*/
|
659 |
+
var appendControlsAuto = function(){
|
660 |
+
slider.controls.start = $('<div class="soliloquy-controls-auto-item"><a class="soliloquy-start" href=""><span>' + slider.settings.startText + '</span></a></div>');
|
661 |
+
slider.controls.stop = $('<div class="soliloquy-controls-auto-item"><a class="soliloquy-stop" href=""><span>' + slider.settings.stopText + '</span></a></div>');
|
662 |
+
// add the controls to the DOM
|
663 |
+
slider.controls.autoEl = $('<div class="soliloquy-controls-auto" />');
|
664 |
+
// bind click actions to the controls
|
665 |
+
slider.controls.autoEl.delegate('.soliloquy-start', 'click', clickStartBind);
|
666 |
+
slider.controls.autoEl.delegate('.soliloquy-stop', 'click', clickStopBind);
|
667 |
+
// if autoControlsCombine, insert only the "start" control
|
668 |
+
if(slider.settings.autoControlsCombine){
|
669 |
+
slider.controls.autoEl.append(slider.controls.start);
|
670 |
+
// if autoControlsCombine is false, insert both controls
|
671 |
+
}else{
|
672 |
+
slider.controls.autoEl.append(slider.controls.start).append(slider.controls.stop);
|
673 |
+
}
|
674 |
+
// if auto controls selector was supplied, populate it with the controls
|
675 |
+
if(slider.settings.autoControlsSelector){
|
676 |
+
$(slider.settings.autoControlsSelector).html(slider.controls.autoEl);
|
677 |
+
// if auto controls selector was not supplied, add it after the wrapper
|
678 |
+
}else{
|
679 |
+
slider.controls.el.addClass('soliloquy-has-controls-auto').append(slider.controls.autoEl);
|
680 |
+
}
|
681 |
+
// update the auto controls
|
682 |
+
updateAutoControls(slider.settings.autoStart ? 'stop' : 'start');
|
683 |
+
}
|
684 |
+
|
685 |
+
/**
|
686 |
+
* Appends image captions to the DOM
|
687 |
+
*/
|
688 |
+
var appendCaptions = function(){
|
689 |
+
// cycle through each child
|
690 |
+
slider.children.each(function(index){
|
691 |
+
// get the image title attribute
|
692 |
+
var title = $(this).find('img:first').attr('title');
|
693 |
+
// append the caption
|
694 |
+
if (title != undefined && ('' + title).length) {
|
695 |
+
$(this).append('<div class="soliloquy-caption"><span>' + title + '</span></div>');
|
696 |
+
}
|
697 |
+
});
|
698 |
+
}
|
699 |
+
|
700 |
+
/**
|
701 |
+
* Click next binding
|
702 |
+
*
|
703 |
+
* @param e (event)
|
704 |
+
* - DOM event object
|
705 |
+
*/
|
706 |
+
var clickNextBind = function(e){
|
707 |
+
// if auto show is running, stop it
|
708 |
+
if (slider.settings.auto) el.stopAuto();
|
709 |
+
el.goToNextSlide();
|
710 |
+
e.preventDefault();
|
711 |
+
}
|
712 |
+
|
713 |
+
/**
|
714 |
+
* Click prev binding
|
715 |
+
*
|
716 |
+
* @param e (event)
|
717 |
+
* - DOM event object
|
718 |
+
*/
|
719 |
+
var clickPrevBind = function(e){
|
720 |
+
// if auto show is running, stop it
|
721 |
+
if (slider.settings.auto) el.stopAuto();
|
722 |
+
el.goToPrevSlide();
|
723 |
+
e.preventDefault();
|
724 |
+
}
|
725 |
+
|
726 |
+
/**
|
727 |
+
* Click start binding
|
728 |
+
*
|
729 |
+
* @param e (event)
|
730 |
+
* - DOM event object
|
731 |
+
*/
|
732 |
+
var clickStartBind = function(e){
|
733 |
+
el.startAuto();
|
734 |
+
e.preventDefault();
|
735 |
+
}
|
736 |
+
|
737 |
+
/**
|
738 |
+
* Click stop binding
|
739 |
+
*
|
740 |
+
* @param e (event)
|
741 |
+
* - DOM event object
|
742 |
+
*/
|
743 |
+
var clickStopBind = function(e){
|
744 |
+
el.stopAuto();
|
745 |
+
e.preventDefault();
|
746 |
+
}
|
747 |
+
|
748 |
+
/**
|
749 |
+
* Click pager binding
|
750 |
+
*
|
751 |
+
* @param e (event)
|
752 |
+
* - DOM event object
|
753 |
+
*/
|
754 |
+
var clickPagerBind = function(e){
|
755 |
+
// if auto show is running, stop it
|
756 |
+
if (slider.settings.auto) el.stopAuto();
|
757 |
+
var pagerLink = $(e.currentTarget);
|
758 |
+
var pagerIndex = parseInt(pagerLink.attr('data-slide-index'));
|
759 |
+
// if clicked pager link is not active, continue with the goToSlide call
|
760 |
+
if(pagerIndex != slider.active.index) el.goToSlide(pagerIndex);
|
761 |
+
e.preventDefault();
|
762 |
+
}
|
763 |
+
|
764 |
+
/**
|
765 |
+
* Updates the pager links with an active class
|
766 |
+
*
|
767 |
+
* @param slideIndex (int)
|
768 |
+
* - index of slide to make active
|
769 |
+
*/
|
770 |
+
var updatePagerActive = function(slideIndex){
|
771 |
+
// if "short" pager type
|
772 |
+
var len = slider.children.length; // nb of children
|
773 |
+
if(slider.settings.pagerType == 'short'){
|
774 |
+
if(slider.settings.maxSlides > 1) {
|
775 |
+
len = Math.ceil(slider.children.length/slider.settings.maxSlides);
|
776 |
+
}
|
777 |
+
slider.pagerEl.html( (slideIndex + 1) + slider.settings.pagerShortSeparator + len);
|
778 |
+
return;
|
779 |
+
}
|
780 |
+
// remove all pager active classes
|
781 |
+
slider.pagerEl.find('a').removeClass('active');
|
782 |
+
// apply the active class for all pagers
|
783 |
+
slider.pagerEl.each(function(i, el) { $(el).find('a').eq(slideIndex).addClass('active'); });
|
784 |
+
}
|
785 |
+
|
786 |
+
/**
|
787 |
+
* Performs needed actions after a slide transition
|
788 |
+
*/
|
789 |
+
var updateAfterSlideTransition = function(){
|
790 |
+
// if infinte loop is true
|
791 |
+
if(slider.settings.infiniteLoop){
|
792 |
+
var position = '';
|
793 |
+
// first slide
|
794 |
+
if(slider.active.index == 0){
|
795 |
+
// set the new position
|
796 |
+
position = slider.children.eq(0).position();
|
797 |
+
// carousel, last slide
|
798 |
+
}else if(slider.active.index == getPagerQty() - 1 && slider.carousel){
|
799 |
+
position = slider.children.eq((getPagerQty() - 1) * getMoveBy()).position();
|
800 |
+
// last slide
|
801 |
+
}else if(slider.active.index == slider.children.length - 1){
|
802 |
+
position = slider.children.eq(slider.children.length - 1).position();
|
803 |
+
}
|
804 |
+
if (slider.settings.mode == 'horizontal') { setPositionProperty(-position.left, 'reset', 0);; }
|
805 |
+
else if (slider.settings.mode == 'vertical') { setPositionProperty(-position.top, 'reset', 0);; }
|
806 |
+
}
|
807 |
+
// declare that the transition is complete
|
808 |
+
slider.working = false;
|
809 |
+
// Remove overflow hidden now that the transition is complete.
|
810 |
+
if(slider.settings.mode == 'fade'){
|
811 |
+
slider.viewport.css({overflow:''});
|
812 |
+
}
|
813 |
+
// onSlideAfter callback
|
814 |
+
slider.settings.onSlideAfter(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
|
815 |
+
}
|
816 |
+
|
817 |
+
/**
|
818 |
+
* Updates the auto controls state (either active, or combined switch)
|
819 |
+
*
|
820 |
+
* @param state (string) "start", "stop"
|
821 |
+
* - the new state of the auto show
|
822 |
+
*/
|
823 |
+
var updateAutoControls = function(state){
|
824 |
+
// if autoControlsCombine is true, replace the current control with the new state
|
825 |
+
if(slider.settings.autoControlsCombine){
|
826 |
+
slider.controls.autoEl.html(slider.controls[state]);
|
827 |
+
// if autoControlsCombine is false, apply the "active" class to the appropriate control
|
828 |
+
}else{
|
829 |
+
slider.controls.autoEl.find('a').removeClass('active');
|
830 |
+
slider.controls.autoEl.find('a:not(.soliloquy-' + state + ')').addClass('active');
|
831 |
+
}
|
832 |
+
}
|
833 |
+
|
834 |
+
/**
|
835 |
+
* Updates the direction controls (checks if either should be hidden)
|
836 |
+
*/
|
837 |
+
var updateDirectionControls = function(){
|
838 |
+
if(getPagerQty() == 1){
|
839 |
+
slider.controls.prev.addClass('disabled');
|
840 |
+
slider.controls.next.addClass('disabled');
|
841 |
+
}else if(!slider.settings.infiniteLoop && slider.settings.hideControlOnEnd){
|
842 |
+
// if first slide
|
843 |
+
if (slider.active.index == 0){
|
844 |
+
slider.controls.prev.addClass('disabled');
|
845 |
+
slider.controls.next.removeClass('disabled');
|
846 |
+
// if last slide
|
847 |
+
}else if(slider.active.index == getPagerQty() - 1){
|
848 |
+
slider.controls.next.addClass('disabled');
|
849 |
+
slider.controls.prev.removeClass('disabled');
|
850 |
+
// if any slide in the middle
|
851 |
+
}else{
|
852 |
+
slider.controls.prev.removeClass('disabled');
|
853 |
+
slider.controls.next.removeClass('disabled');
|
854 |
+
}
|
855 |
+
}
|
856 |
+
}
|
857 |
+
|
858 |
+
/**
|
859 |
+
* Initialzes the auto process
|
860 |
+
*/
|
861 |
+
var initAuto = function(){
|
862 |
+
// if autoDelay was supplied, launch the auto show using a setTimeout() call
|
863 |
+
if(slider.settings.autoDelay > 0){
|
864 |
+
var timeout = setTimeout(el.startAuto, slider.settings.autoDelay);
|
865 |
+
// if autoDelay was not supplied, start the auto show normally
|
866 |
+
}else{
|
867 |
+
el.startAuto();
|
868 |
+
}
|
869 |
+
// if autoHover is requested
|
870 |
+
if(slider.settings.autoHover){
|
871 |
+
// on el hover
|
872 |
+
el.hover(function(){
|
873 |
+
// if the auto show is currently playing (has an active interval)
|
874 |
+
if(slider.interval){
|
875 |
+
// stop the auto show and pass true agument which will prevent control update
|
876 |
+
el.stopAuto(true);
|
877 |
+
// create a new autoPaused value which will be used by the relative "mouseout" event
|
878 |
+
slider.autoPaused = true;
|
879 |
+
}
|
880 |
+
}, function(){
|
881 |
+
// if the autoPaused value was created be the prior "mouseover" event
|
882 |
+
if(slider.autoPaused){
|
883 |
+
// start the auto show and pass true agument which will prevent control update
|
884 |
+
el.startAuto(true);
|
885 |
+
// reset the autoPaused value
|
886 |
+
slider.autoPaused = null;
|
887 |
+
}
|
888 |
+
});
|
889 |
+
}
|
890 |
+
}
|
891 |
+
|
892 |
+
/**
|
893 |
+
* Initialzes the ticker process
|
894 |
+
*/
|
895 |
+
var initTicker = function(){
|
896 |
+
var startPosition = 0;
|
897 |
+
// if autoDirection is "next", append a clone of the entire slider
|
898 |
+
if(slider.settings.autoDirection == 'next'){
|
899 |
+
el.append(slider.children.clone().addClass('soliloquy-clone'));
|
900 |
+
// if autoDirection is "prev", prepend a clone of the entire slider, and set the left position
|
901 |
+
}else{
|
902 |
+
el.prepend(slider.children.clone().addClass('soliloquy-clone'));
|
903 |
+
var position = slider.children.first().position();
|
904 |
+
startPosition = slider.settings.mode == 'horizontal' ? -position.left : -position.top;
|
905 |
+
}
|
906 |
+
setPositionProperty(startPosition, 'reset', 0);
|
907 |
+
// do not allow controls in ticker mode
|
908 |
+
slider.settings.pager = false;
|
909 |
+
slider.settings.controls = false;
|
910 |
+
slider.settings.autoControls = false;
|
911 |
+
// if autoHover is requested
|
912 |
+
if(slider.settings.tickerHover && !slider.usingCSS){
|
913 |
+
// on el hover
|
914 |
+
slider.viewport.hover(function(){
|
915 |
+
el.stop();
|
916 |
+
}, function(){
|
917 |
+
// calculate the total width of children (used to calculate the speed ratio)
|
918 |
+
var totalDimens = 0;
|
919 |
+
slider.children.each(function(index){
|
920 |
+
totalDimens += slider.settings.mode == 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true);
|
921 |
+
});
|
922 |
+
// calculate the speed ratio (used to determine the new speed to finish the paused animation)
|
923 |
+
var ratio = slider.settings.speed / totalDimens;
|
924 |
+
// determine which property to use
|
925 |
+
var property = slider.settings.mode == 'horizontal' ? 'left' : 'top';
|
926 |
+
// calculate the new speed
|
927 |
+
var newSpeed = ratio * (totalDimens - (Math.abs(parseInt(el.css(property)))));
|
928 |
+
tickerLoop(newSpeed);
|
929 |
+
});
|
930 |
+
}
|
931 |
+
// start the ticker loop
|
932 |
+
tickerLoop();
|
933 |
+
}
|
934 |
+
|
935 |
+
/**
|
936 |
+
* Runs a continuous loop, news ticker-style
|
937 |
+
*/
|
938 |
+
var tickerLoop = function(resumeSpeed){
|
939 |
+
speed = resumeSpeed ? resumeSpeed : slider.settings.speed;
|
940 |
+
var position = {left: 0, top: 0};
|
941 |
+
var reset = {left: 0, top: 0};
|
942 |
+
// if "next" animate left position to last child, then reset left to 0
|
943 |
+
if(slider.settings.autoDirection == 'next'){
|
944 |
+
position = el.find('.soliloquy-clone').first().position();
|
945 |
+
// if "prev" animate left position to 0, then reset left to first non-clone child
|
946 |
+
}else{
|
947 |
+
reset = slider.children.first().position();
|
948 |
+
}
|
949 |
+
var animateProperty = slider.settings.mode == 'horizontal' ? -position.left : -position.top;
|
950 |
+
var resetValue = slider.settings.mode == 'horizontal' ? -reset.left : -reset.top;
|
951 |
+
var params = {resetValue: resetValue};
|
952 |
+
setPositionProperty(animateProperty, 'ticker', speed, params);
|
953 |
+
}
|
954 |
+
|
955 |
+
/**
|
956 |
+
* Initializes touch events
|
957 |
+
*/
|
958 |
+
var initTouch = function(){
|
959 |
+
// initialize object to contain all touch values
|
960 |
+
slider.touch = {
|
961 |
+
start: {x: 0, y: 0},
|
962 |
+
end: {x: 0, y: 0}
|
963 |
+
}
|
964 |
+
slider.viewport.bind('touchstart', onTouchStart);
|
965 |
+
}
|
966 |
+
|
967 |
+
/**
|
968 |
+
* Event handler for "touchstart"
|
969 |
+
*
|
970 |
+
* @param e (event)
|
971 |
+
* - DOM event object
|
972 |
+
*/
|
973 |
+
var onTouchStart = function(e){
|
974 |
+
if(slider.working){
|
975 |
+
e.preventDefault();
|
976 |
+
}else{
|
977 |
+
// record the original position when touch starts
|
978 |
+
slider.touch.originalPos = el.position();
|
979 |
+
var orig = e.originalEvent;
|
980 |
+
// record the starting touch x, y coordinates
|
981 |
+
slider.touch.start.x = orig.changedTouches[0].pageX;
|
982 |
+
slider.touch.start.y = orig.changedTouches[0].pageY;
|
983 |
+
// bind a "touchmove" event to the viewport
|
984 |
+
slider.viewport.bind('touchmove', onTouchMove);
|
985 |
+
// bind a "touchend" event to the viewport
|
986 |
+
slider.viewport.bind('touchend', onTouchEnd);
|
987 |
+
}
|
988 |
+
}
|
989 |
+
|
990 |
+
/**
|
991 |
+
* Event handler for "touchmove"
|
992 |
+
*
|
993 |
+
* @param e (event)
|
994 |
+
* - DOM event object
|
995 |
+
*/
|
996 |
+
var onTouchMove = function(e){
|
997 |
+
var orig = e.originalEvent;
|
998 |
+
// if scrolling on y axis, do not prevent default
|
999 |
+
var xMovement = Math.abs(orig.changedTouches[0].pageX - slider.touch.start.x);
|
1000 |
+
var yMovement = Math.abs(orig.changedTouches[0].pageY - slider.touch.start.y);
|
1001 |
+
// x axis swipe
|
1002 |
+
if((xMovement * 3) > yMovement && slider.settings.preventDefaultSwipeX){
|
1003 |
+
e.preventDefault();
|
1004 |
+
// y axis swipe
|
1005 |
+
}else if((yMovement * 3) > xMovement && slider.settings.preventDefaultSwipeY){
|
1006 |
+
e.preventDefault();
|
1007 |
+
}
|
1008 |
+
if(slider.settings.mode != 'fade' && slider.settings.oneToOneTouch){
|
1009 |
+
var value = 0;
|
1010 |
+
// if horizontal, drag along x axis
|
1011 |
+
if(slider.settings.mode == 'horizontal'){
|
1012 |
+
var change = orig.changedTouches[0].pageX - slider.touch.start.x;
|
1013 |
+
value = slider.touch.originalPos.left + change;
|
1014 |
+
// if vertical, drag along y axis
|
1015 |
+
}else{
|
1016 |
+
var change = orig.changedTouches[0].pageY - slider.touch.start.y;
|
1017 |
+
value = slider.touch.originalPos.top + change;
|
1018 |
+
}
|
1019 |
+
setPositionProperty(value, 'reset', 0);
|
1020 |
+
}
|
1021 |
+
}
|
1022 |
+
|
1023 |
+
/**
|
1024 |
+
* Event handler for "touchend"
|
1025 |
+
*
|
1026 |
+
* @param e (event)
|
1027 |
+
* - DOM event object
|
1028 |
+
*/
|
1029 |
+
var onTouchEnd = function(e){
|
1030 |
+
slider.viewport.unbind('touchmove', onTouchMove);
|
1031 |
+
var orig = e.originalEvent;
|
1032 |
+
var value = 0;
|
1033 |
+
// record end x, y positions
|
1034 |
+
slider.touch.end.x = orig.changedTouches[0].pageX;
|
1035 |
+
slider.touch.end.y = orig.changedTouches[0].pageY;
|
1036 |
+
// if fade mode, check if absolute x distance clears the threshold
|
1037 |
+
if(slider.settings.mode == 'fade'){
|
1038 |
+
var distance = Math.abs(slider.touch.start.x - slider.touch.end.x);
|
1039 |
+
if(distance >= slider.settings.swipeThreshold){
|
1040 |
+
slider.touch.start.x > slider.touch.end.x ? el.goToNextSlide() : el.goToPrevSlide();
|
1041 |
+
el.stopAuto();
|
1042 |
+
}
|
1043 |
+
// not fade mode
|
1044 |
+
}else{
|
1045 |
+
var distance = 0;
|
1046 |
+
// calculate distance and el's animate property
|
1047 |
+
if(slider.settings.mode == 'horizontal'){
|
1048 |
+
distance = slider.touch.end.x - slider.touch.start.x;
|
1049 |
+
value = slider.touch.originalPos.left;
|
1050 |
+
}else{
|
1051 |
+
distance = slider.touch.end.y - slider.touch.start.y;
|
1052 |
+
value = slider.touch.originalPos.top;
|
1053 |
+
}
|
1054 |
+
// if not infinite loop and first / last slide, do not attempt a slide transition
|
1055 |
+
if(!slider.settings.infiniteLoop && ((slider.active.index == 0 && distance > 0) || (slider.active.last && distance < 0))){
|
1056 |
+
setPositionProperty(value, 'reset', 200);
|
1057 |
+
}else{
|
1058 |
+
// check if distance clears threshold
|
1059 |
+
if(Math.abs(distance) >= slider.settings.swipeThreshold){
|
1060 |
+
distance < 0 ? el.goToNextSlide() : el.goToPrevSlide();
|
1061 |
+
el.stopAuto();
|
1062 |
+
}else{
|
1063 |
+
// el.animate(property, 200);
|
1064 |
+
setPositionProperty(value, 'reset', 200);
|
1065 |
+
}
|
1066 |
+
}
|
1067 |
+
}
|
1068 |
+
slider.viewport.unbind('touchend', onTouchEnd);
|
1069 |
+
}
|
1070 |
+
|
1071 |
+
/**
|
1072 |
+
* Window resize event callback
|
1073 |
+
*/
|
1074 |
+
var resizeWindow = function(e){
|
1075 |
+
// get the new window dimens (again, thank you IE)
|
1076 |
+
var windowWidthNew = $(window).width();
|
1077 |
+
var windowHeightNew = $(window).height();
|
1078 |
+
// make sure that it is a true window resize
|
1079 |
+
// *we must check this because our dinosaur friend IE fires a window resize event when certain DOM elements
|
1080 |
+
// are resized. Can you just die already?*
|
1081 |
+
if(windowWidth != windowWidthNew || windowHeight != windowHeightNew){
|
1082 |
+
// set the new window dimens
|
1083 |
+
windowWidth = windowWidthNew;
|
1084 |
+
windowHeight = windowHeightNew;
|
1085 |
+
// update all dynamic elements
|
1086 |
+
el.redrawSlider();
|
1087 |
+
}
|
1088 |
+
}
|
1089 |
+
|
1090 |
+
/**
|
1091 |
+
* ===================================================================================
|
1092 |
+
* = PUBLIC FUNCTIONS
|
1093 |
+
* ===================================================================================
|
1094 |
+
*/
|
1095 |
+
|
1096 |
+
/**
|
1097 |
+
* Performs slide transition to the specified slide
|
1098 |
+
*
|
1099 |
+
* @param slideIndex (int)
|
1100 |
+
* - the destination slide's index (zero-based)
|
1101 |
+
*
|
1102 |
+
* @param direction (string)
|
1103 |
+
* - INTERNAL USE ONLY - the direction of travel ("prev" / "next")
|
1104 |
+
*/
|
1105 |
+
el.goToSlide = function(slideIndex, direction){
|
1106 |
+
// if plugin is currently in motion, ignore request
|
1107 |
+
if(slider.working || slider.active.index == slideIndex) return;
|
1108 |
+
// declare that plugin is in motion
|
1109 |
+
slider.working = true;
|
1110 |
+
// store the old index
|
1111 |
+
slider.oldIndex = slider.active.index;
|
1112 |
+
// if slideIndex is less than zero, set active index to last child (this happens during infinite loop)
|
1113 |
+
if(slideIndex < 0){
|
1114 |
+
slider.active.index = getPagerQty() - 1;
|
1115 |
+
// if slideIndex is greater than children length, set active index to 0 (this happens during infinite loop)
|
1116 |
+
}else if(slideIndex >= getPagerQty()){
|
1117 |
+
slider.active.index = 0;
|
1118 |
+
// set active index to requested slide
|
1119 |
+
}else{
|
1120 |
+
slider.active.index = slideIndex;
|
1121 |
+
}
|
1122 |
+
// onSlideBefore, onSlideNext, onSlidePrev callbacks
|
1123 |
+
slider.settings.onSlideBefore(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
|
1124 |
+
if(direction == 'next'){
|
1125 |
+
slider.settings.onSlideNext(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
|
1126 |
+
}else if(direction == 'prev'){
|
1127 |
+
slider.settings.onSlidePrev(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
|
1128 |
+
}
|
1129 |
+
// check if last slide
|
1130 |
+
slider.active.last = slider.active.index >= getPagerQty() - 1;
|
1131 |
+
// update the pager with active class
|
1132 |
+
if(slider.settings.pager) updatePagerActive(slider.active.index);
|
1133 |
+
// // check for direction control update
|
1134 |
+
if(slider.settings.controls) updateDirectionControls();
|
1135 |
+
// if slider is set to mode: "fade"
|
1136 |
+
if(slider.settings.mode == 'fade'){
|
1137 |
+
// Set overflow hidden when transitioning slides.
|
1138 |
+
slider.viewport.css({overflow:'hidden'});
|
1139 |
+
// if adaptiveHeight is true and next height is different from current height, animate to the new height
|
1140 |
+
if(slider.settings.adaptiveHeight && slider.viewport.height() != getViewportHeight()){
|
1141 |
+
slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
|
1142 |
+
}
|
1143 |
+
// fade out the visible child and reset its z-index value
|
1144 |
+
slider.children.filter(':visible').fadeOut(slider.settings.speed).css({zIndex: 0});
|
1145 |
+
// fade in the newly requested slide
|
1146 |
+
slider.children.eq(slider.active.index).css('zIndex', 51).fadeIn(slider.settings.speed, function(){
|
1147 |
+
$(this).css('zIndex', 50);
|
1148 |
+
updateAfterSlideTransition();
|
1149 |
+
});
|
1150 |
+
// slider mode is not "fade"
|
1151 |
+
}else{
|
1152 |
+
// if adaptiveHeight is true and next height is different from current height, animate to the new height
|
1153 |
+
if(slider.settings.adaptiveHeight && slider.viewport.height() != getViewportHeight()){
|
1154 |
+
slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
|
1155 |
+
}
|
1156 |
+
var moveBy = 0;
|
1157 |
+
var position = {left: 0, top: 0};
|
1158 |
+
// if carousel and not infinite loop
|
1159 |
+
if(!slider.settings.infiniteLoop && slider.carousel && slider.active.last){
|
1160 |
+
if(slider.settings.mode == 'horizontal'){
|
1161 |
+
// get the last child position
|
1162 |
+
var lastChild = slider.children.eq(slider.children.length - 1);
|
1163 |
+
position = lastChild.position();
|
1164 |
+
// calculate the position of the last slide
|
1165 |
+
moveBy = slider.viewport.width() - lastChild.outerWidth();
|
1166 |
+
}else{
|
1167 |
+
// get last showing index position
|
1168 |
+
var lastShowingIndex = slider.children.length - slider.settings.minSlides;
|
1169 |
+
position = slider.children.eq(lastShowingIndex).position();
|
1170 |
+
}
|
1171 |
+
// horizontal carousel, going previous while on first slide (infiniteLoop mode)
|
1172 |
+
}else if(slider.carousel && slider.active.last && direction == 'prev'){
|
1173 |
+
// get the last child position
|
1174 |
+
var eq = slider.settings.moveSlides == 1 ? slider.settings.maxSlides - getMoveBy() : ((getPagerQty() - 1) * getMoveBy()) - (slider.children.length - slider.settings.maxSlides);
|
1175 |
+
var lastChild = el.children('.soliloquy-clone').eq(eq);
|
1176 |
+
position = lastChild.position();
|
1177 |
+
// if infinite loop and "Next" is clicked on the last slide
|
1178 |
+
}else if(direction == 'next' && slider.active.index == 0){
|
1179 |
+
// get the last clone position
|
1180 |
+
position = el.find('> .soliloquy-clone').eq(slider.settings.maxSlides).position();
|
1181 |
+
slider.active.last = false;
|
1182 |
+
// normal non-zero requests
|
1183 |
+
}else if(slideIndex >= 0){
|
1184 |
+
var requestEl = slideIndex * getMoveBy();
|
1185 |
+
position = slider.children.eq(requestEl).position();
|
1186 |
+
}
|
1187 |
+
|
1188 |
+
/* If the position doesn't exist
|
1189 |
+
* (e.g. if you destroy the slider on a next click),
|
1190 |
+
* it doesn't throw an error.
|
1191 |
+
*/
|
1192 |
+
if ("undefined" !== typeof(position)) {
|
1193 |
+
var value = slider.settings.mode == 'horizontal' ? -(position.left - moveBy) : -position.top;
|
1194 |
+
// plugin values to be animated
|
1195 |
+
setPositionProperty(value, 'slide', slider.settings.speed);
|
1196 |
+
}
|
1197 |
+
}
|
1198 |
+
}
|
1199 |
+
|
1200 |
+
/**
|
1201 |
+
* Transitions to the next slide in the show
|
1202 |
+
*/
|
1203 |
+
el.goToNextSlide = function(){
|
1204 |
+
// if infiniteLoop is false and last page is showing, disregard call
|
1205 |
+
if (!slider.settings.infiniteLoop && slider.active.last) return;
|
1206 |
+
var pagerIndex = parseInt(slider.active.index) + 1;
|
1207 |
+
el.goToSlide(pagerIndex, 'next');
|
1208 |
+
}
|
1209 |
+
|
1210 |
+
/**
|
1211 |
+
* Transitions to the prev slide in the show
|
1212 |
+
*/
|
1213 |
+
el.goToPrevSlide = function(){
|
1214 |
+
// if infiniteLoop is false and last page is showing, disregard call
|
1215 |
+
if (!slider.settings.infiniteLoop && slider.active.index == 0) return;
|
1216 |
+
var pagerIndex = parseInt(slider.active.index) - 1;
|
1217 |
+
el.goToSlide(pagerIndex, 'prev');
|
1218 |
+
}
|
1219 |
+
|
1220 |
+
/**
|
1221 |
+
* Starts the auto show
|
1222 |
+
*
|
1223 |
+
* @param preventControlUpdate (boolean)
|
1224 |
+
* - if true, auto controls state will not be updated
|
1225 |
+
*/
|
1226 |
+
el.startAuto = function(preventControlUpdate){
|
1227 |
+
// if an interval already exists, disregard call
|
1228 |
+
if(slider.interval) return;
|
1229 |
+
// create an interval
|
1230 |
+
slider.interval = setInterval(function(){
|
1231 |
+
slider.settings.autoDirection == 'next' ? el.goToNextSlide() : el.goToPrevSlide();
|
1232 |
+
}, slider.settings.pause);
|
1233 |
+
// if auto controls are displayed and preventControlUpdate is not true
|
1234 |
+
if (slider.settings.autoControls && preventControlUpdate != true) updateAutoControls('stop');
|
1235 |
+
}
|
1236 |
+
|
1237 |
+
/**
|
1238 |
+
* Stops the auto show
|
1239 |
+
*
|
1240 |
+
* @param preventControlUpdate (boolean)
|
1241 |
+
* - if true, auto controls state will not be updated
|
1242 |
+
*/
|
1243 |
+
el.stopAuto = function(preventControlUpdate){
|
1244 |
+
// if no interval exists, disregard call
|
1245 |
+
if(!slider.interval) return;
|
1246 |
+
// clear the interval
|
1247 |
+
clearInterval(slider.interval);
|
1248 |
+
slider.interval = null;
|
1249 |
+
// if auto controls are displayed and preventControlUpdate is not true
|
1250 |
+
if (slider.settings.autoControls && preventControlUpdate != true) updateAutoControls('start');
|
1251 |
+
}
|
1252 |
+
|
1253 |
+
/**
|
1254 |
+
* Returns current slide index (zero-based)
|
1255 |
+
*/
|
1256 |
+
el.getCurrentSlide = function(){
|
1257 |
+
return slider.active.index;
|
1258 |
+
}
|
1259 |
+
|
1260 |
+
/**
|
1261 |
+
* Returns number of slides in show
|
1262 |
+
*/
|
1263 |
+
el.getSlideCount = function(){
|
1264 |
+
return slider.children.length;
|
1265 |
+
}
|
1266 |
+
|
1267 |
+
/**
|
1268 |
+
* Update all dynamic slider elements
|
1269 |
+
*/
|
1270 |
+
el.redrawSlider = function(){
|
1271 |
+
// resize all children in ratio to new screen size
|
1272 |
+
slider.children.add(el.find('.soliloquy-clone')).outerWidth(getSlideWidth());
|
1273 |
+
// adjust the height
|
1274 |
+
slider.viewport.css('height', getViewportHeight());
|
1275 |
+
// update the slide position
|
1276 |
+
if(!slider.settings.ticker) setSlidePosition();
|
1277 |
+
// if active.last was true before the screen resize, we want
|
1278 |
+
// to keep it last no matter what screen size we end on
|
1279 |
+
if (slider.active.last) slider.active.index = getPagerQty() - 1;
|
1280 |
+
// if the active index (page) no longer exists due to the resize, simply set the index as last
|
1281 |
+
if (slider.active.index >= getPagerQty()) slider.active.last = true;
|
1282 |
+
// if a pager is being displayed and a custom pager is not being used, update it
|
1283 |
+
if(slider.settings.pager && !slider.settings.pagerCustom){
|
1284 |
+
populatePager();
|
1285 |
+
updatePagerActive(slider.active.index);
|
1286 |
+
}
|
1287 |
+
}
|
1288 |
+
|
1289 |
+
/**
|
1290 |
+
* Destroy the current instance of the slider (revert everything back to original state)
|
1291 |
+
*/
|
1292 |
+
el.destroySlider = function(){
|
1293 |
+
// don't do anything if slider has already been destroyed
|
1294 |
+
if(!slider.initialized) return;
|
1295 |
+
slider.initialized = false;
|
1296 |
+
$('.soliloquy-clone', this).remove();
|
1297 |
+
slider.children.each(function() {
|
1298 |
+
$(this).data("origStyle") != undefined ? $(this).attr("style", $(this).data("origStyle")) : $(this).removeAttr('style');
|
1299 |
+
});
|
1300 |
+
$(this).data("origStyle") != undefined ? this.attr("style", $(this).data("origStyle")) : $(this).removeAttr('style');
|
1301 |
+
$(this).unwrap().unwrap();
|
1302 |
+
if(slider.controls.el) slider.controls.el.remove();
|
1303 |
+
if(slider.controls.next) slider.controls.next.remove();
|
1304 |
+
if(slider.controls.prev) slider.controls.prev.remove();
|
1305 |
+
if(slider.pagerEl) slider.pagerEl.remove();
|
1306 |
+
$('.soliloquy-caption', this).remove();
|
1307 |
+
if(slider.controls.autoEl) slider.controls.autoEl.remove();
|
1308 |
+
clearInterval(slider.interval);
|
1309 |
+
if(slider.settings.responsive) $(window).unbind('resize', resizeWindow);
|
1310 |
+
}
|
1311 |
+
|
1312 |
+
/**
|
1313 |
+
* Reload the slider (revert all DOM changes, and re-initialize)
|
1314 |
+
*/
|
1315 |
+
el.reloadSlider = function(settings){
|
1316 |
+
if (settings != undefined) options = settings;
|
1317 |
+
el.destroySlider();
|
1318 |
+
init();
|
1319 |
+
}
|
1320 |
+
|
1321 |
+
init();
|
1322 |
+
|
1323 |
+
// returns the current jQuery object
|
1324 |
+
return this;
|
1325 |
+
}
|
1326 |
+
|
1327 |
+
})(jQuery);
|
1328 |
+
// Video functions.
|
1329 |
+
function soliloquyYouTubeVids(data, id, width, height, holder, $){
|
1330 |
+
// Immediately make the holder visible and increase z-index to overlay the player icon.
|
1331 |
+
$('#' + holder).show().css({'display':'block','z-index':'1210'});
|
1332 |
+
|
1333 |
+
// Load a new video into the slider.
|
1334 |
+
if ( YT.Player ) {
|
1335 |
+
soliloquy_youtube[id] = new YT.Player(holder, {
|
1336 |
+
videoId: id,
|
1337 |
+
playerVars: data,
|
1338 |
+
events: {
|
1339 |
+
'onStateChange' : soliloquyYouTubeOnStateChange
|
1340 |
+
}
|
1341 |
+
});
|
1342 |
+
}
|
1343 |
+
}
|
1344 |
+
function soliloquyYouTubeOnStateChange(event){
|
1345 |
+
var id = jQuery(event.target.a).data('soliloquy-slider-id');
|
1346 |
+
// If the video has been paused or has finished playing, restart the slider.
|
1347 |
+
if ( event.data === YT.PlayerState.PAUSED || event.data === YT.PlayerState.ENDED ) {
|
1348 |
+
if ( soliloquy_slider[id] ) {
|
1349 |
+
soliloquy_slider[id].startAuto();
|
1350 |
+
}
|
1351 |
+
}
|
1352 |
+
|
1353 |
+
// If the video is playing, pause the slider.
|
1354 |
+
if ( event.data === YT.PlayerState.PLAYING ) {
|
1355 |
+
if ( soliloquy_slider[id] ) {
|
1356 |
+
soliloquy_slider[id].stopAuto();
|
1357 |
+
}
|
1358 |
+
}
|
1359 |
+
}
|
1360 |
+
function onYouTubeIframeAPIReady(){}
|
1361 |
+
function soliloquyVimeoVids(data, id, width, height, holder, $){
|
1362 |
+
// Immediately make the holder visible and increase z-index to overlay the player icon.
|
1363 |
+
$('#' + holder).show().css({'display':'block','z-index':'1210'});
|
1364 |
+
|
1365 |
+
// Load a new video into the slider.
|
1366 |
+
if ( $f ) {
|
1367 |
+
var attrs = {};
|
1368 |
+
$.each($('#' + holder)[0].attributes, function(idx, attr){
|
1369 |
+
attrs[attr.nodeName] = attr.nodeValue;
|
1370 |
+
});
|
1371 |
+
|
1372 |
+
// Add iframe specific attributes.
|
1373 |
+
data.player_id = holder;
|
1374 |
+
attrs.src = '//player.vimeo.com/video/' + id + '?' + $.param(data);
|
1375 |
+
attrs.frameborder = 0;
|
1376 |
+
|
1377 |
+
// Convert the holder to the video.
|
1378 |
+
$('#' + holder).replaceWith(function(){
|
1379 |
+
return $('<iframe />', attrs).append($(this).contents());
|
1380 |
+
});
|
1381 |
+
|
1382 |
+
// Store a reference to the video object for use with the API.
|
1383 |
+
soliloquy_vimeo[id] = $f($('#' + holder)[0]);
|
1384 |
+
soliloquy_vimeo[id].addEvent('ready', function(){
|
1385 |
+
soliloquy_vimeo[id].addEvent('play', soliloquyVimeoSliderPause);
|
1386 |
+
soliloquy_vimeo[id].addEvent('pause', soliloquyVimeoSliderStart);
|
1387 |
+
soliloquy_vimeo[id].addEvent('finish', soliloquyVimeoSliderStart);
|
1388 |
+
});
|
1389 |
+
}
|
1390 |
+
|
1391 |
+
}
|
1392 |
+
function soliloquyVimeoSliderPause(vid){
|
1393 |
+
var id = jQuery('#' + vid).data('soliloquy-slider-id');
|
1394 |
+
if ( soliloquy_slider[id] ) {
|
1395 |
+
soliloquy_slider[id].stopAuto();
|
1396 |
+
}
|
1397 |
+
}
|
1398 |
+
function soliloquyVimeoSliderStart(vid){
|
1399 |
+
var id = jQuery('#' + vid).data('soliloquy-slider-id');
|
1400 |
+
if ( soliloquy_slider[id] ) {
|
1401 |
+
soliloquy_slider[id].startAuto();
|
1402 |
+
}
|
1403 |
+
}
|
1404 |
+
function soliloquyWistiaVids(data, id, width, height, holder, $){
|
1405 |
+
// Immediately make the holder visible and increase z-index to overlay the player icon.
|
1406 |
+
$('#' + holder).show().css({'display':'block','z-index':'1210'});
|
1407 |
+
|
1408 |
+
if ( wistiaEmbeds ) {
|
1409 |
+
var attrs = {};
|
1410 |
+
$.each($('#' + holder)[0].attributes, function(idx, attr){
|
1411 |
+
attrs[attr.nodeName] = attr.nodeValue;
|
1412 |
+
});
|
1413 |
+
|
1414 |
+
// Add iframe specific attributes.
|
1415 |
+
data.container = holder;
|
1416 |
+
attrs.src = '//fast.wistia.net/embed/iframe/' + id + '?' + $.param(data);
|
1417 |
+
attrs.frameborder = 0;
|
1418 |
+
|
1419 |
+
// Convert the holder to the video.
|
1420 |
+
$('#' + holder).replaceWith(function(){
|
1421 |
+
return $('<iframe />', attrs).addClass('wistia_embed').append($(this).contents());
|
1422 |
+
});
|
1423 |
+
|
1424 |
+
wistiaEmbeds.onFind(function(video){
|
1425 |
+
if ( id == video.hashedId() ) {
|
1426 |
+
soliloquy_wistia[id] = video;
|
1427 |
+
soliloquy_wistia[id].bind('play', function(){
|
1428 |
+
var id = $(this.container).data('soliloquy-slider-id');
|
1429 |
+
if ( soliloquy_slider[id] ) {
|
1430 |
+
soliloquy_slider[id].stopAuto();
|
1431 |
+
}
|
1432 |
+
});
|
1433 |
+
soliloquy_wistia[id].bind('pause', function(){
|
1434 |
+
var id = $(this.container).data('soliloquy-slider-id');
|
1435 |
+
if ( soliloquy_slider[id] ) {
|
1436 |
+
soliloquy_slider[id].startAuto();
|
1437 |
+
}
|
1438 |
+
});
|
1439 |
+
soliloquy_wistia[id].bind('end', function(){
|
1440 |
+
var id = $(this.container).data('soliloquy-slider-id');
|
1441 |
+
if ( soliloquy_slider[id] ) {
|
1442 |
+
soliloquy_slider[id].startAuto();
|
1443 |
+
}
|
1444 |
+
});
|
1445 |
+
video.play();
|
1446 |
+
}
|
1447 |
+
});
|
1448 |
+
}
|
1449 |
+
}
|
assets/js/soliloquy.js
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Soliloquyv2.
|
2 |
+
;(function(b){var a={};var c={mode:"horizontal",slideSelector:"",infiniteLoop:true,hideControlOnEnd:false,speed:500,easing:null,slideMargin:0,startSlide:0,randomStart:false,captions:false,ticker:false,tickerHover:false,adaptiveHeight:false,adaptiveHeightSpeed:500,video:false,useCSS:true,preloadImages:"visible",responsive:true,touchEnabled:true,swipeThreshold:50,oneToOneTouch:true,preventDefaultSwipeX:true,preventDefaultSwipeY:false,pager:true,pagerType:"full",pagerShortSeparator:" / ",pagerSelector:null,buildPager:null,pagerCustom:null,controls:true,nextText:"Next",prevText:"Prev",nextSelector:null,prevSelector:null,autoControls:false,startText:"Start",stopText:"Stop",autoControlsCombine:false,autoControlsSelector:null,keyboard:false,auto:false,pause:4000,autoStart:true,autoDirection:"next",autoHover:false,autoDelay:0,minSlides:1,maxSlides:1,moveSlides:0,slideWidth:0,onSliderLoad:function(){},onSlideBefore:function(){},onSlideAfter:function(){},onSlideNext:function(){},onSlidePrev:function(){}};b.fn.soliloquy=function(s){if(this.length==0){return this}if(this.length>1){this.each(function(){b(this).soliloquy(s)});return this}var j={};var H=this;a.el=this;var J=b(window).width();var M=b(window).height();var C=function(){j.settings=b.extend({},c,s);j.settings.slideWidth=parseInt(j.settings.slideWidth);j.children=H.children(j.settings.slideSelector);if(j.children.length<j.settings.minSlides){j.settings.minSlides=j.children.length}if(j.children.length<j.settings.maxSlides){j.settings.maxSlides=j.children.length}if(j.settings.randomStart){j.settings.startSlide=Math.floor(Math.random()*j.children.length)}j.active={index:j.settings.startSlide};j.carousel=j.settings.minSlides>1||j.settings.maxSlides>1;if(j.carousel){j.settings.preloadImages="all"}j.minThreshold=(j.settings.minSlides*j.settings.slideWidth)+((j.settings.minSlides-1)*j.settings.slideMargin);j.maxThreshold=(j.settings.maxSlides*j.settings.slideWidth)+((j.settings.maxSlides-1)*j.settings.slideMargin);j.working=false;j.controls={};j.interval=null;j.animProp=j.settings.mode=="vertical"?"top":"left";j.usingCSS=j.settings.useCSS&&j.settings.mode!="fade"&&(function(){var T=document.createElement("div");var S=["WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(var R in S){if(T.style[S[R]]!==undefined){j.cssPrefix=S[R].replace("Perspective","").toLowerCase();j.animProp="-"+j.cssPrefix+"-transform";return true}}return false}());if(j.settings.mode=="vertical"){j.settings.maxSlides=j.settings.minSlides}H.data("origStyle",H.attr("style"));H.children(j.settings.slideSelector).each(function(){b(this).data("origStyle",b(this).attr("style"))});m()};var m=function(){H.wrap('<div class="soliloquy-wrapper"><div class="soliloquy-viewport"></div></div>');j.viewport=H.parent();j.loader=b('<div class="soliloquy-loading" />');j.viewport.prepend(j.loader);H.css({width:j.settings.mode=="horizontal"?(j.children.length*100+215)+"%":"auto",position:"relative"});if(j.usingCSS&&j.settings.easing){H.css("-"+j.cssPrefix+"-transition-timing-function",j.settings.easing)}else{if(!j.settings.easing){j.settings.easing="swing"}}var R=A();j.viewport.css({width:"100%",position:"relative"});if(j.settings.mode!="fade"){j.viewport.css({overflow:"hidden"})}j.viewport.parent().css({maxWidth:L()});if(!j.settings.pager){j.viewport.parent().css({margin:"0 auto 0px"})}j.children.css({"float":j.settings.mode=="horizontal"?"left":"none",listStyle:"none",position:"relative"});j.children.css("width",D());if(j.settings.mode=="horizontal"&&j.settings.slideMargin>0){j.children.css("marginRight",j.settings.slideMargin)}if(j.settings.mode=="vertical"&&j.settings.slideMargin>0){j.children.css("marginBottom",j.settings.slideMargin)}if(j.settings.mode=="fade"){j.children.css({position:"absolute",zIndex:0,display:"none"});j.children.eq(j.settings.startSlide).css({zIndex:50,display:"block"})}j.controls.el=b('<div class="soliloquy-controls" />');if(j.settings.captions){z()}j.active.last=j.settings.startSlide==v()-1;if(j.settings.video){H.soliloquyVids()}var S=j.children.eq(j.settings.startSlide);if(j.settings.preloadImages=="all"){S=j.children}if(!j.settings.ticker){if(j.settings.pager){O()}if(j.settings.controls){k()}if(j.settings.auto&&j.settings.autoControls){K()}if(j.settings.controls||j.settings.autoControls||j.settings.pager){j.viewport.after(j.controls.el)}}else{j.settings.pager=false}d(S,t)};var d=function(R,U){var T=R.find("img, iframe").length;if(T==0){U();return}var S=0;R.find("img, iframe").each(function(){b(this).one("load",function(){if(++S==T){U()}}).each(function(){if(this.complete){b(this).load()}})})};var t=function(){if(j.settings.infiniteLoop&&j.settings.mode!="fade"&&!j.settings.ticker){var T=j.settings.mode=="vertical"?j.settings.minSlides:j.settings.maxSlides;var S=j.children.slice(0,T).clone().addClass("soliloquy-clone");var R=j.children.slice(-T).clone().addClass("soliloquy-clone");H.append(S).prepend(R)}j.loader.remove();h();if(j.settings.mode=="vertical"){j.settings.adaptiveHeight=true}j.viewport.height(o());H.redrawSlider();j.settings.onSliderLoad(j.active.index);j.initialized=true;if(j.settings.responsive){b(window).bind("resize",n)}if(j.settings.auto&&j.settings.autoStart){e()}if(j.settings.ticker){F()}if(j.settings.pager){Q(j.settings.startSlide)}if(j.settings.controls){l()}if(j.settings.touchEnabled&&!j.settings.ticker){f()}if(j.settings.keyboard&&!j.settings.ticker){b(document).on("keydown",function(U){if(U.keyCode==39){g(U);return false}else{if(U.keyCode==37){N(U);return false}}})}};var o=function(){var R=0;var T=b();if(j.settings.mode!="vertical"&&!j.settings.adaptiveHeight){T=j.children}else{if(!j.carousel){T=j.children.eq(j.active.index)}else{var S=j.settings.moveSlides==1?j.active.index:j.active.index*q();T=j.children.eq(S);for(i=1;i<=j.settings.maxSlides-1;i++){if(S+i>=j.children.length){T=T.add(j.children.eq(i-1))}else{T=T.add(j.children.eq(S+i))}}}}if(j.settings.mode=="vertical"){T.each(function(U){R+=b(this).outerHeight()});if(j.settings.slideMargin>0){R+=j.settings.slideMargin*(j.settings.minSlides-1)}}else{R=Math.max.apply(Math,T.map(function(){return b(this).outerHeight(false)}).get())}return R};var L=function(){var R="100%";if(j.settings.slideWidth>0){if(j.settings.mode=="horizontal"){R=(j.settings.maxSlides*j.settings.slideWidth)+((j.settings.maxSlides-1)*j.settings.slideMargin)}else{R=j.settings.slideWidth}}return R};var D=function(){var S=j.settings.slideWidth;var R=j.viewport.width();if(j.settings.slideWidth==0||(j.settings.slideWidth>R&&!j.carousel)||j.settings.mode=="vertical"){S=R}else{if(j.settings.maxSlides>1&&j.settings.mode=="horizontal"){if(R>j.maxThreshold){}else{if(R<j.minThreshold){S=(R-(j.settings.slideMargin*(j.settings.minSlides-1)))/j.settings.minSlides}}}}return S};var A=function(){var S=1;if(j.settings.mode=="horizontal"&&j.settings.slideWidth>0){if(j.viewport.width()<j.minThreshold){S=j.settings.minSlides}else{if(j.viewport.width()>j.maxThreshold){S=j.settings.maxSlides}else{var R=j.children.first().width();S=Math.floor(j.viewport.width()/R)}}}else{if(j.settings.mode=="vertical"){S=j.settings.minSlides}}return S};var v=function(){var S=0;if(j.settings.moveSlides>0){if(j.settings.infiniteLoop){S=j.children.length/q()}else{var T=0;var R=0;while(T<j.children.length){++S;T=R+A();R+=j.settings.moveSlides<=A()?j.settings.moveSlides:A()}}}else{S=Math.ceil(j.children.length/A())}return S};var q=function(){if(j.settings.moveSlides>0&&j.settings.moveSlides<=A()){return j.settings.moveSlides}return A()};var h=function(){if(j.children.length>j.settings.maxSlides&&j.active.last&&!j.settings.infiniteLoop){if(j.settings.mode=="horizontal"){var T=j.children.last();var R=T.position();B(-(R.left-(j.viewport.width()-T.width())),"reset",0)}else{if(j.settings.mode=="vertical"){var S=j.children.length-j.settings.minSlides;var R=j.children.eq(S).position();B(-R.top,"reset",0)}}}else{var R=j.children.eq(j.active.index*q()).position();if(j.active.index==v()-1){j.active.last=true}if(R!=undefined){if(j.settings.mode=="horizontal"){B(-R.left,"reset",0)}else{if(j.settings.mode=="vertical"){B(-R.top,"reset",0)}}}}};var B=function(T,S,U,W){if(j.usingCSS){var V=j.settings.mode=="vertical"?"translate3d(0, "+T+"px, 0)":"translate3d("+T+"px, 0, 0)";H.css("-"+j.cssPrefix+"-transition-duration",U/1000+"s");if(S=="slide"){H.css(j.animProp,V);H.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){H.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd");p()})}else{if(S=="reset"){H.css(j.animProp,V)}else{if(S=="ticker"){H.css("-"+j.cssPrefix+"-transition-timing-function","linear");H.css(j.animProp,V);H.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){H.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd");B(W.resetValue,"reset",0);u()})}}}}else{var R={};R[j.animProp]=T;if(S=="slide"){H.animate(R,U,j.settings.easing,function(){p()})}else{if(S=="reset"){H.css(j.animProp,T)}else{if(S=="ticker"){H.animate(R,speed,"linear",function(){B(W.resetValue,"reset",0);u()})}}}}};var r=function(){var U="";var T=v();for(var S=0;S<T;S++){var R="";if(j.settings.buildPager&&b.isFunction(j.settings.buildPager)){R=j.settings.buildPager(S);j.pagerEl.addClass("soliloquy-custom-pager")}else{R=S+1;j.pagerEl.addClass("soliloquy-default-pager")}U+='<div class="soliloquy-pager-item"><a href="" data-slide-index="'+S+'" class="soliloquy-pager-link"><span>'+R+"</span></a></div>"}j.pagerEl.html(U)};var O=function(){if(!j.settings.pagerCustom){j.pagerEl=b('<div class="soliloquy-pager" />');if(j.settings.pagerSelector){b(j.settings.pagerSelector).html(j.pagerEl)}else{j.controls.el.addClass("soliloquy-has-pager").append(j.pagerEl)}r()}else{j.pagerEl=b(j.settings.pagerCustom)}j.pagerEl.delegate("a","click",x)};var k=function(){j.controls.next=b('<a class="soliloquy-next" href=""><span>'+j.settings.nextText+"</span></a>");j.controls.prev=b('<a class="soliloquy-prev" href=""><span>'+j.settings.prevText+"</span></a>");j.controls.next.bind("click",g);j.controls.prev.bind("click",N);if(j.settings.nextSelector){b(j.settings.nextSelector).append(j.controls.next)}if(j.settings.prevSelector){b(j.settings.prevSelector).append(j.controls.prev)}if(!j.settings.nextSelector&&!j.settings.prevSelector){j.controls.directionEl=b('<div class="soliloquy-controls-direction" />');j.controls.directionEl.append(j.controls.prev).append(j.controls.next);j.controls.el.addClass("soliloquy-has-controls-direction").append(j.controls.directionEl)}};var K=function(){j.controls.start=b('<div class="soliloquy-controls-auto-item"><a class="soliloquy-start" href=""><span>'+j.settings.startText+"</span></a></div>");j.controls.stop=b('<div class="soliloquy-controls-auto-item"><a class="soliloquy-stop" href=""><span>'+j.settings.stopText+"</span></a></div>");j.controls.autoEl=b('<div class="soliloquy-controls-auto" />');j.controls.autoEl.delegate(".soliloquy-start","click",w);j.controls.autoEl.delegate(".soliloquy-stop","click",P);if(j.settings.autoControlsCombine){j.controls.autoEl.append(j.controls.start)}else{j.controls.autoEl.append(j.controls.start).append(j.controls.stop)}if(j.settings.autoControlsSelector){b(j.settings.autoControlsSelector).html(j.controls.autoEl)}else{j.controls.el.addClass("soliloquy-has-controls-auto").append(j.controls.autoEl)}G(j.settings.autoStart?"stop":"start")};var z=function(){j.children.each(function(R){var S=b(this).find("img:first").attr("title");if(S!=undefined&&(""+S).length){b(this).append('<div class="soliloquy-caption"><span>'+S+"</span></div>")}})};var g=function(R){if(j.settings.auto){H.stopAuto()}H.goToNextSlide();R.preventDefault()};var N=function(R){if(j.settings.auto){H.stopAuto()}H.goToPrevSlide();R.preventDefault()};var w=function(R){H.startAuto();R.preventDefault()};var P=function(R){H.stopAuto();R.preventDefault()};var x=function(T){if(j.settings.auto){H.stopAuto()}var S=b(T.currentTarget);var R=parseInt(S.attr("data-slide-index"));if(R!=j.active.index){H.goToSlide(R)}T.preventDefault()};var Q=function(S){var R=j.children.length;if(j.settings.pagerType=="short"){if(j.settings.maxSlides>1){R=Math.ceil(j.children.length/j.settings.maxSlides)}j.pagerEl.html((S+1)+j.settings.pagerShortSeparator+R);return}j.pagerEl.find("a").removeClass("active");j.pagerEl.each(function(T,U){b(U).find("a").eq(S).addClass("active")})};var p=function(){if(j.settings.infiniteLoop){var R="";if(j.active.index==0){R=j.children.eq(0).position()}else{if(j.active.index==v()-1&&j.carousel){R=j.children.eq((v()-1)*q()).position()}else{if(j.active.index==j.children.length-1){R=j.children.eq(j.children.length-1).position()}}}if(j.settings.mode=="horizontal"){B(-R.left,"reset",0)}else{if(j.settings.mode=="vertical"){B(-R.top,"reset",0)}}}j.working=false;if(j.settings.mode=="fade"){j.viewport.css({overflow:""})}j.settings.onSlideAfter(j.children.eq(j.active.index),j.oldIndex,j.active.index)};var G=function(R){if(j.settings.autoControlsCombine){j.controls.autoEl.html(j.controls[R])}else{j.controls.autoEl.find("a").removeClass("active");j.controls.autoEl.find("a:not(.soliloquy-"+R+")").addClass("active")}};var l=function(){if(v()==1){j.controls.prev.addClass("disabled");j.controls.next.addClass("disabled")}else{if(!j.settings.infiniteLoop&&j.settings.hideControlOnEnd){if(j.active.index==0){j.controls.prev.addClass("disabled");j.controls.next.removeClass("disabled")}else{if(j.active.index==v()-1){j.controls.next.addClass("disabled");j.controls.prev.removeClass("disabled")}else{j.controls.prev.removeClass("disabled");j.controls.next.removeClass("disabled")}}}}};var e=function(){if(j.settings.autoDelay>0){var R=setTimeout(H.startAuto,j.settings.autoDelay)}else{H.startAuto()}if(j.settings.autoHover){H.hover(function(){if(j.interval){H.stopAuto(true);j.autoPaused=true}},function(){if(j.autoPaused){H.startAuto(true);j.autoPaused=null}})}};var F=function(){var S=0;if(j.settings.autoDirection=="next"){H.append(j.children.clone().addClass("soliloquy-clone"))}else{H.prepend(j.children.clone().addClass("soliloquy-clone"));var R=j.children.first().position();S=j.settings.mode=="horizontal"?-R.left:-R.top}B(S,"reset",0);j.settings.pager=false;j.settings.controls=false;j.settings.autoControls=false;if(j.settings.tickerHover&&!j.usingCSS){j.viewport.hover(function(){H.stop()},function(){var W=0;j.children.each(function(X){W+=j.settings.mode=="horizontal"?b(this).outerWidth(true):b(this).outerHeight(true)});var T=j.settings.speed/W;var U=j.settings.mode=="horizontal"?"left":"top";var V=T*(W-(Math.abs(parseInt(H.css(U)))));u(V)})}u()};var u=function(W){speed=W?W:j.settings.speed;var R={left:0,top:0};var U={left:0,top:0};if(j.settings.autoDirection=="next"){R=H.find(".soliloquy-clone").first().position()}else{U=j.children.first().position()}var T=j.settings.mode=="horizontal"?-R.left:-R.top;var S=j.settings.mode=="horizontal"?-U.left:-U.top;var V={resetValue:S};B(T,"ticker",speed,V)};var f=function(){j.touch={start:{x:0,y:0},end:{x:0,y:0}};j.viewport.bind("touchstart",E)};var E=function(R){if(j.working){R.preventDefault()}else{j.touch.originalPos=H.position();var S=R.originalEvent;j.touch.start.x=S.changedTouches[0].pageX;j.touch.start.y=S.changedTouches[0].pageY;j.viewport.bind("touchmove",I);j.viewport.bind("touchend",y)}};var I=function(S){var W=S.originalEvent;var T=Math.abs(W.changedTouches[0].pageX-j.touch.start.x);var V=Math.abs(W.changedTouches[0].pageY-j.touch.start.y);if((T*3)>V&&j.settings.preventDefaultSwipeX){S.preventDefault()}else{if((V*3)>T&&j.settings.preventDefaultSwipeY){S.preventDefault()}}if(j.settings.mode!="fade"&&j.settings.oneToOneTouch){var R=0;if(j.settings.mode=="horizontal"){var U=W.changedTouches[0].pageX-j.touch.start.x;R=j.touch.originalPos.left+U}else{var U=W.changedTouches[0].pageY-j.touch.start.y;R=j.touch.originalPos.top+U}B(R,"reset",0)}};var y=function(S){j.viewport.unbind("touchmove",I);var U=S.originalEvent;var R=0;j.touch.end.x=U.changedTouches[0].pageX;j.touch.end.y=U.changedTouches[0].pageY;if(j.settings.mode=="fade"){var T=Math.abs(j.touch.start.x-j.touch.end.x);if(T>=j.settings.swipeThreshold){j.touch.start.x>j.touch.end.x?H.goToNextSlide():H.goToPrevSlide();H.stopAuto()}}else{var T=0;if(j.settings.mode=="horizontal"){T=j.touch.end.x-j.touch.start.x;R=j.touch.originalPos.left}else{T=j.touch.end.y-j.touch.start.y;R=j.touch.originalPos.top}if(!j.settings.infiniteLoop&&((j.active.index==0&&T>0)||(j.active.last&&T<0))){B(R,"reset",200)}else{if(Math.abs(T)>=j.settings.swipeThreshold){T<0?H.goToNextSlide():H.goToPrevSlide();H.stopAuto()}else{B(R,"reset",200)}}}j.viewport.unbind("touchend",y)};var n=function(S){var R=b(window).width();var T=b(window).height();if(J!=R||M!=T){J=R;M=T;H.redrawSlider()}};H.goToSlide=function(V,X){if(j.working||j.active.index==V){return}j.working=true;j.oldIndex=j.active.index;if(V<0){j.active.index=v()-1}else{if(V>=v()){j.active.index=0}else{j.active.index=V}}j.settings.onSlideBefore(j.children.eq(j.active.index),j.oldIndex,j.active.index);if(X=="next"){j.settings.onSlideNext(j.children.eq(j.active.index),j.oldIndex,j.active.index)}else{if(X=="prev"){j.settings.onSlidePrev(j.children.eq(j.active.index),j.oldIndex,j.active.index)}}j.active.last=j.active.index>=v()-1;if(j.settings.pager){Q(j.active.index)}if(j.settings.controls){l()}if(j.settings.mode=="fade"){j.viewport.css({overflow:"hidden"});if(j.settings.adaptiveHeight&&j.viewport.height()!=o()){j.viewport.animate({height:o()},j.settings.adaptiveHeightSpeed)}j.children.filter(":visible").fadeOut(j.settings.speed).css({zIndex:0});j.children.eq(j.active.index).css("zIndex",51).fadeIn(j.settings.speed,function(){b(this).css("zIndex",50);p()})}else{if(j.settings.adaptiveHeight&&j.viewport.height()!=o()){j.viewport.animate({height:o()},j.settings.adaptiveHeightSpeed)}var W=0;var U={left:0,top:0};if(!j.settings.infiniteLoop&&j.carousel&&j.active.last){if(j.settings.mode=="horizontal"){var R=j.children.eq(j.children.length-1);U=R.position();W=j.viewport.width()-R.outerWidth()}else{var T=j.children.length-j.settings.minSlides;U=j.children.eq(T).position()}}else{if(j.carousel&&j.active.last&&X=="prev"){var Z=j.settings.moveSlides==1?j.settings.maxSlides-q():((v()-1)*q())-(j.children.length-j.settings.maxSlides);var R=H.children(".soliloquy-clone").eq(Z);U=R.position()}else{if(X=="next"&&j.active.index==0){U=H.find("> .soliloquy-clone").eq(j.settings.maxSlides).position();j.active.last=false}else{if(V>=0){var S=V*q();U=j.children.eq(S).position()}}}}if("undefined"!==typeof(U)){var Y=j.settings.mode=="horizontal"?-(U.left-W):-U.top;B(Y,"slide",j.settings.speed)}}};H.goToNextSlide=function(){if(!j.settings.infiniteLoop&&j.active.last){return}var R=parseInt(j.active.index)+1;H.goToSlide(R,"next")};H.goToPrevSlide=function(){if(!j.settings.infiniteLoop&&j.active.index==0){return}var R=parseInt(j.active.index)-1;H.goToSlide(R,"prev")};H.startAuto=function(R){if(j.interval){return}j.interval=setInterval(function(){j.settings.autoDirection=="next"?H.goToNextSlide():H.goToPrevSlide()},j.settings.pause);if(j.settings.autoControls&&R!=true){G("stop")}};H.stopAuto=function(R){if(!j.interval){return}clearInterval(j.interval);j.interval=null;if(j.settings.autoControls&&R!=true){G("start")}};H.getCurrentSlide=function(){return j.active.index};H.getSlideCount=function(){return j.children.length};H.redrawSlider=function(){j.children.add(H.find(".soliloquy-clone")).outerWidth(D());j.viewport.css("height",o());if(!j.settings.ticker){h()}if(j.active.last){j.active.index=v()-1}if(j.active.index>=v()){j.active.last=true}if(j.settings.pager&&!j.settings.pagerCustom){r();Q(j.active.index)}};H.destroySlider=function(){if(!j.initialized){return}j.initialized=false;b(".soliloquy-clone",this).remove();j.children.each(function(){b(this).data("origStyle")!=undefined?b(this).attr("style",b(this).data("origStyle")):b(this).removeAttr("style")});b(this).data("origStyle")!=undefined?this.attr("style",b(this).data("origStyle")):b(this).removeAttr("style");b(this).unwrap().unwrap();if(j.controls.el){j.controls.el.remove()}if(j.controls.next){j.controls.next.remove()}if(j.controls.prev){j.controls.prev.remove()}if(j.pagerEl){j.pagerEl.remove()}b(".soliloquy-caption",this).remove();if(j.controls.autoEl){j.controls.autoEl.remove()}clearInterval(j.interval);if(j.settings.responsive){b(window).unbind("resize",n)}};H.reloadSlider=function(R){if(R!=undefined){s=R}H.destroySlider();C()};C();return this}})(jQuery);
|
3 |
+
// Mobile checker function.
|
4 |
+
function soliloquyIsMobile(){var check = false;(function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check=true})(navigator.userAgent||navigator.vendor||window.opera);return check;}
|
5 |
+
// Video functions.
|
6 |
+
function soliloquyYouTubeVids(e,f,c,a,b,d){d("#"+b).show().css({display:"block","z-index":"1210"});if(YT.Player){soliloquy_youtube[f]=new YT.Player(b,{videoId:f,playerVars:e,events:{onStateChange:soliloquyYouTubeOnStateChange}})}}function soliloquyYouTubeOnStateChange(a){var b=jQuery(a.target.a).data("soliloquy-slider-id");if(a.data===YT.PlayerState.PAUSED||a.data===YT.PlayerState.ENDED){if(soliloquy_slider[b]){soliloquy_slider[b].startAuto()}}if(a.data===YT.PlayerState.PLAYING){if(soliloquy_slider[b]){soliloquy_slider[b].stopAuto()}}}function onYouTubeIframeAPIReady(){}function soliloquyVimeoVids(f,g,d,a,c,e){e("#"+c).show().css({display:"block","z-index":"1210"});if($f){var b={};e.each(e("#"+c)[0].attributes,function(i,h){b[h.nodeName]=h.nodeValue});f.player_id=c;b.src="//player.vimeo.com/video/"+g+"?"+e.param(f);b.frameborder=0;e("#"+c).replaceWith(function(){return e("<iframe />",b).append(e(this).contents())});soliloquy_vimeo[g]=$f(e("#"+c)[0]);soliloquy_vimeo[g].addEvent("ready",function(){soliloquy_vimeo[g].addEvent("play",soliloquyVimeoSliderPause);soliloquy_vimeo[g].addEvent("pause",soliloquyVimeoSliderStart);soliloquy_vimeo[g].addEvent("finish",soliloquyVimeoSliderStart)})}}function soliloquyVimeoSliderPause(a){var b=jQuery("#"+a).data("soliloquy-slider-id");if(soliloquy_slider[b]){soliloquy_slider[b].stopAuto()}}function soliloquyVimeoSliderStart(a){var b=jQuery("#"+a).data("soliloquy-slider-id");if(soliloquy_slider[b]){soliloquy_slider[b].startAuto()}}function soliloquyWistiaVids(f,g,d,a,c,e){e("#"+c).show().css({display:"block","z-index":"1210"});if(wistiaEmbeds){var b={};e.each(e("#"+c)[0].attributes,function(i,h){b[h.nodeName]=h.nodeValue});f.container=c;b.src="//fast.wistia.net/embed/iframe/"+g+"?"+e.param(f);b.frameborder=0;e("#"+c).replaceWith(function(){return e("<iframe />",b).addClass("wistia_embed").append(e(this).contents())});wistiaEmbeds.onFind(function(h){if(g==h.hashedId()){soliloquy_wistia[g]=h;soliloquy_wistia[g].bind("play",function(){var i=e(this.container).data("soliloquy-slider-id");if(soliloquy_slider[i]){soliloquy_slider[i].stopAuto()}});soliloquy_wistia[g].bind("pause",function(){var i=e(this.container).data("soliloquy-slider-id");if(soliloquy_slider[i]){soliloquy_slider[i].startAuto()}});soliloquy_wistia[g].bind("end",function(){var i=e(this.container).data("soliloquy-slider-id");if(soliloquy_slider[i]){soliloquy_slider[i].startAuto()}});h.play()}})}};
|
includes/admin/ajax.php
ADDED
@@ -0,0 +1,640 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Handles all admin ajax interactions for the Soliloquy plugin.
|
4 |
+
*
|
5 |
+
* @since 1.0.0
|
6 |
+
*
|
7 |
+
* @package Soliloquy
|
8 |
+
* @author Thomas Griffin
|
9 |
+
*/
|
10 |
+
|
11 |
+
add_action( 'wp_ajax_soliloquy_upgrade_sliders', 'soliloquy_lite_ajax_upgrade_sliders' );
|
12 |
+
/**
|
13 |
+
* Upgrades sliders from v1 to v2.
|
14 |
+
*
|
15 |
+
* @since 1.0.0
|
16 |
+
*/
|
17 |
+
function soliloquy_lite_ajax_upgrade_sliders() {
|
18 |
+
|
19 |
+
// Run a security check first.
|
20 |
+
check_ajax_referer( 'soliloquy-upgrade', 'nonce' );
|
21 |
+
|
22 |
+
// Increase the time limit to account for large slider sets and suspend cache invalidations.
|
23 |
+
set_time_limit( 0 );
|
24 |
+
wp_suspend_cache_invalidation( true );
|
25 |
+
|
26 |
+
// Grab all sliders and convert them to the new system.
|
27 |
+
$sliders = get_posts(
|
28 |
+
array(
|
29 |
+
'post_type' => 'soliloquy',
|
30 |
+
'posts_per_page' => -1
|
31 |
+
)
|
32 |
+
);
|
33 |
+
|
34 |
+
// Loop through sliders and convert them.
|
35 |
+
foreach ( (array) $sliders as $slider ) {
|
36 |
+
// Grab meta from the v1 sliders.
|
37 |
+
$meta = get_post_meta( $slider->ID, '_soliloquy_settings', true );
|
38 |
+
|
39 |
+
// Move meta from v1 to v2.
|
40 |
+
$new_meta = array(
|
41 |
+
'id' => $slider->ID,
|
42 |
+
'config' => array(),
|
43 |
+
'slider' => array(),
|
44 |
+
'status' => 'active'
|
45 |
+
);
|
46 |
+
|
47 |
+
// Splice meta from v1 to v2.
|
48 |
+
$new_meta['config']['title'] = $slider->post_title;
|
49 |
+
$new_meta['config']['slug'] = $slider->post_name;
|
50 |
+
$new_meta['config']['slider'] = 0;
|
51 |
+
|
52 |
+
if ( ! empty( $meta['width'] ) ) {
|
53 |
+
$new_meta['config']['slider_width'] = $meta['width'];
|
54 |
+
}
|
55 |
+
|
56 |
+
if ( ! empty( $meta['height'] ) ) {
|
57 |
+
$new_meta['config']['slider_height'] = $meta['height'];
|
58 |
+
}
|
59 |
+
|
60 |
+
if ( ! empty( $meta['transition'] ) ) {
|
61 |
+
$new_meta['config']['transition'] = $meta['transition'];
|
62 |
+
}
|
63 |
+
|
64 |
+
if ( ! empty( $meta['speed'] ) ) {
|
65 |
+
$new_meta['config']['duration'] = $meta['speed'];
|
66 |
+
}
|
67 |
+
|
68 |
+
if ( ! empty( $meta['duration'] ) ) {
|
69 |
+
$new_meta['config']['speed'] = $meta['duration'];
|
70 |
+
}
|
71 |
+
|
72 |
+
// Set to the classic theme to keep people from going nuts with a theme change.
|
73 |
+
$new_meta['config']['slider_theme'] = 'classic';
|
74 |
+
|
75 |
+
// Grab all attachments and add them to the slider.
|
76 |
+
$attachments = get_posts(
|
77 |
+
array(
|
78 |
+
'orderby' => 'menu_order',
|
79 |
+
'order' => 'ASC',
|
80 |
+
'post_type' => 'attachment',
|
81 |
+
'post_parent' => $slider->ID,
|
82 |
+
'post_status' => null,
|
83 |
+
'posts_per_page' => -1
|
84 |
+
)
|
85 |
+
);
|
86 |
+
|
87 |
+
// Loop through attachments and add them to the slider.
|
88 |
+
foreach ( (array) $attachments as $slide ) {
|
89 |
+
$url = wp_get_attachment_image_src( $slide->ID, 'full' );
|
90 |
+
$alt_text = get_post_meta( $slide->ID, '_wp_attachment_image_alt', true );
|
91 |
+
$new_meta['slider'][$slide->ID] = array(
|
92 |
+
'status' => 'active',
|
93 |
+
'id' => $slide->ID,
|
94 |
+
'src' => isset( $url[0] ) ? esc_url( $url[0] ) : '',
|
95 |
+
'title' => get_the_title( $slide->ID ),
|
96 |
+
'link' => get_post_meta( $slide->ID, '_soliloquy_image_link', true ),
|
97 |
+
'alt' => ! empty( $alt_text ) ? $alt_text : get_the_title( $slide->ID ),
|
98 |
+
'caption' => ! empty( $slide->post_excerpt ) ? $slide->post_excerpt : '',
|
99 |
+
'type' => 'image'
|
100 |
+
);
|
101 |
+
}
|
102 |
+
|
103 |
+
// Update the post meta for the new slider.
|
104 |
+
update_post_meta( $slider->ID, '_sol_slider_data', $new_meta );
|
105 |
+
|
106 |
+
// Force the post to update.
|
107 |
+
wp_update_post( array( 'ID' => $slider->ID ) );
|
108 |
+
|
109 |
+
// Flush caches for any sliders.
|
110 |
+
Soliloquy_Common_Lite::get_instance()->flush_slider_caches( $slider->ID, $new_meta['config']['slug'] );
|
111 |
+
}
|
112 |
+
|
113 |
+
// Turn off cache suspension and flush the cache to remove any cache inconsistencies.
|
114 |
+
wp_suspend_cache_invalidation( false );
|
115 |
+
wp_cache_flush();
|
116 |
+
|
117 |
+
// Update the option to signify that upgrading is complete.
|
118 |
+
update_option( 'soliloquy_upgrade', true );
|
119 |
+
|
120 |
+
// Send back the response.
|
121 |
+
echo json_encode( true );
|
122 |
+
die;
|
123 |
+
|
124 |
+
}
|
125 |
+
|
126 |
+
add_action( 'wp_ajax_soliloquy_change_type', 'soliloquy_lite_ajax_change_type' );
|
127 |
+
/**
|
128 |
+
* Changes the type of slider to the user selection.
|
129 |
+
*
|
130 |
+
* @since 1.0.0
|
131 |
+
*/
|
132 |
+
function soliloquy_lite_ajax_change_type() {
|
133 |
+
|
134 |
+
// Run a security check first.
|
135 |
+
check_ajax_referer( 'soliloquy-change-type', 'nonce' );
|
136 |
+
|
137 |
+
// Prepare variables.
|
138 |
+
$post_id = absint( $_POST['post_id'] );
|
139 |
+
$post = get_post( $post_id );
|
140 |
+
$type = stripslashes( $_POST['type'] );
|
141 |
+
|
142 |
+
// Retrieve the data for the type selected.
|
143 |
+
ob_start();
|
144 |
+
$instance = Soliloquy_Metaboxes_Lite::get_instance();
|
145 |
+
$instance->images_display( $type, $post );
|
146 |
+
$html = ob_get_clean();
|
147 |
+
|
148 |
+
// Send back the response.
|
149 |
+
echo json_encode( array( 'type' => $type, 'html' => $html ) );
|
150 |
+
die;
|
151 |
+
|
152 |
+
}
|
153 |
+
|
154 |
+
add_action( 'wp_ajax_soliloquy_load_image', 'soliloquy_lite_ajax_load_image' );
|
155 |
+
/**
|
156 |
+
* Loads an image into a slider.
|
157 |
+
*
|
158 |
+
* @since 1.0.0
|
159 |
+
*/
|
160 |
+
function soliloquy_lite_ajax_load_image() {
|
161 |
+
|
162 |
+
// Run a security check first.
|
163 |
+
check_ajax_referer( 'soliloquy-load-image', 'nonce' );
|
164 |
+
|
165 |
+
// Prepare variables.
|
166 |
+
$id = absint( $_POST['id'] );
|
167 |
+
$post_id = absint( $_POST['post_id'] );
|
168 |
+
|
169 |
+
// Set post meta to show that this image is attached to one or more Soliloquy sliders.
|
170 |
+
$has_slider = get_post_meta( $id, '_sol_has_slider', true );
|
171 |
+
if ( empty( $has_slider ) ) {
|
172 |
+
$has_slider = array();
|
173 |
+
}
|
174 |
+
|
175 |
+
$has_slider[] = $post_id;
|
176 |
+
update_post_meta( $id, '_sol_has_slider', $has_slider );
|
177 |
+
|
178 |
+
// Set post meta to show that this image is attached to a slider on this page.
|
179 |
+
$in_slider = get_post_meta( $post_id, '_sol_in_slider', true );
|
180 |
+
if ( empty( $in_slider ) ) {
|
181 |
+
$in_slider = array();
|
182 |
+
}
|
183 |
+
|
184 |
+
$in_slider[] = $id;
|
185 |
+
update_post_meta( $post_id, '_sol_in_slider', $in_slider );
|
186 |
+
|
187 |
+
// Set data and order of image in slider.
|
188 |
+
$slider_data = get_post_meta( $post_id, '_sol_slider_data', true );
|
189 |
+
if ( empty( $slider_data ) ) {
|
190 |
+
$slider_data = array();
|
191 |
+
}
|
192 |
+
|
193 |
+
// If no slider ID has been set, set it now.
|
194 |
+
if ( empty( $slider_data['id'] ) ) {
|
195 |
+
$slider_data['id'] = $post_id;
|
196 |
+
}
|
197 |
+
|
198 |
+
// Set data and update the meta information.
|
199 |
+
$slider_data = soliloquy_lite_ajax_prepare_slider_data( $slider_data, $id );
|
200 |
+
update_post_meta( $post_id, '_sol_slider_data', $slider_data );
|
201 |
+
|
202 |
+
// Run hook before building out the item.
|
203 |
+
do_action( 'soliloquy_ajax_load_image', $id, $post_id );
|
204 |
+
|
205 |
+
// Build out the individual HTML output for the slider image that has just been uploaded.
|
206 |
+
$html = Soliloquy_Metaboxes_Lite::get_instance()->get_slider_item( $id, $slider_data['slider'][$id], 'image', $post_id );
|
207 |
+
|
208 |
+
// Flush the slider cache.
|
209 |
+
Soliloquy_Common_Lite::get_instance()->flush_slider_caches( $post_id );
|
210 |
+
|
211 |
+
echo json_encode( $html );
|
212 |
+
die;
|
213 |
+
|
214 |
+
}
|
215 |
+
|
216 |
+
add_action( 'wp_ajax_soliloquy_load_library', 'soliloquy_lite_ajax_load_library' );
|
217 |
+
/**
|
218 |
+
* Loads the Media Library images into the media modal window for selection.
|
219 |
+
*
|
220 |
+
* @since 1.0.0
|
221 |
+
*/
|
222 |
+
function soliloquy_lite_ajax_load_library() {
|
223 |
+
|
224 |
+
// Run a security check first.
|
225 |
+
check_ajax_referer( 'soliloquy-load-slider', 'nonce' );
|
226 |
+
|
227 |
+
// Prepare variables.
|
228 |
+
$offset = (int) $_POST['offset'];
|
229 |
+
$post_id = absint( $_POST['post_id'] );
|
230 |
+
$html = '';
|
231 |
+
|
232 |
+
// Grab the library contents with the included offset parameter.
|
233 |
+
$library = get_posts( array( 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_status' => 'any', 'posts_per_page' => 20, 'offset' => $offset ) );
|
234 |
+
if ( $library ) {
|
235 |
+
foreach ( (array) $library as $image ) {
|
236 |
+
$has_slider = get_post_meta( $image->ID, '_sol_has_slider', true );
|
237 |
+
$class = $has_slider && in_array( $post_id, (array) $has_slider ) ? ' selected soliloquy-in-slider' : '';
|
238 |
+
|
239 |
+
$html .= '<li class="attachment' . $class . '" data-attachment-id="' . absint( $image->ID ) . '">';
|
240 |
+
$html .= '<div class="attachment-preview landscape">';
|
241 |
+
$html .= '<div class="thumbnail">';
|
242 |
+
$html .= '<div class="centered">';
|
243 |
+
$src = wp_get_attachment_image_src( $image->ID, 'thumbnail' );
|
244 |
+
$html .= '<img src="' . esc_url( $src[0] ) . '" />';
|
245 |
+
$html .= '</div>';
|
246 |
+
$html .= '</div>';
|
247 |
+
$html .= '<a class="check" href="#"><div class="media-modal-icon"></div></a>';
|
248 |
+
$html .= '</div>';
|
249 |
+
$html .= '</li>';
|
250 |
+
}
|
251 |
+
}
|
252 |
+
|
253 |
+
echo json_encode( array( 'html' => stripslashes( $html ) ) );
|
254 |
+
die;
|
255 |
+
|
256 |
+
}
|
257 |
+
|
258 |
+
add_action( 'wp_ajax_soliloquy_library_search', 'soliloquy_lite_ajax_library_search' );
|
259 |
+
/**
|
260 |
+
* Searches the Media Library for images matching the term specified in the search.
|
261 |
+
*
|
262 |
+
* @since 1.0.0
|
263 |
+
*/
|
264 |
+
function soliloquy_lite_ajax_library_search() {
|
265 |
+
|
266 |
+
// Run a security check first.
|
267 |
+
check_ajax_referer( 'soliloquy-library-search', 'nonce' );
|
268 |
+
|
269 |
+
// Prepare variables.
|
270 |
+
$search = stripslashes( $_POST['search'] );
|
271 |
+
$post_id = absint( $_POST['post_id'] );
|
272 |
+
$html = '';
|
273 |
+
|
274 |
+
// Grab the library contents with the included offset parameter.
|
275 |
+
$library = get_posts( array( 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_status' => 'any', 'posts_per_page' => -1, 's' => $search ) );
|
276 |
+
if ( $library ) {
|
277 |
+
foreach ( (array) $library as $image ) {
|
278 |
+
$has_slider = get_post_meta( $image->ID, '_sol_has_slider', true );
|
279 |
+
$class = $has_slider && in_array( $post_id, (array) $has_slider ) ? ' selected soliloquy-in-slider' : '';
|
280 |
+
|
281 |
+
$html .= '<li class="attachment' . $class . '" data-attachment-id="' . absint( $image->ID ) . '">';
|
282 |
+
$html .= '<div class="attachment-preview landscape">';
|
283 |
+
$html .= '<div class="thumbnail">';
|
284 |
+
$html .= '<div class="centered">';
|
285 |
+
$src = wp_get_attachment_image_src( $image->ID, 'thumbnail' );
|
286 |
+
$html .= '<img src="' . esc_url( $src[0] ) . '" />';
|
287 |
+
$html .= '</div>';
|
288 |
+
$html .= '</div>';
|
289 |
+
$html .= '<a class="check" href="#"><div class="media-modal-icon"></div></a>';
|
290 |
+
$html .= '</div>';
|
291 |
+
$html .= '</li>';
|
292 |
+
}
|
293 |
+
}
|
294 |
+
|
295 |
+
echo json_encode( array( 'html' => stripslashes( $html ) ) );
|
296 |
+
die;
|
297 |
+
|
298 |
+
}
|
299 |
+
|
300 |
+
add_action( 'wp_ajax_soliloquy_insert_slides', 'soliloquy_lite_ajax_insert_slides' );
|
301 |
+
/**
|
302 |
+
* Inserts one or more slides into a slider.
|
303 |
+
*
|
304 |
+
* @since 1.0.0
|
305 |
+
*/
|
306 |
+
function soliloquy_lite_ajax_insert_slides() {
|
307 |
+
|
308 |
+
// Run a security check first.
|
309 |
+
check_ajax_referer( 'soliloquy-insert-images', 'nonce' );
|
310 |
+
|
311 |
+
// Prepare variables.
|
312 |
+
$images = ! empty( $_POST['images'] ) ? stripslashes_deep( (array) $_POST['images'] ) : array();
|
313 |
+
$videos = ! empty( $_POST['videos'] ) ? stripslashes_deep( (array) $_POST['videos'] ) : array();
|
314 |
+
$html = ! empty( $_POST['html'] ) ? stripslashes_deep( (array) $_POST['html'] ) : array();
|
315 |
+
$post_id = absint( $_POST['post_id'] );
|
316 |
+
|
317 |
+
// Grab and update any slider data if necessary.
|
318 |
+
$in_slider = get_post_meta( $post_id, '_sol_in_slider', true );
|
319 |
+
if ( empty( $in_slider ) ) {
|
320 |
+
$in_slider = array();
|
321 |
+
}
|
322 |
+
|
323 |
+
// Set data and order of image in slider.
|
324 |
+
$slider_data = get_post_meta( $post_id, '_sol_slider_data', true );
|
325 |
+
if ( empty( $slider_data ) ) {
|
326 |
+
$slider_data = array();
|
327 |
+
}
|
328 |
+
|
329 |
+
// If no slider ID has been set, set it now.
|
330 |
+
if ( empty( $slider_data['id'] ) ) {
|
331 |
+
$slider_data['id'] = $post_id;
|
332 |
+
}
|
333 |
+
|
334 |
+
// Loop through the images and add them to the slider.
|
335 |
+
foreach ( (array) $images as $i => $id ) {
|
336 |
+
// Update the attachment image post meta first.
|
337 |
+
$has_slider = get_post_meta( $id, '_sol_has_slider', true );
|
338 |
+
if ( empty( $has_slider ) ) {
|
339 |
+
$has_slider = array();
|
340 |
+
}
|
341 |
+
|
342 |
+
$has_slider[] = $post_id;
|
343 |
+
update_post_meta( $id, '_sol_has_slider', $has_slider );
|
344 |
+
|
345 |
+
// Now add the image to the slider for this particular post.
|
346 |
+
$in_slider[] = $id;
|
347 |
+
$slider_data = soliloquy_ajax_prepare_slider_data( $slider_data, $id );
|
348 |
+
}
|
349 |
+
|
350 |
+
// Loop through the videos and add them to the slider.
|
351 |
+
foreach ( (array) $videos as $i => $data ) {
|
352 |
+
// Pass over if the main items necessary for the video are not set.
|
353 |
+
if ( ! isset( $data['title'] ) || ! isset( $data['url'] ) || ! isset( $data['thumb'] ) ) {
|
354 |
+
continue;
|
355 |
+
}
|
356 |
+
|
357 |
+
// Generate a custom ID for the video.
|
358 |
+
$id = sanitize_title_with_dashes( $slider_data['id'] . '-' . $data['title'] );
|
359 |
+
|
360 |
+
// Now add the image to the slider for this particular post.
|
361 |
+
$in_slider[] = $id;
|
362 |
+
$slider_data = soliloquy_lite_ajax_prepare_slider_data( $slider_data, $id, 'video', $data );
|
363 |
+
}
|
364 |
+
|
365 |
+
// Loop through the videos and add them to the slider.
|
366 |
+
foreach ( (array) $html as $i => $data ) {
|
367 |
+
// Pass over if the main items necessary for the video are not set.
|
368 |
+
if ( empty( $data['title'] ) || empty( $data['code'] ) ) {
|
369 |
+
continue;
|
370 |
+
}
|
371 |
+
|
372 |
+
// Generate a custom ID for the video.
|
373 |
+
$id = sanitize_title_with_dashes( $slider_data['id'] . '-' . $data['title'] );
|
374 |
+
|
375 |
+
// Now add the image to the slider for this particular post.
|
376 |
+
$in_slider[] = $id;
|
377 |
+
$slider_data = soliloquy_lite_ajax_prepare_slider_data( $slider_data, $id, 'html', $data );
|
378 |
+
}
|
379 |
+
|
380 |
+
// Update the slider data.
|
381 |
+
update_post_meta( $post_id, '_sol_in_slider', $in_slider );
|
382 |
+
update_post_meta( $post_id, '_sol_slider_data', $slider_data );
|
383 |
+
|
384 |
+
// Run hook before finishing.
|
385 |
+
do_action( 'soliloquy_ajax_insert_slides', $images, $videos, $html, $post_id );
|
386 |
+
|
387 |
+
// Flush the slider cache.
|
388 |
+
Soliloquy_Common_Lite::get_instance()->flush_slider_caches( $post_id );
|
389 |
+
|
390 |
+
echo json_encode( true );
|
391 |
+
die;
|
392 |
+
|
393 |
+
}
|
394 |
+
|
395 |
+
add_action( 'wp_ajax_soliloquy_sort_images', 'soliloquy_lite_ajax_sort_images' );
|
396 |
+
/**
|
397 |
+
* Sorts images based on user-dragged position in the slider.
|
398 |
+
*
|
399 |
+
* @since 1.0.0
|
400 |
+
*/
|
401 |
+
function soliloquy_lite_ajax_sort_images() {
|
402 |
+
|
403 |
+
// Run a security check first.
|
404 |
+
check_ajax_referer( 'soliloquy-sort', 'nonce' );
|
405 |
+
|
406 |
+
// Prepare variables.
|
407 |
+
$order = explode( ',', $_POST['order'] );
|
408 |
+
$post_id = absint( $_POST['post_id'] );
|
409 |
+
$slider_data = get_post_meta( $post_id, '_sol_slider_data', true );
|
410 |
+
$new_order = array();
|
411 |
+
|
412 |
+
// Loop through the order and generate a new array based on order received.
|
413 |
+
foreach ( $order as $id ) {
|
414 |
+
$new_order['slider'][$id] = $slider_data['slider'][$id];
|
415 |
+
}
|
416 |
+
|
417 |
+
// Update the slider data.
|
418 |
+
update_post_meta( $post_id, '_sol_slider_data', $new_order );
|
419 |
+
|
420 |
+
// Flush the slider cache.
|
421 |
+
Soliloquy_Common_Lite::get_instance()->flush_slider_caches( $post_id );
|
422 |
+
|
423 |
+
echo json_encode( true );
|
424 |
+
die;
|
425 |
+
|
426 |
+
}
|
427 |
+
|
428 |
+
add_action( 'wp_ajax_soliloquy_remove_slide', 'soliloquy_lite_ajax_remove_slide' );
|
429 |
+
/**
|
430 |
+
* Removes an image from a slider.
|
431 |
+
*
|
432 |
+
* @since 1.0.0
|
433 |
+
*/
|
434 |
+
function soliloquy_lite_ajax_remove_slide() {
|
435 |
+
|
436 |
+
// Run a security check first.
|
437 |
+
check_ajax_referer( 'soliloquy-remove-slide', 'nonce' );
|
438 |
+
|
439 |
+
// Prepare variables.
|
440 |
+
$post_id = absint( $_POST['post_id'] );
|
441 |
+
$attach_id = trim( $_POST['attachment_id'] );
|
442 |
+
$slider_data = get_post_meta( $post_id, '_sol_slider_data', true );
|
443 |
+
$in_slider = get_post_meta( $post_id, '_sol_in_slider', true );
|
444 |
+
$has_slider = get_post_meta( $attach_id, '_sol_has_slider', true );
|
445 |
+
|
446 |
+
// Unset the image from the slider, in_slider and has_slider checkers.
|
447 |
+
unset( $slider_data['slider'][$attach_id] );
|
448 |
+
|
449 |
+
if ( ( $key = array_search( $attach_id, (array) $in_slider ) ) !== false ) {
|
450 |
+
unset( $in_slider[$key] );
|
451 |
+
}
|
452 |
+
|
453 |
+
if ( ( $key = array_search( $post_id, (array) $has_slider ) ) !== false ) {
|
454 |
+
unset( $has_slider[$key] );
|
455 |
+
}
|
456 |
+
|
457 |
+
// Update the slider data.
|
458 |
+
update_post_meta( $post_id, '_sol_slider_data', $slider_data );
|
459 |
+
update_post_meta( $post_id, '_sol_in_slider', $in_slider );
|
460 |
+
update_post_meta( $attach_id, '_sol_has_slider', $has_slider );
|
461 |
+
|
462 |
+
// Run hook before finishing the reponse.
|
463 |
+
do_action( 'soliloquy_ajax_remove_slide', $attach_id, $post_id );
|
464 |
+
|
465 |
+
// Flush the slider cache.
|
466 |
+
Soliloquy_Common_Lite::get_instance()->flush_slider_caches( $post_id );
|
467 |
+
|
468 |
+
echo json_encode( true );
|
469 |
+
die;
|
470 |
+
|
471 |
+
}
|
472 |
+
|
473 |
+
add_action( 'wp_ajax_soliloquy_save_meta', 'soliloquy_lite_ajax_save_meta' );
|
474 |
+
/**
|
475 |
+
* Saves the metadata for an image in a slider.
|
476 |
+
*
|
477 |
+
* @since 1.0.0
|
478 |
+
*/
|
479 |
+
function soliloquy_lite_ajax_save_meta() {
|
480 |
+
|
481 |
+
// Run a security check first.
|
482 |
+
check_ajax_referer( 'soliloquy-save-meta', 'nonce' );
|
483 |
+
|
484 |
+
// Prepare variables.
|
485 |
+
$post_id = absint( $_POST['post_id'] );
|
486 |
+
$attach_id = $_POST['attach_id'];
|
487 |
+
$meta = $_POST['meta'];
|
488 |
+
$slider_data = get_post_meta( $post_id, '_sol_slider_data', true );
|
489 |
+
|
490 |
+
// Save the different types of default meta fields for images, videos and HTML slides.
|
491 |
+
if ( isset( $meta['title'] ) ) {
|
492 |
+
$slider_data['slider'][$attach_id]['title'] = trim( esc_html( $meta['title'] ) );
|
493 |
+
}
|
494 |
+
|
495 |
+
if ( isset( $meta['alt'] ) ) {
|
496 |
+
$slider_data['slider'][$attach_id]['alt'] = trim( esc_html( $meta['alt'] ) );
|
497 |
+
}
|
498 |
+
|
499 |
+
if ( isset( $meta['link'] ) ) {
|
500 |
+
$slider_data['slider'][$attach_id]['link'] = esc_url( $meta['link'] );
|
501 |
+
}
|
502 |
+
|
503 |
+
if ( isset( $meta['caption'] ) ) {
|
504 |
+
$slider_data['slider'][$attach_id]['caption'] = trim( $meta['caption'] );
|
505 |
+
}
|
506 |
+
|
507 |
+
if ( isset( $meta['url'] ) ) {
|
508 |
+
$slider_data['slider'][$attach_id]['url'] = esc_url( $meta['url'] );
|
509 |
+
}
|
510 |
+
|
511 |
+
if ( isset( $meta['thumb'] ) ) {
|
512 |
+
$slider_data['slider'][$attach_id]['thumb'] = esc_url( $meta['thumb'] );
|
513 |
+
$slider_data['slider'][$attach_id]['src'] = esc_url( $meta['thumb'] );
|
514 |
+
}
|
515 |
+
|
516 |
+
if ( isset( $meta['code'] ) ) {
|
517 |
+
$slider_data['slider'][$attach_id]['code'] = trim( $meta['code'] );
|
518 |
+
}
|
519 |
+
|
520 |
+
// Allow filtering of meta before saving.
|
521 |
+
$slider_data = apply_filters( 'soliloquy_ajax_save_meta', $slider_data, $meta, $attach_id, $post_id );
|
522 |
+
|
523 |
+
// Update the slider data.
|
524 |
+
update_post_meta( $post_id, '_sol_slider_data', $slider_data );
|
525 |
+
|
526 |
+
// Flush the slider cache.
|
527 |
+
Soliloquy_Common_Lite::get_instance()->flush_slider_caches( $post_id );
|
528 |
+
|
529 |
+
echo json_encode( true );
|
530 |
+
die;
|
531 |
+
|
532 |
+
}
|
533 |
+
|
534 |
+
add_action( 'wp_ajax_soliloquy_refresh', 'soliloquy_lite_ajax_refresh' );
|
535 |
+
/**
|
536 |
+
* Refreshes the DOM view for a slider.
|
537 |
+
*
|
538 |
+
* @since 1.0.0
|
539 |
+
*/
|
540 |
+
function soliloquy_lite_ajax_refresh() {
|
541 |
+
|
542 |
+
// Run a security check first.
|
543 |
+
check_ajax_referer( 'soliloquy-refresh', 'nonce' );
|
544 |
+
|
545 |
+
// Prepare variables.
|
546 |
+
$post_id = absint( $_POST['post_id'] );
|
547 |
+
$slider = '';
|
548 |
+
|
549 |
+
// Grab all slider data.
|
550 |
+
$slider_data = get_post_meta( $post_id, '_sol_slider_data', true );
|
551 |
+
|
552 |
+
// If there are no slider items, don't do anything.
|
553 |
+
if ( empty( $slider_data ) || empty( $slider_data['slider'] ) ) {
|
554 |
+
echo json_encode( array( 'error' => true ) );
|
555 |
+
die;
|
556 |
+
}
|
557 |
+
|
558 |
+
// Loop through the data and build out the slider view.
|
559 |
+
foreach ( (array) $slider_data['slider'] as $id => $data ) {
|
560 |
+
$slider .= Soliloquy_Metaboxes_Lite::get_instance()->get_slider_item( $id, $data, $data['type'], $post_id );
|
561 |
+
}
|
562 |
+
|
563 |
+
echo json_encode( array( 'success' => $slider ) );
|
564 |
+
die;
|
565 |
+
|
566 |
+
}
|
567 |
+
|
568 |
+
add_action( 'wp_ajax_soliloquy_load_slider_data', 'soliloquy_lite_ajax_load_slider_data' );
|
569 |
+
/**
|
570 |
+
* Retrieves and return slider data for the specified ID.
|
571 |
+
*
|
572 |
+
* @since 1.0.0
|
573 |
+
*/
|
574 |
+
function soliloquy_lite_ajax_load_slider_data() {
|
575 |
+
|
576 |
+
// Prepare variables and grab the slider data.
|
577 |
+
$slider_id = absint( $_POST['id'] );
|
578 |
+
$slider_data = get_post_meta( $slider_id, '_sol_slider_data', true );
|
579 |
+
|
580 |
+
// Send back the slider data.
|
581 |
+
echo json_encode( $slider_data );
|
582 |
+
die;
|
583 |
+
|
584 |
+
}
|
585 |
+
|
586 |
+
/**
|
587 |
+
* Helper function to prepare the metadata for an image in a slider.
|
588 |
+
*
|
589 |
+
* @since 1.0.0
|
590 |
+
*
|
591 |
+
* @param array $slider_data Array of data for the slider.
|
592 |
+
* @param int $id The attachment ID to prepare data for.
|
593 |
+
* @param string $type The type of slide to prepare (defaults to image).
|
594 |
+
* @param array $data Data to be used for the slide.
|
595 |
+
* @return array $slider_data Amended slider data with updated image metadata.
|
596 |
+
*/
|
597 |
+
function soliloquy_lite_ajax_prepare_slider_data( $slider_data, $id, $type = 'image', $data = array() ) {
|
598 |
+
|
599 |
+
switch ( $type ) {
|
600 |
+
case 'image' :
|
601 |
+
$attachment = get_post( $id );
|
602 |
+
$url = wp_get_attachment_image_src( $id, 'full' );
|
603 |
+
$alt_text = get_post_meta( $id, '_wp_attachment_image_alt', true );
|
604 |
+
$slider_data['slider'][$id] = array(
|
605 |
+
'status' => 'pending',
|
606 |
+
'src' => isset( $url[0] ) ? esc_url( $url[0] ) : '',
|
607 |
+
'title' => get_the_title( $id ),
|
608 |
+
'link' => '',
|
609 |
+
'alt' => ! empty( $alt_text ) ? $alt_text : get_the_title( $id ),
|
610 |
+
'caption' => ! empty( $attachment->post_excerpt ) ? $attachment->post_excerpt : '',
|
611 |
+
'type' => $type
|
612 |
+
);
|
613 |
+
break;
|
614 |
+
case 'video' :
|
615 |
+
$slider_data['slider'][$id] = array(
|
616 |
+
'status' => 'pending',
|
617 |
+
'src' => esc_url( $data['thumb'] ),
|
618 |
+
'title' => esc_html( $data['title'] ),
|
619 |
+
'url' => esc_url( $data['url'] ),
|
620 |
+
'thumb' => esc_url( $data['thumb'] ),
|
621 |
+
'caption' => trim( $data['caption'] ),
|
622 |
+
'type' => $type
|
623 |
+
);
|
624 |
+
break;
|
625 |
+
case 'html' :
|
626 |
+
$slider_data['slider'][$id] = array(
|
627 |
+
'status' => 'pending',
|
628 |
+
'src' => esc_url( $data['thumb'] ),
|
629 |
+
'title' => esc_html( $data['title'] ),
|
630 |
+
'code' => trim( $data['code'] ),
|
631 |
+
'type' => $type
|
632 |
+
);
|
633 |
+
break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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Common admin class.
|
4 |
+
*
|
5 |
+
* @since 1.0.0
|
6 |
+
*
|
7 |
+
* @package Soliloquy_Lite
|
8 |
+
* @author Thomas Griffin
|
9 |
+
*/
|
10 |
+
class Soliloquy_Common_Admin_Lite {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Holds the class object.
|
14 |
+
*
|
15 |
+
* @since 1.0.0
|
16 |
+
*
|
17 |
+
* @var object
|
18 |
+
*/
|
19 |
+
public static $instance;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Path to the file.
|
23 |
+
*
|
24 |
+
* @since 1.0.0
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
public $file = __FILE__;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Holds the base class object.
|
32 |
+
*
|
33 |
+
* @since 1.0.0
|
34 |
+
*
|
35 |
+
* @var object
|
36 |
+
*/
|
37 |
+
public $base;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Primary class constructor.
|
41 |
+
*
|
42 |
+
* @since 1.0.0
|
43 |
+
*/
|
44 |
+
public function __construct() {
|
45 |
+
|
46 |
+
// Load the base class object.
|
47 |
+
$this->base = Soliloquy_Lite::get_instance();
|
48 |
+
|
49 |
+
// Check for upgrading sliders.
|
50 |
+
add_action( 'admin_notices', array( $this, 'legacy_upgrade' ) );
|
51 |
+
add_action( 'admin_notices', array( $this, 'legacy_upgrade_success' ) );
|
52 |
+
|
53 |
+
// Delete any slider association on attachment deletion. Also delete any extra cropped images.
|
54 |
+
add_action( 'delete_attachment', array( $this, 'delete_slider_association' ) );
|
55 |
+
add_action( 'delete_attachment', array( $this, 'delete_cropped_image' ) );
|
56 |
+
|
57 |
+
// Ensure slider display is correct when trashing/untrashing sliders.
|
58 |
+
add_action( 'wp_trash_post', array( $this, 'trash_slider' ) );
|
59 |
+
add_action( 'untrash_post', array( $this, 'untrash_slider' ) );
|
60 |
+
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Performs a legacy upgrade for sliders from v1 to v2.
|
65 |
+
*
|
66 |
+
* @since 1.0.0
|
67 |
+
*/
|
68 |
+
public function legacy_upgrade() {
|
69 |
+
|
70 |
+
// If the option exists for upgrading, do nothing.
|
71 |
+
$upgrade = get_option( 'soliloquy_upgrade' );
|
72 |
+
if ( $upgrade ) {
|
73 |
+
return;
|
74 |
+
}
|
75 |
+
|
76 |
+
?>
|
77 |
+
<div class="error">
|
78 |
+
<p><?php printf( __( 'Soliloquy Lite is now rocking v2! <strong>You need to upgrade your legacy v1 sliders to v2.</strong> <a href="%s">Click here to begin the upgrade process.</a>', 'soliloquy' ), add_query_arg( 'page', 'soliloquy-lite-settings', admin_url( 'edit.php?post_type=soliloquy' ) ) ); ?></p>
|
79 |
+
</div>
|
80 |
+
<?php
|
81 |
+
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Outputs the legacy upgrade notice message for folks who have just upgraded.
|
86 |
+
*
|
87 |
+
* @since 1.0.0
|
88 |
+
*/
|
89 |
+
public function legacy_upgrade_success() {
|
90 |
+
|
91 |
+
// If the parameter is not set, do nothing.
|
92 |
+
if ( empty( $_GET['soliloquy-upgraded'] ) ) {
|
93 |
+
return;
|
94 |
+
}
|
95 |
+
|
96 |
+
?>
|
97 |
+
<div class="updated">
|
98 |
+
<p><strong><?php _e( 'Congratulations! You have upgraded your sliders successfully!', 'soliloquy' ); ?></strong></p>
|
99 |
+
</div>
|
100 |
+
<?php
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Deletes the Soliloquy slider association for the image being deleted.
|
106 |
+
*
|
107 |
+
* @since 1.0.0
|
108 |
+
*
|
109 |
+
* @param int $attach_id The attachment ID being deleted.
|
110 |
+
*/
|
111 |
+
public function delete_slider_association( $attach_id ) {
|
112 |
+
|
113 |
+
$has_slider = get_post_meta( $attach_id, '_sol_has_slider', true );
|
114 |
+
|
115 |
+
// Only proceed if the image is attached to any Soliloquy sliders.
|
116 |
+
if ( ! empty( $has_slider ) ) {
|
117 |
+
foreach ( (array) $has_slider as $post_id ) {
|
118 |
+
// Remove the in_slider association.
|
119 |
+
$in_slider = get_post_meta( $post_id, '_sol_in_slider', true );
|
120 |
+
if ( ! empty( $in_slider ) ) {
|
121 |
+
if ( ( $key = array_search( $attach_id, (array) $in_slider ) ) !== false ) {
|
122 |
+
unset( $in_slider[$key] );
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
update_post_meta( $post_id, '_sol_in_slider', $in_slider );
|
127 |
+
|
128 |
+
// Remove the image from the slider altogether.
|
129 |
+
$slider_data = get_post_meta( $post_id, '_sol_slider_data', true );
|
130 |
+
if ( ! empty( $slider_data['slider'] ) ) {
|
131 |
+
unset( $slider_data['slider'][$attach_id] );
|
132 |
+
}
|
133 |
+
|
134 |
+
// Update the post meta for the slider.
|
135 |
+
update_post_meta( $post_id, '_sol_slider_data', $slider_data );
|
136 |
+
|
137 |
+
// Flush necessary slider caches.
|
138 |
+
Soliloquy_Common_Lite::get_instance()->flush_slider_caches( $post_id, ( ! empty( $slider_data['config']['slug'] ) ? $slider_data['config']['slug'] : '' ) );
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Removes any extra cropped images when an attachment is deleted.
|
146 |
+
*
|
147 |
+
* @since 1.0.0
|
148 |
+
*
|
149 |
+
* @param int $post_id The post ID.
|
150 |
+
* @return null Return early if the appropriate metadata cannot be retrieved.
|
151 |
+
*/
|
152 |
+
public function delete_cropped_image( $post_id ) {
|
153 |
+
|
154 |
+
// Get attachment image metadata.
|
155 |
+
$metadata = wp_get_attachment_metadata( $post_id );
|
156 |
+
|
157 |
+
// Return if no metadata is found.
|
158 |
+
if ( ! $metadata ) {
|
159 |
+
return;
|
160 |
+
}
|
161 |
+
|
162 |
+
// Return if we don't have the proper metadata.
|
163 |
+
if ( ! isset( $metadata['file'] ) || ! isset( $metadata['image_meta']['resized_images'] ) ) {
|
164 |
+
return;
|
165 |
+
}
|
166 |
+
|
167 |
+
// Grab the necessary info to removed the cropped images.
|
168 |
+
$wp_upload_dir = wp_upload_dir();
|
169 |
+
$pathinfo = pathinfo( $metadata['file'] );
|
170 |
+
$resized_images = $metadata['image_meta']['resized_images'];
|
171 |
+
|
172 |
+
// Loop through and deleted and resized/cropped images.
|
173 |
+
foreach ( $resized_images as $dims ) {
|
174 |
+
// Get the resized images filename and delete the image.
|
175 |
+
$file = $wp_upload_dir['basedir'] . '/' . $pathinfo['dirname'] . '/' . $pathinfo['filename'] . '-' . $dims . '.' . $pathinfo['extension'];
|
176 |
+
|
177 |
+
// Delete the resized image.
|
178 |
+
if ( file_exists( $file ) ) {
|
179 |
+
@unlink( $file );
|
180 |
+
}
|
181 |
+
}
|
182 |
+
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Trash a slider when the slider post type is trashed.
|
187 |
+
*
|
188 |
+
* @since 1.0.0
|
189 |
+
*
|
190 |
+
* @param $id The post ID being trashed.
|
191 |
+
* @return null Return early if no slider is found.
|
192 |
+
*/
|
193 |
+
public function trash_slider( $id ) {
|
194 |
+
|
195 |
+
$slider = get_post( $id );
|
196 |
+
|
197 |
+
// Flush necessary slider caches to ensure trashed sliders are not showing.
|
198 |
+
Soliloquy_Common_Lite::get_instance()->flush_slider_caches( $id );
|
199 |
+
|
200 |
+
// Return early if not an Soliloquy slider.
|
201 |
+
if ( 'soliloquyv2' !== $slider->post_type ) {
|
202 |
+
return;
|
203 |
+
}
|
204 |
+
|
205 |
+
// Set the slider status to inactive.
|
206 |
+
$slider_data = get_post_meta( $id, '_sol_slider_data', true );
|
207 |
+
if ( empty( $slider_data ) ) {
|
208 |
+
return;
|
209 |
+
}
|
210 |
+
|
211 |
+
$slider_data['status'] = 'inactive';
|
212 |
+
update_post_meta( $id, '_sol_slider_data', $slider_data );
|
213 |
+
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Untrash a slider when the slider post type is untrashed.
|
218 |
+
*
|
219 |
+
* @since 1.0.0
|
220 |
+
*
|
221 |
+
* @param $id The post ID being untrashed.
|
222 |
+
* @return null Return early if no slider is found.
|
223 |
+
*/
|
224 |
+
public function untrash_slider( $id ) {
|
225 |
+
|
226 |
+
$slider = get_post( $id );
|
227 |
+
|
228 |
+
// Flush necessary slider caches to ensure untrashed sliders are showing.
|
229 |
+
Soliloquy_Common_Lite::get_instance()->flush_slider_caches( $id );
|
230 |
+
|
231 |
+
// Return early if not an Soliloquy slider.
|
232 |
+
if ( 'soliloquyv2' !== $slider->post_type ) {
|
233 |
+
return;
|
234 |
+
}
|
235 |
+
|
236 |
+
// Set the slider status to inactive.
|
237 |
+
$slider_data = get_post_meta( $id, '_sol_slider_data', true );
|
238 |
+
if ( empty( $slider_data ) ) {
|
239 |
+
return;
|
240 |
+
}
|
241 |
+
|
242 |
+
if ( isset( $slider_data['status'] ) ) {
|
243 |
+
unset( $slider_data['status'] );
|
244 |
+
}
|
245 |
+
|
246 |
+
update_post_meta( $id, '_sol_slider_data', $slider_data );
|
247 |
+
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Returns the singleton instance of the class.
|
252 |
+
*
|
253 |
+
* @since 1.0.0
|
254 |
+
*
|
255 |
+
* @return object The Soliloquy_Common_Admin_Lite object.
|
256 |
+
*/
|
257 |
+
public static function get_instance() {
|
258 |
+
|
259 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Soliloquy_Common_Admin_Lite ) ) {
|
260 |
+
self::$instance = new Soliloquy_Common_Admin_Lite();
|
261 |
+
}
|
262 |
+
|
263 |
+
return self::$instance;
|
264 |
+
|
265 |
+
}
|
266 |
+
|
267 |
+
}
|
268 |
+
|
269 |
+
// Load the common admin class.
|
270 |
+
$soliloquy_common_admin_lite = Soliloquy_Common_Admin_Lite::get_instance();
|
includes/admin/editor.php
ADDED
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Editor class.
|
4 |
+
*
|
5 |
+
* @since 1.0.0
|
6 |
+
*
|
7 |
+
* @package Soliloquy_Lite
|
8 |
+
* @author Thomas Griffin
|
9 |
+
*/
|
10 |
+
class Soliloquy_Editor_Lite {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Holds the class object.
|
14 |
+
*
|
15 |
+
* @since 1.0.0
|
16 |
+
*
|
17 |
+
* @var object
|
18 |
+
*/
|
19 |
+
public static $instance;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Path to the file.
|
23 |
+
*
|
24 |
+
* @since 1.0.0
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
public $file = __FILE__;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Holds the base class object.
|
32 |
+
*
|
33 |
+
* @since 1.0.0
|
34 |
+
*
|
35 |
+
* @var object
|
36 |
+
*/
|
37 |
+
public $base;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Flag to determine if media modal is loaded.
|
41 |
+
*
|
42 |
+
* @since 1.0.0
|
43 |
+
*
|
44 |
+
* @var object
|
45 |
+
*/
|
46 |
+
public $loaded = false;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Primary class constructor.
|
50 |
+
*
|
51 |
+
* @since 1.0.0
|
52 |
+
*/
|
53 |
+
public function __construct() {
|
54 |
+
|
55 |
+
// Load the base class object.
|
56 |
+
$this->base = Soliloquy_Lite::get_instance();
|
57 |
+
|
58 |
+
// Add a custom media button to the editor.
|
59 |
+
add_filter( 'media_buttons_context', array( $this, 'media_button' ) );
|
60 |
+
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Adds a custom slider insert button beside the media uploader button.
|
65 |
+
*
|
66 |
+
* @since 1.0.0
|
67 |
+
*
|
68 |
+
* @param string $buttons The media buttons context HTML.
|
69 |
+
* @return string $buttons Amended media buttons context HTML.
|
70 |
+
*/
|
71 |
+
public function media_button( $buttons ) {
|
72 |
+
|
73 |
+
// Create the media button.
|
74 |
+
$button = '<style type="text/css">@media only screen and (-webkit-min-device-pixel-ratio: 2),only screen and (min--moz-device-pixel-ratio: 2),only screen and (-o-min-device-pixel-ratio: 2/1),only screen and (min-device-pixel-ratio: 2),only screen and (min-resolution: 192dpi),only screen and (min-resolution: 2dppx) { #soliloquy-media-modal-button .soliloquy-media-icon[style] { background-image: url(' . plugins_url( 'assets/css/images/editor@2x.png', $this->base->file ) . ') !important; background-size: 16px 16px !important; } }</style>';
|
75 |
+
$button .= '<a id="soliloquy-media-modal-button" href="#" class="button soliloquy-choose-slider" title="' . esc_attr__( 'Add Slider', 'soliloquy' ) . '" style="padding-left: .4em;"><span class="soliloquy-media-icon" style="background: transparent url(' . plugins_url( 'assets/css/images/editor-icon.png', $this->base->file ) . ') no-repeat scroll 0 0; width: 16px; height: 16px; display: inline-block; vertical-align: text-top;"></span> ' . __( 'Add Slider', 'soliloquy' ) . '</a>';
|
76 |
+
|
77 |
+
// Enqueue the script that will trigger the editor button.
|
78 |
+
wp_enqueue_script( $this->base->plugin_slug . '-editor-script', plugins_url( 'assets/js/editor.js', $this->base->file ), array( 'jquery' ), $this->base->version, true );
|
79 |
+
|
80 |
+
// Add the action to the footer to output the modal window.
|
81 |
+
add_action( 'admin_footer', array( $this, 'slider_selection_modal' ) );
|
82 |
+
|
83 |
+
// Append the button.
|
84 |
+
return $buttons . $button;
|
85 |
+
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Outputs the slider selection modal to insert a slider into an editor.
|
90 |
+
*
|
91 |
+
* @since 1.0.0
|
92 |
+
*/
|
93 |
+
public function slider_selection_modal() {
|
94 |
+
|
95 |
+
echo $this->get_slider_selection_modal();
|
96 |
+
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Returns the slider selection modal to insert a slider into an editor.
|
101 |
+
*
|
102 |
+
* @since 1.0.0
|
103 |
+
*
|
104 |
+
* @global object $post The current post object.
|
105 |
+
* @return string Empty string if no sliders are found, otherwise modal UI.
|
106 |
+
*/
|
107 |
+
public function get_slider_selection_modal() {
|
108 |
+
|
109 |
+
// Return early if already loaded.
|
110 |
+
if ( $this->loaded ) {
|
111 |
+
return '';
|
112 |
+
}
|
113 |
+
|
114 |
+
// Set the loaded flag to true.
|
115 |
+
$this->loaded = true;
|
116 |
+
|
117 |
+
global $post;
|
118 |
+
$sliders = $this->base->get_sliders();
|
119 |
+
|
120 |
+
ob_start();
|
121 |
+
?>
|
122 |
+
<div class="soliloquy-default-ui-wrapper" style="display: none;">
|
123 |
+
<div class="soliloquy-default-ui soliloquy-image-meta">
|
124 |
+
<div class="media-modal wp-core-ui">
|
125 |
+
<a class="media-modal-close" href="#"><span class="media-modal-icon"></span>
|
126 |
+
</a>
|
127 |
+
<div class="media-modal-content">
|
128 |
+
<div class="media-frame wp-core-ui hide-menu hide-router soliloquy-meta-wrap">
|
129 |
+
<div class="media-frame-title">
|
130 |
+
<h1><?php _e( 'Choose Your Slider', 'soliloquy' ); ?></h1>
|
131 |
+
</div>
|
132 |
+
<div class="media-frame-content">
|
133 |
+
<div class="attachments-browser">
|
134 |
+
<ul class="soliloquy-meta attachments" style="padding-left: 8px; top: 1em;">
|
135 |
+
<li class="attachment" data-soliloquy-id="<?php echo absint( $post->ID ); ?>" style="margin: 8px;">
|
136 |
+
<div class="attachment-preview landscape">
|
137 |
+
<div class="thumbnail" style="display: table;">
|
138 |
+
<div style="display: table-cell; vertical-align: middle; text-align: center;">
|
139 |
+
<h3 style="margin: 0;color: #7ad03a;"><?php _e( 'This Post\'s Slider', 'soliloquy' ); ?></h3>
|
140 |
+
<code style="color: #7ad03a;">[soliloquy id="<?php echo absint( $post->ID ); ?>"]</code>
|
141 |
+
</div>
|
142 |
+
</div>
|
143 |
+
<a class="check" href="#"><div class="media-modal-icon"></div></a>
|
144 |
+
</div>
|
145 |
+
</li>
|
146 |
+
<?php foreach ( (array) $sliders as $slider ) : if ( $post->ID == $slider['id'] ) continue; ?>
|
147 |
+
<li class="attachment" data-soliloquy-id="<?php echo absint( $slider['id'] ); ?>" style="margin: 8px;">
|
148 |
+
<div class="attachment-preview landscape">
|
149 |
+
<div class="thumbnail" style="display: table;">
|
150 |
+
<div style="display: table-cell; vertical-align: middle; text-align: center;">
|
151 |
+
<?php
|
152 |
+
if ( ! empty( $slider['config']['title'] ) ) {
|
153 |
+
$title = $slider['config']['title'];
|
154 |
+
} else if ( ! empty( $slider['config']['slug'] ) ) {
|
155 |
+
$title = $slider['config']['title'];
|
156 |
+
} else {
|
157 |
+
$title = sprintf( __( 'Slider ID #%s', 'soliloquy' ), $slider['id'] );
|
158 |
+
}
|
159 |
+
?>
|
160 |
+
<h3 style="margin: 0;"><?php echo $title; ?></h3>
|
161 |
+
<code>[soliloquy id="<?php echo absint( $slider['id'] ); ?>"]</code>
|
162 |
+
</div>
|
163 |
+
</div>
|
164 |
+
<a class="check" href="#"><div class="media-modal-icon"></div></a>
|
165 |
+
</div>
|
166 |
+
</li>
|
167 |
+
<?php endforeach; ?>
|
168 |
+
</ul>
|
169 |
+
<!-- end .soliloquy-meta -->
|
170 |
+
<div class="media-sidebar">
|
171 |
+
<div class="soliloquy-meta-sidebar">
|
172 |
+
<h3 style="margin: 1.4em 0 1em;"><?php _e( 'Helpful Tips', 'soliloquy' ); ?></h3>
|
173 |
+
<strong><?php _e( 'Choosing Your Slider', 'soliloquy' ); ?></strong>
|
174 |
+
<p style="margin: 0 0 1.5em;"><?php _e( 'To choose your slider, simply click on one of the boxes to the left. The "Insert Slider" button will be activated once you have selected a slider.', 'soliloquy' ); ?></p>
|
175 |
+
<strong><?php _e( 'Inserting Your Slider', 'soliloquy' ); ?></strong>
|
176 |
+
<p style="margin: 0 0 1.5em;"><?php _e( 'To insert your slider into the editor, click on the "Insert Slider" button below.', 'soliloquy' ); ?></p>
|
177 |
+
</div>
|
178 |
+
<!-- end .soliloquy-meta-sidebar -->
|
179 |
+
</div>
|
180 |
+
<!-- end .media-sidebar -->
|
181 |
+
</div>
|
182 |
+
<!-- end .attachments-browser -->
|
183 |
+
</div>
|
184 |
+
<!-- end .media-frame-content -->
|
185 |
+
<div class="media-frame-toolbar">
|
186 |
+
<div class="media-toolbar">
|
187 |
+
<div class="media-toolbar-secondary">
|
188 |
+
<a href="#" class="soliloquy-cancel-insertion button media-button button-large button-secondary media-button-insert" title="<?php esc_attr_e( 'Cancel Slider Insertion', 'soliloquy' ); ?>"><?php _e( 'Cancel Slider Insertion', 'soliloquy' ); ?></a>
|
189 |
+
</div>
|
190 |
+
<div class="media-toolbar-primary">
|
191 |
+
<a href="#" class="soliloquy-insert-slider button media-button button-large button-primary media-button-insert" disabled="disabled" title="<?php esc_attr_e( 'Insert Slider', 'soliloquy' ); ?>"><?php _e( 'Insert Slider', 'soliloquy' ); ?></a>
|
192 |
+
</div>
|
193 |
+
<!-- end .media-toolbar-primary -->
|
194 |
+
</div>
|
195 |
+
<!-- end .media-toolbar -->
|
196 |
+
</div>
|
197 |
+
<!-- end .media-frame-toolbar -->
|
198 |
+
</div>
|
199 |
+
<!-- end .media-frame -->
|
200 |
+
</div>
|
201 |
+
<!-- end .media-modal-content -->
|
202 |
+
</div>
|
203 |
+
<!-- end .media-modal -->
|
204 |
+
<div class="media-modal-backdrop"></div>
|
205 |
+
</div><!-- end #soliloquy-default-ui -->
|
206 |
+
</div><!-- end #soliloquy-default-ui-wrapper -->
|
207 |
+
<?php
|
208 |
+
return ob_get_clean();
|
209 |
+
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Returns the singleton instance of the class.
|
214 |
+
*
|
215 |
+
* @since 1.0.0
|
216 |
+
*
|
217 |
+
* @return object The Soliloquy_Editor_Lite object.
|
218 |
+
*/
|
219 |
+
public static function get_instance() {
|
220 |
+
|
221 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Soliloquy_Editor_Lite ) ) {
|
222 |
+
self::$instance = new Soliloquy_Editor_Lite();
|
223 |
+
}
|
224 |
+
|
225 |
+
return self::$instance;
|
226 |
+
|
227 |
+
}
|
228 |
+
|
229 |
+
}
|
230 |
+
|
231 |
+
// Load the editor class.
|
232 |
+
$soliloquy_editor_lite = Soliloquy_Editor_Lite::get_instance();
|
includes/admin/media.php
ADDED
@@ -0,0 +1,249 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Media class.
|
4 |
+
*
|
5 |
+
* @since 1.0.0
|
6 |
+
*
|
7 |
+
* @package Soliloquy_Lite
|
8 |
+
* @author Thomas Griffin
|
9 |
+
*/
|
10 |
+
class Soliloquy_Media_Lite {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Holds the class object.
|
14 |
+
*
|
15 |
+
* @since 1.0.0
|
16 |
+
*
|
17 |
+
* @var object
|
18 |
+
*/
|
19 |
+
public static $instance;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Path to the file.
|
23 |
+
*
|
24 |
+
* @since 1.0.0
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
public $file = __FILE__;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Holds the base class object.
|
32 |
+
*
|
33 |
+
* @since 1.0.0
|
34 |
+
*
|
35 |
+
* @var object
|
36 |
+
*/
|
37 |
+
public $base;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Primary class constructor.
|
41 |
+
*
|
42 |
+
* @since 1.0.0
|
43 |
+
*/
|
44 |
+
public function __construct() {
|
45 |
+
|
46 |
+
// Load the base class object.
|
47 |
+
$this->base = Soliloquy_Lite::get_instance();
|
48 |
+
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Prepares a custom media upload form that allows multiple forms on one page.
|
53 |
+
*
|
54 |
+
* @since 1.0.0
|
55 |
+
*
|
56 |
+
* @return null Return early if the form cannot be output.
|
57 |
+
*/
|
58 |
+
public function media_upload_form() {
|
59 |
+
|
60 |
+
do_action( 'pre-upload-ui' );
|
61 |
+
|
62 |
+
if ( ! $this->device_can_upload() ) {
|
63 |
+
echo '<p>' . sprintf( __( 'The web browser on your device cannot be used to upload files. You may be able to use the <a href="%s">native app for your device</a> instead.', 'soliloquy' ), 'http://wordpress.org/mobile/' ) . '</p>';
|
64 |
+
return;
|
65 |
+
}
|
66 |
+
|
67 |
+
if ( ! $this->has_upload_capacity() ) {
|
68 |
+
do_action( 'upload_ui_over_quota' );
|
69 |
+
return;
|
70 |
+
}
|
71 |
+
|
72 |
+
// Get both resize width and height for the media form.
|
73 |
+
$width = $this->get_resize_width();
|
74 |
+
$height = $this->get_resize_height();
|
75 |
+
|
76 |
+
// Output the media form.
|
77 |
+
$this->do_media_upload_form( $width, $height );
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Outputs a custom media upload form that allows multiple forms on one page.
|
83 |
+
*
|
84 |
+
* @since 1.0.0
|
85 |
+
*
|
86 |
+
* @global bool $ie_IE Flag for Internet Explorer.
|
87 |
+
* @global bool $is_opera Flag for Opera.
|
88 |
+
* @param int $width The media resize width.
|
89 |
+
* @param int $height The media resize height.
|
90 |
+
*/
|
91 |
+
public function do_media_upload_form( $width, $height ) {
|
92 |
+
|
93 |
+
// Prepare globals and variables.
|
94 |
+
global $is_IE, $is_opera;
|
95 |
+
$sizes = array( 'KB', 'MB', 'GB' );
|
96 |
+
$max_upload_size = wp_max_upload_size();
|
97 |
+
|
98 |
+
?>
|
99 |
+
<script type="text/javascript">var resize_width = <?php echo $width; ?>, resize_height = <?php echo $height; ?>;</script>
|
100 |
+
<div id="soliloquy-upload-error"></div>
|
101 |
+
<div id="soliloquy-plupload-upload-ui" class="hide-if-no-js">
|
102 |
+
<?php do_action( 'pre-plupload-upload-ui' ); ?>
|
103 |
+
<div id="soliloquy-drag-drop-area">
|
104 |
+
<div class="drag-drop-inside">
|
105 |
+
<p class="drag-drop-info"><?php _e( 'Drop images here', 'soliloquy' ); ?></p>
|
106 |
+
<p><?php _ex( 'or', 'Uploader: Drop images here - or - Select Images', 'soliloquy' ); ?></p>
|
107 |
+
<p class="drag-drop-buttons">
|
108 |
+
<input id="soliloquy-plupload-browse-button" type="button" value="<?php esc_attr_e( 'Select Images', 'soliloquy' ); ?>" class="button" />
|
109 |
+
</p>
|
110 |
+
</div>
|
111 |
+
</div>
|
112 |
+
<?php do_action( 'post-plupload-upload-ui' ); ?>
|
113 |
+
</div>
|
114 |
+
|
115 |
+
<div id="soliloquy-html-upload-ui" class="hide-if-js">
|
116 |
+
<?php do_action('pre-html-upload-ui'); ?>
|
117 |
+
<p id="soliloquy-async-upload-wrap">
|
118 |
+
<label class="screen-reader-text" for="soliloquy-async-upload"><?php _e( 'Upload', 'soliloquy' ); ?></label>
|
119 |
+
<input type="file" name="async-upload" id="soliloquy-async-upload" />
|
120 |
+
<?php submit_button( __( 'Upload', 'soliloquy' ), 'button', 'html-upload', false ); ?>
|
121 |
+
<a href="#" onclick="try{top.tb_remove();}catch(e){};return false;"><?php _e( 'Cancel', 'soliloquy' ); ?></a>
|
122 |
+
</p>
|
123 |
+
<div class="clear"></div>
|
124 |
+
<?php do_action( 'post-html-upload-ui' ); ?>
|
125 |
+
</div>
|
126 |
+
|
127 |
+
<span class="max-upload-size"><?php printf( __( 'Maximum upload file size: %d%s.', 'soliloquy' ), esc_html( $this->get_upload_size_unit( $sizes ) ), esc_html( $sizes[$this->get_upload_size_unit( $sizes, 'unit' )] ) ); ?></span>
|
128 |
+
<?php
|
129 |
+
|
130 |
+
// Output a notice if the browser may have trouble with uploading large images.
|
131 |
+
if ( ( $is_IE || $is_opera ) && $max_upload_size > 100 * 1024 * 1024 ) {
|
132 |
+
echo '<span class="big-file-warning">' . __( 'Your browser has some limitations uploading large files with the multi-file uploader. Please use the browser uploader for files over 100MB.', 'soliloquy' ) . '</span>';
|
133 |
+
}
|
134 |
+
|
135 |
+
do_action( 'post-upload-ui' );
|
136 |
+
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Flag if the device can upload images.
|
141 |
+
*
|
142 |
+
* @since 1.0.0
|
143 |
+
*
|
144 |
+
* @return bool True if it can, false otherwise.
|
145 |
+
*/
|
146 |
+
public function device_can_upload() {
|
147 |
+
|
148 |
+
// Why is this method internal? It is quite useful.
|
149 |
+
return _device_can_upload();
|
150 |
+
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Flag if the site has the capacity to receive an upload.
|
155 |
+
*
|
156 |
+
* @since 1.0.0
|
157 |
+
*
|
158 |
+
* @return bool True if it can, false otherwise.
|
159 |
+
*/
|
160 |
+
public function has_upload_capacity() {
|
161 |
+
|
162 |
+
return ! ( is_multisite() && ! is_upload_space_available() );
|
163 |
+
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Returns the resize width for the media form.
|
168 |
+
*
|
169 |
+
* @since 1.0.0
|
170 |
+
*
|
171 |
+
* @return int $width The resize width.
|
172 |
+
*/
|
173 |
+
public function get_resize_width() {
|
174 |
+
|
175 |
+
$width = absint( get_option( 'large_size_w' ) );
|
176 |
+
if ( ! $width ) {
|
177 |
+
$width = 1024;
|
178 |
+
}
|
179 |
+
|
180 |
+
return $width;
|
181 |
+
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Returns the resize height for the media form.
|
186 |
+
*
|
187 |
+
* @since 1.0.0
|
188 |
+
*
|
189 |
+
* @return int $width The resize height.
|
190 |
+
*/
|
191 |
+
public function get_resize_height() {
|
192 |
+
|
193 |
+
$height = absint( get_option( 'large_size_h' ) );
|
194 |
+
if ( ! $height ) {
|
195 |
+
$height = 1024;
|
196 |
+
}
|
197 |
+
|
198 |
+
return $height;
|
199 |
+
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Returns the upload unit for the media uploader.
|
204 |
+
*
|
205 |
+
* @since 1.0.0
|
206 |
+
*
|
207 |
+
* @param array $sizes Array of sizes to use for units.
|
208 |
+
* @param string $type Type of unit to retrieve ('size' or 'unit').
|
209 |
+
*/
|
210 |
+
public function get_upload_size_unit( $sizes, $type = 'size' ) {
|
211 |
+
|
212 |
+
$upload_size_unit = wp_max_upload_size();
|
213 |
+
for ( $u = -1; $upload_size_unit > 1024 && $u < count( $sizes ) - 1; $u++ ) {
|
214 |
+
$upload_size_unit /= 1024;
|
215 |
+
}
|
216 |
+
|
217 |
+
// If the upload size is 0, disable uploading, otherwise allow uploading to continue.
|
218 |
+
if ( $u < 0 ) {
|
219 |
+
$upload_size_unit = 0;
|
220 |
+
$u = 0;
|
221 |
+
} else {
|
222 |
+
$upload_size_unit = (int) $upload_size_unit;
|
223 |
+
}
|
224 |
+
|
225 |
+
return 'unit' == $type ? $u : $upload_size_unit;
|
226 |
+
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Returns the singleton instance of the class.
|
231 |
+
*
|
232 |
+
* @since 1.0.0
|
233 |
+
*
|
234 |
+
* @return object The Soliloquy_Media_Lite object.
|
235 |
+
*/
|
236 |
+
public static function get_instance() {
|
237 |
+
|
238 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Soliloquy_Media_Lite ) ) {
|
239 |
+
self::$instance = new Soliloquy_Media_Lite();
|
240 |
+
}
|
241 |
+
|
242 |
+
return self::$instance;
|
243 |
+
|
244 |
+
}
|
245 |
+
|
246 |
+
}
|
247 |
+
|
248 |
+
// Load the media class.
|
249 |
+
$soliloquy_media_lite = Soliloquy_Media_Lite::get_instance();
|
includes/admin/metaboxes.php
ADDED
@@ -0,0 +1,1312 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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package Soliloquy_Lite
|
8 |
+
* @author Thomas Griffin
|
9 |
+
*/
|
10 |
+
class Soliloquy_Metaboxes_Lite {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Holds the class object.
|
14 |
+
*
|
15 |
+
* @since 1.0.0
|
16 |
+
*
|
17 |
+
* @var object
|
18 |
+
*/
|
19 |
+
public static $instance;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Path to the file.
|
23 |
+
*
|
24 |
+
* @since 1.0.0
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
public $file = __FILE__;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Holds the base class object.
|
32 |
+
*
|
33 |
+
* @since 1.0.0
|
34 |
+
*
|
35 |
+
* @var object
|
36 |
+
*/
|
37 |
+
public $base;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Primary class constructor.
|
41 |
+
*
|
42 |
+
* @since 1.0.0
|
43 |
+
*/
|
44 |
+
public function __construct() {
|
45 |
+
|
46 |
+
// Load the base class object.
|
47 |
+
$this->base = Soliloquy_Lite::get_instance();
|
48 |
+
|
49 |
+
// Load metabox assets.
|
50 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'meta_box_styles' ) );
|
51 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'meta_box_scripts' ) );
|
52 |
+
|
53 |
+
// Load the metabox hooks and filters.
|
54 |
+
add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 100 );
|
55 |
+
|
56 |
+
// Load all tabs.
|
57 |
+
add_action( 'soliloquy_tab_images', array( $this, 'images_tab' ) );
|
58 |
+
add_action( 'soliloquy_tab_config', array( $this, 'config_tab' ) );
|
59 |
+
add_action( 'soliloquy_tab_misc', array( $this, 'misc_tab' ) );
|
60 |
+
|
61 |
+
// Add action to save metabox config options.
|
62 |
+
add_action( 'save_post', array( $this, 'save_meta_boxes' ), 10, 2 );
|
63 |
+
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Loads styles for our metaboxes.
|
68 |
+
*
|
69 |
+
* @since 1.0.0
|
70 |
+
*
|
71 |
+
* @return null Return early if not on the proper screen.
|
72 |
+
*/
|
73 |
+
public function meta_box_styles() {
|
74 |
+
|
75 |
+
if ( 'post' !== get_current_screen()->base ) {
|
76 |
+
return;
|
77 |
+
}
|
78 |
+
|
79 |
+
if ( isset( get_current_screen()->post_type ) && in_array( get_current_screen()->post_type, $this->get_skipped_posttypes() ) ) {
|
80 |
+
return;
|
81 |
+
}
|
82 |
+
|
83 |
+
// Load necessary metabox styles.
|
84 |
+
wp_register_style( $this->base->plugin_slug . '-metabox-style', plugins_url( 'assets/css/metabox.css', $this->base->file ), array(), $this->base->version );
|
85 |
+
wp_enqueue_style( $this->base->plugin_slug . '-metabox-style' );
|
86 |
+
|
87 |
+
// Fire a hook to load in custom metabox styles.
|
88 |
+
do_action( 'soliloquy_metabox_styles' );
|
89 |
+
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Loads scripts for our metaboxes.
|
94 |
+
*
|
95 |
+
* @since 1.0.0
|
96 |
+
*
|
97 |
+
* @global int $id The current post ID.
|
98 |
+
* @global object $post The current post object..
|
99 |
+
* @return null Return early if not on the proper screen.
|
100 |
+
*/
|
101 |
+
public function meta_box_scripts( $hook ) {
|
102 |
+
|
103 |
+
global $id, $post;
|
104 |
+
|
105 |
+
if ( isset( get_current_screen()->base ) && 'post' !== get_current_screen()->base ) {
|
106 |
+
return;
|
107 |
+
}
|
108 |
+
|
109 |
+
if ( isset( get_current_screen()->post_type ) && in_array( get_current_screen()->post_type, $this->get_skipped_posttypes() ) ) {
|
110 |
+
return;
|
111 |
+
}
|
112 |
+
|
113 |
+
// Set the post_id for localization.
|
114 |
+
$post_id = isset( $post->ID ) ? $post->ID : (int) $id;
|
115 |
+
|
116 |
+
// Load necessary metabox scripts.
|
117 |
+
wp_enqueue_script( 'jquery-ui-sortable' );
|
118 |
+
wp_enqueue_media( array( 'post' => $post_id ) );
|
119 |
+
|
120 |
+
// Load necessary metabox scripts.
|
121 |
+
wp_enqueue_script( 'plupload-handlers' );
|
122 |
+
wp_register_script( $this->base->plugin_slug . '-metabox-script', plugins_url( 'assets/js/metabox.js', $this->base->file ), array( 'jquery', 'plupload-handlers', 'quicktags', 'jquery-ui-sortable' ), $this->base->version, true );
|
123 |
+
wp_enqueue_script( $this->base->plugin_slug . '-metabox-script' );
|
124 |
+
wp_localize_script(
|
125 |
+
$this->base->plugin_slug . '-metabox-script',
|
126 |
+
'soliloquy_metabox',
|
127 |
+
array(
|
128 |
+
'ajax' => admin_url( 'admin-ajax.php' ),
|
129 |
+
'change_nonce' => wp_create_nonce( 'soliloquy-change-type' ),
|
130 |
+
'slider' => esc_attr__( 'Click Here to Insert Slides from Other Sources', 'soliloquy' ),
|
131 |
+
'id' => $post_id,
|
132 |
+
'htmlcode' => __( 'HTML Slide Code', 'soliloquy' ),
|
133 |
+
'htmlslide' => __( 'HTML Slide Title', 'soliloquy' ),
|
134 |
+
'htmlplace' => __( 'Enter HTML slide title here...', 'soliloquy' ),
|
135 |
+
'htmlstart' => __( '<!-- Enter your HTML code here for this slide (you can delete this line). -->', 'soliloquy' ),
|
136 |
+
'htmlthumb' => __( 'HTML Slide Thumbnail', 'soliloquy' ),
|
137 |
+
'htmlsrc' => __( 'Enter your HTML thumbnail URL here...', 'soliloquy' ),
|
138 |
+
'htmlselect' => __( 'Choose HTML Thumbnail', 'soliloquy' ),
|
139 |
+
'htmldelete' => __( 'Remove HTML Thumbnail', 'soliloquy' ),
|
140 |
+
'htmlframe' => __( 'Choose a HTML Thumbnail', 'soliloquy' ),
|
141 |
+
'htmluse' => __( 'Select Thumbnail', 'soliloquy' ),
|
142 |
+
'import' => __( 'You must select a file to import before continuing.', 'soliloquy' ),
|
143 |
+
'insert_nonce' => wp_create_nonce( 'soliloquy-insert-images' ),
|
144 |
+
'inserting' => __( 'Inserting...', 'soliloquy' ),
|
145 |
+
'library_search' => wp_create_nonce( 'soliloquy-library-search' ),
|
146 |
+
'load_image' => wp_create_nonce( 'soliloquy-load-image' ),
|
147 |
+
'load_slider' => wp_create_nonce( 'soliloquy-load-slider' ),
|
148 |
+
'path' => plugin_dir_path( 'assets' ),
|
149 |
+
'plupload' => $this->get_plupload_init( $post_id ),
|
150 |
+
'refresh_nonce' => wp_create_nonce( 'soliloquy-refresh' ),
|
151 |
+
'remove' => __( 'Are you sure you want to remove this slide from the slider?', 'soliloquy' ),
|
152 |
+
'remove_nonce' => wp_create_nonce( 'soliloquy-remove-slide' ),
|
153 |
+
'removeslide' => __( 'Remove', 'soliloquy' ),
|
154 |
+
'save_nonce' => wp_create_nonce( 'soliloquy-save-meta' ),
|
155 |
+
'saving' => __( 'Saving...', 'soliloquy' ),
|
156 |
+
'sort' => wp_create_nonce( 'soliloquy-sort' ),
|
157 |
+
'upgrade_nonce' => wp_create_nonce( 'soliloquy-upgrade' ),
|
158 |
+
'videocaption' => __( 'Video Slide Caption', 'soliloquy' ),
|
159 |
+
'videoslide' => __( 'Video Slide Title', 'soliloquy' ),
|
160 |
+
'videoplace' => __( 'Enter video slide title here...', 'soliloquy' ),
|
161 |
+
'videotitle' => __( 'Video Slide URL', 'soliloquy' ),
|
162 |
+
'videothumb' => __( 'Video Slide Thumbnail', 'soliloquy' ),
|
163 |
+
'videosrc' => __( 'Enter your video thumbnail URL here...', 'soliloquy' ),
|
164 |
+
'videoselect' => __( 'Choose Video Thumbnail', 'soliloquy' ),
|
165 |
+
'videodelete' => __( 'Remove Video Thumbnail', 'soliloquy' ),
|
166 |
+
'videooutput' => __( 'Enter your video URL here...', 'soliloquy' ),
|
167 |
+
'videoframe' => __( 'Choose a Video Thumbnail', 'soliloquy' ),
|
168 |
+
'videouse' => __( 'Select Thumbnail', 'soliloquy' )
|
169 |
+
)
|
170 |
+
);
|
171 |
+
|
172 |
+
// Load necessary HTML slide scripts and styles.
|
173 |
+
wp_register_script( $this->base->plugin_slug . '-codemirror', plugins_url( 'assets/js/codemirror.js', $this->base->file ), array(), $this->base->version, true );
|
174 |
+
wp_register_style( $this->base->plugin_slug . '-codemirror', plugins_url( 'assets/css/codemirror.css', $this->base->file ), array(), $this->base->version );
|
175 |
+
wp_enqueue_script( $this->base->plugin_slug . '-codemirror' );
|
176 |
+
wp_enqueue_style( $this->base->plugin_slug . '-codemirror' );
|
177 |
+
|
178 |
+
// If on an Soliloquy post type, add custom CSS for hiding specific things.
|
179 |
+
if ( isset( get_current_screen()->post_type ) && 'soliloquy' == get_current_screen()->post_type ) {
|
180 |
+
add_action( 'admin_head', array( $this, 'meta_box_css' ) );
|
181 |
+
}
|
182 |
+
|
183 |
+
// Fire a hook to load custom metabox scripts.
|
184 |
+
do_action( 'soliloquy_metabox_scripts' );
|
185 |
+
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Returns custom plupload init properties for the media uploader.
|
190 |
+
*
|
191 |
+
* @since 1.0.0
|
192 |
+
*
|
193 |
+
* @param int $post_id The current post ID.
|
194 |
+
* @return array Array of plupload init data.
|
195 |
+
*/
|
196 |
+
public function get_plupload_init( $post_id ) {
|
197 |
+
|
198 |
+
// Prepare $_POST form variables and apply backwards compat filter.
|
199 |
+
$post_params = array(
|
200 |
+
'post_id' => $post_id,
|
201 |
+
'_wpnonce' => wp_create_nonce( 'media-form' ),
|
202 |
+
'type' => '',
|
203 |
+
'tab' => '',
|
204 |
+
'short' => 3
|
205 |
+
);
|
206 |
+
$post_params = apply_filters( 'upload_post_params', $post_params );
|
207 |
+
|
208 |
+
// Prepare upload size parameters.
|
209 |
+
$max_upload_size = wp_max_upload_size();
|
210 |
+
|
211 |
+
// Prepare the plupload init array.
|
212 |
+
$plupload_init = array(
|
213 |
+
'runtimes' => 'html5,silverlight,flash,html4',
|
214 |
+
'browse_button' => 'soliloquy-plupload-browse-button',
|
215 |
+
'container' => 'soliloquy-plupload-upload-ui',
|
216 |
+
'drop_element' => 'soliloquy-drag-drop-area',
|
217 |
+
'file_data_name' => 'async-upload',
|
218 |
+
'multiple_queues' => true,
|
219 |
+
'max_file_size' => $max_upload_size . 'b',
|
220 |
+
'url' => admin_url( 'async-upload.php' ),
|
221 |
+
'flash_swf_url' => includes_url( 'js/plupload/plupload.flash.swf' ),
|
222 |
+
'silverlight_xap_url' => includes_url( 'js/plupload/plupload.silverlight.xap' ),
|
223 |
+
'filters' => array(
|
224 |
+
array(
|
225 |
+
'title' => __( 'Allowed Files', 'soliloquy' ),
|
226 |
+
'extensions' => '*'
|
227 |
+
),
|
228 |
+
),
|
229 |
+
'multipart' => true,
|
230 |
+
'urlstream_upload' => true,
|
231 |
+
'multipart_params' => $post_params,
|
232 |
+
'resize' => array(
|
233 |
+
'width' => Soliloquy_Media_Lite::get_instance()->get_resize_width(),
|
234 |
+
'height' => Soliloquy_Media_Lite::get_instance()->get_resize_height(),
|
235 |
+
'quality' => 100,
|
236 |
+
'enabled' => true
|
237 |
+
)
|
238 |
+
);
|
239 |
+
|
240 |
+
// If we are on a mobile device, disable multi selection.
|
241 |
+
if ( wp_is_mobile() ) {
|
242 |
+
$plupload_init['multi_selection'] = false;
|
243 |
+
}
|
244 |
+
|
245 |
+
// Apply backwards compat filter.
|
246 |
+
$plupload_init = apply_filters( 'plupload_init', $plupload_init );
|
247 |
+
|
248 |
+
// Return and apply a custom filter to our init data.
|
249 |
+
return apply_filters( 'soliloquy_plupload_init', $plupload_init, $post_id );
|
250 |
+
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Hides unnecessary meta box items on Soliloquy post type screens.
|
255 |
+
*
|
256 |
+
* @since 1.0.0
|
257 |
+
*/
|
258 |
+
public function meta_box_css() {
|
259 |
+
|
260 |
+
?>
|
261 |
+
<style type="text/css">.misc-pub-section:not(.misc-pub-post-status) { display: none; }</style>
|
262 |
+
<?php
|
263 |
+
|
264 |
+
// Fire action for CSS on Soliloquy post type screens.
|
265 |
+
do_action( 'soliloquy_admin_css' );
|
266 |
+
|
267 |
+
}
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Creates metaboxes for handling and managing sliders.
|
271 |
+
*
|
272 |
+
* @since 1.0.0
|
273 |
+
*/
|
274 |
+
public function add_meta_boxes() {
|
275 |
+
|
276 |
+
// Let's remove all of those dumb metaboxes from our post type screen to control the experience.
|
277 |
+
$this->remove_all_the_metaboxes();
|
278 |
+
|
279 |
+
// Get all public post types.
|
280 |
+
$post_types = get_post_types( array( 'public' => true ) );
|
281 |
+
|
282 |
+
// Splice the soliloquy post type since it is not visible to the public by default.
|
283 |
+
$post_types[] = 'soliloquy';
|
284 |
+
|
285 |
+
// Loops through the post types and add the metaboxes.
|
286 |
+
foreach ( (array) $post_types as $post_type ) {
|
287 |
+
// Don't output boxes on these post types.
|
288 |
+
if ( in_array( $post_type, $this->get_skipped_posttypes() ) ) {
|
289 |
+
continue;
|
290 |
+
}
|
291 |
+
|
292 |
+
add_meta_box( 'soliloquy', __( 'Soliloquy Settings', 'soliloquy' ), array( $this, 'meta_box_callback' ), $post_type, 'normal', 'high' );
|
293 |
+
}
|
294 |
+
|
295 |
+
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* Removes all the metaboxes except the ones I want on MY POST TYPE. RAGE.
|
299 |
+
*
|
300 |
+
* @since 1.0.0
|
301 |
+
*
|
302 |
+
* @global array $wp_meta_boxes Array of registered metaboxes.
|
303 |
+
* @return smile $for_my_buyers Happy customers with no spammy metaboxes!
|
304 |
+
*/
|
305 |
+
public function remove_all_the_metaboxes() {
|
306 |
+
|
307 |
+
global $wp_meta_boxes;
|
308 |
+
|
309 |
+
// This is the post type you want to target. Adjust it to match yours.
|
310 |
+
$post_type = 'soliloquy';
|
311 |
+
|
312 |
+
// These are the metabox IDs you want to pass over. They don't have to match exactly. preg_match will be run on them.
|
313 |
+
$pass_over = array( 'submitdiv', 'soliloquy' );
|
314 |
+
|
315 |
+
// All the metabox contexts you want to check.
|
316 |
+
$contexts = array( 'normal', 'advanced', 'side' );
|
317 |
+
|
318 |
+
// All the priorities you want to check.
|
319 |
+
$priorities = array( 'high', 'core', 'default', 'low' );
|
320 |
+
|
321 |
+
// Loop through and target each context.
|
322 |
+
foreach ( $contexts as $context ) {
|
323 |
+
// Now loop through each priority and start the purging process.
|
324 |
+
foreach ( $priorities as $priority ) {
|
325 |
+
if ( isset( $wp_meta_boxes[$post_type][$context][$priority] ) ) {
|
326 |
+
foreach ( (array) $wp_meta_boxes[$post_type][$context][$priority] as $id => $metabox_data ) {
|
327 |
+
// If the metabox ID to pass over matches the ID given, remove it from the array and continue.
|
328 |
+
if ( in_array( $id, $pass_over ) ) {
|
329 |
+
unset( $pass_over[$id] );
|
330 |
+
continue;
|
331 |
+
}
|
332 |
+
|
333 |
+
// Otherwise, loop through the pass_over IDs and if we have a match, continue.
|
334 |
+
foreach ( $pass_over as $to_pass ) {
|
335 |
+
if ( preg_match( '#^' . $id . '#i', $to_pass ) ) {
|
336 |
+
continue;
|
337 |
+
}
|
338 |
+
}
|
339 |
+
|
340 |
+
// If we reach this point, remove the metabox completely.
|
341 |
+
unset( $wp_meta_boxes[$post_type][$context][$priority][$id] );
|
342 |
+
}
|
343 |
+
}
|
344 |
+
}
|
345 |
+
}
|
346 |
+
|
347 |
+
}
|
348 |
+
|
349 |
+
/**
|
350 |
+
* Callback for displaying content in the registered metabox.
|
351 |
+
*
|
352 |
+
* @since 1.0.0
|
353 |
+
*
|
354 |
+
* @param object $post The current post object.
|
355 |
+
*/
|
356 |
+
public function meta_box_callback( $post ) {
|
357 |
+
|
358 |
+
// Keep security first.
|
359 |
+
wp_nonce_field( 'soliloquy', 'soliloquy' );
|
360 |
+
|
361 |
+
// Check for our meta overlay helper.
|
362 |
+
$slider_data = get_post_meta( $post->ID, '_sol_slider_data', true );
|
363 |
+
$helper = get_post_meta( $post->ID, '_sol_just_published', true );
|
364 |
+
$class = '';
|
365 |
+
if ( $helper ) {
|
366 |
+
$class = 'soliloquy-helper-needed';
|
367 |
+
}
|
368 |
+
|
369 |
+
?>
|
370 |
+
<div id="soliloquy-tabs" class="soliloquy-clear <?php echo $class; ?>">
|
371 |
+
<?php $this->meta_helper( $post, $slider_data ); ?>
|
372 |
+
<ul id="soliloquy-tabs-nav" class="soliloquy-clear">
|
373 |
+
<?php $i = 0; foreach ( (array) $this->get_soliloquy_tab_nav() as $id => $title ) : $class = 0 === $i ? 'soliloquy-active' : ''; ?>
|
374 |
+
<li class="<?php echo $class; ?>"><a href="#soliloquy-tab-<?php echo $id; ?>" title="<?php echo $title; ?>"><?php echo $title; ?></a></li>
|
375 |
+
<?php $i++; endforeach; ?>
|
376 |
+
</ul>
|
377 |
+
<?php $i = 0; foreach ( (array) $this->get_soliloquy_tab_nav() as $id => $title ) : $class = 0 === $i ? 'soliloquy-active' : ''; ?>
|
378 |
+
<div id="soliloquy-tab-<?php echo $id; ?>" class="soliloquy-tab soliloquy-clear <?php echo $class; ?>">
|
379 |
+
<?php do_action( 'soliloquy_tab_' . $id, $post ); ?>
|
380 |
+
</div>
|
381 |
+
<?php $i++; endforeach; ?>
|
382 |
+
</div>
|
383 |
+
<?php
|
384 |
+
|
385 |
+
}
|
386 |
+
|
387 |
+
/**
|
388 |
+
* Callback for getting all of the tabs for Soliloquy sliders.
|
389 |
+
*
|
390 |
+
* @since 1.0.0
|
391 |
+
*
|
392 |
+
* @return array Array of tab information.
|
393 |
+
*/
|
394 |
+
public function get_soliloquy_tab_nav() {
|
395 |
+
|
396 |
+
$tabs = array(
|
397 |
+
'images' => __( 'Images', 'soliloquy' ),
|
398 |
+
'config' => __( 'Config', 'soliloquy' ),
|
399 |
+
);
|
400 |
+
$tabs = apply_filters( 'soliloquy_tab_nav', $tabs );
|
401 |
+
|
402 |
+
// "Misc" tab is required.
|
403 |
+
$tabs['misc'] = __( 'Misc', 'soliloquy' );
|
404 |
+
|
405 |
+
return $tabs;
|
406 |
+
|
407 |
+
}
|
408 |
+
|
409 |
+
/**
|
410 |
+
* Callback for displaying the UI for main images tab.
|
411 |
+
*
|
412 |
+
* @since 1.0.0
|
413 |
+
*
|
414 |
+
* @param object $post The current post object.
|
415 |
+
*/
|
416 |
+
public function images_tab( $post ) {
|
417 |
+
|
418 |
+
// Output a notice if missing cropping extensions because Soliloquy needs them.
|
419 |
+
if ( ! $this->has_gd_extension() && ! $this->has_imagick_extension() ) {
|
420 |
+
?>
|
421 |
+
<div class="error below-h2">
|
422 |
+
<p><strong><?php _e( 'The GD or Imagick libraries are not installed on your server. Soliloquy requires at least one (preferably Imagick) in order to crop images and may not work properly without it. Please contact your webhost and ask them to compile GD or Imagick for your PHP install.', 'soliloquy' ); ?></strong></p>
|
423 |
+
</div>
|
424 |
+
<?php
|
425 |
+
}
|
426 |
+
|
427 |
+
// Output the slider type selection items.
|
428 |
+
?>
|
429 |
+
<ul id="soliloquy-types-nav" class="soliloquy-clear">
|
430 |
+
<li class="soliloquy-type-label"><span><?php _e( 'Slider Type', 'soliloquy' ); ?></span></li>
|
431 |
+
<?php $i = 0; foreach ( (array) $this->get_soliloquy_types( $post ) as $id => $title ) : ?>
|
432 |
+
<li><label for="soliloquy-type-<?php echo $id; ?>"><input id="soliloquy-type-<?php echo sanitize_html_class( $id ); ?>" type="radio" name="_soliloquy[type]" value="<?php echo $id; ?>" <?php checked( $this->get_config( 'type', $this->get_config_default( 'type' ) ), $id ); ?> /> <?php echo $title; ?></label></li>
|
433 |
+
<?php $i++; endforeach; ?>
|
434 |
+
<li class="soliloquy-type-spinner"><span class="spinner soliloquy-spinner"></span></li>
|
435 |
+
</ul>
|
436 |
+
<?php
|
437 |
+
|
438 |
+
// Output the display based on the type of slider being created.
|
439 |
+
echo '<div id="soliloquy-slider-main" class="soliloquy-clear">';
|
440 |
+
$this->images_display( $this->get_config( 'type', $this->get_config_default( 'type' ) ), $post );
|
441 |
+
echo '</div>';
|
442 |
+
|
443 |
+
}
|
444 |
+
|
445 |
+
/**
|
446 |
+
* Returns the types of sliders available.
|
447 |
+
*
|
448 |
+
* @since 1.0.0
|
449 |
+
*
|
450 |
+
* @param object $post The current post object.
|
451 |
+
* @return array Array of slider types to choose.
|
452 |
+
*/
|
453 |
+
public function get_soliloquy_types( $post ) {
|
454 |
+
|
455 |
+
$types = array(
|
456 |
+
'default' => __( 'Default', 'soliloquy' )
|
457 |
+
);
|
458 |
+
|
459 |
+
return apply_filters( 'soliloquy_slider_types', $types, $post );
|
460 |
+
|
461 |
+
}
|
462 |
+
|
463 |
+
/**
|
464 |
+
* Determines the Images tab display based on the type of slider selected.
|
465 |
+
*
|
466 |
+
* @since 1.0.0
|
467 |
+
*
|
468 |
+
* @param string $type The type of display to output.
|
469 |
+
* @param object $post The current post object.
|
470 |
+
*/
|
471 |
+
public function images_display( $type = 'default', $post ) {
|
472 |
+
|
473 |
+
// Output a unique hidden field for settings save testing for each type of slider.
|
474 |
+
echo '<input type="hidden" name="_soliloquy[type_' . $type . ']" value="1" />';
|
475 |
+
|
476 |
+
// Output the display based on the type of slider available.
|
477 |
+
switch ( $type ) {
|
478 |
+
case 'default' :
|
479 |
+
$this->do_default_display( $post );
|
480 |
+
break;
|
481 |
+
default:
|
482 |
+
do_action( 'soliloquy_display_' . $type, $post );
|
483 |
+
break;
|
484 |
+
}
|
485 |
+
|
486 |
+
}
|
487 |
+
|
488 |
+
/**
|
489 |
+
* Callback for displaying the default slider UI.
|
490 |
+
*
|
491 |
+
* @since 1.0.0
|
492 |
+
*
|
493 |
+
* @param object $post The current post object.
|
494 |
+
*/
|
495 |
+
public function do_default_display( $post ) {
|
496 |
+
|
497 |
+
?>
|
498 |
+
<div class="soliloquy-alert soliloquy-clear" style="margin-bottom:10px;">
|
499 |
+
<?php _e( '<em>Want to make your slider workflow even better?</em> By upgrading to Soliloquy Pro, you can get access to numerous other features, including: <strong>a fully featured slider widget</strong>, <strong>media library support</strong>, <strong>thumbnail and carousel support</strong>, <strong>dynamic sliders on the fly</strong>, <strong>complete slider API</strong>, <strong>powerful slider documentation</strong>, <strong>full mobile and Retina support</strong>, <strong>dedicated customer support</strong> and so much more! <a href="http://soliloquywp.com/lite/?utm_source=liteplugin&utm_medium=link&utm_campaign=WordPress" title="Click here to upgrade to Soliloquy Pro!" target="_blank">Click here to upgrade to Soliloquy Pro!</a>', 'soliloquy' ); ?>
|
500 |
+
</div>
|
501 |
+
<?php
|
502 |
+
|
503 |
+
// Output the custom media upload form.
|
504 |
+
Soliloquy_Media_Lite::get_instance()->media_upload_form();
|
505 |
+
|
506 |
+
// Prepare output data.
|
507 |
+
$slider_data = get_post_meta( $post->ID, '_sol_slider_data', true );
|
508 |
+
|
509 |
+
?>
|
510 |
+
<ul id="soliloquy-output" class="soliloquy-clear">
|
511 |
+
<?php if ( ! empty( $slider_data['slider'] ) ) : ?>
|
512 |
+
<?php foreach ( $slider_data['slider'] as $id => $data ) : ?>
|
513 |
+
<?php echo $this->get_slider_item( $id, $data, ( ! empty( $data['type'] ) ? $data['type'] : 'image' ), $post->ID ); ?>
|
514 |
+
<?php endforeach; ?>
|
515 |
+
<?php endif; ?>
|
516 |
+
</ul>
|
517 |
+
<?php $this->media_library( $post );
|
518 |
+
|
519 |
+
}
|
520 |
+
|
521 |
+
/**
|
522 |
+
* Inserts the meta icon for displaying useful slider meta like shortcode and template tag.
|
523 |
+
*
|
524 |
+
* @since 1.0.0
|
525 |
+
*
|
526 |
+
* @param object $post The current post object.
|
527 |
+
* @param array $slider_data Array of slider data for the current post.
|
528 |
+
* @return null Return early if this is an auto-draft.
|
529 |
+
*/
|
530 |
+
public function meta_helper( $post, $slider_data ) {
|
531 |
+
|
532 |
+
if ( isset( $post->post_status ) && 'auto-draft' == $post->post_status ) {
|
533 |
+
return;
|
534 |
+
}
|
535 |
+
|
536 |
+
// Check for our meta overlay helper.
|
537 |
+
$helper = get_post_meta( $post->ID, '_sol_just_published', true );
|
538 |
+
$class = '';
|
539 |
+
if ( $helper ) {
|
540 |
+
$class = 'soliloquy-helper-active';
|
541 |
+
delete_post_meta( $post->ID, '_sol_just_published' );
|
542 |
+
}
|
543 |
+
|
544 |
+
?>
|
545 |
+
<div class="soliloquy-meta-helper <?php echo $class; ?>">
|
546 |
+
<span class="soliloquy-meta-close-text"><?php _e( '(click the icon to open and close the overlay dialog)', 'soliloquy' ); ?></span>
|
547 |
+
<a href="#" class="soliloquy-meta-icon" title="<?php esc_attr__( 'Click here to view meta information about this slider.', 'soliloquy' ); ?>"></a>
|
548 |
+
<div class="soliloquy-meta-information">
|
549 |
+
<p><?php _e( 'You can place this slider anywhere into your posts, pages, custom post types or widgets by using <strong>one</strong> of the shortcode(s) below:', 'soliloquy' ); ?></p>
|
550 |
+
<code><?php echo '[soliloquy id="' . $post->ID . '"]'; ?></code>
|
551 |
+
<?php if ( ! empty( $slider_data['config']['slug'] ) ) : ?>
|
552 |
+
<br><code><?php echo '[soliloquy slug="' . $slider_data['config']['slug'] . '"]'; ?></code>
|
553 |
+
<?php endif; ?>
|
554 |
+
<p><?php _e( 'You can also place this slider into your template files by using <strong>one</strong> of the template tag(s) below:', 'soliloquy' ); ?></p>
|
555 |
+
<code><?php echo 'if ( function_exists( \'soliloquy\' ) ) { soliloquy( \'' . $post->ID . '\' ); }'; ?></code>
|
556 |
+
<?php if ( ! empty( $slider_data['config']['slug'] ) ) : ?>
|
557 |
+
<br><code><?php echo 'if ( function_exists( \'soliloquy\' ) ) { soliloquy( \'' . $slider_data['config']['slug'] . '\', \'slug\' ); }'; ?></code>
|
558 |
+
<?php endif; ?>
|
559 |
+
</div>
|
560 |
+
</div>
|
561 |
+
<?php
|
562 |
+
|
563 |
+
}
|
564 |
+
|
565 |
+
/**
|
566 |
+
* Callback for displaying the UI for selecting images from the media library to insert.
|
567 |
+
*
|
568 |
+
* @since 1.0.0
|
569 |
+
*
|
570 |
+
* @param object $post The current post object.
|
571 |
+
*/
|
572 |
+
public function media_library( $post ) {
|
573 |
+
|
574 |
+
?>
|
575 |
+
<div id="soliloquy-upload-ui-wrapper">
|
576 |
+
<div id="soliloquy-upload-ui" class="soliloquy-image-meta" style="display: none;">
|
577 |
+
<div class="media-modal wp-core-ui">
|
578 |
+
<a class="media-modal-close" href="#"><span class="media-modal-icon"></span></a>
|
579 |
+
<div class="media-modal-content">
|
580 |
+
<div class="media-frame soliloquy-media-frame wp-core-ui hide-menu soliloquy-meta-wrap">
|
581 |
+
<div class="media-frame-title">
|
582 |
+
<h1><?php _e( 'Insert Slides into Slider', 'soliloquy' ); ?></h1>
|
583 |
+
</div>
|
584 |
+
<div class="media-frame-router">
|
585 |
+
<div class="media-router">
|
586 |
+
<a href="#" class="media-menu-item active" data-soliloquy-content="image-slides"><?php _e( 'Image Slides', 'soliloquy' ); ?></a>
|
587 |
+
<?php do_action( 'soliloquy_modal_router', $post ); ?>
|
588 |
+
</div><!-- end .media-router -->
|
589 |
+
</div><!-- end .media-frame-router -->
|
590 |
+
<?php $this->image_slides_content( $post ); ?>
|
591 |
+
<?php do_action( 'soliloquy_modal_content', $post ); ?>
|
592 |
+
<div class="media-frame-toolbar">
|
593 |
+
<div class="media-toolbar">
|
594 |
+
<div class="media-toolbar-primary">
|
595 |
+
<a href="#" class="soliloquy-media-insert button media-button button-large button-primary media-button-insert" title="<?php esc_attr_e( 'Insert Slides into Slider', 'soliloquy' ); ?>"><?php _e( 'Insert Slides into Slider', 'soliloquy' ); ?></a>
|
596 |
+
</div><!-- end .media-toolbar-primary -->
|
597 |
+
</div><!-- end .media-toolbar -->
|
598 |
+
</div><!-- end .media-frame-toolbar -->
|
599 |
+
</div><!-- end .media-frame -->
|
600 |
+
</div><!-- end .media-modal-content -->
|
601 |
+
</div><!-- end .media-modal -->
|
602 |
+
<div class="media-modal-backdrop"></div>
|
603 |
+
</div><!-- end .soliloquy-image-meta -->
|
604 |
+
</div><!-- end #soliloquy-upload-ui-wrapper-->
|
605 |
+
<?php
|
606 |
+
|
607 |
+
}
|
608 |
+
|
609 |
+
/**
|
610 |
+
* Outputs the image slides content in the modal selection window.
|
611 |
+
*
|
612 |
+
* @since 1.0.0
|
613 |
+
*
|
614 |
+
* @param object $post The current post object.
|
615 |
+
*/
|
616 |
+
public function image_slides_content( $post ) {
|
617 |
+
|
618 |
+
?>
|
619 |
+
<div id="soliloquy-image-slides">
|
620 |
+
<div class="media-frame-content">
|
621 |
+
<div class="attachments-browser">
|
622 |
+
<div class="media-toolbar soliloquy-library-toolbar">
|
623 |
+
<div class="media-toolbar-primary">
|
624 |
+
<span class="spinner soliloquy-spinner"></span><input type="search" placeholder="<?php esc_attr_e( 'Search', 'soliloquy' ); ?>" id="soliloquy-slider-search" class="search" value="" />
|
625 |
+
</div>
|
626 |
+
<div class="media-toolbar-secondary">
|
627 |
+
<a class="button media-button button-large button-secodary soliloquy-load-library" href="#" data-soliloquy-offset="20"><?php _e( 'Load More Images from Library', 'soliloquy' ); ?></a><span class="spinner soliloquy-spinner"></span>
|
628 |
+
</div>
|
629 |
+
</div>
|
630 |
+
<?php $library = get_posts( array( 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_status' => 'inherit', 'posts_per_page' => 20 ) ); ?>
|
631 |
+
<?php if ( $library ) : ?>
|
632 |
+
<ul class="attachments soliloquy-slider">
|
633 |
+
<?php foreach ( (array) $library as $image ) :
|
634 |
+
$has_slider = get_post_meta( $image->ID, '_sol_has_slider', true );
|
635 |
+
$class = $has_slider && in_array( $post->ID, (array) $has_slider ) ? ' selected soliloquy-in-slider' : ''; ?>
|
636 |
+
<li class="attachment<?php echo $class; ?>" data-attachment-id="<?php echo absint( $image->ID ); ?>">
|
637 |
+
<div class="attachment-preview landscape">
|
638 |
+
<div class="thumbnail">
|
639 |
+
<div class="centered">
|
640 |
+
<?php $src = wp_get_attachment_image_src( $image->ID, 'thumbnail' ); ?>
|
641 |
+
<img src="<?php echo esc_url( $src[0] ); ?>" />
|
642 |
+
</div>
|
643 |
+
</div>
|
644 |
+
<a class="check" href="#"><div class="media-modal-icon"></div></a>
|
645 |
+
</div>
|
646 |
+
</li>
|
647 |
+
<?php endforeach; ?>
|
648 |
+
</ul><!-- end .soliloquy-meta -->
|
649 |
+
<?php endif; ?>
|
650 |
+
<div class="media-sidebar">
|
651 |
+
<div class="soliloquy-meta-sidebar">
|
652 |
+
<h3><?php _e( 'Helpful Tips', 'soliloquy' ); ?></h3>
|
653 |
+
<strong><?php _e( 'Selecting Images', 'soliloquy' ); ?></strong>
|
654 |
+
<p><?php _e( 'You can insert any image from your Media Library into your slider. If the image you want to insert is not shown on the screen, you can either click on the "Load More Images from Library" button to load more images or use the search box to find the images you are looking for.', 'soliloquy' ); ?></p>
|
655 |
+
</div><!-- end .soliloquy-meta-sidebar -->
|
656 |
+
</div><!-- end .media-sidebar -->
|
657 |
+
</div><!-- end .attachments-browser -->
|
658 |
+
</div><!-- end .media-frame-content -->
|
659 |
+
</div><!-- end #soliloquy-image-slides -->
|
660 |
+
<?php
|
661 |
+
|
662 |
+
}
|
663 |
+
|
664 |
+
/**
|
665 |
+
* Callback for displaying the UI for setting slider config options.
|
666 |
+
*
|
667 |
+
* @since 1.0.0
|
668 |
+
*
|
669 |
+
* @param object $post The current post object.
|
670 |
+
*/
|
671 |
+
public function config_tab( $post ) {
|
672 |
+
|
673 |
+
?>
|
674 |
+
<div id="soliloquy-config">
|
675 |
+
<p class="soliloquy-intro"><?php _e( 'The settings below adjust the basic configuration options for the slider display.', 'soliloquy' ); ?></p>
|
676 |
+
<table class="form-table">
|
677 |
+
<tbody>
|
678 |
+
<tr id="soliloquy-config-slider-theme-box">
|
679 |
+
<th scope="row">
|
680 |
+
<label for="soliloquy-config-slider-theme"><?php _e( 'Slider Theme', 'soliloquy' ); ?></label>
|
681 |
+
</th>
|
682 |
+
<td>
|
683 |
+
<select id="soliloquy-config-slider-theme" name="_soliloquy[slider_theme]">
|
684 |
+
<?php foreach ( (array) $this->get_slider_themes() as $i => $data ) : ?>
|
685 |
+
<option value="<?php echo $data['value']; ?>"<?php selected( $data['value'], $this->get_config( 'slider_theme', $this->get_config_default( 'slider_theme' ) ) ); ?>><?php echo $data['name']; ?></option>
|
686 |
+
<?php endforeach; ?>
|
687 |
+
</select>
|
688 |
+
<p class="description"><?php _e( 'Sets the theme for the slider display.', 'soliloquy' ); ?></p>
|
689 |
+
</td>
|
690 |
+
</tr>
|
691 |
+
<tr id="soliloquy-config-slider-size-box">
|
692 |
+
<th scope="row">
|
693 |
+
<label for="soliloquy-config-slider-width"><?php _e( 'Slider Dimensions', 'soliloquy' ); ?></label>
|
694 |
+
</th>
|
695 |
+
<td>
|
696 |
+
<input id="soliloquy-config-slider-width" type="number" name="_soliloquy[slider_width]" value="<?php echo $this->get_config( 'slider_width', $this->get_config_default( 'slider_width' ) ); ?>" /> × <input id="soliloquy-config-slider-height" type="number" name="_soliloquy[slider_height]" value="<?php echo $this->get_config( 'slider_height', $this->get_config_default( 'slider_height' ) ); ?>" /> <span class="soliloquy-unit"><?php _e( 'px', 'soliloquy' ); ?></span>
|
697 |
+
<p class="description"><?php _e( 'Sets the width and height dimensions for the slider.', 'soliloquy' ); ?></p>
|
698 |
+
</td>
|
699 |
+
</tr>
|
700 |
+
<tr id="soliloquy-config-transition-box">
|
701 |
+
<th scope="row">
|
702 |
+
<label for="soliloquy-config-transition"><?php _e( 'Slider Transition', 'soliloquy' ); ?></label>
|
703 |
+
</th>
|
704 |
+
<td>
|
705 |
+
<select id="soliloquy-config-transition" name="_soliloquy[transition]">
|
706 |
+
<?php foreach ( (array) $this->get_slider_transitions() as $i => $data ) : ?>
|
707 |
+
<option value="<?php echo $data['value']; ?>"<?php selected( $data['value'], $this->get_config( 'transition', $this->get_config_default( 'transition' ) ) ); ?>><?php echo $data['name']; ?></option>
|
708 |
+
<?php endforeach; ?>
|
709 |
+
</select>
|
710 |
+
<p class="description"><?php _e( 'Sets the type of transition for the slider.', 'soliloquy' ); ?></p>
|
711 |
+
</td>
|
712 |
+
</tr>
|
713 |
+
<tr id="soliloquy-config-slider-duration-box">
|
714 |
+
<th scope="row">
|
715 |
+
<label for="soliloquy-config-duration"><?php _e( 'Slider Transition Duration', 'soliloquy' ); ?></label>
|
716 |
+
</th>
|
717 |
+
<td>
|
718 |
+
<input id="soliloquy-config-duration" type="number" name="_soliloquy[duration]" value="<?php echo $this->get_config( 'duration', $this->get_config_default( 'duration' ) ); ?>" /> <span class="soliloquy-unit"><?php _e( 'ms', 'soliloquy' ); ?></span>
|
719 |
+
<p class="description"><?php _e( 'Sets the amount of time between each slide transition <strong>(in milliseconds)</strong>.', 'soliloquy' ); ?></p>
|
720 |
+
</td>
|
721 |
+
</tr>
|
722 |
+
<tr id="soliloquy-config-slider-speed-box">
|
723 |
+
<th scope="row">
|
724 |
+
<label for="soliloquy-config-speed"><?php _e( 'Slider Transition Speed', 'soliloquy' ); ?></label>
|
725 |
+
</th>
|
726 |
+
<td>
|
727 |
+
<input id="soliloquy-config-speed" type="number" name="_soliloquy[speed]" value="<?php echo $this->get_config( 'speed', $this->get_config_default( 'speed' ) ); ?>" /> <span class="soliloquy-unit"><?php _e( 'ms', 'soliloquy' ); ?></span>
|
728 |
+
<p class="description"><?php _e( 'Sets the transition speed when moving from one slide to the next <strong>(in milliseconds)</strong>.', 'soliloquy' ); ?></p>
|
729 |
+
</td>
|
730 |
+
</tr>
|
731 |
+
<tr id="soliloquy-config-gutter-box">
|
732 |
+
<th scope="row">
|
733 |
+
<label for="soliloquy-config-gutter"><?php _e( 'Slider Gutter', 'soliloquy' ); ?></label>
|
734 |
+
</th>
|
735 |
+
<td>
|
736 |
+
<input id="soliloquy-config-gutter" type="number" name="_soliloquy[gutter]" value="<?php echo $this->get_config( 'gutter', $this->get_config_default( 'gutter' ) ); ?>" /> <span class="soliloquy-unit"><?php _e( 'px', 'soliloquy' ); ?></span>
|
737 |
+
<p class="description"><?php _e( 'Sets the gutter between the slider and your content based on slider position.', 'soliloquy' ); ?></p>
|
738 |
+
</td>
|
739 |
+
</tr>
|
740 |
+
<tr id="soliloquy-config-slider-box">
|
741 |
+
<th scope="row">
|
742 |
+
<label for="soliloquy-config-slider"><?php _e( 'Crop Images in Slider?', 'soliloquy' ); ?></label>
|
743 |
+
</th>
|
744 |
+
<td>
|
745 |
+
<input id="soliloquy-config-slider" type="checkbox" name="_soliloquy[slider]" value="<?php echo $this->get_config( 'slider', $this->get_config_default( 'slider' ) ); ?>" <?php checked( $this->get_config( 'slider', $this->get_config_default( 'slider' ) ), 1 ); ?> />
|
746 |
+
<span class="description"><?php _e( 'Enables or disables image cropping based on slider dimensions <strong>(recommended)</strong>.', 'soliloquy' ); ?></span>
|
747 |
+
</td>
|
748 |
+
</tr>
|
749 |
+
<?php do_action( 'soliloquy_config_box', $post ); ?>
|
750 |
+
</tbody>
|
751 |
+
</table>
|
752 |
+
<div class="soliloquy-alert soliloquy-clear">
|
753 |
+
<?php _e( '<em>Want to do even more with your slider display?</em> By upgrading to Soliloquy Pro, you can get access to numerous other slider display features, including: <strong>full YouTube, Vimeo and Wistia video integration</strong>, <strong>custom HTML slides that can hold ANYTHING</strong>, <strong>custom slider themes</strong>, <strong>mobile specific image assets for blazing fast load times</strong>, <strong>control over navigation arrows and dots</strong>, <strong>pause/play functionality</strong>, <strong>hardware accelerated CSS transitions</strong>, <strong>slider randomization</strong> and so much more! <a href="http://soliloquywp.com/lite/?utm_source=liteplugin&utm_medium=link&utm_campaign=WordPress" title="Click here to upgrade to Soliloquy Pro!" target="_blank">Click here to upgrade to Soliloquy Pro!</a>', 'soliloquy' ); ?>
|
754 |
+
</div>
|
755 |
+
</div>
|
756 |
+
<?php
|
757 |
+
|
758 |
+
}
|
759 |
+
|
760 |
+
/**
|
761 |
+
* Callback for displaying the UI for setting slider miscellaneous options.
|
762 |
+
*
|
763 |
+
* @since 1.0.0
|
764 |
+
*
|
765 |
+
* @param object $post The current post object.
|
766 |
+
*/
|
767 |
+
public function misc_tab( $post ) {
|
768 |
+
|
769 |
+
?>
|
770 |
+
<div id="soliloquy-misc">
|
771 |
+
<p class="soliloquy-intro"><?php _e( 'The settings below adjust the miscellaneous settings for the slider lightbox display.', 'soliloquy' ); ?></p>
|
772 |
+
<table class="form-table">
|
773 |
+
<tbody>
|
774 |
+
<tr id="soliloquy-config-title-box">
|
775 |
+
<th scope="row">
|
776 |
+
<label for="soliloquy-config-title"><?php _e( 'Slider Title', 'soliloquy' ); ?></label>
|
777 |
+
</th>
|
778 |
+
<td>
|
779 |
+
<input id="soliloquy-config-title" type="text" name="_soliloquy[title]" value="<?php echo $this->get_config( 'title', $this->get_config_default( 'title' ) ); ?>" />
|
780 |
+
<p class="description"><?php _e( 'Internal slider title for identification in the admin.', 'soliloquy' ); ?></p>
|
781 |
+
</td>
|
782 |
+
</tr>
|
783 |
+
<tr id="soliloquy-config-slug-box">
|
784 |
+
<th scope="row">
|
785 |
+
<label for="soliloquy-config-slug"><?php _e( 'Slider Slug', 'soliloquy' ); ?></label>
|
786 |
+
</th>
|
787 |
+
<td>
|
788 |
+
<input id="soliloquy-config-slug" type="text" name="_soliloquy[slug]" value="<?php echo $this->get_config( 'slug', $this->get_config_default( 'slug' ) ); ?>" />
|
789 |
+
<p class="description"><?php _e( '<strong>Unique</strong> internal slider slug for identification and advanced slider queries.', 'soliloquy' ); ?></p>
|
790 |
+
</td>
|
791 |
+
</tr>
|
792 |
+
<tr id="soliloquy-config-classes-box">
|
793 |
+
<th scope="row">
|
794 |
+
<label for="soliloquy-config-classes"><?php _e( 'Custom Slider Classes', 'soliloquy' ); ?></label>
|
795 |
+
</th>
|
796 |
+
<td>
|
797 |
+
<textarea id="soliloquy-config-classes" rows="5" cols="75" name="_soliloquy[classes]" placeholder="<?php _e( 'Enter custom slider CSS classes here, one per line.', 'soliloquy' ); ?>"><?php echo implode( "\n", (array) $this->get_config( 'classes', $this->get_config_default( 'classes' ) ) ); ?></textarea>
|
798 |
+
<p class="description"><?php _e( 'Adds custom CSS classes to this slider. Enter one class per line.', 'soliloquy' ); ?></p>
|
799 |
+
</td>
|
800 |
+
</tr>
|
801 |
+
<?php do_action( 'soliloquy_misc_box', $post ); ?>
|
802 |
+
</tbody>
|
803 |
+
</table>
|
804 |
+
<div class="soliloquy-alert soliloquy-clear">
|
805 |
+
<?php _e( '<em>Want to take your sliders further?</em> By upgrading to Soliloquy Pro, you can get access to numerous other features, including: <strong>a fully-integrated import/export module for your sliders</strong>, <strong>custom CSS controls for each slider</strong>, <strong>lightbox and featured content support</strong> and so much more! <a href="http://soliloquywp.com/lite/?utm_source=liteplugin&utm_medium=link&utm_campaign=WordPress" title="Click here to upgrade to Soliloquy Pro!" target="_blank">Click here to upgrade to Soliloquy Pro!</a>', 'soliloquy' ); ?>
|
806 |
+
</div>
|
807 |
+
</div>
|
808 |
+
<?php
|
809 |
+
|
810 |
+
}
|
811 |
+
|
812 |
+
/**
|
813 |
+
* Callback for saving values from Soliloquy metaboxes.
|
814 |
+
*
|
815 |
+
* @since 1.0.0
|
816 |
+
*
|
817 |
+
* @param int $post_id The current post ID.
|
818 |
+
* @param object $post The current post object.
|
819 |
+
*/
|
820 |
+
public function save_meta_boxes( $post_id, $post ) {
|
821 |
+
|
822 |
+
// Bail out if we fail a security check.
|
823 |
+
if ( ! isset( $_POST['soliloquy'] ) || ! wp_verify_nonce( $_POST['soliloquy'], 'soliloquy' ) || ! isset( $_POST['_soliloquy'] ) ) {
|
824 |
+
return;
|
825 |
+
}
|
826 |
+
|
827 |
+
// Bail out if running an autosave, ajax, cron or revision.
|
828 |
+
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
829 |
+
return;
|
830 |
+
}
|
831 |
+
|
832 |
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
833 |
+
return;
|
834 |
+
}
|
835 |
+
|
836 |
+
if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
|
837 |
+
return;
|
838 |
+
}
|
839 |
+
|
840 |
+
if ( wp_is_post_revision( $post_id ) ) {
|
841 |
+
return;
|
842 |
+
}
|
843 |
+
|
844 |
+
// Bail out if the user doesn't have the correct permissions to update the slider.
|
845 |
+
if ( ! current_user_can( 'edit_post', $post_id ) ) {
|
846 |
+
return;
|
847 |
+
}
|
848 |
+
|
849 |
+
// If the post has just been published for the first time, set meta field for the slider meta overlay helper.
|
850 |
+
if ( isset( $post->post_date ) && isset( $post->post_modified ) && $post->post_date === $post->post_modified ) {
|
851 |
+
update_post_meta( $post_id, '_sol_just_published', true );
|
852 |
+
}
|
853 |
+
|
854 |
+
// Sanitize all user inputs.
|
855 |
+
$settings = get_post_meta( $post_id, '_sol_slider_data', true );
|
856 |
+
if ( empty( $settings ) ) {
|
857 |
+
$settings = array();
|
858 |
+
}
|
859 |
+
|
860 |
+
// If the ID of the slider is not set or is lost, replace it now.
|
861 |
+
if ( empty( $settings['id'] ) || ! $settings['id'] ) {
|
862 |
+
$settings['id'] = $post_id;
|
863 |
+
}
|
864 |
+
|
865 |
+
// Save the config settings.
|
866 |
+
$settings['config']['type'] = isset( $_POST['_soliloquy']['type'] ) ? $_POST['_soliloquy']['type'] : $this->get_config_default( 'type' );
|
867 |
+
$settings['config']['slider_theme'] = preg_replace( '#[^a-z0-9-_]#', '', $_POST['_soliloquy']['slider_theme'] );
|
868 |
+
$settings['config']['slider_width'] = absint( $_POST['_soliloquy']['slider_width'] );
|
869 |
+
$settings['config']['slider_height'] = absint( $_POST['_soliloquy']['slider_height'] );
|
870 |
+
$settings['config']['transition'] = preg_replace( '#[^a-z0-9-_]#', '', $_POST['_soliloquy']['transition'] );
|
871 |
+
$settings['config']['duration'] = absint( $_POST['_soliloquy']['duration'] );
|
872 |
+
$settings['config']['speed'] = absint( $_POST['_soliloquy']['speed'] );
|
873 |
+
$settings['config']['gutter'] = absint( $_POST['_soliloquy']['gutter'] );
|
874 |
+
$settings['config']['slider'] = isset( $_POST['_soliloquy']['slider'] ) ? 1 : 0;
|
875 |
+
$settings['config']['classes'] = explode( "\n", $_POST['_soliloquy']['classes'] );
|
876 |
+
$settings['config']['title'] = trim( strip_tags( $_POST['_soliloquy']['title'] ) );
|
877 |
+
$settings['config']['slug'] = sanitize_text_field( $_POST['_soliloquy']['slug'] );
|
878 |
+
|
879 |
+
// If on an soliloquy post type, map the title and slug of the post object to the custom fields if no value exists yet.
|
880 |
+
if ( isset( $post->post_type ) && 'soliloquy' == $post->post_type ) {
|
881 |
+
if ( empty( $settings['config']['title'] ) ) {
|
882 |
+
$settings['config']['title'] = trim( strip_tags( $post->post_title ) );
|
883 |
+
}
|
884 |
+
|
885 |
+
if ( empty( $settings['config']['slug'] ) ) {
|
886 |
+
$settings['config']['slug'] = sanitize_text_field( $post->post_name );
|
887 |
+
}
|
888 |
+
}
|
889 |
+
|
890 |
+
// Provide a filter to override settings.
|
891 |
+
$settings = apply_filters( 'soliloquy_save_settings', $settings, $post_id, $post );
|
892 |
+
|
893 |
+
// Update the post meta.
|
894 |
+
update_post_meta( $post_id, '_sol_slider_data', $settings );
|
895 |
+
|
896 |
+
// Change states of images in slider from pending to active.
|
897 |
+
$this->change_slider_states( $post_id );
|
898 |
+
|
899 |
+
// If the crop option is checked, crop images accordingly.
|
900 |
+
if ( isset( $settings['config']['slider'] ) && $settings['config']['slider'] ) {
|
901 |
+
$args = apply_filters( 'soliloquy_crop_image_args',
|
902 |
+
array(
|
903 |
+
'position' => 'c',
|
904 |
+
'width' => $this->get_config( 'slider_width', $this->get_config_default( 'slider_width' ) ),
|
905 |
+
'height' => $this->get_config( 'slider_height', $this->get_config_default( 'slider_height' ) ),
|
906 |
+
'quality' => 100,
|
907 |
+
'retina' => false
|
908 |
+
)
|
909 |
+
);
|
910 |
+
$this->crop_images( $args, $post_id );
|
911 |
+
}
|
912 |
+
|
913 |
+
// If the mobile option is checked, crop images accordingly.
|
914 |
+
if ( isset( $settings['config']['slider'] ) && $settings['config']['slider'] ) {
|
915 |
+
if ( isset( $settings['config']['mobile'] ) && $settings['config']['mobile'] ) {
|
916 |
+
$args = apply_filters( 'soliloquy_crop_image_args',
|
917 |
+
array(
|
918 |
+
'position' => 'c',
|
919 |
+
'width' => $this->get_config( 'mobile_width', $this->get_config_default( 'mobile_width' ) ),
|
920 |
+
'height' => $this->get_config( 'mobile_height', $this->get_config_default( 'mobile_height' ) ),
|
921 |
+
'quality' => 100,
|
922 |
+
'retina' => false
|
923 |
+
)
|
924 |
+
);
|
925 |
+
$this->crop_images( $args, $post_id );
|
926 |
+
}
|
927 |
+
}
|
928 |
+
|
929 |
+
// Fire a hook for addons that need to utilize the cropping feature.
|
930 |
+
do_action( 'soliloquy_saved_settings', $settings, $post_id, $post );
|
931 |
+
|
932 |
+
// Finally, flush all slider caches to ensure everything is up to date.
|
933 |
+
$this->flush_slider_caches( $post_id, $settings['config']['slug'] );
|
934 |
+
|
935 |
+
}
|
936 |
+
|
937 |
+
/**
|
938 |
+
* Helper method for retrieving the slider layout for an item in the admin.
|
939 |
+
*
|
940 |
+
* @since 1.0.0
|
941 |
+
*
|
942 |
+
* @param int $id The ID of the item to retrieve.
|
943 |
+
* @param array $data Array of data for the item.
|
944 |
+
* @param string $type The type of slide to retrieve.
|
945 |
+
* @param int $post_id The current post ID.
|
946 |
+
* @return string The HTML output for the slider item.
|
947 |
+
*/
|
948 |
+
public function get_slider_item( $id, $data, $type, $post_id = 0 ) {
|
949 |
+
|
950 |
+
switch ( $type ) {
|
951 |
+
case 'image' :
|
952 |
+
$item = $this->get_slider_image( $id, $data, $post_id );
|
953 |
+
break;
|
954 |
+
case 'video' :
|
955 |
+
$item = $this->get_slider_video( $id, $data, $post_id );
|
956 |
+
break;
|
957 |
+
case 'html' :
|
958 |
+
$item = $this->get_slider_html( $id, $data, $post_id );
|
959 |
+
break;
|
960 |
+
}
|
961 |
+
|
962 |
+
return apply_filters( 'soliloquy_slide_item', $item, $id, $data, $type, $post_id );
|
963 |
+
|
964 |
+
}
|
965 |
+
|
966 |
+
/**
|
967 |
+
* Helper method for retrieving the slider image layout in the admin.
|
968 |
+
*
|
969 |
+
* @since 1.0.0
|
970 |
+
*
|
971 |
+
* @param int $id The ID of the item to retrieve.
|
972 |
+
* @param array $data Array of data for the item.
|
973 |
+
* @param int $post_id The current post ID.
|
974 |
+
* @return string The HTML output for the slider item.
|
975 |
+
*/
|
976 |
+
public function get_slider_image( $id, $data, $post_id = 0 ) {
|
977 |
+
|
978 |
+
$thumbnail = wp_get_attachment_image_src( $id, 'thumbnail' ); ob_start(); ?>
|
979 |
+
<li id="<?php echo $id; ?>" class="soliloquy-slide soliloquy-image soliloquy-status-<?php echo $data['status']; ?>" data-soliloquy-slide="<?php echo $id; ?>">
|
980 |
+
<img src="<?php echo esc_url( $thumbnail[0] ); ?>" alt="<?php esc_attr_e( $data['alt'] ); ?>" />
|
981 |
+
<a href="#" class="soliloquy-remove-slide" title="<?php esc_attr_e( 'Remove Image Slide from Slider?', 'soliloquy' ); ?>"></a>
|
982 |
+
<a href="#" class="soliloquy-modify-slide" title="<?php esc_attr_e( 'Modify Image Slide', 'soliloquy' ); ?>"></a>
|
983 |
+
<?php echo $this->get_slider_image_meta( $id, $data, $post_id ); ?>
|
984 |
+
</li>
|
985 |
+
<?php
|
986 |
+
return ob_get_clean();
|
987 |
+
|
988 |
+
}
|
989 |
+
|
990 |
+
/**
|
991 |
+
* Helper method for retrieving the slider image metadata.
|
992 |
+
*
|
993 |
+
* @since 1.0.0
|
994 |
+
*
|
995 |
+
* @param int $id The ID of the item to retrieve.
|
996 |
+
* @param array $data Array of data for the item.
|
997 |
+
* @param int $post_id The current post ID.
|
998 |
+
* @return string The HTML output for the slider item.
|
999 |
+
*/
|
1000 |
+
public function get_slider_image_meta( $id, $data, $post_id ) {
|
1001 |
+
|
1002 |
+
ob_start();
|
1003 |
+
?>
|
1004 |
+
<div id="soliloquy-meta-<?php echo $id; ?>" class="soliloquy-meta-container" style="display:none;">
|
1005 |
+
<div class="media-modal wp-core-ui">
|
1006 |
+
<a class="media-modal-close" href="#"><span class="media-modal-icon"></span></a>
|
1007 |
+
<div class="media-modal-content">
|
1008 |
+
<div class="media-frame soliloquy-media-frame wp-core-ui hide-menu hide-router soliloquy-meta-wrap">
|
1009 |
+
<div class="media-frame-title">
|
1010 |
+
<h1><?php _e( 'Edit Metadata', 'soliloquy' ); ?></h1>
|
1011 |
+
</div>
|
1012 |
+
<div class="media-frame-content">
|
1013 |
+
<div class="attachments-browser">
|
1014 |
+
<div class="soliloquy-meta attachments">
|
1015 |
+
<?php do_action( 'soliloquy_before_image_meta_table', $id, $data, $post_id ); ?>
|
1016 |
+
<table id="soliloquy-meta-table-<?php echo $id; ?>" class="form-table soliloquy-meta-table" data-soliloquy-meta-id="<?php echo $id; ?>">
|
1017 |
+
<tbody>
|
1018 |
+
<?php do_action( 'soliloquy_before_image_meta_settings', $id, $data, $post_id ); ?>
|
1019 |
+
<tr id="soliloquy-title-box-<?php echo $id; ?>" valign="middle">
|
1020 |
+
<th scope="row"><label for="soliloquy-title-<?php echo $id; ?>"><?php _e( 'Image Title', 'soliloquy' ); ?></label></th>
|
1021 |
+
<td>
|
1022 |
+
<input id="soliloquy-title-<?php echo $id; ?>" class="soliloquy-title" type="text" name="_soliloquy[meta_title]" value="<?php echo ( ! empty( $data['title'] ) ? esc_attr( $data['title'] ) : '' ); ?>" data-soliloquy-meta="title" />
|
1023 |
+
<p class="description"><?php _e( 'Sets the image title attribute for the image.', 'soliloquy' ); ?></p>
|
1024 |
+
</td>
|
1025 |
+
</tr>
|
1026 |
+
<?php do_action( 'soliloquy_before_image_meta_alt', $id, $data, $post_id ); ?>
|
1027 |
+
<tr id="soliloquy-alt-box-<?php echo $id; ?>" valign="middle">
|
1028 |
+
<th scope="row"><label for="soliloquy-alt-<?php echo $id; ?>"><?php _e( 'Image Alt Text', 'soliloquy' ); ?></label></th>
|
1029 |
+
<td>
|
1030 |
+
<input id="soliloquy-alt-<?php echo $id; ?>" class="soliloquy-alt" type="text" name="_soliloquy[meta_alt]" value="<?php echo ( ! empty( $data['alt'] ) ? esc_attr( $data['alt'] ) : '' ); ?>" data-soliloquy-meta="alt" />
|
1031 |
+
<p class="description"><?php _e( 'The image alt text is used for SEO. You should probably fill this one out!', 'soliloquy' ); ?></p>
|
1032 |
+
</td>
|
1033 |
+
</tr>
|
1034 |
+
<?php do_action( 'soliloquy_before_image_meta_link', $id, $data, $post_id ); ?>
|
1035 |
+
<tr id="soliloquy-link-box-<?php echo $id; ?>" class="soliloquy-link-cell" valign="middle">
|
1036 |
+
<th scope="row"><label for="soliloquy-link-<?php echo $id; ?>"><?php _e( 'Image Hyperlink', 'soliloquy' ); ?></label></th>
|
1037 |
+
<td>
|
1038 |
+
<input id="soliloquy-link-<?php echo $id; ?>" class="soliloquy-link" type="text" name="_soliloquy[meta_link]" value="<?php echo ( ! empty( $data['link'] ) ? esc_url( $data['link'] ) : '' ); ?>" data-soliloquy-meta="link" />
|
1039 |
+
<p class="description"><?php _e( 'The image hyperlink determines what opens once the image is clicked. If left empty, no link will be added.', 'soliloquy' ); ?></p>
|
1040 |
+
</td>
|
1041 |
+
</tr>
|
1042 |
+
<?php do_action( 'soliloquy_before_image_meta_caption', $id, $data, $post_id ); ?>
|
1043 |
+
<tr id="soliloquy-caption-box-<?php echo $id; ?>" valign="middle">
|
1044 |
+
<th scope="row"><label for="soliloquy-caption-<?php echo $id; ?>"><?php _e( 'Image Caption', 'soliloquy' ); ?></label></th>
|
1045 |
+
<td>
|
1046 |
+
<?php wp_editor( ( ! empty( $data['caption'] ) ? $data['caption'] : '' ), 'soliloquy-caption-' . $id, array( 'media_buttons' => false, 'wpautop' => false, 'tinymce' => false, 'textarea_name' => '_soliloquy[meta_caption]', 'quicktags' => array( 'buttons' => 'strong,em,link,ul,ol,li,close' ) ) ); ?>
|
1047 |
+
<p class="description"><?php _e( 'Image captions can take any type of HTML.', 'soliloquy' ); ?></p>
|
1048 |
+
</td>
|
1049 |
+
</tr>
|
1050 |
+
<?php do_action( 'soliloquy_after_image_meta_settings', $id, $data, $post_id ); ?>
|
1051 |
+
</tbody>
|
1052 |
+
</table>
|
1053 |
+
<?php do_action( 'soliloquy_after_image_meta_table', $id, $data, $post_id ); ?>
|
1054 |
+
</div><!-- end .soliloquy-meta -->
|
1055 |
+
<div class="media-sidebar">
|
1056 |
+
<div class="soliloquy-meta-sidebar">
|
1057 |
+
<h3><?php _e( 'Helpful Tips', 'soliloquy' ); ?></h3>
|
1058 |
+
<strong><?php _e( 'Image Titles', 'soliloquy' ); ?></strong>
|
1059 |
+
<p><?php _e( 'Image titles can take any type of HTML. You can adjust the position of the titles in the main Lightbox settings.', 'soliloquy' ); ?></p>
|
1060 |
+
<strong><?php _e( 'Image Hyperlinks', 'soliloquy' ); ?></strong>
|
1061 |
+
<p><?php _e( 'The image hyperlink field is used when you click on an image in the slider. It determines what is displayed in the lightbox view. It could be a larger version of the image, a video, or some other form of content.', 'soliloquy' ); ?></p>
|
1062 |
+
<strong><?php _e( 'Saving and Exiting', 'soliloquy' ); ?></strong>
|
1063 |
+
<p class="no-margin"><?php _e( 'Click on the button below to save your image metadata. You can close this window by either clicking on the "X" above or hitting the <code>esc</code> key on your keyboard.', 'soliloquy' ); ?></p>
|
1064 |
+
</div><!-- end .soliloquy-meta-sidebar -->
|
1065 |
+
</div><!-- end .media-sidebar -->
|
1066 |
+
</div><!-- end .attachments-browser -->
|
1067 |
+
</div><!-- end .media-frame-content -->
|
1068 |
+
<div class="media-frame-toolbar">
|
1069 |
+
<div class="media-toolbar">
|
1070 |
+
<div class="media-toolbar-primary">
|
1071 |
+
<a href="#" class="soliloquy-meta-submit button media-button button-large button-primary media-button-insert" title="<?php esc_attr_e( 'Save Metadata', 'soliloquy' ); ?>" data-soliloquy-item="<?php echo $id; ?>"><?php _e( 'Save Metadata', 'soliloquy' ); ?></a>
|
1072 |
+
</div><!-- end .media-toolbar-primary -->
|
1073 |
+
</div><!-- end .media-toolbar -->
|
1074 |
+
</div><!-- end .media-frame-toolbar -->
|
1075 |
+
</div><!-- end .media-frame -->
|
1076 |
+
</div><!-- end .media-modal-content -->
|
1077 |
+
</div><!-- end .media-modal -->
|
1078 |
+
<div class="media-modal-backdrop"></div>
|
1079 |
+
</div>
|
1080 |
+
<?php
|
1081 |
+
return ob_get_clean();
|
1082 |
+
|
1083 |
+
}
|
1084 |
+
|
1085 |
+
/**
|
1086 |
+
* Helper method to change a slider state from pending to active. This is done
|
1087 |
+
* automatically on post save. For previewing sliders before publishing,
|
1088 |
+
* simply click the "Preview" button and Soliloquy will load all the images present
|
1089 |
+
* in the slider at that time.
|
1090 |
+
*
|
1091 |
+
* @since 1.0.0
|
1092 |
+
*
|
1093 |
+
* @param int $id The current post ID.
|
1094 |
+
*/
|
1095 |
+
public function change_slider_states( $post_id ) {
|
1096 |
+
|
1097 |
+
$slider_data = get_post_meta( $post_id, '_sol_slider_data', true );
|
1098 |
+
if ( ! empty( $slider_data['slider'] ) ) {
|
1099 |
+
foreach ( (array) $slider_data['slider'] as $id => $item ) {
|
1100 |
+
$slider_data['slider'][$id]['status'] = 'active';
|
1101 |
+
}
|
1102 |
+
}
|
1103 |
+
|
1104 |
+
update_post_meta( $post_id, '_sol_slider_data', $slider_data );
|
1105 |
+
|
1106 |
+
}
|
1107 |
+
|
1108 |
+
/**
|
1109 |
+
* Helper method to crop slider images to the specified sizes.
|
1110 |
+
*
|
1111 |
+
* @since 1.0.0
|
1112 |
+
*
|
1113 |
+
* @param array $args Array of args used when cropping the images.
|
1114 |
+
* @param int $post_id The current post ID.
|
1115 |
+
*/
|
1116 |
+
public function crop_images( $args, $post_id ) {
|
1117 |
+
|
1118 |
+
// Gather all available images to crop.
|
1119 |
+
$slider_data = get_post_meta( $post_id, '_sol_slider_data', true );
|
1120 |
+
$images = ! empty( $slider_data['slider'] ) ? $slider_data['slider'] : false;
|
1121 |
+
$common = Soliloquy_Common_Lite::get_instance();
|
1122 |
+
|
1123 |
+
// Loop through the images and crop them.
|
1124 |
+
if ( $images ) {
|
1125 |
+
// Increase the time limit to account for large image sets and suspend cache invalidations.
|
1126 |
+
set_time_limit( 0 );
|
1127 |
+
wp_suspend_cache_invalidation( true );
|
1128 |
+
|
1129 |
+
foreach ( $images as $id => $item ) {
|
1130 |
+
// Get the full image attachment. If it does not return the data we need, skip over it.
|
1131 |
+
$image = wp_get_attachment_image_src( $id, 'full' );
|
1132 |
+
if ( ! is_array( $image ) ) {
|
1133 |
+
// Check for video/HTML slide and possibly use a thumbnail instead.
|
1134 |
+
if ( ( isset( $item['type'] ) && 'video' == $item['type'] || isset( $item['type'] ) && 'html' == $item['type'] ) && ! empty( $item['thumb'] ) ) {
|
1135 |
+
$image = $item['thumb'];
|
1136 |
+
} else {
|
1137 |
+
continue;
|
1138 |
+
}
|
1139 |
+
} else {
|
1140 |
+
$image = $image[0];
|
1141 |
+
}
|
1142 |
+
|
1143 |
+
// Allow image to be filtered to use a different thumbnail than the main image.
|
1144 |
+
$image = apply_filters( 'soliloquy_cropped_image', $image, $id, $item, $args, $post_id );
|
1145 |
+
|
1146 |
+
// Generate the cropped image.
|
1147 |
+
$cropped_image = $common->resize_image( $image, $args['width'], $args['height'], true, $args['position'], $args['quality'], $args['retina'] );
|
1148 |
+
|
1149 |
+
// If there is an error, possibly output error message, otherwise woot!
|
1150 |
+
if ( is_wp_error( $cropped_image ) ) {
|
1151 |
+
// If debugging is defined, print out the error.
|
1152 |
+
if ( defined( 'SOLILOQUY_CROP_DEBUG' ) && SOLILOQUY_CROP_DEBUG ) {
|
1153 |
+
echo '<pre>' . var_export( $cropped_image->get_error_message(), true ) . '</pre>';
|
1154 |
+
}
|
1155 |
+
}
|
1156 |
+
}
|
1157 |
+
|
1158 |
+
// Turn off cache suspension and flush the cache to remove any cache inconsistencies.
|
1159 |
+
wp_suspend_cache_invalidation( false );
|
1160 |
+
wp_cache_flush();
|
1161 |
+
}
|
1162 |
+
|
1163 |
+
}
|
1164 |
+
|
1165 |
+
/**
|
1166 |
+
* Helper method to flush slider caches once a slider is updated.
|
1167 |
+
*
|
1168 |
+
* @since 1.0.0
|
1169 |
+
*
|
1170 |
+
* @param int $post_id The current post ID.
|
1171 |
+
* @param string $slug The unique slider slug.
|
1172 |
+
*/
|
1173 |
+
public function flush_slider_caches( $post_id, $slug ) {
|
1174 |
+
|
1175 |
+
Soliloquy_Common_Lite::get_instance()->flush_slider_caches( $post_id, $slug );
|
1176 |
+
|
1177 |
+
}
|
1178 |
+
|
1179 |
+
/**
|
1180 |
+
* Helper method for retrieving config values.
|
1181 |
+
*
|
1182 |
+
* @since 1.0.0
|
1183 |
+
*
|
1184 |
+
* @global int $id The current post ID.
|
1185 |
+
* @global object $post The current post object.
|
1186 |
+
* @param string $key The config key to retrieve.
|
1187 |
+
* @param string $default A default value to use.
|
1188 |
+
* @return string Key value on success, empty string on failure.
|
1189 |
+
*/
|
1190 |
+
public function get_config( $key, $default = false ) {
|
1191 |
+
|
1192 |
+
global $id, $post;
|
1193 |
+
|
1194 |
+
// Get the current post ID. If ajax, grab it from the $_POST variable.
|
1195 |
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
1196 |
+
$post_id = absint( $_POST['post_id'] );
|
1197 |
+
} else {
|
1198 |
+
$post_id = isset( $post->ID ) ? $post->ID : (int) $id;
|
1199 |
+
}
|
1200 |
+
|
1201 |
+
$settings = get_post_meta( $post_id, '_sol_slider_data', true );
|
1202 |
+
if ( isset( $settings['config'][$key] ) ) {
|
1203 |
+
return $settings['config'][$key];
|
1204 |
+
} else {
|
1205 |
+
return $default ? $default : '';
|
1206 |
+
}
|
1207 |
+
|
1208 |
+
}
|
1209 |
+
|
1210 |
+
/**
|
1211 |
+
* Helper method for setting default config values.
|
1212 |
+
*
|
1213 |
+
* @since 1.0.0
|
1214 |
+
*
|
1215 |
+
* @param string $key The default config key to retrieve.
|
1216 |
+
* @return string Key value on success, false on failure.
|
1217 |
+
*/
|
1218 |
+
public function get_config_default( $key ) {
|
1219 |
+
|
1220 |
+
$instance = Soliloquy_Common_Lite::get_instance();
|
1221 |
+
return $instance->get_config_default( $key );
|
1222 |
+
|
1223 |
+
}
|
1224 |
+
|
1225 |
+
/**
|
1226 |
+
* Helper method for retrieving slider themes.
|
1227 |
+
*
|
1228 |
+
* @since 1.0.0
|
1229 |
+
*
|
1230 |
+
* @return array Array of slider theme data.
|
1231 |
+
*/
|
1232 |
+
public function get_slider_themes() {
|
1233 |
+
|
1234 |
+
$instance = Soliloquy_Common_Lite::get_instance();
|
1235 |
+
return $instance->get_slider_themes();
|
1236 |
+
|
1237 |
+
}
|
1238 |
+
|
1239 |
+
/**
|
1240 |
+
* Helper method for retrieving slider transitions.
|
1241 |
+
*
|
1242 |
+
* @since 1.0.0
|
1243 |
+
*
|
1244 |
+
* @return array Array of thumbnail transition data.
|
1245 |
+
*/
|
1246 |
+
public function get_slider_transitions() {
|
1247 |
+
|
1248 |
+
$instance = Soliloquy_Common_Lite::get_instance();
|
1249 |
+
return $instance->get_slider_transitions();
|
1250 |
+
|
1251 |
+
}
|
1252 |
+
|
1253 |
+
/**
|
1254 |
+
* Returns the post types to skip for loading Soliloquy metaboxes.
|
1255 |
+
*
|
1256 |
+
* @since 1.0.0
|
1257 |
+
*
|
1258 |
+
* @return array Array of skipped posttypes.
|
1259 |
+
*/
|
1260 |
+
public function get_skipped_posttypes() {
|
1261 |
+
|
1262 |
+
return apply_filters( 'soliloquy_skipped_posttypes', array( 'attachment', 'revision', 'nav_menu_item', 'envira' ) );
|
1263 |
+
|
1264 |
+
}
|
1265 |
+
|
1266 |
+
/**
|
1267 |
+
* Flag to determine if the GD library has been compiled.
|
1268 |
+
*
|
1269 |
+
* @since 1.0.0
|
1270 |
+
*
|
1271 |
+
* @return bool True if has proper extension, false otherwise.
|
1272 |
+
*/
|
1273 |
+
public function has_gd_extension() {
|
1274 |
+
|
1275 |
+
return extension_loaded( 'gd' ) && function_exists( 'gd_info' );
|
1276 |
+
|
1277 |
+
}
|
1278 |
+
|
1279 |
+
/**
|
1280 |
+
* Flag to determine if the Imagick library has been compiled.
|
1281 |
+
*
|
1282 |
+
* @since 1.0.0
|
1283 |
+
*
|
1284 |
+
* @return bool True if has proper extension, false otherwise.
|
1285 |
+
*/
|
1286 |
+
public function has_imagick_extension() {
|
1287 |
+
|
1288 |
+
return extension_loaded( 'imagick' );
|
1289 |
+
|
1290 |
+
}
|
1291 |
+
|
1292 |
+
/**
|
1293 |
+
* Returns the singleton instance of the class.
|
1294 |
+
*
|
1295 |
+
* @since 1.0.0
|
1296 |
+
*
|
1297 |
+
* @return object The Soliloquy_Metaboxes_Lite object.
|
1298 |
+
*/
|
1299 |
+
public static function get_instance() {
|
1300 |
+
|
1301 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Soliloquy_Metaboxes_Lite ) ) {
|
1302 |
+
self::$instance = new Soliloquy_Metaboxes_Lite();
|
1303 |
+
}
|
1304 |
+
|
1305 |
+
return self::$instance;
|
1306 |
+
|
1307 |
+
}
|
1308 |
+
|
1309 |
+
}
|
1310 |
+
|
1311 |
+
// Load the metabox class.
|
1312 |
+
$soliloquy_metaboxes_lite = Soliloquy_Metaboxes_Lite::get_instance();
|
includes/admin/posttype.php
ADDED
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Posttype admin class.
|
4 |
+
*
|
5 |
+
* @since 1.0.0
|
6 |
+
*
|
7 |
+
* @package Soliloquy_Lite
|
8 |
+
* @author Thomas Griffin
|
9 |
+
*/
|
10 |
+
class Soliloquy_Posttype_Admin_Lite {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Holds the class object.
|
14 |
+
*
|
15 |
+
* @since 1.0.0
|
16 |
+
*
|
17 |
+
* @var object
|
18 |
+
*/
|
19 |
+
public static $instance;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Path to the file.
|
23 |
+
*
|
24 |
+
* @since 1.0.0
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
public $file = __FILE__;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Holds the base class object.
|
32 |
+
*
|
33 |
+
* @since 1.0.0
|
34 |
+
*
|
35 |
+
* @var object
|
36 |
+
*/
|
37 |
+
public $base;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Primary class constructor.
|
41 |
+
*
|
42 |
+
* @since 1.0.0
|
43 |
+
*/
|
44 |
+
public function __construct() {
|
45 |
+
|
46 |
+
// Load the base class object.
|
47 |
+
$this->base = Soliloquy_Lite::get_instance();
|
48 |
+
|
49 |
+
// Remove quick editing from the Soliloquy post type row actions.
|
50 |
+
add_filter( 'post_row_actions', array( $this, 'row_actions' ), 10, 2 );
|
51 |
+
|
52 |
+
// Manage post type columns.
|
53 |
+
add_filter( 'manage_edit-soliloquy_columns', array( $this, 'soliloquy_columns' ) );
|
54 |
+
add_filter( 'manage_soliloquy_posts_custom_column', array( $this, 'soliloquy_custom_columns' ), 10, 2 );
|
55 |
+
|
56 |
+
// Update post type messages.
|
57 |
+
add_filter( 'post_updated_messages', array( $this, 'messages' ) );
|
58 |
+
|
59 |
+
// Force the menu icon to be scaled to proper size (for Retina displays).
|
60 |
+
add_action( 'admin_head', array( $this, 'menu_icon' ) );
|
61 |
+
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Customize the post columns for the Soliloquy post type.
|
66 |
+
*
|
67 |
+
* @since 1.0.0
|
68 |
+
*
|
69 |
+
* @param array $columns The default columns.
|
70 |
+
* @return array $columns Amended columns.
|
71 |
+
*/
|
72 |
+
public function soliloquy_columns( $columns ) {
|
73 |
+
|
74 |
+
$columns = array(
|
75 |
+
'cb' => '<input type="checkbox" />',
|
76 |
+
'title' => __( 'Title', 'soliloquy' ),
|
77 |
+
'shortcode' => __( 'Shortcode', 'soliloquy' ),
|
78 |
+
'template' => __( 'Template Tag', 'soliloquy' ),
|
79 |
+
'images' => __( 'Number of Images', 'soliloquy' ),
|
80 |
+
'modified' => __( 'Last Modified', 'soliloquy' ),
|
81 |
+
'date' => __( 'Date', 'soliloquy' )
|
82 |
+
);
|
83 |
+
|
84 |
+
return $columns;
|
85 |
+
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Add data to the custom columns added to the Soliloquy post type.
|
90 |
+
*
|
91 |
+
* @since 1.0.0
|
92 |
+
*
|
93 |
+
* @global object $post The current post object.
|
94 |
+
* @param string $column The name of the custom column.
|
95 |
+
* @param int $post_id The current post ID.
|
96 |
+
*/
|
97 |
+
public function soliloquy_custom_columns( $column, $post_id ) {
|
98 |
+
|
99 |
+
global $post;
|
100 |
+
$post_id = absint( $post_id );
|
101 |
+
|
102 |
+
switch ( $column ) {
|
103 |
+
case 'shortcode' :
|
104 |
+
echo '<code>[soliloquy id="' . $post_id . '"]</code>';
|
105 |
+
break;
|
106 |
+
|
107 |
+
case 'template' :
|
108 |
+
echo '<code>if ( function_exists( \'soliloquy\' ) ) { soliloquy( \'' . $post_id . '\' ); }</code>';
|
109 |
+
break;
|
110 |
+
|
111 |
+
case 'images' :
|
112 |
+
$slider_data = get_post_meta( $post_id, '_sol_slider_data', true );
|
113 |
+
echo ( ! empty( $slider_data['slider'] ) ? count( $slider_data['slider'] ) : 0 );
|
114 |
+
break;
|
115 |
+
|
116 |
+
case 'modified' :
|
117 |
+
the_modified_date();
|
118 |
+
break;
|
119 |
+
}
|
120 |
+
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Filter out unnecessary row actions from the Soliloquy post table.
|
125 |
+
*
|
126 |
+
* @since 1.0.0
|
127 |
+
*
|
128 |
+
* @param array $actions Default row actions.
|
129 |
+
* @param object $post The current post object.
|
130 |
+
* @return array $actions Amended row actions.
|
131 |
+
*/
|
132 |
+
public function row_actions( $actions, $post ) {
|
133 |
+
|
134 |
+
if ( isset( get_current_screen()->post_type ) && 'soliloquy' == get_current_screen()->post_type ) {
|
135 |
+
unset( $actions['inline hide-if-no-js'] );
|
136 |
+
}
|
137 |
+
|
138 |
+
return apply_filters( 'soliloquy_row_actions', $actions, $post );
|
139 |
+
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Contextualizes the post updated messages.
|
144 |
+
*
|
145 |
+
* @since 1.0.0
|
146 |
+
*
|
147 |
+
* @global object $post The current post object.
|
148 |
+
* @param array $messages Array of default post updated messages.
|
149 |
+
* @return array $messages Amended array of post updated messages.
|
150 |
+
*/
|
151 |
+
public function messages( $messages ) {
|
152 |
+
|
153 |
+
global $post;
|
154 |
+
|
155 |
+
// Contextualize the messages.
|
156 |
+
$messages['soliloquy'] = apply_filters( 'soliloquy_messages',
|
157 |
+
array(
|
158 |
+
0 => '',
|
159 |
+
1 => __( 'Soliloquy slider updated.', 'soliloquy' ),
|
160 |
+
2 => __( 'Soliloquy slider custom field updated.', 'soliloquy' ),
|
161 |
+
3 => __( 'Soliloquy slider custom field deleted.', 'soliloquy' ),
|
162 |
+
4 => __( 'Soliloquy slider updated.', 'soliloquy' ),
|
163 |
+
5 => isset( $_GET['revision'] ) ? sprintf( __( 'Soliloquy slider restored to revision from %s.', 'soliloquy' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
|
164 |
+
6 => __( 'Soliloquy slider published.', 'soliloquy' ),
|
165 |
+
7 => __( 'Soliloquy slider saved.', 'soliloquy' ),
|
166 |
+
8 => __( 'Soliloquy slider submitted.', 'soliloquy' ),
|
167 |
+
9 => sprintf( __( 'Soliloquy slider scheduled for: <strong>%1$s</strong>.', 'soliloquy' ), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ) ),
|
168 |
+
10 => __( 'Soliloquy slider draft updated.', 'soliloquy' )
|
169 |
+
)
|
170 |
+
);
|
171 |
+
|
172 |
+
return $messages;
|
173 |
+
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Forces the Soliloquy menu icon width/height for Retina devices.
|
178 |
+
*
|
179 |
+
* @since 1.0.0
|
180 |
+
*/
|
181 |
+
public function menu_icon() {
|
182 |
+
|
183 |
+
?>
|
184 |
+
<style type="text/css">#menu-posts-soliloquy .wp-menu-image img { width: 16px; height: 16px; }</style>
|
185 |
+
<?php
|
186 |
+
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Returns the singleton instance of the class.
|
191 |
+
*
|
192 |
+
* @since 1.0.0
|
193 |
+
*
|
194 |
+
* @return object The Soliloquy_Posttype_Admin_Lite object.
|
195 |
+
*/
|
196 |
+
public static function get_instance() {
|
197 |
+
|
198 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Soliloquy_Posttype_Admin_Lite ) ) {
|
199 |
+
self::$instance = new Soliloquy_Posttype_Admin_Lite();
|
200 |
+
}
|
201 |
+
|
202 |
+
return self::$instance;
|
203 |
+
|
204 |
+
}
|
205 |
+
|
206 |
+
}
|
207 |
+
|
208 |
+
// Load the posttype admin class.
|
209 |
+
$soliloquy_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ings class.
|
4 |
+
*
|
5 |
+
* @since 1.0.0
|
6 |
+
*
|
7 |
+
* @package Soliloquy_Lite
|
8 |
+
* @author Thomas Griffin
|
9 |
+
*/
|
10 |
+
class Soliloquy_Settings_Lite {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Holds the class object.
|
14 |
+
*
|
15 |
+
* @since 1.0.0
|
16 |
+
*
|
17 |
+
* @var object
|
18 |
+
*/
|
19 |
+
public static $instance;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Path to the file.
|
23 |
+
*
|
24 |
+
* @since 1.0.0
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
public $file = __FILE__;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Holds the base class object.
|
32 |
+
*
|
33 |
+
* @since 1.0.0
|
34 |
+
*
|
35 |
+
* @var object
|
36 |
+
*/
|
37 |
+
public $base;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Holds the submenu pagehook.
|
41 |
+
*
|
42 |
+
* @since 1.0.0
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
public $hook;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Primary class constructor.
|
50 |
+
*
|
51 |
+
* @since 1.0.0
|
52 |
+
*/
|
53 |
+
public function __construct() {
|
54 |
+
|
55 |
+
// Load the base class object.
|
56 |
+
$this->base = Soliloquy_Lite::get_instance();
|
57 |
+
|
58 |
+
// Add custom settings submenu.
|
59 |
+
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
60 |
+
|
61 |
+
// Add callbacks for settings tabs.
|
62 |
+
add_action( 'soliloquy_tab_settings_upgrade', array( $this, 'settings_upgrade_tab' ) );
|
63 |
+
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Register the Settings submenu item for Soliloquy.
|
68 |
+
*
|
69 |
+
* @since 1.0.0
|
70 |
+
*/
|
71 |
+
public function admin_menu() {
|
72 |
+
|
73 |
+
// If the option exists for upgrading, do nothing.
|
74 |
+
$upgrade = get_option( 'soliloquy_upgrade' );
|
75 |
+
if ( $upgrade ) {
|
76 |
+
return;
|
77 |
+
}
|
78 |
+
|
79 |
+
// Register the submenu.
|
80 |
+
$this->hook = add_submenu_page(
|
81 |
+
'edit.php?post_type=soliloquy',
|
82 |
+
__( 'Soliloquy Settings', 'soliloquy' ),
|
83 |
+
__( 'Settings', 'soliloquy' ),
|
84 |
+
apply_filters( 'soliloquy_menu_cap', 'manage_options' ),
|
85 |
+
$this->base->plugin_slug . '-settings',
|
86 |
+
array( $this, 'settings_page' )
|
87 |
+
);
|
88 |
+
|
89 |
+
// If successful, load admin assets only on that page and check for addons refresh.
|
90 |
+
if ( $this->hook ) {
|
91 |
+
add_action( 'load-' . $this->hook, array( $this, 'settings_page_assets' ) );
|
92 |
+
}
|
93 |
+
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Loads assets for the settings page.
|
98 |
+
*
|
99 |
+
* @since 1.0.0
|
100 |
+
*/
|
101 |
+
public function settings_page_assets() {
|
102 |
+
|
103 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
|
104 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
|
105 |
+
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Register and enqueue settings page specific CSS.
|
110 |
+
*
|
111 |
+
* @since 1.0.0
|
112 |
+
*/
|
113 |
+
public function enqueue_admin_styles() {
|
114 |
+
|
115 |
+
wp_register_style( $this->base->plugin_slug . '-settings-style', plugins_url( 'assets/css/settings.css', $this->base->file ), array(), $this->base->version );
|
116 |
+
wp_enqueue_style( $this->base->plugin_slug . '-settings-style' );
|
117 |
+
|
118 |
+
// Run a hook to load in custom styles.
|
119 |
+
do_action( 'soliloquy_settings_styles' );
|
120 |
+
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Register and enqueue settings page specific JS.
|
125 |
+
*
|
126 |
+
* @since 1.0.0
|
127 |
+
*/
|
128 |
+
public function enqueue_admin_scripts() {
|
129 |
+
|
130 |
+
wp_register_script( $this->base->plugin_slug . '-settings-script', plugins_url( 'assets/js/settings.js', $this->base->file ), array( 'jquery' ), $this->base->version, true );
|
131 |
+
wp_enqueue_script( $this->base->plugin_slug . '-settings-script' );
|
132 |
+
wp_localize_script(
|
133 |
+
$this->base->plugin_slug . '-settings-script',
|
134 |
+
'soliloquy_settings',
|
135 |
+
array(
|
136 |
+
'ajax' => admin_url( 'admin-ajax.php' ),
|
137 |
+
'redirect' => add_query_arg( array( 'post_type' => 'soliloquy', 'soliloquy-upgraded' => true ), admin_url( 'edit.php' ) ),
|
138 |
+
'upgrade_nonce' => wp_create_nonce( 'soliloquy-upgrade' )
|
139 |
+
)
|
140 |
+
);
|
141 |
+
|
142 |
+
// Run a hook to load in custom scripts.
|
143 |
+
do_action( 'soliloquy_settings_scripts' );
|
144 |
+
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Callback to output the Soliloquy settings page.
|
149 |
+
*
|
150 |
+
* @since 1.0.0
|
151 |
+
*/
|
152 |
+
public function settings_page() {
|
153 |
+
|
154 |
+
?>
|
155 |
+
<div id="soliloquy-settings" class="wrap">
|
156 |
+
<h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
|
157 |
+
<div class="soliloquy soliloquy-clear">
|
158 |
+
<div id="soliloquy-tabs" class="soliloquy-clear">
|
159 |
+
<h2 id="soliloquy-tabs-nav" class="soliloquy-clear nav-tab-wrapper">
|
160 |
+
<?php $i = 0; foreach ( (array) $this->get_soliloquy_settings_tab_nav() as $id => $title ) : $class = 0 === $i ? 'soliloquy-active nav-tab-active' : ''; ?>
|
161 |
+
<a class="nav-tab <?php echo $class; ?>" href="#soliloquy-tab-<?php echo $id; ?>" title="<?php echo $title; ?>"><?php echo $title; ?></a>
|
162 |
+
<?php $i++; endforeach; ?>
|
163 |
+
</h2>
|
164 |
+
<?php $i = 0; foreach ( (array) $this->get_soliloquy_settings_tab_nav() as $id => $title ) : $class = 0 === $i ? 'soliloquy-active' : ''; ?>
|
165 |
+
<div id="soliloquy-tab-<?php echo $id; ?>" class="soliloquy-tab soliloquy-clear <?php echo $class; ?>">
|
166 |
+
<?php do_action( 'soliloquy_tab_settings_' . $id ); ?>
|
167 |
+
</div>
|
168 |
+
<?php $i++; endforeach; ?>
|
169 |
+
</div>
|
170 |
+
</div>
|
171 |
+
</div>
|
172 |
+
<?php
|
173 |
+
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Callback for getting all of the settings tabs for Soliloquy.
|
178 |
+
*
|
179 |
+
* @since 1.0.0
|
180 |
+
*
|
181 |
+
* @return array Array of tab information.
|
182 |
+
*/
|
183 |
+
public function get_soliloquy_settings_tab_nav() {
|
184 |
+
|
185 |
+
$tabs = array(
|
186 |
+
'upgrade' => __( 'Upgrade', 'soliloquy' ) // This tab is required. DO NOT REMOVE VIA FILTERING.
|
187 |
+
);
|
188 |
+
$tabs = apply_filters( 'soliloquy_settings_tab_nav', $tabs );
|
189 |
+
|
190 |
+
return $tabs;
|
191 |
+
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Callback for displaying the UI for upgrade settings tab.
|
196 |
+
*
|
197 |
+
* @since 1.0.0
|
198 |
+
*/
|
199 |
+
public function settings_upgrade_tab() {
|
200 |
+
|
201 |
+
?>
|
202 |
+
<div id="soliloquy-settings-upgrade">
|
203 |
+
<p><strong><?php _e( 'You have upgraded to v2 of Soliloquy. You need to upgrade your sliders using our custom upgrading tool. Click on the button below to start the process.', 'soliloquy' ); ?></strong></p>
|
204 |
+
<p><a class="button button-primary soliloquy-start-upgrade" href="#" title="<?php esc_attr_e( 'Click Here to Start the Upgrade Process', 'soliloquy' ); ?>"><?php _e( 'Click Here to Start the Upgrade Process', 'soliloquy' ); ?></a> <span class="spinner soliloquy-spinner"></span></p>
|
205 |
+
</div>
|
206 |
+
<?php
|
207 |
+
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Returns the singleton instance of the class.
|
212 |
+
*
|
213 |
+
* @since 1.0.0
|
214 |
+
*
|
215 |
+
* @return object The Soliloquy_Settings_Lite object.
|
216 |
+
*/
|
217 |
+
public static function get_instance() {
|
218 |
+
|
219 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Soliloquy_Settings_Lite ) ) {
|
220 |
+
self::$instance = new Soliloquy_Settings_Lite();
|
221 |
+
}
|
222 |
+
|
223 |
+
return self::$instance;
|
224 |
+
|
225 |
+
}
|
226 |
+
|
227 |
+
}
|
228 |
+
|
229 |
+
// Load the settings class.
|
230 |
+
$soliloquy_settings_lite = Soliloquy_Settings_Lite::get_instance();
|
includes/global/common.php
ADDED
@@ -0,0 +1,429 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Common class.
|
4 |
+
*
|
5 |
+
* @since 1.0.0
|
6 |
+
*
|
7 |
+
* @package Soliloquy_Lite
|
8 |
+
* @author Thomas Griffin
|
9 |
+
*/
|
10 |
+
class Soliloquy_Common_Lite {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Holds the class object.
|
14 |
+
*
|
15 |
+
* @since 1.0.0
|
16 |
+
*
|
17 |
+
* @var object
|
18 |
+
*/
|
19 |
+
public static $instance;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Path to the file.
|
23 |
+
*
|
24 |
+
* @since 1.0.0
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
public $file = __FILE__;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Holds the base class object.
|
32 |
+
*
|
33 |
+
* @since 1.0.0
|
34 |
+
*
|
35 |
+
* @var object
|
36 |
+
*/
|
37 |
+
public $base;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Primary class constructor.
|
41 |
+
*
|
42 |
+
* @since 1.0.0
|
43 |
+
*/
|
44 |
+
public function __construct() {
|
45 |
+
|
46 |
+
// Load the base class object.
|
47 |
+
$this->base = Soliloquy_Lite::get_instance();
|
48 |
+
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Helper method for retrieving slider themes.
|
53 |
+
*
|
54 |
+
* @since 1.0.0
|
55 |
+
*
|
56 |
+
* @return array Array of slider theme data.
|
57 |
+
*/
|
58 |
+
public function get_slider_themes() {
|
59 |
+
|
60 |
+
$themes = array(
|
61 |
+
array(
|
62 |
+
'value' => 'base',
|
63 |
+
'name' => __( 'Base', 'soliloquy' ),
|
64 |
+
'file' => $this->base->file
|
65 |
+
),
|
66 |
+
array(
|
67 |
+
'value' => 'classic',
|
68 |
+
'name' => __( 'Classic', 'soliloquy' ),
|
69 |
+
'file' => $this->base->file
|
70 |
+
)
|
71 |
+
);
|
72 |
+
|
73 |
+
return apply_filters( 'soliloquy_slider_themes', $themes );
|
74 |
+
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Helper method for retrieving slider transitions.
|
79 |
+
*
|
80 |
+
* @since 1.0.0
|
81 |
+
*
|
82 |
+
* @return array Array of slider transition data.
|
83 |
+
*/
|
84 |
+
public function get_slider_transitions() {
|
85 |
+
|
86 |
+
$transitions = array(
|
87 |
+
array(
|
88 |
+
'value' => 'fade',
|
89 |
+
'name' => __( 'Fade', 'soliloquy' )
|
90 |
+
)
|
91 |
+
);
|
92 |
+
|
93 |
+
return apply_filters( 'soliloquy_slider_transitions', $transitions );
|
94 |
+
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Helper method for setting default config values.
|
99 |
+
*
|
100 |
+
* @since 1.0.0
|
101 |
+
*
|
102 |
+
* @global int $id The current post ID.
|
103 |
+
* @global object $post The current post object.
|
104 |
+
* @param string $key The default config key to retrieve.
|
105 |
+
* @return string Key value on success, false on failure.
|
106 |
+
*/
|
107 |
+
public function get_config_default( $key ) {
|
108 |
+
|
109 |
+
global $id, $post;
|
110 |
+
|
111 |
+
// Get the current post ID. If ajax, grab it from the $_POST variable.
|
112 |
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
113 |
+
$post_id = absint( $_POST['post_id'] );
|
114 |
+
} else {
|
115 |
+
$post_id = isset( $post->ID ) ? $post->ID : (int) $id;
|
116 |
+
}
|
117 |
+
|
118 |
+
// Prepare default values.
|
119 |
+
$defaults = $this->get_config_defaults( $post_id );
|
120 |
+
|
121 |
+
// Return the key specified.
|
122 |
+
return isset( $defaults[$key] ) ? $defaults[$key] : false;
|
123 |
+
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Retrieves the slider config defaults.
|
128 |
+
*
|
129 |
+
* @since 1.0.0
|
130 |
+
*
|
131 |
+
* @param int $post_id The current post ID.
|
132 |
+
* @return array Array of slider config defaults.
|
133 |
+
*/
|
134 |
+
public function get_config_defaults( $post_id ) {
|
135 |
+
|
136 |
+
$defaults = array(
|
137 |
+
'type' => 'default',
|
138 |
+
'slider_theme' => 'base',
|
139 |
+
'slider_width' => 960,
|
140 |
+
'slider_height' => 300,
|
141 |
+
'transition' => 'fade',
|
142 |
+
'duration' => 5000,
|
143 |
+
'speed' => 400,
|
144 |
+
'gutter' => 20,
|
145 |
+
'slider' => 1,
|
146 |
+
'classes' => array(),
|
147 |
+
'title' => '',
|
148 |
+
'slug' => ''
|
149 |
+
);
|
150 |
+
return apply_filters( 'soliloquy_defaults', $defaults, $post_id );
|
151 |
+
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* API method for cropping images.
|
156 |
+
*
|
157 |
+
* @since 1.0.0
|
158 |
+
*
|
159 |
+
* @global object $wpdb The $wpdb database object.
|
160 |
+
*
|
161 |
+
* @param string $url The URL of the image to resize.
|
162 |
+
* @param int $width The width for cropping the image.
|
163 |
+
* @param int $height The height for cropping the image.
|
164 |
+
* @param bool $crop Whether or not to crop the image (default yes).
|
165 |
+
* @param string $align The crop position alignment.
|
166 |
+
* @param bool $retina Whether or not to make a retina copy of image.
|
167 |
+
* @return WP_Error|string Return WP_Error on error, URL of resized image on success.
|
168 |
+
*/
|
169 |
+
public function resize_image( $url, $width = null, $height = null, $crop = true, $align = 'c', $quality = 100, $retina = false ) {
|
170 |
+
|
171 |
+
global $wpdb;
|
172 |
+
|
173 |
+
// Get common vars.
|
174 |
+
$args = func_get_args();
|
175 |
+
$common = $this->get_image_info( $args );
|
176 |
+
|
177 |
+
// Unpack variables if an array, otherwise return WP_Error.
|
178 |
+
if ( is_wp_error( $common ) ) {
|
179 |
+
return $common;
|
180 |
+
} else {
|
181 |
+
extract( $common );
|
182 |
+
}
|
183 |
+
|
184 |
+
// If the destination width/height values are the same as the original, don't do anything.
|
185 |
+
if ( $orig_width === $dest_width && $orig_height === $dest_height ) {
|
186 |
+
return $url;
|
187 |
+
}
|
188 |
+
|
189 |
+
// If the file doesn't exist yet, we need to create it.
|
190 |
+
if ( ! file_exists( $dest_file_name ) ) {
|
191 |
+
// We only want to resize Media Library images, so we can be sure they get deleted correctly when appropriate.
|
192 |
+
$get_attachment = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE guid='%s'", $url ) );
|
193 |
+
|
194 |
+
// Load the WordPress image editor.
|
195 |
+
$editor = wp_get_image_editor( $file_path );
|
196 |
+
|
197 |
+
// If an editor cannot be found, the user needs to have GD or Imagick installed.
|
198 |
+
if ( is_wp_error( $editor ) ) {
|
199 |
+
return new WP_Error( 'soliloquy-error-no-editor', __( 'No image editor could be selected. Please verify with your webhost that you have either the GD or Imagick image library compiled with your PHP install on your server.', 'soliloquy' ) );
|
200 |
+
}
|
201 |
+
|
202 |
+
// Set the image editor quality.
|
203 |
+
$editor->set_quality( $quality );
|
204 |
+
|
205 |
+
// If cropping, process cropping.
|
206 |
+
if ( $crop ) {
|
207 |
+
$src_x = $src_y = 0;
|
208 |
+
$src_w = $orig_width;
|
209 |
+
$src_h = $orig_height;
|
210 |
+
|
211 |
+
$cmp_x = $orig_width / $dest_width;
|
212 |
+
$cmp_y = $orig_height / $dest_height;
|
213 |
+
|
214 |
+
// Calculate x or y coordinate and width or height of source
|
215 |
+
if ( $cmp_x > $cmp_y ) {
|
216 |
+
$src_w = round( $orig_width / $cmp_x * $cmp_y );
|
217 |
+
$src_x = round( ($orig_width - ($orig_width / $cmp_x * $cmp_y)) / 2 );
|
218 |
+
} else if ( $cmp_y > $cmp_x ) {
|
219 |
+
$src_h = round( $orig_height / $cmp_y * $cmp_x );
|
220 |
+
$src_y = round( ($orig_height - ($orig_height / $cmp_y * $cmp_x)) / 2 );
|
221 |
+
}
|
222 |
+
|
223 |
+
// Positional cropping.
|
224 |
+
if ( $align && $align != 'c' ) {
|
225 |
+
if ( strpos( $align, 't' ) !== false || strpos( $align, 'tr' ) !== false || strpos( $align, 'tl' ) !== false ) {
|
226 |
+
$src_y = 0;
|
227 |
+
}
|
228 |
+
|
229 |
+
if ( strpos( $align, 'b' ) !== false || strpos( $align, 'br' ) !== false || strpos( $align, 'bl' ) !== false ) {
|
230 |
+
$src_y = $orig_height - $src_h;
|
231 |
+
}
|
232 |
+
|
233 |
+
if ( strpos( $align, 'l' ) !== false ) {
|
234 |
+
$src_x = 0;
|
235 |
+
}
|
236 |
+
|
237 |
+
if ( strpos ( $align, 'r' ) !== false ) {
|
238 |
+
$src_x = $orig_width - $src_w;
|
239 |
+
}
|
240 |
+
}
|
241 |
+
|
242 |
+
// Crop the image.
|
243 |
+
$editor->crop( $src_x, $src_y, $src_w, $src_h, $dest_width, $dest_height );
|
244 |
+
} else {
|
245 |
+
// Just resize the image.
|
246 |
+
$editor->resize( $dest_width, $dest_height );
|
247 |
+
}
|
248 |
+
|
249 |
+
// Save the image.
|
250 |
+
$saved = $editor->save( $dest_file_name );
|
251 |
+
|
252 |
+
// Print possible out of memory errors.
|
253 |
+
if ( is_wp_error( $saved ) ) {
|
254 |
+
@unlink( $dest_file_name );
|
255 |
+
return $saved;
|
256 |
+
}
|
257 |
+
|
258 |
+
// Add the resized dimensions and alignment to original image metadata, so the images
|
259 |
+
// can be deleted when the original image is delete from the Media Library.
|
260 |
+
if ( $get_attachment ) {
|
261 |
+
$metadata = wp_get_attachment_metadata( $get_attachment[0]->ID );
|
262 |
+
|
263 |
+
if ( isset( $metadata['image_meta'] ) ) {
|
264 |
+
$md = $saved['width'] . 'x' . $saved['height'];
|
265 |
+
|
266 |
+
if ( $crop ) {
|
267 |
+
$md .= $align ? "_${align}" : "_c";
|
268 |
+
}
|
269 |
+
|
270 |
+
$metadata['image_meta']['resized_images'][] = $md;
|
271 |
+
wp_update_attachment_metadata( $get_attachment[0]->ID, $metadata );
|
272 |
+
}
|
273 |
+
}
|
274 |
+
|
275 |
+
// Set the resized image URL.
|
276 |
+
$resized_url = str_replace( basename( $url ), basename( $saved['path'] ), $url );
|
277 |
+
} else {
|
278 |
+
// Set the resized image URL.
|
279 |
+
$resized_url = str_replace( basename( $url ), basename( $dest_file_name ), $url );
|
280 |
+
}
|
281 |
+
|
282 |
+
// Return the resized image URL.
|
283 |
+
return $resized_url;
|
284 |
+
|
285 |
+
}
|
286 |
+
|
287 |
+
/**
|
288 |
+
* Helper method to return common information about an image.
|
289 |
+
*
|
290 |
+
* @since 1.0.0
|
291 |
+
*
|
292 |
+
* @param array $args List of resizing args to expand for gathering info.
|
293 |
+
* @return WP_Error|string Return WP_Error on error, array of data on success.
|
294 |
+
*/
|
295 |
+
public function get_image_info( $args ) {
|
296 |
+
|
297 |
+
// Unpack arguments.
|
298 |
+
list( $url, $width, $height, $crop, $align, $quality, $retina ) = $args;
|
299 |
+
|
300 |
+
// Return an error if no URL is present.
|
301 |
+
if ( empty( $url ) ) {
|
302 |
+
return new WP_Error( 'soliloquy-error-no-url', __( 'No image URL specified for cropping.', 'soliloquy' ) );
|
303 |
+
}
|
304 |
+
|
305 |
+
// Get the image file path.
|
306 |
+
$urlinfo = parse_url( $url );
|
307 |
+
$wp_upload_dir = wp_upload_dir();
|
308 |
+
|
309 |
+
// Interpret the file path of the image.
|
310 |
+
if ( preg_match( '/\/[0-9]{4}\/[0-9]{2}\/.+$/', $urlinfo['path'], $matches ) ) {
|
311 |
+
$file_path = $wp_upload_dir['basedir'] . $matches[0];
|
312 |
+
} else {
|
313 |
+
$pathinfo = parse_url( $url );
|
314 |
+
$uploads_dir = is_multisite() ? '/files/' : '/wp-content/';
|
315 |
+
$file_path = ABSPATH . str_replace( dirname( $_SERVER['SCRIPT_NAME'] ) . '/', '', strstr( $pathinfo['path'], $uploads_dir ) );
|
316 |
+
$file_path = preg_replace( '/(\/\/)/', '/', $file_path );
|
317 |
+
}
|
318 |
+
|
319 |
+
// Don't process a file that does not exist.
|
320 |
+
if ( ! file_exists( $file_path ) ) {
|
321 |
+
return new WP_Error( 'soliloquy-error-no-file', __( 'No file could be found for the image URL specified.', 'soliloquy' ) );
|
322 |
+
}
|
323 |
+
|
324 |
+
// Get original image size
|
325 |
+
$size = @getimagesize( $file_path );
|
326 |
+
|
327 |
+
// If no size data obtained, return an error.
|
328 |
+
if ( ! $size ) {
|
329 |
+
return new WP_Error( 'soliloquy-error-no-size', __( 'The dimensions of the original image could not be retrieved for cropping.', 'soliloquy' ) );
|
330 |
+
}
|
331 |
+
|
332 |
+
// Set original width and height.
|
333 |
+
list( $orig_width, $orig_height, $orig_type ) = $size;
|
334 |
+
|
335 |
+
// Generate width or height if not provided.
|
336 |
+
if ( $width && ! $height ) {
|
337 |
+
$height = floor( $orig_height * ($width / $orig_width) );
|
338 |
+
} else if ( $height && ! $width ) {
|
339 |
+
$width = floor( $orig_width * ($height / $orig_height) );
|
340 |
+
} else if ( ! $width && ! $height ) {
|
341 |
+
return new WP_Error( 'soliloquy-error-no-size', __( 'The dimensions of the original image could not be retrieved for cropping.', 'soliloquy' ) );
|
342 |
+
}
|
343 |
+
|
344 |
+
// Allow for different retina image sizes.
|
345 |
+
$retina = $retina ? ( $retina === true ? 2 : $retina ) : 1;
|
346 |
+
|
347 |
+
// Destination width and height variables
|
348 |
+
$dest_width = $width * $retina;
|
349 |
+
$dest_height = $height * $retina;
|
350 |
+
|
351 |
+
// Some additional info about the image.
|
352 |
+
$info = pathinfo( $file_path );
|
353 |
+
$dir = $info['dirname'];
|
354 |
+
$ext = $info['extension'];
|
355 |
+
$name = wp_basename( $file_path, ".$ext" );
|
356 |
+
|
357 |
+
// Suffix applied to filename
|
358 |
+
$suffix = "${dest_width}x${dest_height}";
|
359 |
+
|
360 |
+
// Set alignment information on the file.
|
361 |
+
if ( $crop ) {
|
362 |
+
$suffix .= ( $align ) ? "_${align}" : "_c";
|
363 |
+
}
|
364 |
+
|
365 |
+
// Get the destination file name
|
366 |
+
$dest_file_name = "${dir}/${name}-${suffix}.${ext}";
|
367 |
+
|
368 |
+
// Return the info.
|
369 |
+
return array(
|
370 |
+
'dir' => $dir,
|
371 |
+
'name' => $name,
|
372 |
+
'ext' => $ext,
|
373 |
+
'suffix' => $suffix,
|
374 |
+
'orig_width' => $orig_width,
|
375 |
+
'orig_height' => $orig_height,
|
376 |
+
'orig_type' => $orig_type,
|
377 |
+
'dest_width' => $dest_width,
|
378 |
+
'dest_height' => $dest_height,
|
379 |
+
'file_path' => $file_path,
|
380 |
+
'dest_file_name' => $dest_file_name,
|
381 |
+
);
|
382 |
+
|
383 |
+
}
|
384 |
+
|
385 |
+
/**
|
386 |
+
* Helper method to flush slider caches once a slider is updated.
|
387 |
+
*
|
388 |
+
* @since 1.0.0
|
389 |
+
*
|
390 |
+
* @param int $post_id The current post ID.
|
391 |
+
* @param string $slug The unique slider slug.
|
392 |
+
*/
|
393 |
+
public function flush_slider_caches( $post_id, $slug = '' ) {
|
394 |
+
|
395 |
+
// Delete known slider caches.
|
396 |
+
delete_transient( '_sol_cache_' . $post_id );
|
397 |
+
delete_transient( '_sol_cache_all' );
|
398 |
+
|
399 |
+
// Possibly delete slug slider cache if available.
|
400 |
+
if ( ! empty( $slug ) ) {
|
401 |
+
delete_transient( '_sol_cache_' . $slug );
|
402 |
+
}
|
403 |
+
|
404 |
+
// Run a hook for Addons to access.
|
405 |
+
do_action( 'soliloquy_flush_caches', $post_id, $slug );
|
406 |
+
|
407 |
+
}
|
408 |
+
|
409 |
+
/**
|
410 |
+
* Returns the singleton instance of the class.
|
411 |
+
*
|
412 |
+
* @since 1.0.0
|
413 |
+
*
|
414 |
+
* @return object The Soliloquy_Common_Lite object.
|
415 |
+
*/
|
416 |
+
public static function get_instance() {
|
417 |
+
|
418 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Soliloquy_Common_Lite ) ) {
|
419 |
+
self::$instance = new Soliloquy_Common_Lite();
|
420 |
+
}
|
421 |
+
|
422 |
+
return self::$instance;
|
423 |
+
|
424 |
+
}
|
425 |
+
|
426 |
+
}
|
427 |
+
|
428 |
+
// Load the common class.
|
429 |
+
$soliloquy_common_lite = Soliloquy_Common_Lite::get_instance();
|
includes/global/posttype.php
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Posttype class.
|
4 |
+
*
|
5 |
+
* @since 1.0.0
|
6 |
+
*
|
7 |
+
* @package Soliloquy_Lite
|
8 |
+
* @author Thomas Griffin
|
9 |
+
*/
|
10 |
+
class Soliloquy_Posttype_Lite {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Holds the class object.
|
14 |
+
*
|
15 |
+
* @since 1.0.0
|
16 |
+
*
|
17 |
+
* @var object
|
18 |
+
*/
|
19 |
+
public static $instance;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Path to the file.
|
23 |
+
*
|
24 |
+
* @since 1.0.0
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
public $file = __FILE__;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Holds the base class object.
|
32 |
+
*
|
33 |
+
* @since 1.0.0
|
34 |
+
*
|
35 |
+
* @var object
|
36 |
+
*/
|
37 |
+
public $base;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Primary class constructor.
|
41 |
+
*
|
42 |
+
* @since 1.0.0
|
43 |
+
*/
|
44 |
+
public function __construct() {
|
45 |
+
|
46 |
+
// Load the base class object.
|
47 |
+
$this->base = Soliloquy_Lite::get_instance();
|
48 |
+
|
49 |
+
// Build the labels for the post type.
|
50 |
+
$labels = apply_filters( 'soliloquy_post_type_labels',
|
51 |
+
array(
|
52 |
+
'name' => __( 'Soliloquy Sliders', 'soliloquy' ),
|
53 |
+
'singular_name' => __( 'Soliloquy', 'soliloquy' ),
|
54 |
+
'add_new' => __( 'Add New', 'soliloquy' ),
|
55 |
+
'add_new_item' => __( 'Add New Soliloquy Slider', 'soliloquy' ),
|
56 |
+
'edit_item' => __( 'Edit Soliloquy Slider', 'soliloquy' ),
|
57 |
+
'new_item' => __( 'New Soliloquy Slider', 'soliloquy' ),
|
58 |
+
'view_item' => __( 'View Soliloquy Slider', 'soliloquy' ),
|
59 |
+
'search_items' => __( 'Search Soliloquy Sliders', 'soliloquy' ),
|
60 |
+
'not_found' => __( 'No Soliloquy sliders found.', 'soliloquy' ),
|
61 |
+
'not_found_in_trash' => __( 'No Soliloquy sliders found in trash.', 'soliloquy' ),
|
62 |
+
'parent_item_colon' => '',
|
63 |
+
'menu_name' => __( 'Soliloquy', 'soliloquy' )
|
64 |
+
)
|
65 |
+
);
|
66 |
+
|
67 |
+
// Build out the post type arguments.
|
68 |
+
$args = apply_filters( 'soliloquy_post_type_args',
|
69 |
+
array(
|
70 |
+
'labels' => $labels,
|
71 |
+
'public' => false,
|
72 |
+
'exclude_from_search' => false,
|
73 |
+
'show_ui' => true,
|
74 |
+
'show_in_admin_bar' => false,
|
75 |
+
'rewrite' => false,
|
76 |
+
'query_var' => false,
|
77 |
+
'menu_position' => apply_filters( 'soliloquy_post_type_menu_position', 248 ),
|
78 |
+
'menu_icon' => plugins_url( 'assets/css/images/menu-icon@2x.png', $this->base->file ),
|
79 |
+
'supports' => array( 'title' )
|
80 |
+
)
|
81 |
+
);
|
82 |
+
|
83 |
+
// Register the post type with WordPress.
|
84 |
+
register_post_type( 'soliloquy', $args );
|
85 |
+
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Returns the singleton instance of the class.
|
90 |
+
*
|
91 |
+
* @since 1.0.0
|
92 |
+
*
|
93 |
+
* @return object The Soliloquy_Posttype_Lite object.
|
94 |
+
*/
|
95 |
+
public static function get_instance() {
|
96 |
+
|
97 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Soliloquy_Posttype_Lite ) ) {
|
98 |
+
self::$instance = new Soliloquy_Posttype_Lite();
|
99 |
+
}
|
100 |
+
|
101 |
+
return self::$instance;
|
102 |
+
|
103 |
+
}
|
104 |
+
|
105 |
+
}
|
106 |
+
|
107 |
+
// Load the posttype class.
|
108 |
+
$soliloquy_posttype_lite = Soliloquy_Posttype_Lite::get_instance();
|
includes/global/shortcode.php
ADDED
@@ -0,0 +1,814 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Shortcode class.
|
4 |
+
*
|
5 |
+
* @since 1.0.0
|
6 |
+
*
|
7 |
+
* @package Soliloquy_Lite
|
8 |
+
* @author Thomas Griffin
|
9 |
+
*/
|
10 |
+
class Soliloquy_Shortcode_Lite {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Holds the class object.
|
14 |
+
*
|
15 |
+
* @since 1.0.0
|
16 |
+
*
|
17 |
+
* @var object
|
18 |
+
*/
|
19 |
+
public static $instance;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Path to the file.
|
23 |
+
*
|
24 |
+
* @since 1.0.0
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
public $file = __FILE__;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Holds the base class object.
|
32 |
+
*
|
33 |
+
* @since 1.0.0
|
34 |
+
*
|
35 |
+
* @var object
|
36 |
+
*/
|
37 |
+
public $base;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Holds the slider data.
|
41 |
+
*
|
42 |
+
* @since 1.0.0
|
43 |
+
*
|
44 |
+
* @var array
|
45 |
+
*/
|
46 |
+
public $data;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Holds slider IDs for init firing checks.
|
50 |
+
*
|
51 |
+
* @since 1.0.0
|
52 |
+
*
|
53 |
+
* @var array
|
54 |
+
*/
|
55 |
+
public $done = array();
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Iterator for sliders on the page.
|
59 |
+
*
|
60 |
+
* @since 1.0.0
|
61 |
+
*
|
62 |
+
* @var int
|
63 |
+
*/
|
64 |
+
public $counter = 1;
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Flag for YouTube videos.
|
68 |
+
*
|
69 |
+
* @since 1.0.0
|
70 |
+
*
|
71 |
+
* @var bool
|
72 |
+
*/
|
73 |
+
public $youtube = false;
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Flag for Vimeo videos.
|
77 |
+
*
|
78 |
+
* @since 1.0.0
|
79 |
+
*
|
80 |
+
* @var bool
|
81 |
+
*/
|
82 |
+
public $vimeo = false;
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Flag for Wistia videos.
|
86 |
+
*
|
87 |
+
* @since 1.0.0
|
88 |
+
*
|
89 |
+
* @var bool
|
90 |
+
*/
|
91 |
+
public $wistia = false;
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Flag for HTML slides.
|
95 |
+
*
|
96 |
+
* @since 1.0.0
|
97 |
+
*
|
98 |
+
* @var bool
|
99 |
+
*/
|
100 |
+
public $html = false;
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Primary class constructor.
|
104 |
+
*
|
105 |
+
* @since 1.0.0
|
106 |
+
*/
|
107 |
+
public function __construct() {
|
108 |
+
|
109 |
+
// Load the base class object.
|
110 |
+
$this->base = Soliloquy_Lite::get_instance();
|
111 |
+
|
112 |
+
// Register main slider style.
|
113 |
+
wp_register_style( $this->base->plugin_slug . '-style', plugins_url( 'assets/css/soliloquy.css', $this->base->file ), array(), $this->base->version );
|
114 |
+
|
115 |
+
// Register main slider script.
|
116 |
+
wp_register_script( $this->base->plugin_slug . '-script', plugins_url( 'assets/js/soliloquy.js', $this->base->file ), array( 'jquery' ), $this->base->version, true );
|
117 |
+
|
118 |
+
// Load hooks and filters.
|
119 |
+
add_shortcode( 'soliloquy', array( $this, 'shortcode' ) );
|
120 |
+
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Creates the shortcode for the plugin.
|
125 |
+
*
|
126 |
+
* @since 1.0.0
|
127 |
+
*
|
128 |
+
* @global object $post The current post object.
|
129 |
+
*
|
130 |
+
* @param array $atts Array of shortcode attributes.
|
131 |
+
* @return string The slider output.
|
132 |
+
*/
|
133 |
+
public function shortcode( $atts ) {
|
134 |
+
|
135 |
+
global $post;
|
136 |
+
|
137 |
+
// If no attributes have been passed, the slider should be pulled from the current post.
|
138 |
+
$slider_id = false;
|
139 |
+
if ( empty( $atts ) ) {
|
140 |
+
$slider_id = $post->ID;
|
141 |
+
$data = is_preview() ? $this->base->_get_slider( $slider_id ) : $this->base->get_slider( $slider_id );
|
142 |
+
} else if ( isset( $atts['id'] ) ) {
|
143 |
+
$slider_id = (int) $atts['id'];
|
144 |
+
$data = is_preview() ? $this->base->_get_slider( $slider_id ) : $this->base->get_slider( $slider_id );
|
145 |
+
} else if ( isset( $atts['slug'] ) ) {
|
146 |
+
$slider_id = $atts['slug'];
|
147 |
+
$data = is_preview() ? $this->base->_get_slider_by_slug( $slider_id ) : $this->base->get_slider_by_slug( $slider_id );
|
148 |
+
} else {
|
149 |
+
// A custom attribute must have been passed. Allow it to be filtered to grab data from a custom source.
|
150 |
+
$data = apply_filters( 'soliloquy_custom_slider_data', false, $atts, $post );
|
151 |
+
}
|
152 |
+
|
153 |
+
// Allow the data to be filtered before it is stored and used to create the slider output.
|
154 |
+
$data = apply_filters( 'soliloquy_pre_data', $data, $slider_id );
|
155 |
+
|
156 |
+
// If there is no data to output or the slider is inactive, do nothing.
|
157 |
+
if ( ! $data || empty( $data['slider'] ) || isset( $data['status'] ) && 'inactive' == $data['status'] && ! is_preview() ) {
|
158 |
+
return false;
|
159 |
+
}
|
160 |
+
|
161 |
+
// If the data is to be randomized, do it now.
|
162 |
+
if ( $this->get_config( 'random', $data ) ) {
|
163 |
+
$data = $this->shuffle( $data );
|
164 |
+
}
|
165 |
+
|
166 |
+
// Prepare variables.
|
167 |
+
$this->data[$data['id']] = $data;
|
168 |
+
$slider = '';
|
169 |
+
$i = 1;
|
170 |
+
|
171 |
+
// If this is a feed view, customize the output and return early.
|
172 |
+
if ( is_feed() ) {
|
173 |
+
return $this->do_feed_output( $data );
|
174 |
+
}
|
175 |
+
|
176 |
+
// Load scripts and styles.
|
177 |
+
wp_enqueue_style( $this->base->plugin_slug . '-style' );
|
178 |
+
wp_enqueue_script( $this->base->plugin_slug . '-script' );
|
179 |
+
|
180 |
+
// Load custom slider themes if necessary.
|
181 |
+
if ( 'base' !== $this->get_config( 'slider_theme', $data ) ) {
|
182 |
+
$this->load_slider_theme( $this->get_config( 'slider_theme', $data ) );
|
183 |
+
}
|
184 |
+
|
185 |
+
// Load slider init code in the footer.
|
186 |
+
add_action( 'wp_footer', array( $this, 'slider_init' ), 1000 );
|
187 |
+
|
188 |
+
// Run a hook before the slider output begins but after scripts and inits have been set.
|
189 |
+
do_action( 'soliloquy_before_output', $data );
|
190 |
+
|
191 |
+
// Apply a filter before starting the slider HTML.
|
192 |
+
$slider = apply_filters( 'soliloquy_output_start', $slider, $data );
|
193 |
+
|
194 |
+
// Build out the slider HTML.
|
195 |
+
$slider .= '<div id="soliloquy-container-' . sanitize_html_class( $data['id'] ) . '" class="' . $this->get_slider_classes( $data ) . '" style="max-width:' . $this->get_config( 'slider_width', $data ) . 'px;max-height:' . $this->get_config( 'slider_height', $data ) . 'px;' . apply_filters( 'soliloquy_output_container_style', '', $data ) . '"' . apply_filters( 'soliloquy_output_container_attr', '', $data ) . '>';
|
196 |
+
$slider .= '<ul id="soliloquy-' . sanitize_html_class( $data['id'] ) . '" class="soliloquy-slider soliloquy-wrap soliloquy-clear">';
|
197 |
+
$slider = apply_filters( 'soliloquy_output_before_container', $slider, $data );
|
198 |
+
|
199 |
+
foreach ( (array) $data['slider'] as $id => $item ) {
|
200 |
+
// Skip over images that are pending (ignore if in Preview mode).
|
201 |
+
if ( isset( $item['status'] ) && 'pending' == $item['status'] && ! is_preview() ) {
|
202 |
+
continue;
|
203 |
+
}
|
204 |
+
|
205 |
+
// Allow filtering of individual items.
|
206 |
+
$item = apply_filters( 'soliloquy_output_item_data', $item, $id, $data, $i );
|
207 |
+
|
208 |
+
$slider = apply_filters( 'soliloquy_output_before_item', $slider, $id, $item, $data, $i );
|
209 |
+
$output = '<li class="' . $this->get_slider_item_classes( $item, $i, $data ) . '"' . apply_filters( 'soliloquy_output_item_attr', '', $id, $item, $data, $i ) . ' draggable="false" style="list-style:none">';
|
210 |
+
$output .= $this->get_slide( $id, $item, $data, $i );
|
211 |
+
$output .= '</li>';
|
212 |
+
$output = apply_filters( 'soliloquy_output_single_item', $output, $id, $item, $data, $i );
|
213 |
+
$slider .= $output;
|
214 |
+
$slider = apply_filters( 'soliloquy_output_after_item', $slider, $id, $item, $data, $i );
|
215 |
+
|
216 |
+
// Increment the iterator.
|
217 |
+
$i++;
|
218 |
+
}
|
219 |
+
|
220 |
+
$slider = apply_filters( 'soliloquy_output_after_container', $slider, $data );
|
221 |
+
$slider .= '</ul>';
|
222 |
+
$slider = apply_filters( 'soliloquy_output_end', $slider, $data );
|
223 |
+
$slider .= '</div>';
|
224 |
+
|
225 |
+
// Increment the counter.
|
226 |
+
$this->counter++;
|
227 |
+
|
228 |
+
// Return the slider HTML.
|
229 |
+
return apply_filters( 'soliloquy_output', $slider, $data );
|
230 |
+
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Retrieves an individual slide for the slider.
|
235 |
+
*
|
236 |
+
* @since 1.0.0
|
237 |
+
*
|
238 |
+
* @param int|string $id The ID for the slide.
|
239 |
+
* @param array $item Array of data for the slide.
|
240 |
+
* @param array $data Array of data for the slider.
|
241 |
+
* @param int $i The number of the slide in the slider.
|
242 |
+
* @return string HTML markup for the slide.
|
243 |
+
*/
|
244 |
+
public function get_slide( $id, $item, $data, $i ) {
|
245 |
+
|
246 |
+
$type = ! empty( $item['type'] ) ? $item['type'] : 'image';
|
247 |
+
switch ( $type ) {
|
248 |
+
case 'image' :
|
249 |
+
$slide = $this->get_image_slide( $id, $item, $data, $i );
|
250 |
+
break;
|
251 |
+
case 'video' :
|
252 |
+
$slide = $this->get_video_slide( $id, $item, $data, $i );
|
253 |
+
break;
|
254 |
+
case 'html' :
|
255 |
+
$slide = $this->get_html_slide( $id, $item, $data, $i );
|
256 |
+
break;
|
257 |
+
}
|
258 |
+
|
259 |
+
return apply_filters( 'soliloquy_output_slide', $slide, $id, $item, $data, $i );
|
260 |
+
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* Retrieves an individual image slide for the slider.
|
265 |
+
*
|
266 |
+
* @since 1.0.0
|
267 |
+
*
|
268 |
+
* @param int|string $id The ID for the slide.
|
269 |
+
* @param array $item Array of data for the slide.
|
270 |
+
* @param array $data Array of data for the slider.
|
271 |
+
* @param int $i The number of the slide in the slider.
|
272 |
+
* @return string HTML markup for the image slide.
|
273 |
+
*/
|
274 |
+
public function get_image_slide( $id, $item, $data, $i ) {
|
275 |
+
|
276 |
+
// Grab our image src and prepare our output.
|
277 |
+
$imagesrc = $this->get_image_src( $id, $item, $data );
|
278 |
+
$output = '';
|
279 |
+
|
280 |
+
// If our image is linked, link it.
|
281 |
+
if ( ! empty( $item['link'] ) ) {
|
282 |
+
$output = apply_filters( 'soliloquy_output_before_link', $output, $id, $item, $data, $i );
|
283 |
+
$output .= '<a href="' . esc_url( $item['link'] ) . '" class="soliloquy-link" title="' . esc_attr( $item['title'] ) . '"' . apply_filters( 'soliloquy_output_link_attr', '', $id, $item, $data, $i ) . '>';
|
284 |
+
}
|
285 |
+
|
286 |
+
$output = apply_filters( 'soliloquy_output_before_image', $output, $id, $item, $data, $i );
|
287 |
+
$output .= '<img id="soliloquy-image-' . sanitize_html_class( $id ) . '" class="soliloquy-image soliloquy-image-' . $i . '" src="' . esc_url( $imagesrc ) . '" alt="' . esc_attr( $item['alt'] ) . '"' . apply_filters( 'soliloquy_output_image_attr', '', $id, $item, $data, $i ) . ' />';
|
288 |
+
$output = apply_filters( 'soliloquy_output_after_image', $output, $id, $item, $data, $i );
|
289 |
+
|
290 |
+
// If our image is linked, close the link.
|
291 |
+
if ( ! empty( $item['link'] ) ) {
|
292 |
+
$output .= '</a>';
|
293 |
+
}
|
294 |
+
|
295 |
+
$output = apply_filters( 'soliloquy_output_after_link', $output, $id, $item, $data, $i );
|
296 |
+
|
297 |
+
// If we have a caption, output the caption.
|
298 |
+
if ( ! empty( $item['caption'] ) ) {
|
299 |
+
$output = apply_filters( 'soliloquy_output_before_caption', $output, $id, $item, $data, $i );
|
300 |
+
$output .= '<div class="soliloquy-caption"><div class="soliloquy-caption-inside">';
|
301 |
+
$caption = apply_filters( 'soliloquy_output_caption', $item['caption'], $id, $item, $data, $i );
|
302 |
+
$output .= $caption;
|
303 |
+
$output .= '</div></div>';
|
304 |
+
$output = apply_filters( 'soliloquy_output_after_caption', $output, $id, $item, $data, $i );
|
305 |
+
}
|
306 |
+
|
307 |
+
// Return our inner image slide HTML.
|
308 |
+
return apply_filters( 'soliloquy_output_image_slide', $output, $id, $item, $data, $i );
|
309 |
+
|
310 |
+
}
|
311 |
+
|
312 |
+
/**
|
313 |
+
* Outputs the slider init script in the footer.
|
314 |
+
*
|
315 |
+
* @since 1.0.0
|
316 |
+
*/
|
317 |
+
public function slider_init() {
|
318 |
+
|
319 |
+
foreach ( $this->data as $id => $data ) {
|
320 |
+
// Prevent multiple init scripts for the same slider ID.
|
321 |
+
if ( in_array( $data['id'], $this->done ) ) {
|
322 |
+
continue;
|
323 |
+
}
|
324 |
+
$this->done[] = $data['id'];
|
325 |
+
|
326 |
+
?>
|
327 |
+
<script type="text/javascript"><?php ob_start(); do_action( 'soliloquy_api_start_global', $data ); ?>
|
328 |
+
if ( typeof soliloquy_slider === 'undefined' || false === soliloquy_slider ) {
|
329 |
+
soliloquy_slider = {};
|
330 |
+
}
|
331 |
+
|
332 |
+
<?php if ( ! empty( $data['youtube'] ) ) : ?>
|
333 |
+
if ( typeof soliloquy_youtube === 'undefined' || false === soliloquy_youtube ) {
|
334 |
+
soliloquy_youtube = {};
|
335 |
+
}
|
336 |
+
<?php endif; ?>
|
337 |
+
|
338 |
+
<?php if ( ! empty( $data['vimeo'] ) ) : ?>
|
339 |
+
if ( typeof soliloquy_vimeo === 'undefined' || false === soliloquy_vimeo ) {
|
340 |
+
soliloquy_vimeo = {};
|
341 |
+
}
|
342 |
+
<?php endif; ?>
|
343 |
+
|
344 |
+
<?php if ( ! empty( $data['wistia'] ) ) : ?>
|
345 |
+
if ( typeof soliloquy_wistia === 'undefined' || false === soliloquy_wistia ) {
|
346 |
+
soliloquy_wistia = {};
|
347 |
+
}
|
348 |
+
<?php endif; ?>
|
349 |
+
|
350 |
+
jQuery('#soliloquy-container-<?php echo $data['id']; ?>').css('height', Math.round(jQuery('#soliloquy-container-<?php echo $data['id']; ?>').width()/(<?php echo $this->get_config( 'slider_width', $data ); ?>/<?php echo $this->get_config( 'slider_height', $data ); ?>))).fadeTo(300, 1);
|
351 |
+
|
352 |
+
jQuery(document).ready(function($){
|
353 |
+
<?php do_action( 'soliloquy_api_start', $data ); ?>
|
354 |
+
|
355 |
+
var soliloquy_container_<?php echo $data['id']; ?> = $('#soliloquy-container-<?php echo $data['id']; ?>'),
|
356 |
+
soliloquy_<?php echo $data['id']; ?> = $('#soliloquy-<?php echo $data['id']; ?>');
|
357 |
+
|
358 |
+
soliloquy_slider['<?php echo $data['id']; ?>'] = soliloquy_<?php echo $data['id']; ?>.soliloquy({
|
359 |
+
<?php do_action( 'soliloquy_api_config_start', $data ); ?>
|
360 |
+
slideSelector: '.soliloquy-item',
|
361 |
+
speed: <?php echo $this->get_config( 'speed', $data ); ?>,
|
362 |
+
pause: <?php echo $this->get_config( 'duration', $data ); ?>,
|
363 |
+
auto: 1,
|
364 |
+
useCSS: 0,
|
365 |
+
adaptiveHeight: 1,
|
366 |
+
adaptiveHeightSpeed: <?php echo apply_filters( 'soliloquy_adaptive_height_speed', 400, $data ); ?>,
|
367 |
+
infiniteLoop: 1,
|
368 |
+
mode: '<?php echo $this->get_config( 'transition', $data ); ?>',
|
369 |
+
pager: 1,
|
370 |
+
controls: 1,
|
371 |
+
nextText: '<?php echo apply_filters( 'soliloquy_next_text', '', $data ); ?>',
|
372 |
+
prevText: '<?php echo apply_filters( 'soliloquy_prev_text', '', $data ); ?>',
|
373 |
+
startText: '<?php echo apply_filters( 'soliloquy_start_text', '', $data ); ?>',
|
374 |
+
stopText: '<?php echo apply_filters( 'soliloquy_stop_text', '', $data ); ?>',
|
375 |
+
<?php do_action( 'soliloquy_api_config_callback', $data ); ?>
|
376 |
+
onSliderLoad: function(currentIndex){
|
377 |
+
soliloquy_container_<?php echo $data['id']; ?>.find('.soliloquy-active-slide').removeClass('soliloquy-active-slide');
|
378 |
+
soliloquy_container_<?php echo $data['id']; ?>.css({'height':'auto','background-image':'none'}).find('.soliloquy-controls').fadeTo(300, 1);
|
379 |
+
soliloquy_<?php echo $data['id']; ?>.find('.soliloquy-item:not(.soliloquy-clone):eq(' + currentIndex + ')').addClass('soliloquy-active-slide');
|
380 |
+
// Purge all cloned items of IDs to avoid duplicate ID issues.
|
381 |
+
soliloquy_container_<?php echo $data['id']; ?>.find('.soliloquy-clone').find('*').removeAttr('id');
|
382 |
+
<?php do_action( 'soliloquy_api_on_load', $data ); ?>
|
383 |
+
},
|
384 |
+
onSlideBefore: function(element, oldIndex, newIndex){
|
385 |
+
soliloquy_container_<?php echo $data['id']; ?>.find('.soliloquy-active-slide').removeClass('soliloquy-active-slide');
|
386 |
+
$(element).addClass('soliloquy-active-slide');
|
387 |
+
<?php do_action( 'soliloquy_api_before_transition', $data ); ?>
|
388 |
+
},
|
389 |
+
onSlideAfter: function(element, oldIndex, newIndex){
|
390 |
+
<?php do_action( 'soliloquy_api_after_transition', $data ); ?>
|
391 |
+
},
|
392 |
+
<?php do_action( 'soliloquy_api_config_end', $data ); ?>
|
393 |
+
});
|
394 |
+
|
395 |
+
<?php do_action( 'soliloquy_api_slider', $data ); ?>
|
396 |
+
|
397 |
+
<?php do_action( 'soliloquy_api_end', $data ); ?>
|
398 |
+
});
|
399 |
+
|
400 |
+
// Minify before outputting to improve page load time.
|
401 |
+
<?php do_action( 'soliloquy_api_end_global', $data ); echo $this->minify( ob_get_clean() ); ?></script>
|
402 |
+
<?php
|
403 |
+
}
|
404 |
+
|
405 |
+
}
|
406 |
+
|
407 |
+
/**
|
408 |
+
* Loads a custom slider display theme.
|
409 |
+
*
|
410 |
+
* @since 1.0.0
|
411 |
+
*
|
412 |
+
* @param string $theme The custom theme slug to load.
|
413 |
+
*/
|
414 |
+
public function load_slider_theme( $theme ) {
|
415 |
+
|
416 |
+
// Loop through the available themes and enqueue the one called.
|
417 |
+
foreach ( Soliloquy_Common_Lite::get_instance()->get_slider_themes() as $array => $data ) {
|
418 |
+
if ( $theme !== $data['value'] ) {
|
419 |
+
continue;
|
420 |
+
}
|
421 |
+
|
422 |
+
wp_enqueue_style( $this->base->plugin_slug . $theme . '-theme', plugins_url( 'themes/' . $theme . '/style.css', $data['file'] ), array( $this->base->plugin_slug . '-style' ) );
|
423 |
+
break;
|
424 |
+
}
|
425 |
+
|
426 |
+
}
|
427 |
+
|
428 |
+
/**
|
429 |
+
* Helper method for adding custom slider classes.
|
430 |
+
*
|
431 |
+
* @since 1.0.0
|
432 |
+
*
|
433 |
+
* @param array $data The slider data to use for retrieval.
|
434 |
+
* @return string String of space separated slider classes.
|
435 |
+
*/
|
436 |
+
public function get_slider_classes( $data ) {
|
437 |
+
|
438 |
+
// Set default class.
|
439 |
+
$classes = array();
|
440 |
+
$classes[] = 'soliloquy-container';
|
441 |
+
|
442 |
+
// Add custom class based on the transition.
|
443 |
+
$classes[] = 'soliloquy-transition-' . $this->get_config( 'transition', $data );
|
444 |
+
|
445 |
+
// If we have custom classes defined for this slider, output them now.
|
446 |
+
foreach ( (array) $this->get_config( 'classes', $data ) as $class ) {
|
447 |
+
$classes[] = $class;
|
448 |
+
}
|
449 |
+
|
450 |
+
// Allow filtering of classes and then return what's left.
|
451 |
+
$classes = apply_filters( 'soliloquy_output_classes', $classes, $data );
|
452 |
+
|
453 |
+
// Add custom class based on the theme.
|
454 |
+
$classes[] = 'soliloquy-theme-' . $this->get_config( 'slider_theme', $data );
|
455 |
+
|
456 |
+
return trim( implode( ' ', array_map( 'trim', array_map( 'sanitize_html_class', array_unique( $classes ) ) ) ) );
|
457 |
+
|
458 |
+
}
|
459 |
+
|
460 |
+
/**
|
461 |
+
* Helper method for adding custom slider classes.
|
462 |
+
*
|
463 |
+
* @since 1.0.4
|
464 |
+
*
|
465 |
+
* @param array $item Array of item data.
|
466 |
+
* @param int $i The current position in the slider.
|
467 |
+
* @param array $data The slider data to use for retrieval.
|
468 |
+
* @return string String of space separated slider item classes.
|
469 |
+
*/
|
470 |
+
public function get_slider_item_classes( $item, $i, $data ) {
|
471 |
+
|
472 |
+
// Set default class.
|
473 |
+
$classes = array();
|
474 |
+
$classes[] = 'soliloquy-item';
|
475 |
+
$classes[] = 'soliloquy-item-' . $i;
|
476 |
+
|
477 |
+
// Set the type of slide as a class.
|
478 |
+
$classes[] = ! empty( $item['type'] ) ? 'soliloquy-' . $item['type'] . '-slide' : 'soliloquy-image-slide';
|
479 |
+
|
480 |
+
// Allow filtering of classes and then return what's left.
|
481 |
+
$classes = apply_filters( 'soliloquy_output_item_classes', $classes, $item, $i, $data );
|
482 |
+
return trim( implode( ' ', array_map( 'trim', array_map( 'sanitize_html_class', array_unique( $classes ) ) ) ) );
|
483 |
+
|
484 |
+
}
|
485 |
+
|
486 |
+
/**
|
487 |
+
* Helper method to retrieve the proper image src attribute based on slider settings.
|
488 |
+
*
|
489 |
+
* @since 1.0.0
|
490 |
+
*
|
491 |
+
* @param int $id The image attachment ID to use.
|
492 |
+
* @param array $item Slider item data.
|
493 |
+
* @param array $data The slider data to use for retrieval.
|
494 |
+
* @param string $type The type of cropped image to retrieve.
|
495 |
+
* @return string The proper image src attribute for the image.
|
496 |
+
*/
|
497 |
+
public function get_image_src( $id, $item, $data, $type = 'slider' ) {
|
498 |
+
|
499 |
+
// Get the full image src. If it does not return the data we need, return the image link instead.
|
500 |
+
$src = wp_get_attachment_image_src( $id, 'full' );
|
501 |
+
$image = ! empty( $src[0] ) ? $src[0] : false;
|
502 |
+
|
503 |
+
// Allow image to be filtered to use a different thumbnail than the main image.
|
504 |
+
if ( 'thumbnails' == $type ) {
|
505 |
+
$image = apply_filters( 'soliloquy_cropped_image', $image, $id, $item, $data, $data['id'] );
|
506 |
+
}
|
507 |
+
|
508 |
+
// If no image, return with the base link.
|
509 |
+
if ( ! $image ) {
|
510 |
+
$image = ! empty( $item['src'] ) ? $item['src'] : false;
|
511 |
+
if ( ! $image ) {
|
512 |
+
return apply_filters( 'soliloquy_no_image_src', $item['link'], $id, $item, $data );
|
513 |
+
}
|
514 |
+
}
|
515 |
+
|
516 |
+
// Generate the cropped image if necessary.
|
517 |
+
$type = 'thumbnails' !== $type ? apply_filters( 'soliloquy_crop_type', $type, $id, $item, $data ) : $type;
|
518 |
+
if ( empty( $type ) ) {
|
519 |
+
return apply_filters( 'soliloquy_no_image_type', $item['link'], $id, $item, $data );
|
520 |
+
}
|
521 |
+
|
522 |
+
// If the setting exists, go onward with cropping.
|
523 |
+
if ( isset( $data['config']['slider'] ) && $data['config']['slider'] ) {
|
524 |
+
if ( isset( $data['config'][$type] ) && $data['config'][$type] ) {
|
525 |
+
$common = Soliloquy_Common_Lite::get_instance();
|
526 |
+
$args = apply_filters( 'soliloquy_crop_image_args',
|
527 |
+
array(
|
528 |
+
'position' => 'c',
|
529 |
+
'width' => $this->get_config( $type . '_width', $data ),
|
530 |
+
'height' => $this->get_config( $type . '_height', $data ),
|
531 |
+
'quality' => 100,
|
532 |
+
'retina' => false
|
533 |
+
)
|
534 |
+
);
|
535 |
+
$cropped_image = $common->resize_image( $image, $args['width'], $args['height'], true, $args['position'], $args['quality'], $args['retina'] );
|
536 |
+
|
537 |
+
// If there is an error, possibly output error message and return the default image src.
|
538 |
+
if ( is_wp_error( $cropped_image ) ) {
|
539 |
+
// If debugging is defined, print out the error.
|
540 |
+
if ( defined( 'SOLILOQUY_CROP_DEBUG' ) && SOLILOQUY_CROP_DEBUG ) {
|
541 |
+
echo '<pre>' . var_export( $cropped_image->get_error_message(), true ) . '</pre>';
|
542 |
+
}
|
543 |
+
|
544 |
+
// Return the non-cropped image as a fallback.
|
545 |
+
return apply_filters( 'soliloquy_image_src', $image, $id, $item, $data );
|
546 |
+
} else {
|
547 |
+
return apply_filters( 'soliloquy_image_src', $cropped_image, $id, $item, $data );
|
548 |
+
}
|
549 |
+
} else {
|
550 |
+
return apply_filters( 'soliloquy_image_src', $image, $id, $item, $data );
|
551 |
+
}
|
552 |
+
} else {
|
553 |
+
return apply_filters( 'soliloquy_image_src', $image, $id, $item, $data );
|
554 |
+
}
|
555 |
+
|
556 |
+
}
|
557 |
+
|
558 |
+
/**
|
559 |
+
* Helper method for positioning the slider.
|
560 |
+
*
|
561 |
+
* @since 1.0.0
|
562 |
+
*
|
563 |
+
* @param string $style String of slider container styles.
|
564 |
+
* @param array $data Array of slider data.
|
565 |
+
* @return string $style Amended string of slider container styles.
|
566 |
+
*/
|
567 |
+
public function position_slider( $style, $data ) {
|
568 |
+
|
569 |
+
$gutter = $this->get_config( 'gutter', $data );
|
570 |
+
$position = '';
|
571 |
+
switch ( $this->get_config( 'position', $data ) ) {
|
572 |
+
case 'center' :
|
573 |
+
$position .= 'margin:0 auto ' . $gutter . 'px;';
|
574 |
+
break;
|
575 |
+
case 'left' :
|
576 |
+
$position .= 'float:left;margin:0 ' . $gutter . 'px ' . $gutter . 'px 0;';
|
577 |
+
break;
|
578 |
+
case 'right' :
|
579 |
+
$position .= 'float:right;margin:0 0 ' . $gutter . 'px ' . $gutter . 'px;';
|
580 |
+
break;
|
581 |
+
}
|
582 |
+
|
583 |
+
$position = apply_filters( 'soliloquy_position_style', $position, $data );
|
584 |
+
return $style . $position;
|
585 |
+
|
586 |
+
}
|
587 |
+
|
588 |
+
/**
|
589 |
+
* Helper method for retrieving the mobile image src attribute.
|
590 |
+
*
|
591 |
+
* @since 1.0.0
|
592 |
+
*
|
593 |
+
* @param string $attr String of image attributes.
|
594 |
+
* @param int $id The ID of the image attachment.
|
595 |
+
* @param array $item The array of date for the image.
|
596 |
+
* @param array $data Array of slider data.
|
597 |
+
* @return string $attr Amended string of image attributes.
|
598 |
+
*/
|
599 |
+
public function mobile_image( $attr, $id, $item, $data ) {
|
600 |
+
|
601 |
+
$mobile_image = $this->get_image_src( $id, $item, $data, 'mobile' );
|
602 |
+
return $attr . ' data-soliloquy-src-mobile="' . esc_url( $mobile_image ) . '"';
|
603 |
+
|
604 |
+
}
|
605 |
+
|
606 |
+
/**
|
607 |
+
* Shuffles and randomizes images in a slider.
|
608 |
+
*
|
609 |
+
* @since 1.0.0
|
610 |
+
*
|
611 |
+
* @param array $data The slider data to use for retrieval.
|
612 |
+
* @return array $data Shuffled slider data.
|
613 |
+
*/
|
614 |
+
public function shuffle( $data ) {
|
615 |
+
|
616 |
+
// Return early there are no items to shuffle.
|
617 |
+
if ( ! is_array( $data['slider'] ) ) {
|
618 |
+
return $data;
|
619 |
+
}
|
620 |
+
|
621 |
+
// Prepare variables.
|
622 |
+
$random = array();
|
623 |
+
$keys = array_keys( $data['slider'] );
|
624 |
+
|
625 |
+
// Shuffle the keys and loop through them to create a new, randomized array of images.
|
626 |
+
shuffle( $keys );
|
627 |
+
foreach ( $keys as $key ) {
|
628 |
+
$random[$key] = $data['slider'][$key];
|
629 |
+
}
|
630 |
+
|
631 |
+
// Return the randomized image array.
|
632 |
+
$data['slider'] = $random;
|
633 |
+
return $data;
|
634 |
+
|
635 |
+
}
|
636 |
+
|
637 |
+
/**
|
638 |
+
* Helper method for retrieving config values.
|
639 |
+
*
|
640 |
+
* @since 1.0.0
|
641 |
+
*
|
642 |
+
* @param string $key The config key to retrieve.
|
643 |
+
* @param array $data The slider data to use for retrieval.
|
644 |
+
* @return string Key value on success, default if not set.
|
645 |
+
*/
|
646 |
+
public function get_config( $key, $data ) {
|
647 |
+
|
648 |
+
$instance = Soliloquy_Common_Lite::get_instance();
|
649 |
+
return isset( $data['config'][$key] ) ? $data['config'][$key] : $instance->get_config_default( $key );
|
650 |
+
|
651 |
+
}
|
652 |
+
|
653 |
+
/**
|
654 |
+
* Helper method to minify a string of data.
|
655 |
+
*
|
656 |
+
* @since 1.0.4
|
657 |
+
*
|
658 |
+
* @param string $string String of data to minify.
|
659 |
+
* @return string $string Minified string of data.
|
660 |
+
*/
|
661 |
+
public function minify( $string ) {
|
662 |
+
|
663 |
+
$clean = preg_replace( '/((?:\/\*(?:[^*]|(?:\*+[^*\/]))*\*+\/)|(?:\/\/.*))/', '', $string );
|
664 |
+
$clean = str_replace( array( "\r\n", "\r", "\t", "\n", ' ', ' ', ' ' ), '', $clean );
|
665 |
+
return apply_filters( 'soliloquy_minified_string', $clean, $string );
|
666 |
+
|
667 |
+
}
|
668 |
+
|
669 |
+
/**
|
670 |
+
* Outputs only the first image of the slider inside a regular <div> tag
|
671 |
+
* to avoid styling issues with feeds.
|
672 |
+
*
|
673 |
+
* @since 1.0.0
|
674 |
+
*
|
675 |
+
* @param array $data Array of slider data.
|
676 |
+
* @return string $slider Custom slider output for feeds.
|
677 |
+
*/
|
678 |
+
public function do_feed_output( $data ) {
|
679 |
+
|
680 |
+
$slider = '<div class="soliloquy-feed-output">';
|
681 |
+
foreach ( $data['slider'] as $id => $item ) {
|
682 |
+
// Skip over images that are pending (ignore if in Preview mode).
|
683 |
+
if ( isset( $item['status'] ) && 'pending' == $item['status'] && ! is_preview() ) {
|
684 |
+
continue;
|
685 |
+
}
|
686 |
+
|
687 |
+
$imagesrc = $this->get_image_src( $id, $item, $data );
|
688 |
+
$slider .= '<img class="soliloquy-feed-image" src="' . esc_url( $imagesrc ) . '" title="' . esc_attr( $item['title'] ) . '" alt="' . esc_attr( $item['alt'] ) . '" />';
|
689 |
+
break;
|
690 |
+
}
|
691 |
+
$slider .= '</div>';
|
692 |
+
|
693 |
+
return apply_filters( 'soliloquy_feed_output', $slider, $data );
|
694 |
+
|
695 |
+
}
|
696 |
+
|
697 |
+
/**
|
698 |
+
* Returns the query args to be passed to YouTube videos.
|
699 |
+
*
|
700 |
+
* @since 1.0.0
|
701 |
+
*
|
702 |
+
* @param array $data Array of slider data.
|
703 |
+
*/
|
704 |
+
public function get_youtube_args( $data ) {
|
705 |
+
|
706 |
+
return apply_filters( 'soliloquy_youtube_args',
|
707 |
+
array(
|
708 |
+
'enablejsapi' => 1,
|
709 |
+
'version' => 3,
|
710 |
+
'wmode' => 'transparent',
|
711 |
+
'rel' => 0,
|
712 |
+
'showinfo' => 0,
|
713 |
+
'modestbranding' => 1,
|
714 |
+
'autoplay' => 1,
|
715 |
+
'origin' => get_home_url()
|
716 |
+
),
|
717 |
+
$data
|
718 |
+
);
|
719 |
+
|
720 |
+
}
|
721 |
+
|
722 |
+
/**
|
723 |
+
* Returns the query args to be passed to Vimeo videos.
|
724 |
+
*
|
725 |
+
* @since 1.0.0
|
726 |
+
*
|
727 |
+
* @param array $data Array of slider data.
|
728 |
+
*/
|
729 |
+
public function get_vimeo_args( $data ) {
|
730 |
+
|
731 |
+
return apply_filters( 'soliloquy_vimeo_args',
|
732 |
+
array(
|
733 |
+
'api' => 1,
|
734 |
+
'wmode' => 'transparent',
|
735 |
+
'byline' => 0,
|
736 |
+
'title' => 0,
|
737 |
+
'portrait' => 0,
|
738 |
+
'autoplay' => 1,
|
739 |
+
'badge' => 0,
|
740 |
+
'fullscreen' => 1
|
741 |
+
),
|
742 |
+
$data
|
743 |
+
);
|
744 |
+
|
745 |
+
}
|
746 |
+
|
747 |
+
/**
|
748 |
+
* Returns the query args to be passed to Wistia videos.
|
749 |
+
*
|
750 |
+
* @since 1.0.0
|
751 |
+
*
|
752 |
+
* @param array $data Array of slider data.
|
753 |
+
*/
|
754 |
+
public function get_wistia_args( $data ) {
|
755 |
+
|
756 |
+
return apply_filters( 'soliloquy_wistia_args',
|
757 |
+
array(
|
758 |
+
'version' => 'v1',
|
759 |
+
'wmode' => 'opaque',
|
760 |
+
'volumeControl' => 1,
|
761 |
+
'controlsVisibleOnLoad' => 1,
|
762 |
+
'videoFoam' => 1
|
763 |
+
),
|
764 |
+
$data
|
765 |
+
);
|
766 |
+
|
767 |
+
}
|
768 |
+
|
769 |
+
/**
|
770 |
+
* Flag for detecting a mobile device server-side.
|
771 |
+
*
|
772 |
+
* @since 1.0.0
|
773 |
+
*
|
774 |
+
* @return bool True if on a mobile device, false otherwise.
|
775 |
+
*/
|
776 |
+
public function is_mobile() {
|
777 |
+
|
778 |
+
// If the user agent header is not set, return false.
|
779 |
+
if ( ! isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
|
780 |
+
return false;
|
781 |
+
}
|
782 |
+
|
783 |
+
// Test for a mobile browser.
|
784 |
+
$user_agent = stripslashes( $_SERVER['HTTP_USER_AGENT'] );
|
785 |
+
if ( preg_match( '/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i', $user_agent ) || preg_match( '/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i', substr( $user_agent, 0, 4 ) ) ) {
|
786 |
+
return true;
|
787 |
+
}
|
788 |
+
|
789 |
+
// Return false if not a mobile device.
|
790 |
+
return false;
|
791 |
+
|
792 |
+
}
|
793 |
+
|
794 |
+
/**
|
795 |
+
* Returns the singleton instance of the class.
|
796 |
+
*
|
797 |
+
* @since 1.0.0
|
798 |
+
*
|
799 |
+
* @return object The Soliloquy_Shortcode_Lite object.
|
800 |
+
*/
|
801 |
+
public static function get_instance() {
|
802 |
+
|
803 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Soliloquy_Shortcode_Lite ) ) {
|
804 |
+
self::$instance = new Soliloquy_Shortcode_Lite();
|
805 |
+
}
|
806 |
+
|
807 |
+
return self::$instance;
|
808 |
+
|
809 |
+
}
|
810 |
+
|
811 |
+
}
|
812 |
+
|
813 |
+
// Load the shortcode class.
|
814 |
+
$soliloquy_shortcode_lite = Soliloquy_Shortcode_Lite::get_instance();
|
readme.txt
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Responsive WordPress Slider - Soliloquy Lite ===
|
2 |
+
Contributors: griffinjt
|
3 |
+
Tags: wordpress slider, slider, wordpress slider plugin, slider plugin, responsive, responsive slider, image slider, image slider plugin, responsive slider plugin, responsive image slider, responsive image slider plugin, custom post types, slideshow, responsive slideshow, slideshow plugin, responsive slideshow plugin, rotator, image rotator, responsive rotator, jquery slider, javascript slider, jquery rotator, javascript rotator, picture slider, photo slider, photo rotator, shortcode, template tag, wordpress slideshow, photo slider, wordpress responsive slider, wordpress picture slider, responsive picture slider
|
4 |
+
Requires at least: 3.5.1
|
5 |
+
Tested up to: 3.9
|
6 |
+
Stable tag: trunk
|
7 |
+
License: GNU General Public License v2.0 or later
|
8 |
+
|
9 |
+
The best responsive WordPress slider plugin. Made lite and free.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
Soliloquy, the [best responsive WordPress slider plugin](http://soliloquywp.com/pricing/?utm_source=orgrepo&utm_medium=link&utm_campaign=Soliloquy%2BLite), is now available in its Lite form! Soliloquy is audited by Mark Jaquith, lead developer of WordPress, for security and features the **easiest to use and most performance optimized code for a WordPress slider plugin.** By utilizing custom post types, Soliloquy allows you to create an infinite number of responsive WordPress sliders with an infinite number of images in each slider with a few clicks of the mouse. **It's hard to go wrong with this WordPress slider!**
|
14 |
+
|
15 |
+
*Need more convincing? [Check out the top ten reasons why Soliloquy is the **best responsive WordPress slider plugin** on the market!](http://soliloquywp.com/wordpress-slider-plugin/?utm_source=orgrepo&utm_medium=link&utm_campaign=Soliloquy%2BLite)
|
16 |
+
|
17 |
+
**Note: This is the lite version of the Soliloquy WordPress slider. Want even more WordPress slider features, including HTML/video slides, complete embedded video support for YouTube and Vimeo, widgets, and access to exclusive Addons (such as full lightbox support and image filters)? [Click here to purchase the best responsive WordPress slider plugin now!](http://soliloquywp.com/pricing/?utm_source=orgrepo&utm_medium=link&utm_campaign=Soliloquy%2BLite).**
|
18 |
+
|
19 |
+
= Features =
|
20 |
+
|
21 |
+
* Usage of custom post types to create an unlimited number of WordPress sliders.
|
22 |
+
* Drag-and-drop image uploading, sorting and saving.
|
23 |
+
* Completely SEO optimized with the ability to specify alt and title tags for your images within the slider.
|
24 |
+
* Completely responsive (with touch enabled swiping).
|
25 |
+
* Shortcode and template tags handy so that you can insert your WordPress slider anywhere in your theme.
|
26 |
+
* Metadata editing for each image, including image titles, alt tags and full HTML captions.
|
27 |
+
* Smart JS/CSS loading so that assets only load on pages where a Soliloquy WordPress slider is present.
|
28 |
+
* Media uploader button to easily insert your WordPress slider into your posts/pages from the WYSIWYG editor.
|
29 |
+
|
30 |
+
Beyond the features mentioned above, there are plenty of other **WordPress slider features** inside of the plugin. You gain the benefit of an intuitive user interface that makes slider management easy, simple to understand slider options, and a plethora of hooks and filters to **manipulate the slider output.**
|
31 |
+
|
32 |
+
_It's hard to go wrong by choosing [Soliloquy](http://soliloquywp.com/pricing/?utm_source=orgrepo&utm_medium=link&utm_campaign=Soliloquy%2BLite) as your all-in-one **WordPress slider plugin** solution!_
|
33 |
+
|
34 |
+
= Why Choose Soliloquy? =
|
35 |
+
|
36 |
+
Soliloquy is the **best choice for a WordPress slider plugin** because it is fast, extremely inuitive and super easy to use. You can get your slider going in just a matter of seconds. In fact, take a look at how easy it is to create a WordPress slider with the paid version of the Soliloquy WordPress slider in the video below:
|
37 |
+
|
38 |
+
[youtube http://www.youtube.com/watch?v=zw_t7RXYzTE]
|
39 |
+
|
40 |
+
**Note: This WordPress slider plugin is provided as-is. Only critical bug fixes, future compatibility with WordPress versions and routine maintenance will be addressed in plugin updates. If you want support or access to more slider features, [consider purchasing a support license](http://soliloquywp.com/pricing/?utm_source=orgrepo&utm_medium=link&utm_campaign=Soliloquy%2BLite).**
|
41 |
+
|
42 |
+
== Installation ==
|
43 |
+
|
44 |
+
1. Install Soliloquy Lite either via the WordPress.org plugin repository, or by uploading the files to your server.
|
45 |
+
2. Activate Soliloquy Lite.
|
46 |
+
3. Navigate to the Soliloquy tab at the bottom of your admin menu and click "Add New" to begin creating your new WordPress slider.
|
47 |
+
4. Salivate for new features and [purchase the full version of Soliloquy](http://soliloquywp.com/pricing/?utm_source=orgrepo&utm_medium=link&utm_campaign=Soliloquy%2BLite)!
|
48 |
+
|
49 |
+
== Frequently Asked Questions ==
|
50 |
+
|
51 |
+
= I'd like access to more features. How can I get them? =
|
52 |
+
|
53 |
+
You can get access to more features, Addons and support by [visiting the Soliloquy website and purchasing a support license](http://soliloquywp.com/pricing/?utm_source=orgrepo&utm_medium=link&utm_campaign=Soliloquy%2BLite). Purchasing a support license gets you access to the full version of Soliloquy, automatic updates and support. Purchasing a developer support license gets you all the aforementioned plus exclusive access to Soliloquy Addons.
|
54 |
+
|
55 |
+
== Screenshots ==
|
56 |
+
|
57 |
+
1. Main Soliloquy screen.
|
58 |
+
2. Soliloquy Add/Edit screen with images loaded.
|
59 |
+
3. Soliloquy Config options screen.
|
60 |
+
4. Soliloquy image metadata editing modal.
|
61 |
+
5. Easily select a slider to insert into your post or page.
|
62 |
+
6. The final result.
|
63 |
+
|
64 |
+
== Notes ==
|
65 |
+
|
66 |
+
Soliloquy is absolutely, positively the [best responsive WordPress slider plugin](http://soliloquywp.com/?utm_source=orgrepo&utm_medium=link&utm_campaign=Soliloquy%2BLite) on the market. It is fast, flexible and solves the problem of responsive sliders in a flash.
|
67 |
+
|
68 |
+
In v2.0 of Soliloquy Lite, it includes a big plugin architecture change. You need to make sure you click on the link and follow the instructions on the screen when updating. There will be an upgrade notice - make sure you click this and upgrade your sliders after updating to v2!
|
69 |
+
|
70 |
+
= Addons =
|
71 |
+
|
72 |
+
Soliloquy has many Addons that extend its default functionality to make it do incredible things.
|
73 |
+
|
74 |
+
* (Soliloquy Themes Addon)[http://soliloquywp.com/addons/themes/?utm_source=orgrepo&utm_medium=link&utm_campaign=Soliloquy%2BLite] - beautiful themes for your WordPress slider.
|
75 |
+
* (Soliloquy Preview Addon)[http://soliloquywp.com/addons/preview/?utm_source=orgrepo&utm_medium=link&utm_campaign=Soliloquy%2BLite] - get instant previews of your slider straight inside the editing area of the slider.
|
76 |
+
* (Soliloquy Lightbox Addon)[http://soliloquywp.com/addons/lightbox/?utm_source=orgrepo&utm_medium=link&utm_campaign=Soliloquy%2BLite] - use powerful lightbox features to enhance the presentation and interaction with your WordPress slider.
|
77 |
+
* (Soliloquy Instagram Addon)[http://soliloquywp.com/addons/instagram/?utm_source=orgrepo&utm_medium=link&utm_campaign=Soliloquy%2BLite] - make awesome responsive WordPress sliders from your Instagram photo stream.
|
78 |
+
* (Soliloquy Crop Addon)[http://soliloquywp.com/addons/crop/?utm_source=orgrepo&utm_medium=link&utm_campaign=Soliloquy%2BLite] - instantly and dynamically crop images to the size you specify on the fly. No more resizing in Photoshop!
|
79 |
+
* (Soliloquy Featured Content Addon)[http://soliloquywp.com/addons/featured-content/?utm_source=orgrepo&utm_medium=link&utm_campaign=Soliloquy%2BLite] - make a gorgeous WordPress slider from you posts, pages and other custom post types.
|
80 |
+
* (Soliloquy Pinterest Addon)[http://soliloquywp.com/addons/pinterest/?utm_source=orgrepo&utm_medium=link&utm_campaign=Soliloquy%2BLite] - easily add a "Pin It" button to images in your slider.
|
81 |
+
* (Soliloquy Thumbnails Addon)[http://soliloquywp.com/addons/thumbnails/?utm_source=orgrepo&utm_medium=link&utm_campaign=Soliloquy%2BLite] - give your slider easy-to-use and responsive thumbnails.
|
82 |
+
* (Soliloquy Filters Addon)[http://soliloquywp.com/addons/filters/?utm_source=orgrepo&utm_medium=link&utm_campaign=Soliloquy%2BLite] - add 25+ awesome filters to images in your WordPress slider.
|
83 |
+
* (Soliloquy Carousel Addon)[http://soliloquywp.com/addons/carousel/?utm_source=orgrepo&utm_medium=link&utm_campaign=Soliloquy%2BLite] - transform your default WordPress slider into a responsive and easy-to-use carousel slider.
|
84 |
+
|
85 |
+
== Changelog ==
|
86 |
+
|
87 |
+
= 2.0.3 =
|
88 |
+
* Fixed bug with captions loading at top instead of bottom of slide.
|
89 |
+
|
90 |
+
= 2.0.2 =
|
91 |
+
* Fixed error with caption classes.
|
92 |
+
|
93 |
+
= 2.0.1 =
|
94 |
+
* Fixed fatal error on activation for wrong class name.
|
95 |
+
|
96 |
+
= 2.0.0 =
|
97 |
+
* Upgrade to v2 architecture. Make sure you upgrade your sliders after updating!!
|
98 |
+
* Fixed numerous bugs and other browser incompatibilities.
|
99 |
+
* Transitioned to new data structure for better performance and security.
|
100 |
+
* Faster loading times and better prevention of content shifting.
|
101 |
+
* A shiny new interface for easily handling sliders.
|
102 |
+
* Sliders can now be made right inside post/page screens!
|
103 |
+
|
104 |
+
= 1.5.2 =
|
105 |
+
* Fixed possible menu positioning conflict with other plugins.
|
106 |
+
* Updated the slider engine to add touch support for Windows phones and other touch devices.
|
107 |
+
* More optimized CSS/JS files.
|
108 |
+
|
109 |
+
= 1.5.1 =
|
110 |
+
* More bug fixes and enhancements.
|
111 |
+
|
112 |
+
= 1.5.0 =
|
113 |
+
* Bug fixes and enhancements, including upgrade enhancements.
|
114 |
+
|
115 |
+
= 1.4.4 =
|
116 |
+
* Updated the main slider script and init script. Be sure to check out the forum topic if your slider disappears. It is caused by a caching issue.
|
117 |
+
* Added touch support for Windows mobile phones.
|
118 |
+
|
119 |
+
= 1.4.3 =
|
120 |
+
* Fixed undefined variable notice when using the loading icon
|
121 |
+
* Better loading of files (admin and front-end separation)
|
122 |
+
* Miscellaneous bug fixes and enhancements
|
123 |
+
|
124 |
+
= 1.4.2 =
|
125 |
+
* Bug fixes and enhancements
|
126 |
+
|
127 |
+
= 1.4.1 =
|
128 |
+
* Fixed a bug with the dynamic size calculation when using a loading icon for the slider
|
129 |
+
|
130 |
+
= 1.4.0 =
|
131 |
+
* Added ability to display a loading icon to fix content jumping on slider loading (retina ready too!)
|
132 |
+
* Bug fixes and enhancements
|
133 |
+
|
134 |
+
= 1.3.0 =
|
135 |
+
* Compatibility updates with WP 3.5
|
136 |
+
* Updates to bring parity between Soliloquy Lite and Soliloquy
|
137 |
+
* Shiny new media button that integrates seamlessly with the new Add Media button
|
138 |
+
* Default post meta fields are now set when upgrading from Soliloquy Lite to Soliloquy
|
139 |
+
* Bug fixes and enhancements
|
140 |
+
|
141 |
+
= 1.2.0 =
|
142 |
+
* Updated to fix some MS issues
|
143 |
+
* General bug fixes and enhancements
|
144 |
+
|
145 |
+
= 1.1.0 =
|
146 |
+
* Updated icons and such to reflect new branding
|
147 |
+
|
148 |
+
= 1.0.0 =
|
149 |
+
* Initial release
|
soliloquy-lite.php
ADDED
@@ -0,0 +1,508 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: Responsive WordPress Slider - Soliloquy Lite
|
4 |
+
* Plugin URI: http://soliloquywp.com
|
5 |
+
* Description: Soliloquy is best responsive WordPress slider plugin. This is the lite version.
|
6 |
+
* Author: Thomas Griffin
|
7 |
+
* Author URI: http://thomasgriffinmedia.com
|
8 |
+
* Version: 2.0.3
|
9 |
+
* Text Domain: soliloquy
|
10 |
+
* Domain Path: languages
|
11 |
+
*
|
12 |
+
* Soliloquy is free software: you can redistribute it and/or modify
|
13 |
+
* it under the terms of the GNU General Public License as published by
|
14 |
+
* the Free Software Foundation, either version 2 of the License, or
|
15 |
+
* any later version.
|
16 |
+
*
|
17 |
+
* Soliloquy is distributed in the hope that it will be useful,
|
18 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
20 |
+
* GNU General Public License for more details.
|
21 |
+
*
|
22 |
+
* You should have received a copy of the GNU General Public License
|
23 |
+
* along with Soliloquy. If not, see <http://www.gnu.org/licenses/>.
|
24 |
+
*/
|
25 |
+
|
26 |
+
// Exit if accessed directly.
|
27 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
28 |
+
exit;
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Main plugin class.
|
33 |
+
*
|
34 |
+
* @since 1.0.0
|
35 |
+
*
|
36 |
+
* @package Soliloquy_Lite
|
37 |
+
* @author Thomas Griffin
|
38 |
+
*/
|
39 |
+
class Soliloquy_Lite {
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Holds the class object.
|
43 |
+
*
|
44 |
+
* @since 1.0.0
|
45 |
+
*
|
46 |
+
* @var object
|
47 |
+
*/
|
48 |
+
public static $instance;
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Plugin version, used for cache-busting of style and script file references.
|
52 |
+
*
|
53 |
+
* @since 1.0.0
|
54 |
+
*
|
55 |
+
* @var string
|
56 |
+
*/
|
57 |
+
public $version = '2.0.3';
|
58 |
+
|
59 |
+
/**
|
60 |
+
* The name of the plugin.
|
61 |
+
*
|
62 |
+
* @since 1.0.0
|
63 |
+
*
|
64 |
+
* @var string
|
65 |
+
*/
|
66 |
+
public $plugin_name = 'Soliloquy Lite';
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Unique plugin slug identifier.
|
70 |
+
*
|
71 |
+
* @since 1.0.0
|
72 |
+
*
|
73 |
+
* @var string
|
74 |
+
*/
|
75 |
+
public $plugin_slug = 'soliloquy-lite';
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Plugin file.
|
79 |
+
*
|
80 |
+
* @since 1.0.0
|
81 |
+
*
|
82 |
+
* @var string
|
83 |
+
*/
|
84 |
+
public $file = __FILE__;
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Primary class constructor.
|
88 |
+
*
|
89 |
+
* @since 1.0.0
|
90 |
+
*/
|
91 |
+
public function __construct() {
|
92 |
+
|
93 |
+
// Fire a hook before the class is setup.
|
94 |
+
do_action( 'soliloquy_pre_init' );
|
95 |
+
|
96 |
+
// Load the plugin textdomain.
|
97 |
+
add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ) );
|
98 |
+
|
99 |
+
// Load the plugin.
|
100 |
+
add_action( 'init', array( $this, 'init' ), 0 );
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Loads the plugin textdomain for translation.
|
106 |
+
*
|
107 |
+
* @since 1.0.0
|
108 |
+
*/
|
109 |
+
public function load_plugin_textdomain() {
|
110 |
+
|
111 |
+
// If the main Soliloquy plugin exists, do nothing.
|
112 |
+
if ( class_exists( 'Soliloquy' ) || class_exists( 'Tgmsp' ) ) {
|
113 |
+
return;
|
114 |
+
}
|
115 |
+
|
116 |
+
$domain = 'soliloquy';
|
117 |
+
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
|
118 |
+
|
119 |
+
load_textdomain( $domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' );
|
120 |
+
load_plugin_textdomain( $domain, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
121 |
+
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Loads the plugin into WordPress.
|
126 |
+
*
|
127 |
+
* @since 1.0.0
|
128 |
+
*/
|
129 |
+
public function init() {
|
130 |
+
|
131 |
+
// If the main Soliloquy plugin exists, do nothing.
|
132 |
+
if ( class_exists( 'Soliloquy' ) || class_exists( 'Tgmsp' ) ) {
|
133 |
+
return;
|
134 |
+
}
|
135 |
+
|
136 |
+
// Run hook once Soliloquy has been initialized.
|
137 |
+
do_action( 'soliloquy_init' );
|
138 |
+
|
139 |
+
// Load admin only components.
|
140 |
+
if ( is_admin() ) {
|
141 |
+
$this->require_admin();
|
142 |
+
}
|
143 |
+
|
144 |
+
// Load global components.
|
145 |
+
$this->require_global();
|
146 |
+
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Loads all admin related files into scope.
|
151 |
+
*
|
152 |
+
* @since 1.0.0
|
153 |
+
*/
|
154 |
+
public function require_admin() {
|
155 |
+
|
156 |
+
require plugin_dir_path( __FILE__ ) . 'includes/admin/ajax.php';
|
157 |
+
require plugin_dir_path( __FILE__ ) . 'includes/admin/common.php';
|
158 |
+
require plugin_dir_path( __FILE__ ) . 'includes/admin/editor.php';
|
159 |
+
require plugin_dir_path( __FILE__ ) . 'includes/admin/media.php';
|
160 |
+
require plugin_dir_path( __FILE__ ) . 'includes/admin/metaboxes.php';
|
161 |
+
require plugin_dir_path( __FILE__ ) . 'includes/admin/posttype.php';
|
162 |
+
require plugin_dir_path( __FILE__ ) . 'includes/admin/settings.php';
|
163 |
+
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Loads all global files into scope.
|
168 |
+
*
|
169 |
+
* @since 1.0.0
|
170 |
+
*/
|
171 |
+
public function require_global() {
|
172 |
+
|
173 |
+
require plugin_dir_path( __FILE__ ) . 'includes/global/common.php';
|
174 |
+
require plugin_dir_path( __FILE__ ) . 'includes/global/posttype.php';
|
175 |
+
require plugin_dir_path( __FILE__ ) . 'includes/global/shortcode.php';
|
176 |
+
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Returns a slider based on ID.
|
181 |
+
*
|
182 |
+
* @since 1.0.0
|
183 |
+
*
|
184 |
+
* @param int $id The slider ID used to retrieve a slider.
|
185 |
+
* @return array|bool Array of slider data or false if none found.
|
186 |
+
*/
|
187 |
+
public function get_slider( $id ) {
|
188 |
+
|
189 |
+
// Attempt to return the transient first, otherwise generate the new query to retrieve the data.
|
190 |
+
if ( false === ( $slider = get_transient( '_sol_cache_' . $id ) ) ) {
|
191 |
+
$slider = $this->_get_slider( $id );
|
192 |
+
if ( $slider ) {
|
193 |
+
set_transient( '_sol_cache_' . $id, $slider, DAY_IN_SECONDS );
|
194 |
+
}
|
195 |
+
}
|
196 |
+
|
197 |
+
// Return the slider data.
|
198 |
+
return $slider;
|
199 |
+
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Internal method that returns a slider based on ID.
|
204 |
+
*
|
205 |
+
* @since 1.0.0
|
206 |
+
*
|
207 |
+
* @param int $id The slider ID used to retrieve a slider.
|
208 |
+
* @return array|bool Array of slider data or false if none found.
|
209 |
+
*/
|
210 |
+
public function _get_slider( $id ) {
|
211 |
+
|
212 |
+
return get_post_meta( $id, '_sol_slider_data', true );
|
213 |
+
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Returns a slider based on slug.
|
218 |
+
*
|
219 |
+
* @since 1.0.0
|
220 |
+
*
|
221 |
+
* @param string $slug The slider slug used to retrieve a slider.
|
222 |
+
* @return array|bool Array of slider data or false if none found.
|
223 |
+
*/
|
224 |
+
public function get_slider_by_slug( $slug ) {
|
225 |
+
|
226 |
+
// Attempt to return the transient first, otherwise generate the new query to retrieve the data.
|
227 |
+
if ( false === ( $slider = get_transient( '_sol_cache_' . $slug ) ) ) {
|
228 |
+
$slider = $this->_get_slider_by_slug( $slug );
|
229 |
+
if ( $slider ) {
|
230 |
+
set_transient( '_sol_cache_' . $slug, $slider, DAY_IN_SECONDS );
|
231 |
+
}
|
232 |
+
}
|
233 |
+
|
234 |
+
// Return the slider data.
|
235 |
+
return $slider;
|
236 |
+
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Internal method that returns a slider based on slug.
|
241 |
+
*
|
242 |
+
* @since 1.0.0
|
243 |
+
*
|
244 |
+
* @param string $slug The slider slug used to retrieve a slider.
|
245 |
+
* @return array|bool Array of slider data or false if none found.
|
246 |
+
*/
|
247 |
+
public function _get_slider_by_slug( $slug ) {
|
248 |
+
|
249 |
+
$sliders = get_posts(
|
250 |
+
array(
|
251 |
+
'post_type' => 'any',
|
252 |
+
'no_found_rows' => true,
|
253 |
+
'cache_results' => false,
|
254 |
+
'nopaging' => true,
|
255 |
+
'fields' => 'ids',
|
256 |
+
'meta_query' => array(
|
257 |
+
array(
|
258 |
+
'key' => '_sol_slider_data',
|
259 |
+
'value' => maybe_serialize( strval( $slug ) ),
|
260 |
+
'compare' => 'LIKE'
|
261 |
+
)
|
262 |
+
)
|
263 |
+
)
|
264 |
+
);
|
265 |
+
if ( empty( $sliders ) ) {
|
266 |
+
return false;
|
267 |
+
} else {
|
268 |
+
return get_post_meta( $sliders[0], '_sol_slider_data', true );
|
269 |
+
}
|
270 |
+
|
271 |
+
}
|
272 |
+
|
273 |
+
/**
|
274 |
+
* Returns all sliders created on the site.
|
275 |
+
*
|
276 |
+
* @since 1.0.0
|
277 |
+
*
|
278 |
+
* @return array|bool Array of slider data or false if none found.
|
279 |
+
*/
|
280 |
+
public function get_sliders() {
|
281 |
+
|
282 |
+
// Attempt to return the transient first, otherwise generate the new query to retrieve the data.
|
283 |
+
if ( false === ( $sliders = get_transient( '_sol_cache_all' ) ) ) {
|
284 |
+
$sliders = $this->_get_sliders();
|
285 |
+
if ( $sliders ) {
|
286 |
+
set_transient( '_sol_cache_all', $sliders, DAY_IN_SECONDS );
|
287 |
+
}
|
288 |
+
}
|
289 |
+
|
290 |
+
// Return the slider data.
|
291 |
+
return $sliders;
|
292 |
+
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Internal method that returns all sliders created on the site.
|
297 |
+
*
|
298 |
+
* @since 1.0.0
|
299 |
+
*
|
300 |
+
* @return array|bool Array of slider data or false if none found.
|
301 |
+
*/
|
302 |
+
public function _get_sliders() {
|
303 |
+
|
304 |
+
$sliders = get_posts(
|
305 |
+
array(
|
306 |
+
'post_type' => 'any',
|
307 |
+
'no_found_rows' => true,
|
308 |
+
'cache_results' => false,
|
309 |
+
'nopaging' => true,
|
310 |
+
'fields' => 'ids',
|
311 |
+
'meta_query' => array(
|
312 |
+
array(
|
313 |
+
'key' => '_sol_slider_data'
|
314 |
+
)
|
315 |
+
)
|
316 |
+
)
|
317 |
+
);
|
318 |
+
if ( empty( $sliders ) ) {
|
319 |
+
return false;
|
320 |
+
}
|
321 |
+
|
322 |
+
// Now loop through all the sliders found and only use sliders that have images in them.
|
323 |
+
$ret = array();
|
324 |
+
foreach ( $sliders as $id ) {
|
325 |
+
$data = get_post_meta( $id, '_sol_slider_data', true );
|
326 |
+
if ( empty( $data['slider'] ) && 'default' == Soliloquy_Shortcode_Lite::get_instance()->get_config( 'type', $data ) || 'dynamic' == Soliloquy_Shortcode_Lite::get_instance()->get_config( 'type', $data ) ) {
|
327 |
+
continue;
|
328 |
+
}
|
329 |
+
|
330 |
+
$ret[] = $data;
|
331 |
+
}
|
332 |
+
|
333 |
+
// Return the slider data.
|
334 |
+
return $ret;
|
335 |
+
|
336 |
+
}
|
337 |
+
|
338 |
+
/**
|
339 |
+
* Getter method for retrieving the main plugin filepath.
|
340 |
+
*
|
341 |
+
* @since 1.2.0
|
342 |
+
*/
|
343 |
+
public static function get_file() {
|
344 |
+
|
345 |
+
return self::$file;
|
346 |
+
|
347 |
+
}
|
348 |
+
|
349 |
+
/**
|
350 |
+
* Helper flag method for any Soliloquy screen.
|
351 |
+
*
|
352 |
+
* @since 1.2.0
|
353 |
+
*
|
354 |
+
* @return bool True if on a Soliloquy screen, false if not.
|
355 |
+
*/
|
356 |
+
public static function is_soliloquy_screen() {
|
357 |
+
|
358 |
+
$current_screen = get_current_screen();
|
359 |
+
|
360 |
+
if ( ! $current_screen ) {
|
361 |
+
return false;
|
362 |
+
}
|
363 |
+
|
364 |
+
if ( 'soliloquy' == $current_screen->post_type ) {
|
365 |
+
return true;
|
366 |
+
}
|
367 |
+
|
368 |
+
return false;
|
369 |
+
|
370 |
+
}
|
371 |
+
|
372 |
+
/**
|
373 |
+
* Helper flag method for the Add/Edit Soliloquy screens.
|
374 |
+
*
|
375 |
+
* @since 1.2.0
|
376 |
+
*
|
377 |
+
* @return bool True if on a Soliloquy Add/Edit screen, false if not.
|
378 |
+
*/
|
379 |
+
public static function is_soliloquy_add_edit_screen() {
|
380 |
+
|
381 |
+
$current_screen = get_current_screen();
|
382 |
+
|
383 |
+
if ( ! $current_screen ) {
|
384 |
+
return false;
|
385 |
+
}
|
386 |
+
|
387 |
+
if ( 'soliloquy' == $current_screen->post_type && 'post' == $current_screen->base ) {
|
388 |
+
return true;
|
389 |
+
}
|
390 |
+
|
391 |
+
return false;
|
392 |
+
|
393 |
+
}
|
394 |
+
|
395 |
+
/**
|
396 |
+
* Returns the singleton instance of the class.
|
397 |
+
*
|
398 |
+
* @since 1.0.0
|
399 |
+
*
|
400 |
+
* @return object The Soliloquy_Lite object.
|
401 |
+
*/
|
402 |
+
public static function get_instance() {
|
403 |
+
|
404 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Soliloquy_Lite ) ) {
|
405 |
+
self::$instance = new Soliloquy_Lite();
|
406 |
+
}
|
407 |
+
|
408 |
+
return self::$instance;
|
409 |
+
|
410 |
+
}
|
411 |
+
|
412 |
+
}
|
413 |
+
|
414 |
+
register_activation_hook( __FILE__, 'soliloquy_lite_activation_hook' );
|
415 |
+
/**
|
416 |
+
* Fired when the plugin is activated.
|
417 |
+
*
|
418 |
+
* @since 1.0.0
|
419 |
+
*
|
420 |
+
* @global int $wp_version The version of WordPress for this install.
|
421 |
+
* @global object $wpdb The WordPress database object.
|
422 |
+
* @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false otherwise.
|
423 |
+
*/
|
424 |
+
function soliloquy_lite_activation_hook( $network_wide ) {
|
425 |
+
|
426 |
+
global $wp_version;
|
427 |
+
if ( version_compare( $wp_version, '3.5.1', '<' ) && ! defined( 'SOLILOQUY_FORCE_ACTIVATION' ) ) {
|
428 |
+
deactivate_plugins( plugin_basename( __FILE__ ) );
|
429 |
+
wp_die( sprintf( __( 'Sorry, but your version of WordPress does not meet Soliloquy Lite\'s required version of <strong>3.5.1</strong> to run properly. The plugin has been deactivated. <a href="%s">Click here to return to the Dashboard</a>.', 'soliloquy' ), get_admin_url() ) );
|
430 |
+
}
|
431 |
+
|
432 |
+
if ( is_multisite() && $network_wide ) {
|
433 |
+
global $wpdb;
|
434 |
+
$site_list = $wpdb->get_results( "SELECT * FROM $wpdb->blogs ORDER BY blog_id" );
|
435 |
+
foreach ( (array) $site_list as $site ) {
|
436 |
+
switch_to_blog( $site->blog_id );
|
437 |
+
|
438 |
+
// Set the upgraded licenses since this is an activation and no slider will have existed yet.
|
439 |
+
update_option( 'soliloquy_upgrade', true );
|
440 |
+
|
441 |
+
restore_current_blog();
|
442 |
+
}
|
443 |
+
} else {
|
444 |
+
// Set the upgraded licenses since this is an activation and no slider will have existed yet.
|
445 |
+
update_option( 'soliloquy_upgrade', true );
|
446 |
+
}
|
447 |
+
|
448 |
+
}
|
449 |
+
|
450 |
+
// Load the main plugin class.
|
451 |
+
$soliloquy_lite = Soliloquy_Lite::get_instance();
|
452 |
+
|
453 |
+
// Conditionally load the template tag.
|
454 |
+
if ( ! function_exists( 'soliloquy' ) ) {
|
455 |
+
/**
|
456 |
+
* Primary template tag for outputting Soliloquy sliders in templates.
|
457 |
+
*
|
458 |
+
* @since 1.0.0
|
459 |
+
*
|
460 |
+
* @param int $slider_id The ID of the slider to load.
|
461 |
+
* @param string $type The type of field to query.
|
462 |
+
* @param array $args Associative array of args to be passed.
|
463 |
+
* @param bool $return Flag to echo or return the slider HTML.
|
464 |
+
*/
|
465 |
+
function soliloquy( $id, $type = 'id', $args = array(), $return = false ) {
|
466 |
+
|
467 |
+
// If we have args, build them into a shortcode format.
|
468 |
+
$args_string = '';
|
469 |
+
if ( ! empty( $args ) ) {
|
470 |
+
foreach ( (array) $args as $key => $value ) {
|
471 |
+
$args_string .= ' ' . $key . '="' . $value . '"';
|
472 |
+
}
|
473 |
+
}
|
474 |
+
|
475 |
+
// Build the shortcode.
|
476 |
+
$shortcode = ! empty( $args_string ) ? '[soliloquy ' . $type . '="' . $id . '"' . $args_string . ']' : '[soliloquy ' . $type . '="' . $id . '"]';
|
477 |
+
|
478 |
+
// Return or echo the shortcode output.
|
479 |
+
if ( $return ) {
|
480 |
+
return do_shortcode( $shortcode );
|
481 |
+
} else {
|
482 |
+
echo do_shortcode( $shortcode );
|
483 |
+
}
|
484 |
+
|
485 |
+
}
|
486 |
+
}
|
487 |
+
|
488 |
+
// For backwards compat, load the v1 template tag if it doesn't exist.
|
489 |
+
if ( ! function_exists( 'soliloquy_slider' ) ) {
|
490 |
+
/**
|
491 |
+
* Primary template tag for outputting Soliloquy sliders in templates (v1).
|
492 |
+
*
|
493 |
+
* @since 1.0.0
|
494 |
+
*
|
495 |
+
* @param int $slider_id The ID of the slider to load.
|
496 |
+
* @param bool $return Flag to echo or return the slider HTML.
|
497 |
+
*/
|
498 |
+
function soliloquy_slider( $id, $return = false ) {
|
499 |
+
|
500 |
+
// Return the v2 template tag.
|
501 |
+
if ( is_numeric( $id ) ) {
|
502 |
+
return soliloquy( $id, 'id', array(), $return );
|
503 |
+
} else {
|
504 |
+
return soliloquy( $id, 'slug', array(), $return );
|
505 |
+
}
|
506 |
+
|
507 |
+
}
|
508 |
+
}
|
themes/classic/images/slider-arrows-horizontal.png
ADDED
Binary file
|
themes/classic/images/slider-arrows-horizontal@2x.png
ADDED
Binary file
|
themes/classic/images/slider-dots.png
ADDED
Binary file
|
themes/classic/images/slider-dots@2x.png
ADDED
Binary file
|
themes/classic/style.css
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* ==========================================================================
|
2 |
+
Classic Theme Styles
|
3 |
+
========================================================================== */
|
4 |
+
|
5 |
+
.soliloquy-theme-classic:after {
|
6 |
+
display: none;
|
7 |
+
height: 0;
|
8 |
+
line-height: 0;
|
9 |
+
visibility: hidden;
|
10 |
+
content: url('images/slider-arrows-horizontal.png') url('images/slider-dots.png');
|
11 |
+
}
|
12 |
+
|
13 |
+
.soliloquy-theme-classic .soliloquy-prev {
|
14 |
+
display: block;
|
15 |
+
width: 13px;
|
16 |
+
height: 18px;
|
17 |
+
position: absolute;
|
18 |
+
top: 50%;
|
19 |
+
margin-top: -8px;
|
20 |
+
left: 10px;
|
21 |
+
z-index: 1320;
|
22 |
+
background: transparent url('images/slider-arrows-horizontal.png') no-repeat scroll 0 0;
|
23 |
+
}
|
24 |
+
|
25 |
+
.soliloquy-theme-classic .soliloquy-next {
|
26 |
+
display: block;
|
27 |
+
width: 13px;
|
28 |
+
height: 18px;
|
29 |
+
position: absolute;
|
30 |
+
top: 50%;
|
31 |
+
margin-top: -8px;
|
32 |
+
right: 10px;
|
33 |
+
z-index: 1320;
|
34 |
+
background: transparent url('images/slider-arrows-horizontal.png') no-repeat scroll 0 -18px;
|
35 |
+
}
|
36 |
+
|
37 |
+
.soliloquy-theme-classic .soliloquy-pager {
|
38 |
+
width: 100%;
|
39 |
+
margin: 0 0 0 5px;
|
40 |
+
position: absolute;
|
41 |
+
bottom: 10px;
|
42 |
+
height: 14px;
|
43 |
+
text-align: left;
|
44 |
+
}
|
45 |
+
|
46 |
+
.soliloquy-theme-classic .soliloquy-pager-item {
|
47 |
+
display: inline-block;
|
48 |
+
margin: 0 0 0 5px;
|
49 |
+
position: relative;
|
50 |
+
z-index: 1320;
|
51 |
+
}
|
52 |
+
|
53 |
+
.soliloquy-theme-classic .soliloquy-pager-item:first-child {
|
54 |
+
margin-left: 5px;
|
55 |
+
}
|
56 |
+
|
57 |
+
.soliloquy-theme-classic .soliloquy-pager-link {
|
58 |
+
background: url('images/slider-dots.png') no-repeat scroll 0 0;
|
59 |
+
width: 14px;
|
60 |
+
height: 14px;
|
61 |
+
display: block;
|
62 |
+
outline: none;
|
63 |
+
text-indent: -9999px;
|
64 |
+
}
|
65 |
+
|
66 |
+
.soliloquy-theme-classic .soliloquy-pager-link:hover,
|
67 |
+
.soliloquy-theme-classic .soliloquy-pager-link.active {
|
68 |
+
background: url('images/slider-dots.png') no-repeat scroll 0 -14px;
|
69 |
+
}
|
70 |
+
|
71 |
+
.soliloquy-theme-classic .soliloquy-caption-wrap {
|
72 |
+
bottom: 0;
|
73 |
+
top: auto;
|
74 |
+
}
|
75 |
+
|
76 |
+
/* ==========================================================================
|
77 |
+
Retina Styles
|
78 |
+
========================================================================== */
|
79 |
+
|
80 |
+
@media
|
81 |
+
only screen and (-webkit-min-device-pixel-ratio: 2),
|
82 |
+
only screen and ( min--moz-device-pixel-ratio: 2),
|
83 |
+
only screen and ( -o-min-device-pixel-ratio: 2/1),
|
84 |
+
only screen and ( min-device-pixel-ratio: 2),
|
85 |
+
only screen and ( min-resolution: 192dpi),
|
86 |
+
only screen and ( min-resolution: 2dppx) {
|
87 |
+
|
88 |
+
.soliloquy-theme-classic .soliloquy-prev {
|
89 |
+
background: url('images/slider-arrows-horizontal@2x.png') no-repeat scroll 0 0;
|
90 |
+
background-size: 100%;
|
91 |
+
}
|
92 |
+
|
93 |
+
.soliloquy-theme-classic .soliloquy-next {
|
94 |
+
background: url('images/slider-arrows-horizontal@2x.png') no-repeat scroll 0 -20px;
|
95 |
+
background-size: 100%;
|
96 |
+
}
|
97 |
+
|
98 |
+
.soliloquy-theme-classic .soliloquy-pager-link {
|
99 |
+
background: url('images/slider-dots@2x.png') no-repeat scroll 0 0;
|
100 |
+
background-size: 100%;
|
101 |
+
height: 15px;
|
102 |
+
}
|
103 |
+
|
104 |
+
.soliloquy-theme-classic .soliloquy-pager-link:hover,
|
105 |
+
.soliloquy-theme-classic .soliloquy-pager-link.active {
|
106 |
+
background-position: 0 -15px;
|
107 |
+
}
|
108 |
+
|
109 |
+
}
|