Init Repo
420
static/plugins/colpick/css/colpick.css
Executable file
@ -0,0 +1,420 @@
|
||||
/*
|
||||
colpick Color Picker / colpick.com
|
||||
*/
|
||||
|
||||
/*Main container*/
|
||||
.colpick {
|
||||
position: absolute;
|
||||
width: 346px;
|
||||
height: 170px;
|
||||
overflow: hidden;
|
||||
display: none;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
background:#ebebeb;
|
||||
border: 1px solid #bbb;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
|
||||
/*Prevents selecting text when dragging the selectors*/
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-o-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
/*Color selection box with gradients*/
|
||||
.colpick_color {
|
||||
position: absolute;
|
||||
left: 7px;
|
||||
top: 7px;
|
||||
width: 156px;
|
||||
height: 156px;
|
||||
overflow: hidden;
|
||||
outline: 1px solid #aaa;
|
||||
cursor: crosshair;
|
||||
}
|
||||
.colpick_color_overlay1 {
|
||||
position: absolute;
|
||||
left:0;
|
||||
top:0;
|
||||
width: 156px;
|
||||
height: 156px;
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffffff', endColorstr='#00ffffff')"; /* IE8 */
|
||||
background: -moz-linear-gradient(left, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%); /* FF3.6+ */
|
||||
background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(255,255,255,1)), color-stop(100%,rgba(255,255,255,0))); /* Chrome,Safari4+ */
|
||||
background: -webkit-linear-gradient(left, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* Chrome10+,Safari5.1+ */
|
||||
background: -o-linear-gradient(left, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* Opera 11.10+ */
|
||||
background: -ms-linear-gradient(left, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* IE10+ */
|
||||
background: linear-gradient(to right, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffffff', endColorstr='#00ffffff'); /* IE6 & IE7 */
|
||||
}
|
||||
.colpick_color_overlay2 {
|
||||
position: absolute;
|
||||
left:0;
|
||||
top:0;
|
||||
width: 156px;
|
||||
height: 156px;
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#00000000', endColorstr='#000000')"; /* IE8 */
|
||||
background: -moz-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 100%); /* FF3.6+ */
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0)), color-stop(100%,rgba(0,0,0,1))); /* Chrome,Safari4+ */
|
||||
background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,1) 100%); /* Chrome10+,Safari5.1+ */
|
||||
background: -o-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,1) 100%); /* Opera 11.10+ */
|
||||
background: -ms-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,1) 100%); /* IE10+ */
|
||||
background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,rgba(0,0,0,1) 100%); /* W3C */
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', endColorstr='#000000',GradientType=0 ); /* IE6-9 */
|
||||
}
|
||||
/*Circular color selector*/
|
||||
.colpick_selector_outer {
|
||||
background:none;
|
||||
position: absolute;
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
margin: -6px 0 0 -6px;
|
||||
border: 1px solid black;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.colpick_selector_inner{
|
||||
position: absolute;
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
border: 1px solid white;
|
||||
border-radius: 50%;
|
||||
}
|
||||
/*Vertical hue bar*/
|
||||
.colpick_hue {
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
left: 175px;
|
||||
width: 19px;
|
||||
height: 156px;
|
||||
border: 1px solid #aaa;
|
||||
cursor: n-resize;
|
||||
}
|
||||
/*Hue bar sliding indicator*/
|
||||
.colpick_hue_arrs {
|
||||
position: absolute;
|
||||
left: -8px;
|
||||
width: 35px;
|
||||
height: 7px;
|
||||
margin: -7px 0 0 0;
|
||||
}
|
||||
.colpick_hue_larr {
|
||||
position:absolute;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-top: 6px solid transparent;
|
||||
border-bottom: 6px solid transparent;
|
||||
border-left: 7px solid #858585;
|
||||
}
|
||||
.colpick_hue_rarr {
|
||||
position:absolute;
|
||||
right:0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-top: 6px solid transparent;
|
||||
border-bottom: 6px solid transparent;
|
||||
border-right: 7px solid #858585;
|
||||
}
|
||||
/*New color box*/
|
||||
.colpick_new_color {
|
||||
position: absolute;
|
||||
left: 207px;
|
||||
top: 6px;
|
||||
width: 60px;
|
||||
height: 27px;
|
||||
background: #f00;
|
||||
border: 1px solid #8f8f8f;
|
||||
}
|
||||
/*Current color box*/
|
||||
.colpick_current_color {
|
||||
position: absolute;
|
||||
left: 277px;
|
||||
top: 6px;
|
||||
width: 60px;
|
||||
height: 27px;
|
||||
background: #f00;
|
||||
border: 1px solid #8f8f8f;
|
||||
}
|
||||
/*Input field containers*/
|
||||
.colpick_field, .colpick_hex_field {
|
||||
position: absolute;
|
||||
height: 20px;
|
||||
width: 60px;
|
||||
overflow:hidden;
|
||||
background:#f3f3f3;
|
||||
color:#b8b8b8;
|
||||
font-size:12px;
|
||||
border:1px solid #bdbdbd;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.colpick_rgb_r {
|
||||
top: 40px;
|
||||
left: 207px;
|
||||
}
|
||||
.colpick_rgb_g {
|
||||
top: 67px;
|
||||
left: 207px;
|
||||
}
|
||||
.colpick_rgb_b {
|
||||
top: 94px;
|
||||
left: 207px;
|
||||
}
|
||||
.colpick_hsb_h {
|
||||
top: 40px;
|
||||
left: 277px;
|
||||
}
|
||||
.colpick_hsb_s {
|
||||
top: 67px;
|
||||
left: 277px;
|
||||
}
|
||||
.colpick_hsb_b {
|
||||
top: 94px;
|
||||
left: 277px;
|
||||
}
|
||||
.colpick_hex_field {
|
||||
width: 68px;
|
||||
left: 207px;
|
||||
top: 121px;
|
||||
}
|
||||
/*Text field container on focus*/
|
||||
.colpick_focus {
|
||||
border-color: #999;
|
||||
}
|
||||
/*Field label container*/
|
||||
.colpick_field_letter {
|
||||
position: absolute;
|
||||
width: 12px;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
padding-left: 4px;
|
||||
background: #efefef;
|
||||
border-right: 1px solid #bdbdbd;
|
||||
font-weight: bold;
|
||||
color:#777;
|
||||
}
|
||||
/*Text inputs*/
|
||||
.colpick_field input, .colpick_hex_field input {
|
||||
position: absolute;
|
||||
right: 11px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
background: transparent;
|
||||
border: none;
|
||||
font-size: 12px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #555;
|
||||
text-align: right;
|
||||
outline: none;
|
||||
}
|
||||
.colpick_hex_field input {
|
||||
right: 4px;
|
||||
}
|
||||
/*Field up/down arrows*/
|
||||
.colpick_field_arrs {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 9px;
|
||||
height: 21px;
|
||||
cursor: n-resize;
|
||||
}
|
||||
.colpick_field_uarr {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-left: 4px solid transparent;
|
||||
border-right: 4px solid transparent;
|
||||
border-bottom: 4px solid #959595;
|
||||
}
|
||||
.colpick_field_darr {
|
||||
position: absolute;
|
||||
bottom:5px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-left: 4px solid transparent;
|
||||
border-right: 4px solid transparent;
|
||||
border-top: 4px solid #959595;
|
||||
}
|
||||
/*Submit/Select button*/
|
||||
.colpick_submit {
|
||||
position: absolute;
|
||||
left: 207px;
|
||||
top: 149px;
|
||||
width: 130px;
|
||||
height: 22px;
|
||||
line-height:22px;
|
||||
background: #efefef;
|
||||
text-align: center;
|
||||
color: #555;
|
||||
font-size: 12px;
|
||||
font-weight:bold;
|
||||
border: 1px solid #bdbdbd;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.colpick_submit:hover {
|
||||
background:#f3f3f3;
|
||||
border-color:#999;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/*full layout with no submit button*/
|
||||
.colpick_full_ns .colpick_submit, .colpick_full_ns .colpick_current_color{
|
||||
display:none;
|
||||
}
|
||||
.colpick_full_ns .colpick_new_color {
|
||||
width: 130px;
|
||||
height: 25px;
|
||||
}
|
||||
.colpick_full_ns .colpick_rgb_r, .colpick_full_ns .colpick_hsb_h {
|
||||
top: 42px;
|
||||
}
|
||||
.colpick_full_ns .colpick_rgb_g, .colpick_full_ns .colpick_hsb_s {
|
||||
top: 73px;
|
||||
}
|
||||
.colpick_full_ns .colpick_rgb_b, .colpick_full_ns .colpick_hsb_b {
|
||||
top: 104px;
|
||||
}
|
||||
.colpick_full_ns .colpick_hex_field {
|
||||
top: 135px;
|
||||
}
|
||||
|
||||
/*rgbhex layout*/
|
||||
.colpick_rgbhex .colpick_hsb_h, .colpick_rgbhex .colpick_hsb_s, .colpick_rgbhex .colpick_hsb_b {
|
||||
display:none;
|
||||
}
|
||||
.colpick_rgbhex {
|
||||
width:282px;
|
||||
}
|
||||
.colpick_rgbhex .colpick_field, .colpick_rgbhex .colpick_submit {
|
||||
width:68px;
|
||||
}
|
||||
.colpick_rgbhex .colpick_new_color {
|
||||
width:34px;
|
||||
border-right:none;
|
||||
}
|
||||
.colpick_rgbhex .colpick_current_color {
|
||||
width:34px;
|
||||
left:240px;
|
||||
border-left:none;
|
||||
}
|
||||
|
||||
/*rgbhex layout, no submit button*/
|
||||
.colpick_rgbhex_ns .colpick_submit, .colpick_rgbhex_ns .colpick_current_color{
|
||||
display:none;
|
||||
}
|
||||
.colpick_rgbhex_ns .colpick_new_color{
|
||||
width:68px;
|
||||
border: 1px solid #8f8f8f;
|
||||
}
|
||||
.colpick_rgbhex_ns .colpick_rgb_r {
|
||||
top: 42px;
|
||||
}
|
||||
.colpick_rgbhex_ns .colpick_rgb_g {
|
||||
top: 73px;
|
||||
}
|
||||
.colpick_rgbhex_ns .colpick_rgb_b {
|
||||
top: 104px;
|
||||
}
|
||||
.colpick_rgbhex_ns .colpick_hex_field {
|
||||
top: 135px;
|
||||
}
|
||||
|
||||
/*hex layout*/
|
||||
.colpick_hex .colpick_hsb_h, .colpick_hex .colpick_hsb_s, .colpick_hex .colpick_hsb_b, .colpick_hex .colpick_rgb_r, .colpick_hex .colpick_rgb_g, .colpick_hex .colpick_rgb_b {
|
||||
display:none;
|
||||
}
|
||||
.colpick_hex {
|
||||
width:206px;
|
||||
height:201px;
|
||||
}
|
||||
.colpick_hex .colpick_hex_field {
|
||||
width:72px;
|
||||
height:25px;
|
||||
top:168px;
|
||||
left:80px;
|
||||
}
|
||||
.colpick_hex .colpick_hex_field div, .colpick_hex .colpick_hex_field input {
|
||||
height: 25px;
|
||||
line-height: 25px;
|
||||
}
|
||||
.colpick_hex .colpick_new_color {
|
||||
left:9px;
|
||||
top:168px;
|
||||
width:30px;
|
||||
border-right:none;
|
||||
}
|
||||
.colpick_hex .colpick_current_color {
|
||||
left:39px;
|
||||
top:168px;
|
||||
width:30px;
|
||||
border-left:none;
|
||||
}
|
||||
.colpick_hex .colpick_submit {
|
||||
left:164px;
|
||||
top: 168px;
|
||||
width:30px;
|
||||
height:25px;
|
||||
line-height: 25px;
|
||||
}
|
||||
|
||||
/*hex layout, no submit button*/
|
||||
.colpick_hex_ns .colpick_submit, .colpick_hex_ns .colpick_current_color {
|
||||
display:none;
|
||||
}
|
||||
.colpick_hex_ns .colpick_hex_field {
|
||||
width:80px;
|
||||
}
|
||||
.colpick_hex_ns .colpick_new_color{
|
||||
width:60px;
|
||||
border: 1px solid #8f8f8f;
|
||||
}
|
||||
|
||||
/*Dark color scheme*/
|
||||
.colpick_dark {
|
||||
background: #161616;
|
||||
border-color: #2a2a2a;
|
||||
}
|
||||
.colpick_dark .colpick_color {
|
||||
outline-color: #333;
|
||||
}
|
||||
.colpick_dark .colpick_hue {
|
||||
border-color: #555;
|
||||
}
|
||||
.colpick_dark .colpick_field, .colpick_dark .colpick_hex_field {
|
||||
background: #101010;
|
||||
border-color: #2d2d2d;
|
||||
}
|
||||
.colpick_dark .colpick_field_letter {
|
||||
background: #131313;
|
||||
border-color: #2d2d2d;
|
||||
color: #696969;
|
||||
}
|
||||
.colpick_dark .colpick_field input, .colpick_dark .colpick_hex_field input {
|
||||
color: #7a7a7a;
|
||||
}
|
||||
.colpick_dark .colpick_field_uarr {
|
||||
border-bottom-color:#696969;
|
||||
}
|
||||
.colpick_dark .colpick_field_darr {
|
||||
border-top-color:#696969;
|
||||
}
|
||||
.colpick_dark .colpick_focus {
|
||||
border-color:#444;
|
||||
}
|
||||
.colpick_dark .colpick_submit {
|
||||
background: #131313;
|
||||
border-color:#2d2d2d;
|
||||
color:#7a7a7a;
|
||||
}
|
||||
.colpick_dark .colpick_submit:hover {
|
||||
background-color:#101010;
|
||||
border-color:#444;
|
||||
}
|
520
static/plugins/colpick/js/colpick.js
Executable file
@ -0,0 +1,520 @@
|
||||
/*
|
||||
colpick Color Picker
|
||||
Copyright 2013 Jose Vargas. Licensed under GPL license. Based on Stefan Petre's Color Picker www.eyecon.ro, dual licensed under the MIT and GPL licenses
|
||||
|
||||
For usage and examples: colpick.com/plugin
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
var colpick = function () {
|
||||
var
|
||||
tpl = '<div class="colpick"><div class="colpick_color"><div class="colpick_color_overlay1"><div class="colpick_color_overlay2"><div class="colpick_selector_outer"><div class="colpick_selector_inner"></div></div></div></div></div><div class="colpick_hue"><div class="colpick_hue_arrs"><div class="colpick_hue_larr"></div><div class="colpick_hue_rarr"></div></div></div><div class="colpick_new_color"></div><div class="colpick_current_color"></div><div class="colpick_hex_field"><div class="colpick_field_letter">#</div><input type="text" maxlength="6" size="6" /></div><div class="colpick_rgb_r colpick_field"><div class="colpick_field_letter">R</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_rgb_g colpick_field"><div class="colpick_field_letter">G</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_rgb_b colpick_field"><div class="colpick_field_letter">B</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_hsb_h colpick_field"><div class="colpick_field_letter">H</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_hsb_s colpick_field"><div class="colpick_field_letter">S</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_hsb_b colpick_field"><div class="colpick_field_letter">B</div><input type="text" maxlength="3" size="3" /><div class="colpick_field_arrs"><div class="colpick_field_uarr"></div><div class="colpick_field_darr"></div></div></div><div class="colpick_submit"></div></div>',
|
||||
defaults = {
|
||||
showEvent: 'click',
|
||||
onShow: function () {},
|
||||
onBeforeShow: function(){},
|
||||
onHide: function () {},
|
||||
onChange: function () {},
|
||||
onSubmit: function () {},
|
||||
colorScheme: 'light',
|
||||
color: '3289c7',
|
||||
livePreview: true,
|
||||
flat: false,
|
||||
layout: 'full',
|
||||
submit: 1,
|
||||
submitText: 'OK',
|
||||
height: 156
|
||||
},
|
||||
//Fill the inputs of the plugin
|
||||
fillRGBFields = function (hsb, cal) {
|
||||
var rgb = hsbToRgb(hsb);
|
||||
$(cal).data('colpick').fields
|
||||
.eq(1).val(rgb.r).end()
|
||||
.eq(2).val(rgb.g).end()
|
||||
.eq(3).val(rgb.b).end();
|
||||
},
|
||||
fillHSBFields = function (hsb, cal) {
|
||||
$(cal).data('colpick').fields
|
||||
.eq(4).val(Math.round(hsb.h)).end()
|
||||
.eq(5).val(Math.round(hsb.s)).end()
|
||||
.eq(6).val(Math.round(hsb.b)).end();
|
||||
},
|
||||
fillHexFields = function (hsb, cal) {
|
||||
$(cal).data('colpick').fields.eq(0).val(hsbToHex(hsb));
|
||||
},
|
||||
//Set the round selector position
|
||||
setSelector = function (hsb, cal) {
|
||||
$(cal).data('colpick').selector.css('backgroundColor', '#' + hsbToHex({h: hsb.h, s: 100, b: 100}));
|
||||
$(cal).data('colpick').selectorIndic.css({
|
||||
left: parseInt($(cal).data('colpick').height * hsb.s/100, 10),
|
||||
top: parseInt($(cal).data('colpick').height * (100-hsb.b)/100, 10)
|
||||
});
|
||||
},
|
||||
//Set the hue selector position
|
||||
setHue = function (hsb, cal) {
|
||||
$(cal).data('colpick').hue.css('top', parseInt($(cal).data('colpick').height - $(cal).data('colpick').height * hsb.h/360, 10));
|
||||
},
|
||||
//Set current and new colors
|
||||
setCurrentColor = function (hsb, cal) {
|
||||
$(cal).data('colpick').currentColor.css('backgroundColor', '#' + hsbToHex(hsb));
|
||||
},
|
||||
setNewColor = function (hsb, cal) {
|
||||
$(cal).data('colpick').newColor.css('backgroundColor', '#' + hsbToHex(hsb));
|
||||
},
|
||||
//Called when the new color is changed
|
||||
change = function (ev) {
|
||||
var cal = $(this).parent().parent(), col;
|
||||
if (this.parentNode.className.indexOf('_hex') > 0) {
|
||||
cal.data('colpick').color = col = hexToHsb(fixHex(this.value));
|
||||
fillRGBFields(col, cal.get(0));
|
||||
fillHSBFields(col, cal.get(0));
|
||||
} else if (this.parentNode.className.indexOf('_hsb') > 0) {
|
||||
cal.data('colpick').color = col = fixHSB({
|
||||
h: parseInt(cal.data('colpick').fields.eq(4).val(), 10),
|
||||
s: parseInt(cal.data('colpick').fields.eq(5).val(), 10),
|
||||
b: parseInt(cal.data('colpick').fields.eq(6).val(), 10)
|
||||
});
|
||||
fillRGBFields(col, cal.get(0));
|
||||
fillHexFields(col, cal.get(0));
|
||||
} else {
|
||||
cal.data('colpick').color = col = rgbToHsb(fixRGB({
|
||||
r: parseInt(cal.data('colpick').fields.eq(1).val(), 10),
|
||||
g: parseInt(cal.data('colpick').fields.eq(2).val(), 10),
|
||||
b: parseInt(cal.data('colpick').fields.eq(3).val(), 10)
|
||||
}));
|
||||
fillHexFields(col, cal.get(0));
|
||||
fillHSBFields(col, cal.get(0));
|
||||
}
|
||||
setSelector(col, cal.get(0));
|
||||
setHue(col, cal.get(0));
|
||||
setNewColor(col, cal.get(0));
|
||||
cal.data('colpick').onChange.apply(cal.parent(), [col, hsbToHex(col), hsbToRgb(col), cal.data('colpick').el, 0]);
|
||||
},
|
||||
//Change style on blur and on focus of inputs
|
||||
blur = function (ev) {
|
||||
$(this).parent().removeClass('colpick_focus');
|
||||
},
|
||||
focus = function () {
|
||||
$(this).parent().parent().data('colpick').fields.parent().removeClass('colpick_focus');
|
||||
$(this).parent().addClass('colpick_focus');
|
||||
},
|
||||
//Increment/decrement arrows functions
|
||||
downIncrement = function (ev) {
|
||||
ev.preventDefault ? ev.preventDefault() : ev.returnValue = false;
|
||||
var field = $(this).parent().find('input').focus();
|
||||
var current = {
|
||||
el: $(this).parent().addClass('colpick_slider'),
|
||||
max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
|
||||
y: ev.pageY,
|
||||
field: field,
|
||||
val: parseInt(field.val(), 10),
|
||||
preview: $(this).parent().parent().data('colpick').livePreview
|
||||
};
|
||||
$(document).mouseup(current, upIncrement);
|
||||
$(document).mousemove(current, moveIncrement);
|
||||
},
|
||||
moveIncrement = function (ev) {
|
||||
ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val - ev.pageY + ev.data.y, 10))));
|
||||
if (ev.data.preview) {
|
||||
change.apply(ev.data.field.get(0), [true]);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
upIncrement = function (ev) {
|
||||
change.apply(ev.data.field.get(0), [true]);
|
||||
ev.data.el.removeClass('colpick_slider').find('input').focus();
|
||||
$(document).off('mouseup', upIncrement);
|
||||
$(document).off('mousemove', moveIncrement);
|
||||
return false;
|
||||
},
|
||||
//Hue slider functions
|
||||
downHue = function (ev) {
|
||||
ev.preventDefault ? ev.preventDefault() : ev.returnValue = false;
|
||||
var current = {
|
||||
cal: $(this).parent(),
|
||||
y: $(this).offset().top
|
||||
};
|
||||
$(document).on('mouseup touchend',current,upHue);
|
||||
$(document).on('mousemove touchmove',current,moveHue);
|
||||
|
||||
var pageY = ((ev.type == 'touchstart') ? ev.originalEvent.changedTouches[0].pageY : ev.pageY );
|
||||
change.apply(
|
||||
current.cal.data('colpick')
|
||||
.fields.eq(4).val(parseInt(360*(current.cal.data('colpick').height - (pageY - current.y))/current.cal.data('colpick').height, 10))
|
||||
.get(0),
|
||||
[current.cal.data('colpick').livePreview]
|
||||
);
|
||||
return false;
|
||||
},
|
||||
moveHue = function (ev) {
|
||||
var pageY = ((ev.type == 'touchmove') ? ev.originalEvent.changedTouches[0].pageY : ev.pageY );
|
||||
change.apply(
|
||||
ev.data.cal.data('colpick')
|
||||
.fields.eq(4).val(parseInt(360*(ev.data.cal.data('colpick').height - Math.max(0,Math.min(ev.data.cal.data('colpick').height,(pageY - ev.data.y))))/ev.data.cal.data('colpick').height, 10))
|
||||
.get(0),
|
||||
[ev.data.preview]
|
||||
);
|
||||
return false;
|
||||
},
|
||||
upHue = function (ev) {
|
||||
fillRGBFields(ev.data.cal.data('colpick').color, ev.data.cal.get(0));
|
||||
fillHexFields(ev.data.cal.data('colpick').color, ev.data.cal.get(0));
|
||||
$(document).off('mouseup touchend',upHue);
|
||||
$(document).off('mousemove touchmove',moveHue);
|
||||
return false;
|
||||
},
|
||||
//Color selector functions
|
||||
downSelector = function (ev) {
|
||||
ev.preventDefault ? ev.preventDefault() : ev.returnValue = false;
|
||||
var current = {
|
||||
cal: $(this).parent(),
|
||||
pos: $(this).offset()
|
||||
};
|
||||
current.preview = current.cal.data('colpick').livePreview;
|
||||
|
||||
$(document).on('mouseup touchend',current,upSelector);
|
||||
$(document).on('mousemove touchmove',current,moveSelector);
|
||||
|
||||
var payeX,pageY;
|
||||
if(ev.type == 'touchstart') {
|
||||
pageX = ev.originalEvent.changedTouches[0].pageX,
|
||||
pageY = ev.originalEvent.changedTouches[0].pageY;
|
||||
} else {
|
||||
pageX = ev.pageX;
|
||||
pageY = ev.pageY;
|
||||
}
|
||||
|
||||
change.apply(
|
||||
current.cal.data('colpick').fields
|
||||
.eq(6).val(parseInt(100*(current.cal.data('colpick').height - (pageY - current.pos.top))/current.cal.data('colpick').height, 10)).end()
|
||||
.eq(5).val(parseInt(100*(pageX - current.pos.left)/current.cal.data('colpick').height, 10))
|
||||
.get(0),
|
||||
[current.preview]
|
||||
);
|
||||
return false;
|
||||
},
|
||||
moveSelector = function (ev) {
|
||||
var payeX,pageY;
|
||||
if(ev.type == 'touchmove') {
|
||||
pageX = ev.originalEvent.changedTouches[0].pageX,
|
||||
pageY = ev.originalEvent.changedTouches[0].pageY;
|
||||
} else {
|
||||
pageX = ev.pageX;
|
||||
pageY = ev.pageY;
|
||||
}
|
||||
|
||||
change.apply(
|
||||
ev.data.cal.data('colpick').fields
|
||||
.eq(6).val(parseInt(100*(ev.data.cal.data('colpick').height - Math.max(0,Math.min(ev.data.cal.data('colpick').height,(pageY - ev.data.pos.top))))/ev.data.cal.data('colpick').height, 10)).end()
|
||||
.eq(5).val(parseInt(100*(Math.max(0,Math.min(ev.data.cal.data('colpick').height,(pageX - ev.data.pos.left))))/ev.data.cal.data('colpick').height, 10))
|
||||
.get(0),
|
||||
[ev.data.preview]
|
||||
);
|
||||
return false;
|
||||
},
|
||||
upSelector = function (ev) {
|
||||
fillRGBFields(ev.data.cal.data('colpick').color, ev.data.cal.get(0));
|
||||
fillHexFields(ev.data.cal.data('colpick').color, ev.data.cal.get(0));
|
||||
$(document).off('mouseup touchend',upSelector);
|
||||
$(document).off('mousemove touchmove',moveSelector);
|
||||
return false;
|
||||
},
|
||||
//Submit button
|
||||
clickSubmit = function (ev) {
|
||||
var cal = $(this).parent();
|
||||
var col = cal.data('colpick').color;
|
||||
cal.data('colpick').origColor = col;
|
||||
setCurrentColor(col, cal.get(0));
|
||||
cal.data('colpick').onSubmit(col, hsbToHex(col), hsbToRgb(col), cal.data('colpick').el);
|
||||
},
|
||||
//Show/hide the color picker
|
||||
show = function (ev) {
|
||||
// Prevent the trigger of any direct parent
|
||||
ev.stopPropagation();
|
||||
var cal = $('#' + $(this).data('colpickId'));
|
||||
cal.data('colpick').onBeforeShow.apply(this, [cal.get(0)]);
|
||||
var pos = $(this).offset();
|
||||
var top = pos.top + this.offsetHeight;
|
||||
var left = pos.left;
|
||||
var viewPort = getViewport();
|
||||
var calW = cal.width();
|
||||
if (left + calW > viewPort.l + viewPort.w) {
|
||||
left -= calW;
|
||||
}
|
||||
cal.css({left: left + 'px', top: top + 'px'});
|
||||
if (cal.data('colpick').onShow.apply(this, [cal.get(0)]) != false) {
|
||||
cal.show();
|
||||
}
|
||||
//Hide when user clicks outside
|
||||
$('html').mousedown({cal:cal}, hide);
|
||||
cal.mousedown(function(ev){ev.stopPropagation();})
|
||||
},
|
||||
hide = function (ev) {
|
||||
if (ev.data.cal.data('colpick').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
|
||||
ev.data.cal.hide();
|
||||
}
|
||||
$('html').off('mousedown', hide);
|
||||
},
|
||||
getViewport = function () {
|
||||
var m = document.compatMode == 'CSS1Compat';
|
||||
return {
|
||||
l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
|
||||
w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth)
|
||||
};
|
||||
},
|
||||
//Fix the values if the user enters a negative or high value
|
||||
fixHSB = function (hsb) {
|
||||
return {
|
||||
h: Math.min(360, Math.max(0, hsb.h)),
|
||||
s: Math.min(100, Math.max(0, hsb.s)),
|
||||
b: Math.min(100, Math.max(0, hsb.b))
|
||||
};
|
||||
},
|
||||
fixRGB = function (rgb) {
|
||||
return {
|
||||
r: Math.min(255, Math.max(0, rgb.r)),
|
||||
g: Math.min(255, Math.max(0, rgb.g)),
|
||||
b: Math.min(255, Math.max(0, rgb.b))
|
||||
};
|
||||
},
|
||||
fixHex = function (hex) {
|
||||
var len = 6 - hex.length;
|
||||
if (len > 0) {
|
||||
var o = [];
|
||||
for (var i=0; i<len; i++) {
|
||||
o.push('0');
|
||||
}
|
||||
o.push(hex);
|
||||
hex = o.join('');
|
||||
}
|
||||
return hex;
|
||||
},
|
||||
restoreOriginal = function () {
|
||||
var cal = $(this).parent();
|
||||
var col = cal.data('colpick').origColor;
|
||||
cal.data('colpick').color = col;
|
||||
fillRGBFields(col, cal.get(0));
|
||||
fillHexFields(col, cal.get(0));
|
||||
fillHSBFields(col, cal.get(0));
|
||||
setSelector(col, cal.get(0));
|
||||
setHue(col, cal.get(0));
|
||||
setNewColor(col, cal.get(0));
|
||||
};
|
||||
return {
|
||||
init: function (opt) {
|
||||
opt = $.extend({}, defaults, opt||{});
|
||||
//Set color
|
||||
if (typeof opt.color == 'string') {
|
||||
opt.color = hexToHsb(opt.color);
|
||||
} else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) {
|
||||
opt.color = rgbToHsb(opt.color);
|
||||
} else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) {
|
||||
opt.color = fixHSB(opt.color);
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
|
||||
//For each selected DOM element
|
||||
return this.each(function () {
|
||||
//If the element does not have an ID
|
||||
if (!$(this).data('colpickId')) {
|
||||
var options = $.extend({}, opt);
|
||||
options.origColor = opt.color;
|
||||
//Generate and assign a random ID
|
||||
var id = 'collorpicker_' + parseInt(Math.random() * 1000);
|
||||
$(this).data('colpickId', id);
|
||||
//Set the tpl's ID and get the HTML
|
||||
var cal = $(tpl).attr('id', id);
|
||||
//Add class according to layout
|
||||
cal.addClass('colpick_'+options.layout+(options.submit?'':' colpick_'+options.layout+'_ns'));
|
||||
//Add class if the color scheme is not default
|
||||
if(options.colorScheme != 'light') {
|
||||
cal.addClass('colpick_'+options.colorScheme);
|
||||
}
|
||||
//Setup submit button
|
||||
cal.find('div.colpick_submit').html(options.submitText).click(clickSubmit);
|
||||
//Setup input fields
|
||||
options.fields = cal.find('input').change(change).blur(blur).focus(focus);
|
||||
cal.find('div.colpick_field_arrs').mousedown(downIncrement).end().find('div.colpick_current_color').click(restoreOriginal);
|
||||
//Setup hue selector
|
||||
options.selector = cal.find('div.colpick_color').on('mousedown touchstart',downSelector);
|
||||
options.selectorIndic = options.selector.find('div.colpick_selector_outer');
|
||||
//Store parts of the plugin
|
||||
options.el = this;
|
||||
options.hue = cal.find('div.colpick_hue_arrs');
|
||||
huebar = options.hue.parent();
|
||||
//Paint the hue bar
|
||||
var UA = navigator.userAgent.toLowerCase();
|
||||
var isIE = navigator.appName === 'Microsoft Internet Explorer';
|
||||
var IEver = isIE ? parseFloat( UA.match( /msie ([0-9]{1,}[\.0-9]{0,})/ )[1] ) : 0;
|
||||
var ngIE = ( isIE && IEver < 10 );
|
||||
var stops = ['#ff0000','#ff0080','#ff00ff','#8000ff','#0000ff','#0080ff','#00ffff','#00ff80','#00ff00','#80ff00','#ffff00','#ff8000','#ff0000'];
|
||||
if(ngIE) {
|
||||
var i, div;
|
||||
for(i=0; i<=11; i++) {
|
||||
div = $('<div></div>').attr('style','height:8.333333%; filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='+stops[i]+', endColorstr='+stops[i+1]+'); -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='+stops[i]+', endColorstr='+stops[i+1]+')";');
|
||||
huebar.append(div);
|
||||
}
|
||||
} else {
|
||||
stopList = stops.join(',');
|
||||
huebar.attr('style','background:-webkit-linear-gradient(top,'+stopList+'); background: -o-linear-gradient(top,'+stopList+'); background: -ms-linear-gradient(top,'+stopList+'); background:-moz-linear-gradient(top,'+stopList+'); -webkit-linear-gradient(top,'+stopList+'); background:linear-gradient(to bottom,'+stopList+'); ');
|
||||
}
|
||||
cal.find('div.colpick_hue').on('mousedown touchstart',downHue);
|
||||
options.newColor = cal.find('div.colpick_new_color');
|
||||
options.currentColor = cal.find('div.colpick_current_color');
|
||||
//Store options and fill with default color
|
||||
cal.data('colpick', options);
|
||||
fillRGBFields(options.color, cal.get(0));
|
||||
fillHSBFields(options.color, cal.get(0));
|
||||
fillHexFields(options.color, cal.get(0));
|
||||
setHue(options.color, cal.get(0));
|
||||
setSelector(options.color, cal.get(0));
|
||||
setCurrentColor(options.color, cal.get(0));
|
||||
setNewColor(options.color, cal.get(0));
|
||||
//Append to body if flat=false, else show in place
|
||||
if (options.flat) {
|
||||
cal.appendTo(this).show();
|
||||
cal.css({
|
||||
position: 'relative',
|
||||
display: 'block'
|
||||
});
|
||||
} else {
|
||||
cal.appendTo(document.body);
|
||||
$(this).on(options.showEvent, show);
|
||||
cal.css({
|
||||
position:'absolute'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
//Shows the picker
|
||||
showPicker: function() {
|
||||
return this.each( function () {
|
||||
if ($(this).data('colpickId')) {
|
||||
show.apply(this);
|
||||
}
|
||||
});
|
||||
},
|
||||
//Hides the picker
|
||||
hidePicker: function() {
|
||||
return this.each( function () {
|
||||
if ($(this).data('colpickId')) {
|
||||
$('#' + $(this).data('colpickId')).hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
//Sets a color as new and current (default)
|
||||
setColor: function(col, setCurrent) {
|
||||
setCurrent = (typeof setCurrent === "undefined") ? 1 : setCurrent;
|
||||
if (typeof col == 'string') {
|
||||
col = hexToHsb(col);
|
||||
} else if (col.r != undefined && col.g != undefined && col.b != undefined) {
|
||||
col = rgbToHsb(col);
|
||||
} else if (col.h != undefined && col.s != undefined && col.b != undefined) {
|
||||
col = fixHSB(col);
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
return this.each(function(){
|
||||
if ($(this).data('colpickId')) {
|
||||
var cal = $('#' + $(this).data('colpickId'));
|
||||
cal.data('colpick').color = col;
|
||||
cal.data('colpick').origColor = col;
|
||||
fillRGBFields(col, cal.get(0));
|
||||
fillHSBFields(col, cal.get(0));
|
||||
fillHexFields(col, cal.get(0));
|
||||
setHue(col, cal.get(0));
|
||||
setSelector(col, cal.get(0));
|
||||
|
||||
setNewColor(col, cal.get(0));
|
||||
cal.data('colpick').onChange.apply(cal.parent(), [col, hsbToHex(col), hsbToRgb(col), cal.data('colpick').el, 1]);
|
||||
if(setCurrent) {
|
||||
setCurrentColor(col, cal.get(0));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}();
|
||||
//Color space convertions
|
||||
var hexToRgb = function (hex) {
|
||||
var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
|
||||
return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
|
||||
};
|
||||
var hexToHsb = function (hex) {
|
||||
return rgbToHsb(hexToRgb(hex));
|
||||
};
|
||||
var rgbToHsb = function (rgb) {
|
||||
var hsb = {h: 0, s: 0, b: 0};
|
||||
var min = Math.min(rgb.r, rgb.g, rgb.b);
|
||||
var max = Math.max(rgb.r, rgb.g, rgb.b);
|
||||
var delta = max - min;
|
||||
hsb.b = max;
|
||||
hsb.s = max != 0 ? 255 * delta / max : 0;
|
||||
if (hsb.s != 0) {
|
||||
if (rgb.r == max) hsb.h = (rgb.g - rgb.b) / delta;
|
||||
else if (rgb.g == max) hsb.h = 2 + (rgb.b - rgb.r) / delta;
|
||||
else hsb.h = 4 + (rgb.r - rgb.g) / delta;
|
||||
} else hsb.h = -1;
|
||||
hsb.h *= 60;
|
||||
if (hsb.h < 0) hsb.h += 360;
|
||||
hsb.s *= 100/255;
|
||||
hsb.b *= 100/255;
|
||||
return hsb;
|
||||
};
|
||||
var hsbToRgb = function (hsb) {
|
||||
var rgb = {};
|
||||
var h = hsb.h;
|
||||
var s = hsb.s*255/100;
|
||||
var v = hsb.b*255/100;
|
||||
if(s == 0) {
|
||||
rgb.r = rgb.g = rgb.b = v;
|
||||
} else {
|
||||
var t1 = v;
|
||||
var t2 = (255-s)*v/255;
|
||||
var t3 = (t1-t2)*(h%60)/60;
|
||||
if(h==360) h = 0;
|
||||
if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
|
||||
else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
|
||||
else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
|
||||
else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3}
|
||||
else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3}
|
||||
else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3}
|
||||
else {rgb.r=0; rgb.g=0; rgb.b=0}
|
||||
}
|
||||
return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
|
||||
};
|
||||
var rgbToHex = function (rgb) {
|
||||
var hex = [
|
||||
rgb.r.toString(16),
|
||||
rgb.g.toString(16),
|
||||
rgb.b.toString(16)
|
||||
];
|
||||
$.each(hex, function (nr, val) {
|
||||
if (val.length == 1) {
|
||||
hex[nr] = '0' + val;
|
||||
}
|
||||
});
|
||||
return hex.join('');
|
||||
};
|
||||
var hsbToHex = function (hsb) {
|
||||
return rgbToHex(hsbToRgb(hsb));
|
||||
};
|
||||
$.fn.extend({
|
||||
colpick: colpick.init,
|
||||
colpickHide: colpick.hidePicker,
|
||||
colpickShow: colpick.showPicker,
|
||||
colpickSetColor: colpick.setColor
|
||||
});
|
||||
$.extend({
|
||||
colpick:{
|
||||
rgbToHex: rgbToHex,
|
||||
rgbToHsb: rgbToHsb,
|
||||
hsbToHex: hsbToHex,
|
||||
hsbToRgb: hsbToRgb,
|
||||
hexToHsb: hexToHsb,
|
||||
hexToRgb: hexToRgb
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
10
static/plugins/echarts/echarts.min.js
vendored
Executable file
4
static/plugins/font-awesome/css/font-awesome.min.css
vendored
Executable file
BIN
static/plugins/font-awesome/fonts/FontAwesome.otf
Executable file
BIN
static/plugins/font-awesome/fonts/fontawesome-webfont.eot
Executable file
2671
static/plugins/font-awesome/fonts/fontawesome-webfont.svg
Executable file
After Width: | Height: | Size: 434 KiB |
BIN
static/plugins/font-awesome/fonts/fontawesome-webfont.ttf
Executable file
BIN
static/plugins/font-awesome/fonts/fontawesome-webfont.woff
Executable file
BIN
static/plugins/font-awesome/fonts/fontawesome-webfont.woff2
Executable file
BIN
static/plugins/jcrop/css/Jcrop.gif
Executable file
After Width: | Height: | Size: 329 B |
165
static/plugins/jcrop/css/jquery.Jcrop.css
Executable file
@ -0,0 +1,165 @@
|
||||
/* jquery.Jcrop.css v0.9.12 - MIT License */
|
||||
/*
|
||||
The outer-most container in a typical Jcrop instance
|
||||
If you are having difficulty with formatting related to styles
|
||||
on a parent element, place any fixes here or in a like selector
|
||||
|
||||
You can also style this element if you want to add a border, etc
|
||||
A better method for styling can be seen below with .jcrop-light
|
||||
(Add a class to the holder and style elements for that extended class)
|
||||
*/
|
||||
.jcrop-holder {
|
||||
direction: ltr;
|
||||
text-align: left;
|
||||
}
|
||||
/* Selection Border */
|
||||
.jcrop-vline,
|
||||
.jcrop-hline {
|
||||
background: #ffffff url("Jcrop.gif");
|
||||
font-size: 0;
|
||||
position: absolute;
|
||||
}
|
||||
.jcrop-vline {
|
||||
height: 100%;
|
||||
width: 1px !important;
|
||||
}
|
||||
.jcrop-vline.right {
|
||||
right: 0;
|
||||
}
|
||||
.jcrop-hline {
|
||||
height: 1px !important;
|
||||
width: 100%;
|
||||
}
|
||||
.jcrop-hline.bottom {
|
||||
bottom: 0;
|
||||
}
|
||||
/* Invisible click targets */
|
||||
.jcrop-tracker {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
/* "turn off" link highlight */
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
/* disable callout, image save panel */
|
||||
-webkit-touch-callout: none;
|
||||
/* disable cut copy paste */
|
||||
-webkit-user-select: none;
|
||||
}
|
||||
/* Selection Handles */
|
||||
.jcrop-handle {
|
||||
background-color: #333333;
|
||||
border: 1px #eeeeee solid;
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
font-size: 1px;
|
||||
}
|
||||
.jcrop-handle.ord-n {
|
||||
left: 50%;
|
||||
margin-left: -4px;
|
||||
margin-top: -4px;
|
||||
top: 0;
|
||||
}
|
||||
.jcrop-handle.ord-s {
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
margin-bottom: -4px;
|
||||
margin-left: -4px;
|
||||
}
|
||||
.jcrop-handle.ord-e {
|
||||
margin-right: -4px;
|
||||
margin-top: -4px;
|
||||
right: 0;
|
||||
top: 50%;
|
||||
}
|
||||
.jcrop-handle.ord-w {
|
||||
left: 0;
|
||||
margin-left: -4px;
|
||||
margin-top: -4px;
|
||||
top: 50%;
|
||||
}
|
||||
.jcrop-handle.ord-nw {
|
||||
left: 0;
|
||||
margin-left: -4px;
|
||||
margin-top: -4px;
|
||||
top: 0;
|
||||
}
|
||||
.jcrop-handle.ord-ne {
|
||||
margin-right: -4px;
|
||||
margin-top: -4px;
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
.jcrop-handle.ord-se {
|
||||
bottom: 0;
|
||||
margin-bottom: -4px;
|
||||
margin-right: -4px;
|
||||
right: 0;
|
||||
}
|
||||
.jcrop-handle.ord-sw {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
margin-bottom: -4px;
|
||||
margin-left: -4px;
|
||||
}
|
||||
/* Dragbars */
|
||||
.jcrop-dragbar.ord-n,
|
||||
.jcrop-dragbar.ord-s {
|
||||
height: 7px;
|
||||
width: 100%;
|
||||
}
|
||||
.jcrop-dragbar.ord-e,
|
||||
.jcrop-dragbar.ord-w {
|
||||
height: 100%;
|
||||
width: 7px;
|
||||
}
|
||||
.jcrop-dragbar.ord-n {
|
||||
margin-top: -4px;
|
||||
}
|
||||
.jcrop-dragbar.ord-s {
|
||||
bottom: 0;
|
||||
margin-bottom: -4px;
|
||||
}
|
||||
.jcrop-dragbar.ord-e {
|
||||
margin-right: -4px;
|
||||
right: 0;
|
||||
}
|
||||
.jcrop-dragbar.ord-w {
|
||||
margin-left: -4px;
|
||||
}
|
||||
/* The "jcrop-light" class/extension */
|
||||
.jcrop-light .jcrop-vline,
|
||||
.jcrop-light .jcrop-hline {
|
||||
background: #ffffff;
|
||||
filter: alpha(opacity=70) !important;
|
||||
opacity: .70!important;
|
||||
}
|
||||
.jcrop-light .jcrop-handle {
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
background-color: #000000;
|
||||
border-color: #ffffff;
|
||||
border-radius: 3px;
|
||||
}
|
||||
/* The "jcrop-dark" class/extension */
|
||||
.jcrop-dark .jcrop-vline,
|
||||
.jcrop-dark .jcrop-hline {
|
||||
background: #000000;
|
||||
filter: alpha(opacity=70) !important;
|
||||
opacity: 0.7 !important;
|
||||
}
|
||||
.jcrop-dark .jcrop-handle {
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
background-color: #ffffff;
|
||||
border-color: #000000;
|
||||
border-radius: 3px;
|
||||
}
|
||||
/* Simple macro to turn off the antlines */
|
||||
.solid-line .jcrop-vline,
|
||||
.solid-line .jcrop-hline {
|
||||
background: #ffffff;
|
||||
}
|
||||
/* Fix for twitter bootstrap et al. */
|
||||
.jcrop-holder img,
|
||||
img.jcrop-preview {
|
||||
max-width: none;
|
||||
}
|
29
static/plugins/jcrop/css/jquery.Jcrop.min.css
vendored
Executable file
@ -0,0 +1,29 @@
|
||||
/* jquery.Jcrop.min.css v0.9.12 (build:20130126) */
|
||||
.jcrop-holder{direction:ltr;text-align:left;}
|
||||
.jcrop-vline,.jcrop-hline{background:#FFF url(Jcrop.gif);font-size:0;position:absolute;}
|
||||
.jcrop-vline{height:100%;width:1px!important;}
|
||||
.jcrop-vline.right{right:0;}
|
||||
.jcrop-hline{height:1px!important;width:100%;}
|
||||
.jcrop-hline.bottom{bottom:0;}
|
||||
.jcrop-tracker{-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;height:100%;width:100%;}
|
||||
.jcrop-handle{background-color:#333;border:1px #EEE solid;font-size:1px;height:7px;width:7px;}
|
||||
.jcrop-handle.ord-n{left:50%;margin-left:-4px;margin-top:-4px;top:0;}
|
||||
.jcrop-handle.ord-s{bottom:0;left:50%;margin-bottom:-4px;margin-left:-4px;}
|
||||
.jcrop-handle.ord-e{margin-right:-4px;margin-top:-4px;right:0;top:50%;}
|
||||
.jcrop-handle.ord-w{left:0;margin-left:-4px;margin-top:-4px;top:50%;}
|
||||
.jcrop-handle.ord-nw{left:0;margin-left:-4px;margin-top:-4px;top:0;}
|
||||
.jcrop-handle.ord-ne{margin-right:-4px;margin-top:-4px;right:0;top:0;}
|
||||
.jcrop-handle.ord-se{bottom:0;margin-bottom:-4px;margin-right:-4px;right:0;}
|
||||
.jcrop-handle.ord-sw{bottom:0;left:0;margin-bottom:-4px;margin-left:-4px;}
|
||||
.jcrop-dragbar.ord-n,.jcrop-dragbar.ord-s{height:7px;width:100%;}
|
||||
.jcrop-dragbar.ord-e,.jcrop-dragbar.ord-w{height:100%;width:7px;}
|
||||
.jcrop-dragbar.ord-n{margin-top:-4px;}
|
||||
.jcrop-dragbar.ord-s{bottom:0;margin-bottom:-4px;}
|
||||
.jcrop-dragbar.ord-e{margin-right:-4px;right:0;}
|
||||
.jcrop-dragbar.ord-w{margin-left:-4px;}
|
||||
.jcrop-light .jcrop-vline,.jcrop-light .jcrop-hline{background:#FFF;filter:alpha(opacity=70)!important;opacity:.70!important;}
|
||||
.jcrop-light .jcrop-handle{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#000;border-color:#FFF;border-radius:3px;}
|
||||
.jcrop-dark .jcrop-vline,.jcrop-dark .jcrop-hline{background:#000;filter:alpha(opacity=70)!important;opacity:.7!important;}
|
||||
.jcrop-dark .jcrop-handle{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#FFF;border-color:#000;border-radius:3px;}
|
||||
.solid-line .jcrop-vline,.solid-line .jcrop-hline{background:#FFF;}
|
||||
.jcrop-holder img,img.jcrop-preview{max-width:none;}
|
1694
static/plugins/jcrop/js/jquery.Jcrop.js
Executable file
22
static/plugins/jcrop/js/jquery.Jcrop.min.js
vendored
Executable file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* jquery.Jcrop.min.js v0.9.12 (build:20130202)
|
||||
* jQuery Image Cropping Plugin - released under MIT License
|
||||
* Copyright (c) 2008-2013 Tapmodo Interactive LLC
|
||||
* https://github.com/tapmodo/Jcrop
|
||||
*/
|
||||
(function(a){a.Jcrop=function(b,c){function i(a){return Math.round(a)+"px"}function j(a){return d.baseClass+"-"+a}function k(){return a.fx.step.hasOwnProperty("backgroundColor")}function l(b){var c=a(b).offset();return[c.left,c.top]}function m(a){return[a.pageX-e[0],a.pageY-e[1]]}function n(b){typeof b!="object"&&(b={}),d=a.extend(d,b),a.each(["onChange","onSelect","onRelease","onDblClick"],function(a,b){typeof d[b]!="function"&&(d[b]=function(){})})}function o(a,b,c){e=l(D),bc.setCursor(a==="move"?a:a+"-resize");if(a==="move")return bc.activateHandlers(q(b),v,c);var d=_.getFixed(),f=r(a),g=_.getCorner(r(f));_.setPressed(_.getCorner(f)),_.setCurrent(g),bc.activateHandlers(p(a,d),v,c)}function p(a,b){return function(c){if(!d.aspectRatio)switch(a){case"e":c[1]=b.y2;break;case"w":c[1]=b.y2;break;case"n":c[0]=b.x2;break;case"s":c[0]=b.x2}else switch(a){case"e":c[1]=b.y+1;break;case"w":c[1]=b.y+1;break;case"n":c[0]=b.x+1;break;case"s":c[0]=b.x+1}_.setCurrent(c),bb.update()}}function q(a){var b=a;return bd.watchKeys
|
||||
(),function(a){_.moveOffset([a[0]-b[0],a[1]-b[1]]),b=a,bb.update()}}function r(a){switch(a){case"n":return"sw";case"s":return"nw";case"e":return"nw";case"w":return"ne";case"ne":return"sw";case"nw":return"se";case"se":return"nw";case"sw":return"ne"}}function s(a){return function(b){return d.disabled?!1:a==="move"&&!d.allowMove?!1:(e=l(D),W=!0,o(a,m(b)),b.stopPropagation(),b.preventDefault(),!1)}}function t(a,b,c){var d=a.width(),e=a.height();d>b&&b>0&&(d=b,e=b/a.width()*a.height()),e>c&&c>0&&(e=c,d=c/a.height()*a.width()),T=a.width()/d,U=a.height()/e,a.width(d).height(e)}function u(a){return{x:a.x*T,y:a.y*U,x2:a.x2*T,y2:a.y2*U,w:a.w*T,h:a.h*U}}function v(a){var b=_.getFixed();b.w>d.minSelect[0]&&b.h>d.minSelect[1]?(bb.enableHandles(),bb.done()):bb.release(),bc.setCursor(d.allowSelect?"crosshair":"default")}function w(a){if(d.disabled)return!1;if(!d.allowSelect)return!1;W=!0,e=l(D),bb.disableHandles(),bc.setCursor("crosshair");var b=m(a);return _.setPressed(b),bb.update(),bc.activateHandlers(x,v,a.type.substring
|
||||
(0,5)==="touch"),bd.watchKeys(),a.stopPropagation(),a.preventDefault(),!1}function x(a){_.setCurrent(a),bb.update()}function y(){var b=a("<div></div>").addClass(j("tracker"));return g&&b.css({opacity:0,backgroundColor:"white"}),b}function be(a){G.removeClass().addClass(j("holder")).addClass(a)}function bf(a,b){function t(){window.setTimeout(u,l)}var c=a[0]/T,e=a[1]/U,f=a[2]/T,g=a[3]/U;if(X)return;var h=_.flipCoords(c,e,f,g),i=_.getFixed(),j=[i.x,i.y,i.x2,i.y2],k=j,l=d.animationDelay,m=h[0]-j[0],n=h[1]-j[1],o=h[2]-j[2],p=h[3]-j[3],q=0,r=d.swingSpeed;c=k[0],e=k[1],f=k[2],g=k[3],bb.animMode(!0);var s,u=function(){return function(){q+=(100-q)/r,k[0]=Math.round(c+q/100*m),k[1]=Math.round(e+q/100*n),k[2]=Math.round(f+q/100*o),k[3]=Math.round(g+q/100*p),q>=99.8&&(q=100),q<100?(bh(k),t()):(bb.done(),bb.animMode(!1),typeof b=="function"&&b.call(bs))}}();t()}function bg(a){bh([a[0]/T,a[1]/U,a[2]/T,a[3]/U]),d.onSelect.call(bs,u(_.getFixed())),bb.enableHandles()}function bh(a){_.setPressed([a[0],a[1]]),_.setCurrent([a[2],
|
||||
a[3]]),bb.update()}function bi(){return u(_.getFixed())}function bj(){return _.getFixed()}function bk(a){n(a),br()}function bl(){d.disabled=!0,bb.disableHandles(),bb.setCursor("default"),bc.setCursor("default")}function bm(){d.disabled=!1,br()}function bn(){bb.done(),bc.activateHandlers(null,null)}function bo(){G.remove(),A.show(),A.css("visibility","visible"),a(b).removeData("Jcrop")}function bp(a,b){bb.release(),bl();var c=new Image;c.onload=function(){var e=c.width,f=c.height,g=d.boxWidth,h=d.boxHeight;D.width(e).height(f),D.attr("src",a),H.attr("src",a),t(D,g,h),E=D.width(),F=D.height(),H.width(E).height(F),M.width(E+L*2).height(F+L*2),G.width(E).height(F),ba.resize(E,F),bm(),typeof b=="function"&&b.call(bs)},c.src=a}function bq(a,b,c){var e=b||d.bgColor;d.bgFade&&k()&&d.fadeTime&&!c?a.animate({backgroundColor:e},{queue:!1,duration:d.fadeTime}):a.css("backgroundColor",e)}function br(a){d.allowResize?a?bb.enableOnly():bb.enableHandles():bb.disableHandles(),bc.setCursor(d.allowSelect?"crosshair":"default"),bb
|
||||
.setCursor(d.allowMove?"move":"default"),d.hasOwnProperty("trueSize")&&(T=d.trueSize[0]/E,U=d.trueSize[1]/F),d.hasOwnProperty("setSelect")&&(bg(d.setSelect),bb.done(),delete d.setSelect),ba.refresh(),d.bgColor!=N&&(bq(d.shade?ba.getShades():G,d.shade?d.shadeColor||d.bgColor:d.bgColor),N=d.bgColor),O!=d.bgOpacity&&(O=d.bgOpacity,d.shade?ba.refresh():bb.setBgOpacity(O)),P=d.maxSize[0]||0,Q=d.maxSize[1]||0,R=d.minSize[0]||0,S=d.minSize[1]||0,d.hasOwnProperty("outerImage")&&(D.attr("src",d.outerImage),delete d.outerImage),bb.refresh()}var d=a.extend({},a.Jcrop.defaults),e,f=navigator.userAgent.toLowerCase(),g=/msie/.test(f),h=/msie [1-6]\./.test(f);typeof b!="object"&&(b=a(b)[0]),typeof c!="object"&&(c={}),n(c);var z={border:"none",visibility:"visible",margin:0,padding:0,position:"absolute",top:0,left:0},A=a(b),B=!0;if(b.tagName=="IMG"){if(A[0].width!=0&&A[0].height!=0)A.width(A[0].width),A.height(A[0].height);else{var C=new Image;C.src=A[0].src,A.width(C.width),A.height(C.height)}var D=A.clone().removeAttr("id").
|
||||
css(z).show();D.width(A.width()),D.height(A.height()),A.after(D).hide()}else D=A.css(z).show(),B=!1,d.shade===null&&(d.shade=!0);t(D,d.boxWidth,d.boxHeight);var E=D.width(),F=D.height(),G=a("<div />").width(E).height(F).addClass(j("holder")).css({position:"relative",backgroundColor:d.bgColor}).insertAfter(A).append(D);d.addClass&&G.addClass(d.addClass);var H=a("<div />"),I=a("<div />").width("100%").height("100%").css({zIndex:310,position:"absolute",overflow:"hidden"}),J=a("<div />").width("100%").height("100%").css("zIndex",320),K=a("<div />").css({position:"absolute",zIndex:600}).dblclick(function(){var a=_.getFixed();d.onDblClick.call(bs,a)}).insertBefore(D).append(I,J);B&&(H=a("<img />").attr("src",D.attr("src")).css(z).width(E).height(F),I.append(H)),h&&K.css({overflowY:"hidden"});var L=d.boundary,M=y().width(E+L*2).height(F+L*2).css({position:"absolute",top:i(-L),left:i(-L),zIndex:290}).mousedown(w),N=d.bgColor,O=d.bgOpacity,P,Q,R,S,T,U,V=!0,W,X,Y;e=l(D);var Z=function(){function a(){var a={},b=["touchstart"
|
||||
,"touchmove","touchend"],c=document.createElement("div"),d;try{for(d=0;d<b.length;d++){var e=b[d];e="on"+e;var f=e in c;f||(c.setAttribute(e,"return;"),f=typeof c[e]=="function"),a[b[d]]=f}return a.touchstart&&a.touchend&&a.touchmove}catch(g){return!1}}function b(){return d.touchSupport===!0||d.touchSupport===!1?d.touchSupport:a()}return{createDragger:function(a){return function(b){return d.disabled?!1:a==="move"&&!d.allowMove?!1:(e=l(D),W=!0,o(a,m(Z.cfilter(b)),!0),b.stopPropagation(),b.preventDefault(),!1)}},newSelection:function(a){return w(Z.cfilter(a))},cfilter:function(a){return a.pageX=a.originalEvent.changedTouches[0].pageX,a.pageY=a.originalEvent.changedTouches[0].pageY,a},isSupported:a,support:b()}}(),_=function(){function h(d){d=n(d),c=a=d[0],e=b=d[1]}function i(a){a=n(a),f=a[0]-c,g=a[1]-e,c=a[0],e=a[1]}function j(){return[f,g]}function k(d){var f=d[0],g=d[1];0>a+f&&(f-=f+a),0>b+g&&(g-=g+b),F<e+g&&(g+=F-(e+g)),E<c+f&&(f+=E-(c+f)),a+=f,c+=f,b+=g,e+=g}function l(a){var b=m();switch(a){case"ne":return[
|
||||
b.x2,b.y];case"nw":return[b.x,b.y];case"se":return[b.x2,b.y2];case"sw":return[b.x,b.y2]}}function m(){if(!d.aspectRatio)return p();var f=d.aspectRatio,g=d.minSize[0]/T,h=d.maxSize[0]/T,i=d.maxSize[1]/U,j=c-a,k=e-b,l=Math.abs(j),m=Math.abs(k),n=l/m,r,s,t,u;return h===0&&(h=E*10),i===0&&(i=F*10),n<f?(s=e,t=m*f,r=j<0?a-t:t+a,r<0?(r=0,u=Math.abs((r-a)/f),s=k<0?b-u:u+b):r>E&&(r=E,u=Math.abs((r-a)/f),s=k<0?b-u:u+b)):(r=c,u=l/f,s=k<0?b-u:b+u,s<0?(s=0,t=Math.abs((s-b)*f),r=j<0?a-t:t+a):s>F&&(s=F,t=Math.abs(s-b)*f,r=j<0?a-t:t+a)),r>a?(r-a<g?r=a+g:r-a>h&&(r=a+h),s>b?s=b+(r-a)/f:s=b-(r-a)/f):r<a&&(a-r<g?r=a-g:a-r>h&&(r=a-h),s>b?s=b+(a-r)/f:s=b-(a-r)/f),r<0?(a-=r,r=0):r>E&&(a-=r-E,r=E),s<0?(b-=s,s=0):s>F&&(b-=s-F,s=F),q(o(a,b,r,s))}function n(a){return a[0]<0&&(a[0]=0),a[1]<0&&(a[1]=0),a[0]>E&&(a[0]=E),a[1]>F&&(a[1]=F),[Math.round(a[0]),Math.round(a[1])]}function o(a,b,c,d){var e=a,f=c,g=b,h=d;return c<a&&(e=c,f=a),d<b&&(g=d,h=b),[e,g,f,h]}function p(){var d=c-a,f=e-b,g;return P&&Math.abs(d)>P&&(c=d>0?a+P:a-P),Q&&Math.abs
|
||||
(f)>Q&&(e=f>0?b+Q:b-Q),S/U&&Math.abs(f)<S/U&&(e=f>0?b+S/U:b-S/U),R/T&&Math.abs(d)<R/T&&(c=d>0?a+R/T:a-R/T),a<0&&(c-=a,a-=a),b<0&&(e-=b,b-=b),c<0&&(a-=c,c-=c),e<0&&(b-=e,e-=e),c>E&&(g=c-E,a-=g,c-=g),e>F&&(g=e-F,b-=g,e-=g),a>E&&(g=a-F,e-=g,b-=g),b>F&&(g=b-F,e-=g,b-=g),q(o(a,b,c,e))}function q(a){return{x:a[0],y:a[1],x2:a[2],y2:a[3],w:a[2]-a[0],h:a[3]-a[1]}}var a=0,b=0,c=0,e=0,f,g;return{flipCoords:o,setPressed:h,setCurrent:i,getOffset:j,moveOffset:k,getCorner:l,getFixed:m}}(),ba=function(){function f(a,b){e.left.css({height:i(b)}),e.right.css({height:i(b)})}function g(){return h(_.getFixed())}function h(a){e.top.css({left:i(a.x),width:i(a.w),height:i(a.y)}),e.bottom.css({top:i(a.y2),left:i(a.x),width:i(a.w),height:i(F-a.y2)}),e.right.css({left:i(a.x2),width:i(E-a.x2)}),e.left.css({width:i(a.x)})}function j(){return a("<div />").css({position:"absolute",backgroundColor:d.shadeColor||d.bgColor}).appendTo(c)}function k(){b||(b=!0,c.insertBefore(D),g(),bb.setBgOpacity(1,0,1),H.hide(),l(d.shadeColor||d.bgColor,1),bb.
|
||||
isAwake()?n(d.bgOpacity,1):n(1,1))}function l(a,b){bq(p(),a,b)}function m(){b&&(c.remove(),H.show(),b=!1,bb.isAwake()?bb.setBgOpacity(d.bgOpacity,1,1):(bb.setBgOpacity(1,1,1),bb.disableHandles()),bq(G,0,1))}function n(a,e){b&&(d.bgFade&&!e?c.animate({opacity:1-a},{queue:!1,duration:d.fadeTime}):c.css({opacity:1-a}))}function o(){d.shade?k():m(),bb.isAwake()&&n(d.bgOpacity)}function p(){return c.children()}var b=!1,c=a("<div />").css({position:"absolute",zIndex:240,opacity:0}),e={top:j(),left:j().height(F),right:j().height(F),bottom:j()};return{update:g,updateRaw:h,getShades:p,setBgColor:l,enable:k,disable:m,resize:f,refresh:o,opacity:n}}(),bb=function(){function k(b){var c=a("<div />").css({position:"absolute",opacity:d.borderOpacity}).addClass(j(b));return I.append(c),c}function l(b,c){var d=a("<div />").mousedown(s(b)).css({cursor:b+"-resize",position:"absolute",zIndex:c}).addClass("ord-"+b);return Z.support&&d.bind("touchstart.jcrop",Z.createDragger(b)),J.append(d),d}function m(a){var b=d.handleSize,e=l(a,c++
|
||||
).css({opacity:d.handleOpacity}).addClass(j("handle"));return b&&e.width(b).height(b),e}function n(a){return l(a,c++).addClass("jcrop-dragbar")}function o(a){var b;for(b=0;b<a.length;b++)g[a[b]]=n(a[b])}function p(a){var b,c;for(c=0;c<a.length;c++){switch(a[c]){case"n":b="hline";break;case"s":b="hline bottom";break;case"e":b="vline right";break;case"w":b="vline"}e[a[c]]=k(b)}}function q(a){var b;for(b=0;b<a.length;b++)f[a[b]]=m(a[b])}function r(a,b){d.shade||H.css({top:i(-b),left:i(-a)}),K.css({top:i(b),left:i(a)})}function t(a,b){K.width(Math.round(a)).height(Math.round(b))}function v(){var a=_.getFixed();_.setPressed([a.x,a.y]),_.setCurrent([a.x2,a.y2]),w()}function w(a){if(b)return x(a)}function x(a){var c=_.getFixed();t(c.w,c.h),r(c.x,c.y),d.shade&&ba.updateRaw(c),b||A(),a?d.onSelect.call(bs,u(c)):d.onChange.call(bs,u(c))}function z(a,c,e){if(!b&&!c)return;d.bgFade&&!e?D.animate({opacity:a},{queue:!1,duration:d.fadeTime}):D.css("opacity",a)}function A(){K.show(),d.shade?ba.opacity(O):z(O,!0),b=!0}function B
|
||||
(){F(),K.hide(),d.shade?ba.opacity(1):z(1),b=!1,d.onRelease.call(bs)}function C(){h&&J.show()}function E(){h=!0;if(d.allowResize)return J.show(),!0}function F(){h=!1,J.hide()}function G(a){a?(X=!0,F()):(X=!1,E())}function L(){G(!1),v()}var b,c=370,e={},f={},g={},h=!1;d.dragEdges&&a.isArray(d.createDragbars)&&o(d.createDragbars),a.isArray(d.createHandles)&&q(d.createHandles),d.drawBorders&&a.isArray(d.createBorders)&&p(d.createBorders),a(document).bind("touchstart.jcrop-ios",function(b){a(b.currentTarget).hasClass("jcrop-tracker")&&b.stopPropagation()});var M=y().mousedown(s("move")).css({cursor:"move",position:"absolute",zIndex:360});return Z.support&&M.bind("touchstart.jcrop",Z.createDragger("move")),I.append(M),F(),{updateVisible:w,update:x,release:B,refresh:v,isAwake:function(){return b},setCursor:function(a){M.css("cursor",a)},enableHandles:E,enableOnly:function(){h=!0},showHandles:C,disableHandles:F,animMode:G,setBgOpacity:z,done:L}}(),bc=function(){function f(b){M.css({zIndex:450}),b?a(document).bind("touchmove.jcrop"
|
||||
,k).bind("touchend.jcrop",l):e&&a(document).bind("mousemove.jcrop",h).bind("mouseup.jcrop",i)}function g(){M.css({zIndex:290}),a(document).unbind(".jcrop")}function h(a){return b(m(a)),!1}function i(a){return a.preventDefault(),a.stopPropagation(),W&&(W=!1,c(m(a)),bb.isAwake()&&d.onSelect.call(bs,u(_.getFixed())),g(),b=function(){},c=function(){}),!1}function j(a,d,e){return W=!0,b=a,c=d,f(e),!1}function k(a){return b(m(Z.cfilter(a))),!1}function l(a){return i(Z.cfilter(a))}function n(a){M.css("cursor",a)}var b=function(){},c=function(){},e=d.trackDocument;return e||M.mousemove(h).mouseup(i).mouseout(i),D.before(M),{activateHandlers:j,setCursor:n}}(),bd=function(){function e(){d.keySupport&&(b.show(),b.focus())}function f(a){b.hide()}function g(a,b,c){d.allowMove&&(_.moveOffset([b,c]),bb.updateVisible(!0)),a.preventDefault(),a.stopPropagation()}function i(a){if(a.ctrlKey||a.metaKey)return!0;Y=a.shiftKey?!0:!1;var b=Y?10:1;switch(a.keyCode){case 37:g(a,-b,0);break;case 39:g(a,b,0);break;case 38:g(a,0,-b);break;
|
||||
case 40:g(a,0,b);break;case 27:d.allowSelect&&bb.release();break;case 9:return!0}return!1}var b=a('<input type="radio" />').css({position:"fixed",left:"-120px",width:"12px"}).addClass("jcrop-keymgr"),c=a("<div />").css({position:"absolute",overflow:"hidden"}).append(b);return d.keySupport&&(b.keydown(i).blur(f),h||!d.fixedSupport?(b.css({position:"absolute",left:"-20px"}),c.append(b).insertBefore(D)):b.insertBefore(D)),{watchKeys:e}}();Z.support&&M.bind("touchstart.jcrop",Z.newSelection),J.hide(),br(!0);var bs={setImage:bp,animateTo:bf,setSelect:bg,setOptions:bk,tellSelect:bi,tellScaled:bj,setClass:be,disable:bl,enable:bm,cancel:bn,release:bb.release,destroy:bo,focus:bd.watchKeys,getBounds:function(){return[E*T,F*U]},getWidgetSize:function(){return[E,F]},getScaleFactor:function(){return[T,U]},getOptions:function(){return d},ui:{holder:G,selection:K}};return g&&G.bind("selectstart",function(){return!1}),A.data("Jcrop",bs),bs},a.fn.Jcrop=function(b,c){var d;return this.each(function(){if(a(this).data("Jcrop")){if(
|
||||
b==="api")return a(this).data("Jcrop");a(this).data("Jcrop").setOptions(b)}else this.tagName=="IMG"?a.Jcrop.Loader(this,function(){a(this).css({display:"block",visibility:"hidden"}),d=a.Jcrop(this,b),a.isFunction(c)&&c.call(d)}):(a(this).css({display:"block",visibility:"hidden"}),d=a.Jcrop(this,b),a.isFunction(c)&&c.call(d))}),this},a.Jcrop.Loader=function(b,c,d){function g(){f.complete?(e.unbind(".jcloader"),a.isFunction(c)&&c.call(f)):window.setTimeout(g,50)}var e=a(b),f=e[0];e.bind("load.jcloader",g).bind("error.jcloader",function(b){e.unbind(".jcloader"),a.isFunction(d)&&d.call(f)}),f.complete&&a.isFunction(c)&&(e.unbind(".jcloader"),c.call(f))},a.Jcrop.defaults={allowSelect:!0,allowMove:!0,allowResize:!0,trackDocument:!0,baseClass:"jcrop",addClass:null,bgColor:"black",bgOpacity:.6,bgFade:!1,borderOpacity:.4,handleOpacity:.5,handleSize:null,aspectRatio:0,keySupport:!0,createHandles:["n","s","e","w","nw","ne","se","sw"],createDragbars:["n","s","e","w"],createBorders:["n","s","e","w"],drawBorders:!0,dragEdges
|
||||
:!0,fixedSupport:!0,touchSupport:null,shade:null,boxWidth:0,boxHeight:0,boundary:2,fadeTime:400,animationDelay:20,swingSpeed:3,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){},onDblClick:function(){},onRelease:function(){}}})(jQuery);
|
9898
static/plugins/kindeditor/kindeditor-all.js
Executable file
7
static/plugins/kindeditor/kindeditor.js
Executable file
241
static/plugins/kindeditor/lang/en.js
Executable file
@ -0,0 +1,241 @@
|
||||
/*******************************************************************************
|
||||
* KindEditor - WYSIWYG HTML Editor for Internet
|
||||
* Copyright (C) 2006-2011 kindsoft.net
|
||||
*
|
||||
* @author Roddy <luolonghao@gmail.com>
|
||||
* @site http://www.kindsoft.net/
|
||||
* @licence http://www.kindsoft.net/license.php
|
||||
*******************************************************************************/
|
||||
|
||||
KindEditor.lang({
|
||||
source : 'Source',
|
||||
preview : 'Preview',
|
||||
undo : 'Undo(Ctrl+Z)',
|
||||
redo : 'Redo(Ctrl+Y)',
|
||||
cut : 'Cut(Ctrl+X)',
|
||||
copy : 'Copy(Ctrl+C)',
|
||||
paste : 'Paste(Ctrl+V)',
|
||||
plainpaste : 'Paste as plain text',
|
||||
wordpaste : 'Paste from Word',
|
||||
selectall : 'Select all',
|
||||
justifyleft : 'Align left',
|
||||
justifycenter : 'Align center',
|
||||
justifyright : 'Align right',
|
||||
justifyfull : 'Align full',
|
||||
insertorderedlist : 'Ordered list',
|
||||
insertunorderedlist : 'Unordered list',
|
||||
indent : 'Increase indent',
|
||||
outdent : 'Decrease indent',
|
||||
subscript : 'Subscript',
|
||||
superscript : 'Superscript',
|
||||
formatblock : 'Paragraph format',
|
||||
fontname : 'Font family',
|
||||
fontsize : 'Font size',
|
||||
forecolor : 'Text color',
|
||||
hilitecolor : 'Highlight color',
|
||||
bold : 'Bold(Ctrl+B)',
|
||||
italic : 'Italic(Ctrl+I)',
|
||||
underline : 'Underline(Ctrl+U)',
|
||||
strikethrough : 'Strikethrough',
|
||||
removeformat : 'Remove format',
|
||||
image : 'Image',
|
||||
multiimage : 'Multi image',
|
||||
flash : 'Flash',
|
||||
media : 'Embeded media',
|
||||
table : 'Table',
|
||||
tablecell : 'Cell',
|
||||
hr : 'Insert horizontal line',
|
||||
emoticons : 'Insert emoticon',
|
||||
link : 'Link',
|
||||
unlink : 'Unlink',
|
||||
fullscreen : 'Toggle fullscreen mode',
|
||||
about : 'About',
|
||||
print : 'Print',
|
||||
filemanager : 'File Manager',
|
||||
code : 'Insert code',
|
||||
map : 'Google Maps',
|
||||
baidumap : 'Baidu Maps',
|
||||
lineheight : 'Line height',
|
||||
clearhtml : 'Clear HTML code',
|
||||
pagebreak : 'Insert Page Break',
|
||||
quickformat : 'Quick Format',
|
||||
insertfile : 'Insert file',
|
||||
template : 'Insert Template',
|
||||
anchor : 'Anchor',
|
||||
yes : 'OK',
|
||||
no : 'Cancel',
|
||||
close : 'Close',
|
||||
editImage : 'Image properties',
|
||||
deleteImage : 'Delete image',
|
||||
editFlash : 'Flash properties',
|
||||
deleteFlash : 'Delete flash',
|
||||
editMedia : 'Media properties',
|
||||
deleteMedia : 'Delete media',
|
||||
editLink : 'Link properties',
|
||||
deleteLink : 'Unlink',
|
||||
editAnchor : 'Anchor properties',
|
||||
deleteAnchor : 'Delete Anchor',
|
||||
tableprop : 'Table properties',
|
||||
tablecellprop : 'Cell properties',
|
||||
tableinsert : 'Insert table',
|
||||
tabledelete : 'Delete table',
|
||||
tablecolinsertleft : 'Insert column left',
|
||||
tablecolinsertright : 'Insert column right',
|
||||
tablerowinsertabove : 'Insert row above',
|
||||
tablerowinsertbelow : 'Insert row below',
|
||||
tablerowmerge : 'Merge down',
|
||||
tablecolmerge : 'Merge right',
|
||||
tablerowsplit : 'Split row',
|
||||
tablecolsplit : 'Split column',
|
||||
tablecoldelete : 'Delete column',
|
||||
tablerowdelete : 'Delete row',
|
||||
noColor : 'Default',
|
||||
pleaseSelectFile : 'Please select file.',
|
||||
invalidImg : "Please type valid URL.\nAllowed file extension: jpg,gif,bmp,png",
|
||||
invalidMedia : "Please type valid URL.\nAllowed file extension: swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb",
|
||||
invalidWidth : "The width must be number.",
|
||||
invalidHeight : "The height must be number.",
|
||||
invalidBorder : "The border must be number.",
|
||||
invalidUrl : "Please type valid URL.",
|
||||
invalidRows : 'Invalid rows.',
|
||||
invalidCols : 'Invalid columns.',
|
||||
invalidPadding : 'The padding must be number.',
|
||||
invalidSpacing : 'The spacing must be number.',
|
||||
invalidJson : 'Invalid JSON string.',
|
||||
uploadSuccess : 'Upload success.',
|
||||
cutError : 'Currently not supported by your browser, use keyboard shortcut(Ctrl+X) instead.',
|
||||
copyError : 'Currently not supported by your browser, use keyboard shortcut(Ctrl+C) instead.',
|
||||
pasteError : 'Currently not supported by your browser, use keyboard shortcut(Ctrl+V) instead.',
|
||||
ajaxLoading : 'Loading ...',
|
||||
uploadLoading : 'Uploading ...',
|
||||
uploadError : 'Upload Error',
|
||||
'plainpaste.comment' : 'Use keyboard shortcut(Ctrl+V) to paste the text into the window.',
|
||||
'wordpaste.comment' : 'Use keyboard shortcut(Ctrl+V) to paste the text into the window.',
|
||||
'code.pleaseInput' : 'Please input code.',
|
||||
'link.url' : 'URL',
|
||||
'link.linkType' : 'Target',
|
||||
'link.newWindow' : 'New window',
|
||||
'link.selfWindow' : 'Same window',
|
||||
'flash.url' : 'URL',
|
||||
'flash.width' : 'Width',
|
||||
'flash.height' : 'Height',
|
||||
'flash.upload' : 'Upload',
|
||||
'flash.viewServer' : 'Browse',
|
||||
'media.url' : 'URL',
|
||||
'media.width' : 'Width',
|
||||
'media.height' : 'Height',
|
||||
'media.autostart' : 'Auto start',
|
||||
'media.upload' : 'Upload',
|
||||
'media.viewServer' : 'Browse',
|
||||
'image.remoteImage' : 'Insert URL',
|
||||
'image.localImage' : 'Upload',
|
||||
'image.remoteUrl' : 'URL',
|
||||
'image.localUrl' : 'File',
|
||||
'image.size' : 'Size',
|
||||
'image.width' : 'Width',
|
||||
'image.height' : 'Height',
|
||||
'image.resetSize' : 'Reset dimensions',
|
||||
'image.align' : 'Align',
|
||||
'image.defaultAlign' : 'Default',
|
||||
'image.leftAlign' : 'Left',
|
||||
'image.rightAlign' : 'Right',
|
||||
'image.imgTitle' : 'Title',
|
||||
'image.upload' : 'Browse',
|
||||
'image.viewServer' : 'Browse',
|
||||
'multiimage.uploadDesc' : 'Allows users to upload <%=uploadLimit%> images, single image size not exceeding <%=sizeLimit%>',
|
||||
'multiimage.startUpload' : 'Start upload',
|
||||
'multiimage.clearAll' : 'Clear all',
|
||||
'multiimage.insertAll' : 'Insert all',
|
||||
'multiimage.queueLimitExceeded' : 'Queue limit exceeded.',
|
||||
'multiimage.fileExceedsSizeLimit' : 'File exceeds size limit.',
|
||||
'multiimage.zeroByteFile' : 'Zero byte file.',
|
||||
'multiimage.invalidFiletype' : 'Invalid file type.',
|
||||
'multiimage.unknownError' : 'Unknown upload error.',
|
||||
'multiimage.pending' : 'Pending ...',
|
||||
'multiimage.uploadError' : 'Upload error',
|
||||
'filemanager.emptyFolder' : 'Blank',
|
||||
'filemanager.moveup' : 'Parent folder',
|
||||
'filemanager.viewType' : 'Display: ',
|
||||
'filemanager.viewImage' : 'Thumbnails',
|
||||
'filemanager.listImage' : 'List',
|
||||
'filemanager.orderType' : 'Sorting: ',
|
||||
'filemanager.fileName' : 'By name',
|
||||
'filemanager.fileSize' : 'By size',
|
||||
'filemanager.fileType' : 'By type',
|
||||
'insertfile.url' : 'URL',
|
||||
'insertfile.title' : 'Title',
|
||||
'insertfile.upload' : 'Upload',
|
||||
'insertfile.viewServer' : 'Browse',
|
||||
'table.cells' : 'Cells',
|
||||
'table.rows' : 'Rows',
|
||||
'table.cols' : 'Columns',
|
||||
'table.size' : 'Dimensions',
|
||||
'table.width' : 'Width',
|
||||
'table.height' : 'Height',
|
||||
'table.percent' : '%',
|
||||
'table.px' : 'px',
|
||||
'table.space' : 'Space',
|
||||
'table.padding' : 'Padding',
|
||||
'table.spacing' : 'Spacing',
|
||||
'table.align' : 'Align',
|
||||
'table.textAlign' : 'Horizontal',
|
||||
'table.verticalAlign' : 'Vertical',
|
||||
'table.alignDefault' : 'Default',
|
||||
'table.alignLeft' : 'Left',
|
||||
'table.alignCenter' : 'Center',
|
||||
'table.alignRight' : 'Right',
|
||||
'table.alignTop' : 'Top',
|
||||
'table.alignMiddle' : 'Middle',
|
||||
'table.alignBottom' : 'Bottom',
|
||||
'table.alignBaseline' : 'Baseline',
|
||||
'table.border' : 'Border',
|
||||
'table.borderWidth' : 'Width',
|
||||
'table.borderColor' : 'Color',
|
||||
'table.backgroundColor' : 'Background',
|
||||
'map.address' : 'Address: ',
|
||||
'map.search' : 'Search',
|
||||
'baidumap.address' : 'Address: ',
|
||||
'baidumap.search' : 'Search',
|
||||
'baidumap.insertDynamicMap' : 'Dynamic Map',
|
||||
'anchor.name' : 'Anchor name',
|
||||
'formatblock.formatBlock' : {
|
||||
h1 : 'Heading 1',
|
||||
h2 : 'Heading 2',
|
||||
h3 : 'Heading 3',
|
||||
h4 : 'Heading 4',
|
||||
p : 'Normal'
|
||||
},
|
||||
'fontname.fontName' : {
|
||||
'Arial' : 'Arial',
|
||||
'Arial Black' : 'Arial Black',
|
||||
'Comic Sans MS' : 'Comic Sans MS',
|
||||
'Courier New' : 'Courier New',
|
||||
'Garamond' : 'Garamond',
|
||||
'Georgia' : 'Georgia',
|
||||
'Tahoma' : 'Tahoma',
|
||||
'Times New Roman' : 'Times New Roman',
|
||||
'Trebuchet MS' : 'Trebuchet MS',
|
||||
'Verdana' : 'Verdana'
|
||||
},
|
||||
'lineheight.lineHeight' : [
|
||||
{'1' : 'Line height 1'},
|
||||
{'1.5' : 'Line height 1.5'},
|
||||
{'2' : 'Line height 2'},
|
||||
{'2.5' : 'Line height 2.5'},
|
||||
{'3' : 'Line height 3'}
|
||||
],
|
||||
'template.selectTemplate' : 'Template',
|
||||
'template.replaceContent' : 'Replace current content',
|
||||
'template.fileList' : {
|
||||
'1.html' : 'Image and Text',
|
||||
'2.html' : 'Table',
|
||||
'3.html' : 'List'
|
||||
}
|
||||
}, 'en');
|
||||
|
||||
KindEditor.each(KindEditor.options.items, function(i, name) {
|
||||
if (name == 'baidumap') {
|
||||
KindEditor.options.items[i] = 'map';
|
||||
}
|
||||
});
|
||||
KindEditor.options.langType = 'en';
|
238
static/plugins/kindeditor/lang/zh-CN.js
Executable file
@ -0,0 +1,238 @@
|
||||
/*******************************************************************************
|
||||
* KindEditor - WYSIWYG HTML Editor for Internet
|
||||
* Copyright (C) 2006-2011 kindsoft.net
|
||||
*
|
||||
* @author Roddy <luolonghao@gmail.com>
|
||||
* @site http://www.kindsoft.net/
|
||||
* @licence http://www.kindsoft.net/license.php
|
||||
*******************************************************************************/
|
||||
|
||||
KindEditor.lang({
|
||||
source : 'HTML代码',
|
||||
preview : '预览',
|
||||
undo : '后退(Ctrl+Z)',
|
||||
redo : '前进(Ctrl+Y)',
|
||||
cut : '剪切(Ctrl+X)',
|
||||
copy : '复制(Ctrl+C)',
|
||||
paste : '粘贴(Ctrl+V)',
|
||||
plainpaste : '粘贴为无格式文本',
|
||||
wordpaste : '从Word粘贴',
|
||||
selectall : '全选(Ctrl+A)',
|
||||
justifyleft : '左对齐',
|
||||
justifycenter : '居中',
|
||||
justifyright : '右对齐',
|
||||
justifyfull : '两端对齐',
|
||||
insertorderedlist : '编号',
|
||||
insertunorderedlist : '项目符号',
|
||||
indent : '增加缩进',
|
||||
outdent : '减少缩进',
|
||||
subscript : '下标',
|
||||
superscript : '上标',
|
||||
formatblock : '段落',
|
||||
fontname : '字体',
|
||||
fontsize : '文字大小',
|
||||
forecolor : '文字颜色',
|
||||
hilitecolor : '文字背景',
|
||||
bold : '粗体(Ctrl+B)',
|
||||
italic : '斜体(Ctrl+I)',
|
||||
underline : '下划线(Ctrl+U)',
|
||||
strikethrough : '删除线',
|
||||
removeformat : '删除格式',
|
||||
image : '图片',
|
||||
multiimage : '批量图片上传',
|
||||
flash : 'Flash',
|
||||
media : '视音频',
|
||||
table : '表格',
|
||||
tablecell : '单元格',
|
||||
hr : '插入横线',
|
||||
emoticons : '插入表情',
|
||||
link : '超级链接',
|
||||
unlink : '取消超级链接',
|
||||
fullscreen : '全屏显示',
|
||||
about : '关于',
|
||||
print : '打印(Ctrl+P)',
|
||||
filemanager : '文件空间',
|
||||
code : '插入程序代码',
|
||||
map : 'Google地图',
|
||||
baidumap : '百度地图',
|
||||
lineheight : '行距',
|
||||
clearhtml : '清理HTML代码',
|
||||
pagebreak : '插入分页符',
|
||||
quickformat : '一键排版',
|
||||
insertfile : '插入文件',
|
||||
template : '插入模板',
|
||||
anchor : '锚点',
|
||||
yes : '确定',
|
||||
no : '取消',
|
||||
close : '关闭',
|
||||
editImage : '图片属性',
|
||||
deleteImage : '删除图片',
|
||||
editFlash : 'Flash属性',
|
||||
deleteFlash : '删除Flash',
|
||||
editMedia : '视音频属性',
|
||||
deleteMedia : '删除视音频',
|
||||
editLink : '超级链接属性',
|
||||
deleteLink : '取消超级链接',
|
||||
editAnchor : '锚点属性',
|
||||
deleteAnchor : '删除锚点',
|
||||
tableprop : '表格属性',
|
||||
tablecellprop : '单元格属性',
|
||||
tableinsert : '插入表格',
|
||||
tabledelete : '删除表格',
|
||||
tablecolinsertleft : '左侧插入列',
|
||||
tablecolinsertright : '右侧插入列',
|
||||
tablerowinsertabove : '上方插入行',
|
||||
tablerowinsertbelow : '下方插入行',
|
||||
tablerowmerge : '向下合并单元格',
|
||||
tablecolmerge : '向右合并单元格',
|
||||
tablerowsplit : '拆分行',
|
||||
tablecolsplit : '拆分列',
|
||||
tablecoldelete : '删除列',
|
||||
tablerowdelete : '删除行',
|
||||
noColor : '无颜色',
|
||||
pleaseSelectFile : '请选择文件。',
|
||||
invalidImg : "请输入有效的URL地址。\n只允许jpg,gif,bmp,png格式。",
|
||||
invalidMedia : "请输入有效的URL地址。\n只允许swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb格式。",
|
||||
invalidWidth : "宽度必须为数字。",
|
||||
invalidHeight : "高度必须为数字。",
|
||||
invalidBorder : "边框必须为数字。",
|
||||
invalidUrl : "请输入有效的URL地址。",
|
||||
invalidRows : '行数为必选项,只允许输入大于0的数字。',
|
||||
invalidCols : '列数为必选项,只允许输入大于0的数字。',
|
||||
invalidPadding : '边距必须为数字。',
|
||||
invalidSpacing : '间距必须为数字。',
|
||||
invalidJson : '服务器发生故障。',
|
||||
uploadSuccess : '上传成功。',
|
||||
cutError : '您的浏览器安全设置不允许使用剪切操作,请使用快捷键(Ctrl+X)来完成。',
|
||||
copyError : '您的浏览器安全设置不允许使用复制操作,请使用快捷键(Ctrl+C)来完成。',
|
||||
pasteError : '您的浏览器安全设置不允许使用粘贴操作,请使用快捷键(Ctrl+V)来完成。',
|
||||
ajaxLoading : '加载中,请稍候 ...',
|
||||
uploadLoading : '上传中,请稍候 ...',
|
||||
uploadError : '上传错误',
|
||||
'plainpaste.comment' : '请使用快捷键(Ctrl+V)把内容粘贴到下面的方框里。',
|
||||
'wordpaste.comment' : '请使用快捷键(Ctrl+V)把内容粘贴到下面的方框里。',
|
||||
'code.pleaseInput' : '请输入程序代码。',
|
||||
'link.url' : 'URL',
|
||||
'link.linkType' : '打开类型',
|
||||
'link.newWindow' : '新窗口',
|
||||
'link.selfWindow' : '当前窗口',
|
||||
'flash.url' : 'URL',
|
||||
'flash.width' : '宽度',
|
||||
'flash.height' : '高度',
|
||||
'flash.upload' : '上传',
|
||||
'flash.viewServer' : '文件空间',
|
||||
'media.url' : 'URL',
|
||||
'media.width' : '宽度',
|
||||
'media.height' : '高度',
|
||||
'media.autostart' : '自动播放',
|
||||
'media.upload' : '上传',
|
||||
'media.viewServer' : '文件空间',
|
||||
'image.remoteImage' : '网络图片',
|
||||
'image.localImage' : '本地上传',
|
||||
'image.remoteUrl' : '图片地址',
|
||||
'image.localUrl' : '上传文件',
|
||||
'image.size' : '图片大小',
|
||||
'image.width' : '宽',
|
||||
'image.height' : '高',
|
||||
'image.resetSize' : '重置大小',
|
||||
'image.align' : '对齐方式',
|
||||
'image.defaultAlign' : '默认方式',
|
||||
'image.leftAlign' : '左对齐',
|
||||
'image.rightAlign' : '右对齐',
|
||||
'image.imgTitle' : '图片说明',
|
||||
'image.upload' : '浏览...',
|
||||
'image.viewServer' : '图片空间',
|
||||
'multiimage.uploadDesc' : '允许用户同时上传<%=uploadLimit%>张图片,单张图片容量不超过<%=sizeLimit%>',
|
||||
'multiimage.startUpload' : '开始上传',
|
||||
'multiimage.clearAll' : '全部清空',
|
||||
'multiimage.insertAll' : '全部插入',
|
||||
'multiimage.queueLimitExceeded' : '文件数量超过限制。',
|
||||
'multiimage.fileExceedsSizeLimit' : '文件大小超过限制。',
|
||||
'multiimage.zeroByteFile' : '无法上传空文件。',
|
||||
'multiimage.invalidFiletype' : '文件类型不正确。',
|
||||
'multiimage.unknownError' : '发生异常,无法上传。',
|
||||
'multiimage.pending' : '等待上传',
|
||||
'multiimage.uploadError' : '上传失败',
|
||||
'filemanager.emptyFolder' : '空文件夹',
|
||||
'filemanager.moveup' : '移到上一级文件夹',
|
||||
'filemanager.viewType' : '显示方式:',
|
||||
'filemanager.viewImage' : '缩略图',
|
||||
'filemanager.listImage' : '详细信息',
|
||||
'filemanager.orderType' : '排序方式:',
|
||||
'filemanager.fileName' : '名称',
|
||||
'filemanager.fileSize' : '大小',
|
||||
'filemanager.fileType' : '类型',
|
||||
'insertfile.url' : 'URL',
|
||||
'insertfile.title' : '文件说明',
|
||||
'insertfile.upload' : '上传',
|
||||
'insertfile.viewServer' : '文件空间',
|
||||
'table.cells' : '单元格数',
|
||||
'table.rows' : '行数',
|
||||
'table.cols' : '列数',
|
||||
'table.size' : '大小',
|
||||
'table.width' : '宽度',
|
||||
'table.height' : '高度',
|
||||
'table.percent' : '%',
|
||||
'table.px' : 'px',
|
||||
'table.space' : '边距间距',
|
||||
'table.padding' : '边距',
|
||||
'table.spacing' : '间距',
|
||||
'table.align' : '对齐方式',
|
||||
'table.textAlign' : '水平对齐',
|
||||
'table.verticalAlign' : '垂直对齐',
|
||||
'table.alignDefault' : '默认',
|
||||
'table.alignLeft' : '左对齐',
|
||||
'table.alignCenter' : '居中',
|
||||
'table.alignRight' : '右对齐',
|
||||
'table.alignTop' : '顶部',
|
||||
'table.alignMiddle' : '中部',
|
||||
'table.alignBottom' : '底部',
|
||||
'table.alignBaseline' : '基线',
|
||||
'table.border' : '边框',
|
||||
'table.borderWidth' : '边框',
|
||||
'table.borderColor' : '颜色',
|
||||
'table.backgroundColor' : '背景颜色',
|
||||
'map.address' : '地址: ',
|
||||
'map.search' : '搜索',
|
||||
'baidumap.address' : '地址: ',
|
||||
'baidumap.search' : '搜索',
|
||||
'baidumap.insertDynamicMap' : '插入动态地图',
|
||||
'anchor.name' : '锚点名称',
|
||||
'formatblock.formatBlock' : {
|
||||
h1 : '标题 1',
|
||||
h2 : '标题 2',
|
||||
h3 : '标题 3',
|
||||
h4 : '标题 4',
|
||||
p : '正 文'
|
||||
},
|
||||
'fontname.fontName' : {
|
||||
'SimSun' : '宋体',
|
||||
'NSimSun' : '新宋体',
|
||||
'FangSong_GB2312' : '仿宋_GB2312',
|
||||
'KaiTi_GB2312' : '楷体_GB2312',
|
||||
'SimHei' : '黑体',
|
||||
'Microsoft YaHei' : '微软雅黑',
|
||||
'Arial' : 'Arial',
|
||||
'Arial Black' : 'Arial Black',
|
||||
'Times New Roman' : 'Times New Roman',
|
||||
'Courier New' : 'Courier New',
|
||||
'Tahoma' : 'Tahoma',
|
||||
'Verdana' : 'Verdana'
|
||||
},
|
||||
'lineheight.lineHeight' : [
|
||||
{'1' : '单倍行距'},
|
||||
{'1.5' : '1.5倍行距'},
|
||||
{'2' : '2倍行距'},
|
||||
{'2.5' : '2.5倍行距'},
|
||||
{'3' : '3倍行距'}
|
||||
],
|
||||
'template.selectTemplate' : '可选模板',
|
||||
'template.replaceContent' : '替换当前内容',
|
||||
'template.fileList' : {
|
||||
'1.html' : '图片和文字',
|
||||
'2.html' : '表格',
|
||||
'3.html' : '项目编号'
|
||||
}
|
||||
}, 'zh-CN');
|
||||
|
||||
KindEditor.options.langType = 'zh-CN';
|
243
static/plugins/kindeditor/lang/zh-TW.js
Executable file
@ -0,0 +1,243 @@
|
||||
/*******************************************************************************
|
||||
* KindEditor - WYSIWYG HTML Editor for Internet
|
||||
* Copyright (C) 2006-2011 kindsoft.net
|
||||
*
|
||||
* @author Roddy <luolonghao@gmail.com>
|
||||
* @site http://www.kindsoft.net/
|
||||
* @licence http://www.kindsoft.net/license.php
|
||||
*******************************************************************************/
|
||||
|
||||
KindEditor.lang({
|
||||
source : '原始碼',
|
||||
preview : '預覽',
|
||||
undo : '復原(Ctrl+Z)',
|
||||
redo : '重複(Ctrl+Y)',
|
||||
cut : '剪下(Ctrl+X)',
|
||||
copy : '複製(Ctrl+C)',
|
||||
paste : '貼上(Ctrl+V)',
|
||||
plainpaste : '貼為純文字格式',
|
||||
wordpaste : '自Word貼上',
|
||||
selectall : '全選(Ctrl+A)',
|
||||
justifyleft : '靠左對齊',
|
||||
justifycenter : '置中',
|
||||
justifyright : '靠右對齊',
|
||||
justifyfull : '左右對齊',
|
||||
insertorderedlist : '編號清單',
|
||||
insertunorderedlist : '項目清單',
|
||||
indent : '增加縮排',
|
||||
outdent : '減少縮排',
|
||||
subscript : '下標',
|
||||
superscript : '上標',
|
||||
formatblock : '標題',
|
||||
fontname : '字體',
|
||||
fontsize : '文字大小',
|
||||
forecolor : '文字顏色',
|
||||
hilitecolor : '背景顏色',
|
||||
bold : '粗體(Ctrl+B)',
|
||||
italic : '斜體(Ctrl+I)',
|
||||
underline : '底線(Ctrl+U)',
|
||||
strikethrough : '刪除線',
|
||||
removeformat : '清除格式',
|
||||
image : '影像',
|
||||
multiimage : '批量影像上傳',
|
||||
flash : 'Flash',
|
||||
media : '多媒體',
|
||||
table : '表格',
|
||||
tablecell : '儲存格',
|
||||
hr : '插入水平線',
|
||||
emoticons : '插入表情',
|
||||
link : '超連結',
|
||||
unlink : '移除超連結',
|
||||
fullscreen : '最大化',
|
||||
about : '關於',
|
||||
print : '列印(Ctrl+P)',
|
||||
filemanager : '瀏覽伺服器',
|
||||
code : '插入程式代碼',
|
||||
map : 'Google地圖',
|
||||
baidumap : 'Baidu地圖',
|
||||
lineheight : '行距',
|
||||
clearhtml : '清理HTML代碼',
|
||||
pagebreak : '插入分頁符號',
|
||||
quickformat : '快速排版',
|
||||
insertfile : '插入文件',
|
||||
template : '插入樣板',
|
||||
anchor : '錨點',
|
||||
yes : '確定',
|
||||
no : '取消',
|
||||
close : '關閉',
|
||||
editImage : '影像屬性',
|
||||
deleteImage : '刪除影像',
|
||||
editFlash : 'Flash屬性',
|
||||
deleteFlash : '删除Flash',
|
||||
editMedia : '多媒體屬性',
|
||||
deleteMedia : '删除多媒體',
|
||||
editLink : '超連結屬性',
|
||||
deleteLink : '移除超連結',
|
||||
editAnchor : '锚点属性',
|
||||
deleteAnchor : '删除锚点',
|
||||
tableprop : '表格屬性',
|
||||
tablecellprop : '儲存格屬性',
|
||||
tableinsert : '插入表格',
|
||||
tabledelete : '刪除表格',
|
||||
tablecolinsertleft : '向左插入列',
|
||||
tablecolinsertright : '向右插入列',
|
||||
tablerowinsertabove : '向上插入欄',
|
||||
tablerowinsertbelow : '下方插入欄',
|
||||
tablerowmerge : '向下合併單元格',
|
||||
tablecolmerge : '向右合併單元格',
|
||||
tablerowsplit : '分割欄',
|
||||
tablecolsplit : '分割列',
|
||||
tablecoldelete : '删除列',
|
||||
tablerowdelete : '删除欄',
|
||||
noColor : '自動',
|
||||
pleaseSelectFile : '請選擇文件。',
|
||||
invalidImg : "請輸入有效的URL。\n只允許jpg,gif,bmp,png格式。",
|
||||
invalidMedia : "請輸入有效的URL。\n只允許swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb格式。",
|
||||
invalidWidth : "寬度必須是數字。",
|
||||
invalidHeight : "高度必須是數字。",
|
||||
invalidBorder : "邊框必須是數字。",
|
||||
invalidUrl : "請輸入有效的URL。",
|
||||
invalidRows : '欄數是必須輸入項目,只允許輸入大於0的數字。',
|
||||
invalidCols : '列數是必須輸入項目,只允許輸入大於0的數字。',
|
||||
invalidPadding : '內距必須是數字。',
|
||||
invalidSpacing : '間距必須是數字。',
|
||||
invalidJson : '伺服器發生故障。',
|
||||
uploadSuccess : '上傳成功。',
|
||||
cutError : '您的瀏覽器安全設置不允許使用剪下操作,請使用快捷鍵(Ctrl+X)完成。',
|
||||
copyError : '您的瀏覽器安全設置不允許使用剪下操作,請使用快捷鍵(Ctrl+C)完成。',
|
||||
pasteError : '您的瀏覽器安全設置不允許使用剪下操作,請使用快捷鍵(Ctrl+V)完成。',
|
||||
ajaxLoading : '加載中,請稍候 ...',
|
||||
uploadLoading : '上傳中,請稍候 ...',
|
||||
uploadError : '上傳錯誤',
|
||||
'plainpaste.comment' : '請使用快捷鍵(Ctrl+V)把內容貼到下方區域裡。',
|
||||
'wordpaste.comment' : '請使用快捷鍵(Ctrl+V)把內容貼到下方區域裡。',
|
||||
'code.pleaseInput' : 'Please input code.',
|
||||
'link.url' : 'URL',
|
||||
'link.linkType' : '打開類型',
|
||||
'link.newWindow' : '新窗口',
|
||||
'link.selfWindow' : '本頁窗口',
|
||||
'flash.url' : 'URL',
|
||||
'flash.width' : '寬度',
|
||||
'flash.height' : '高度',
|
||||
'flash.upload' : '上傳',
|
||||
'flash.viewServer' : '瀏覽',
|
||||
'media.url' : 'URL',
|
||||
'media.width' : '寬度',
|
||||
'media.height' : '高度',
|
||||
'media.autostart' : '自動播放',
|
||||
'media.upload' : '上傳',
|
||||
'media.viewServer' : '瀏覽',
|
||||
'image.remoteImage' : '網絡影像',
|
||||
'image.localImage' : '上傳影像',
|
||||
'image.remoteUrl' : '影像URL',
|
||||
'image.localUrl' : '影像URL',
|
||||
'image.size' : '影像大小',
|
||||
'image.width' : '寬度',
|
||||
'image.height' : '高度',
|
||||
'image.resetSize' : '原始大小',
|
||||
'image.align' : '對齊方式',
|
||||
'image.defaultAlign' : '未設定',
|
||||
'image.leftAlign' : '向左對齊',
|
||||
'image.rightAlign' : '向右對齊',
|
||||
'image.imgTitle' : '影像說明',
|
||||
'image.upload' : '瀏覽...',
|
||||
'image.viewServer' : '瀏覽...',
|
||||
'multiimage.uploadDesc' : 'Allows users to upload <%=uploadLimit%> images, single image size not exceeding <%=sizeLimit%>',
|
||||
'multiimage.startUpload' : 'Start upload',
|
||||
'multiimage.clearAll' : 'Clear all',
|
||||
'multiimage.insertAll' : 'Insert all',
|
||||
'multiimage.queueLimitExceeded' : 'Queue limit exceeded.',
|
||||
'multiimage.fileExceedsSizeLimit' : 'File exceeds size limit.',
|
||||
'multiimage.zeroByteFile' : 'Zero byte file.',
|
||||
'multiimage.invalidFiletype' : 'Invalid file type.',
|
||||
'multiimage.unknownError' : 'Unknown upload error.',
|
||||
'multiimage.pending' : 'Pending ...',
|
||||
'multiimage.uploadError' : 'Upload error',
|
||||
'filemanager.emptyFolder' : '空文件夾',
|
||||
'filemanager.moveup' : '至上一級文件夾',
|
||||
'filemanager.viewType' : '顯示方式:',
|
||||
'filemanager.viewImage' : '縮略圖',
|
||||
'filemanager.listImage' : '詳細信息',
|
||||
'filemanager.orderType' : '排序方式:',
|
||||
'filemanager.fileName' : '名稱',
|
||||
'filemanager.fileSize' : '大小',
|
||||
'filemanager.fileType' : '類型',
|
||||
'insertfile.url' : 'URL',
|
||||
'insertfile.title' : '文件說明',
|
||||
'insertfile.upload' : '上傳',
|
||||
'insertfile.viewServer' : '瀏覽',
|
||||
'table.cells' : '儲存格數',
|
||||
'table.rows' : '欄數',
|
||||
'table.cols' : '列數',
|
||||
'table.size' : '表格大小',
|
||||
'table.width' : '寬度',
|
||||
'table.height' : '高度',
|
||||
'table.percent' : '%',
|
||||
'table.px' : 'px',
|
||||
'table.space' : '內距間距',
|
||||
'table.padding' : '內距',
|
||||
'table.spacing' : '間距',
|
||||
'table.align' : '對齊方式',
|
||||
'table.textAlign' : '水平對齊',
|
||||
'table.verticalAlign' : '垂直對齊',
|
||||
'table.alignDefault' : '未設定',
|
||||
'table.alignLeft' : '向左對齊',
|
||||
'table.alignCenter' : '置中',
|
||||
'table.alignRight' : '向右對齊',
|
||||
'table.alignTop' : '靠上',
|
||||
'table.alignMiddle' : '置中',
|
||||
'table.alignBottom' : '靠下',
|
||||
'table.alignBaseline' : '基線',
|
||||
'table.border' : '表格邊框',
|
||||
'table.borderWidth' : '邊框',
|
||||
'table.borderColor' : '顏色',
|
||||
'table.backgroundColor' : '背景顏色',
|
||||
'map.address' : '住所: ',
|
||||
'map.search' : '尋找',
|
||||
'baidumap.address' : '住所: ',
|
||||
'baidumap.search' : '尋找',
|
||||
'baidumap.insertDynamicMap' : '插入動態地圖',
|
||||
'anchor.name' : '錨點名稱',
|
||||
'formatblock.formatBlock' : {
|
||||
h1 : '標題 1',
|
||||
h2 : '標題 2',
|
||||
h3 : '標題 3',
|
||||
h4 : '標題 4',
|
||||
p : '一般'
|
||||
},
|
||||
'fontname.fontName' : {
|
||||
'MingLiU' : '細明體',
|
||||
'PMingLiU' : '新細明體',
|
||||
'DFKai-SB' : '標楷體',
|
||||
'SimSun' : '宋體',
|
||||
'NSimSun' : '新宋體',
|
||||
'FangSong' : '仿宋體',
|
||||
'Arial' : 'Arial',
|
||||
'Arial Black' : 'Arial Black',
|
||||
'Times New Roman' : 'Times New Roman',
|
||||
'Courier New' : 'Courier New',
|
||||
'Tahoma' : 'Tahoma',
|
||||
'Verdana' : 'Verdana'
|
||||
},
|
||||
'lineheight.lineHeight' : [
|
||||
{'1' : '单倍行距'},
|
||||
{'1.5' : '1.5倍行距'},
|
||||
{'2' : '2倍行距'},
|
||||
{'2.5' : '2.5倍行距'},
|
||||
{'3' : '3倍行距'}
|
||||
],
|
||||
'template.selectTemplate' : '可選樣板',
|
||||
'template.replaceContent' : '取代當前內容',
|
||||
'template.fileList' : {
|
||||
'1.html' : '影像和文字',
|
||||
'2.html' : '表格',
|
||||
'3.html' : '项目清單'
|
||||
}
|
||||
}, 'zh-TW');
|
||||
|
||||
KindEditor.each(KindEditor.options.items, function(i, name) {
|
||||
if (name == 'baidumap') {
|
||||
KindEditor.options.items[i] = 'map';
|
||||
}
|
||||
});
|
||||
KindEditor.options.langType = 'zh-TW';
|
502
static/plugins/kindeditor/license.txt
Executable file
@ -0,0 +1,502 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
806
static/plugins/kindeditor/php/JSON.php
Executable file
@ -0,0 +1,806 @@
|
||||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
|
||||
|
||||
/**
|
||||
* Converts to and from JSON format.
|
||||
*
|
||||
* JSON (JavaScript Object Notation) is a lightweight data-interchange
|
||||
* format. It is easy for humans to read and write. It is easy for machines
|
||||
* to parse and generate. It is based on a subset of the JavaScript
|
||||
* Programming Language, Standard ECMA-262 3rd Edition - December 1999.
|
||||
* This feature can also be found in Python. JSON is a text format that is
|
||||
* completely language independent but uses conventions that are familiar
|
||||
* to programmers of the C-family of languages, including C, C++, C#, Java,
|
||||
* JavaScript, Perl, TCL, and many others. These properties make JSON an
|
||||
* ideal data-interchange language.
|
||||
*
|
||||
* This package provides a simple encoder and decoder for JSON notation. It
|
||||
* is intended for use with client-side Javascript applications that make
|
||||
* use of HTTPRequest to perform server communication functions - data can
|
||||
* be encoded into JSON notation for use in a client-side javascript, or
|
||||
* decoded from incoming Javascript requests. JSON format is native to
|
||||
* Javascript, and can be directly eval()'ed with no further parsing
|
||||
* overhead
|
||||
*
|
||||
* All strings should be in ASCII or UTF-8 format!
|
||||
*
|
||||
* LICENSE: Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the following
|
||||
* conditions are met: Redistributions of source code must retain the
|
||||
* above copyright notice, this list of conditions and the following
|
||||
* disclaimer. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following disclaimer
|
||||
* in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*
|
||||
* @category
|
||||
* @package Services_JSON
|
||||
* @author Michal Migurski <mike-json@teczno.com>
|
||||
* @author Matt Knapp <mdknapp[at]gmail[dot]com>
|
||||
* @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
|
||||
* @copyright 2005 Michal Migurski
|
||||
* @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php
|
||||
* @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
|
||||
*/
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_SLICE', 1);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_STR', 2);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_ARR', 3);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_OBJ', 4);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_CMT', 5);
|
||||
|
||||
/**
|
||||
* Behavior switch for Services_JSON::decode()
|
||||
*/
|
||||
define('SERVICES_JSON_LOOSE_TYPE', 16);
|
||||
|
||||
/**
|
||||
* Behavior switch for Services_JSON::decode()
|
||||
*/
|
||||
define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
|
||||
|
||||
/**
|
||||
* Converts to and from JSON format.
|
||||
*
|
||||
* Brief example of use:
|
||||
*
|
||||
* <code>
|
||||
* // create a new instance of Services_JSON
|
||||
* $json = new Services_JSON();
|
||||
*
|
||||
* // convert a complexe value to JSON notation, and send it to the browser
|
||||
* $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
|
||||
* $output = $json->encode($value);
|
||||
*
|
||||
* print($output);
|
||||
* // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
|
||||
*
|
||||
* // accept incoming POST data, assumed to be in JSON notation
|
||||
* $input = file_get_contents('php://input', 1000000);
|
||||
* $value = $json->decode($input);
|
||||
* </code>
|
||||
*/
|
||||
class Services_JSON
|
||||
{
|
||||
/**
|
||||
* constructs a new JSON instance
|
||||
*
|
||||
* @param int $use object behavior flags; combine with boolean-OR
|
||||
*
|
||||
* possible values:
|
||||
* - SERVICES_JSON_LOOSE_TYPE: loose typing.
|
||||
* "{...}" syntax creates associative arrays
|
||||
* instead of objects in decode().
|
||||
* - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
|
||||
* Values which can't be encoded (e.g. resources)
|
||||
* appear as NULL instead of throwing errors.
|
||||
* By default, a deeply-nested resource will
|
||||
* bubble up with an error, so all return values
|
||||
* from encode() should be checked with isError()
|
||||
*/
|
||||
function Services_JSON($use = 0)
|
||||
{
|
||||
$this->use = $use;
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a string from one UTF-16 char to one UTF-8 char
|
||||
*
|
||||
* Normally should be handled by mb_convert_encoding, but
|
||||
* provides a slower PHP-only method for installations
|
||||
* that lack the multibye string extension.
|
||||
*
|
||||
* @param string $utf16 UTF-16 character
|
||||
* @return string UTF-8 character
|
||||
* @access private
|
||||
*/
|
||||
function utf162utf8($utf16)
|
||||
{
|
||||
// oh please oh please oh please oh please oh please
|
||||
if(function_exists('mb_convert_encoding')) {
|
||||
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
|
||||
}
|
||||
|
||||
$bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
|
||||
|
||||
switch(true) {
|
||||
case ((0x7F & $bytes) == $bytes):
|
||||
// this case should never be reached, because we are in ASCII range
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0x7F & $bytes);
|
||||
|
||||
case (0x07FF & $bytes) == $bytes:
|
||||
// return a 2-byte UTF-8 character
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0xC0 | (($bytes >> 6) & 0x1F))
|
||||
. chr(0x80 | ($bytes & 0x3F));
|
||||
|
||||
case (0xFFFF & $bytes) == $bytes:
|
||||
// return a 3-byte UTF-8 character
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0xE0 | (($bytes >> 12) & 0x0F))
|
||||
. chr(0x80 | (($bytes >> 6) & 0x3F))
|
||||
. chr(0x80 | ($bytes & 0x3F));
|
||||
}
|
||||
|
||||
// ignoring UTF-32 for now, sorry
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a string from one UTF-8 char to one UTF-16 char
|
||||
*
|
||||
* Normally should be handled by mb_convert_encoding, but
|
||||
* provides a slower PHP-only method for installations
|
||||
* that lack the multibye string extension.
|
||||
*
|
||||
* @param string $utf8 UTF-8 character
|
||||
* @return string UTF-16 character
|
||||
* @access private
|
||||
*/
|
||||
function utf82utf16($utf8)
|
||||
{
|
||||
// oh please oh please oh please oh please oh please
|
||||
if(function_exists('mb_convert_encoding')) {
|
||||
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
|
||||
}
|
||||
|
||||
switch(strlen($utf8)) {
|
||||
case 1:
|
||||
// this case should never be reached, because we are in ASCII range
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return $utf8;
|
||||
|
||||
case 2:
|
||||
// return a UTF-16 character from a 2-byte UTF-8 char
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0x07 & (ord($utf8{0}) >> 2))
|
||||
. chr((0xC0 & (ord($utf8{0}) << 6))
|
||||
| (0x3F & ord($utf8{1})));
|
||||
|
||||
case 3:
|
||||
// return a UTF-16 character from a 3-byte UTF-8 char
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr((0xF0 & (ord($utf8{0}) << 4))
|
||||
| (0x0F & (ord($utf8{1}) >> 2)))
|
||||
. chr((0xC0 & (ord($utf8{1}) << 6))
|
||||
| (0x7F & ord($utf8{2})));
|
||||
}
|
||||
|
||||
// ignoring UTF-32 for now, sorry
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* encodes an arbitrary variable into JSON format
|
||||
*
|
||||
* @param mixed $var any number, boolean, string, array, or object to be encoded.
|
||||
* see argument 1 to Services_JSON() above for array-parsing behavior.
|
||||
* if var is a strng, note that encode() always expects it
|
||||
* to be in ASCII or UTF-8 format!
|
||||
*
|
||||
* @return mixed JSON string representation of input var or an error if a problem occurs
|
||||
* @access public
|
||||
*/
|
||||
function encode($var)
|
||||
{
|
||||
switch (gettype($var)) {
|
||||
case 'boolean':
|
||||
return $var ? 'true' : 'false';
|
||||
|
||||
case 'NULL':
|
||||
return 'null';
|
||||
|
||||
case 'integer':
|
||||
return (int) $var;
|
||||
|
||||
case 'double':
|
||||
case 'float':
|
||||
return (float) $var;
|
||||
|
||||
case 'string':
|
||||
// STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
|
||||
$ascii = '';
|
||||
$strlen_var = strlen($var);
|
||||
|
||||
/*
|
||||
* Iterate over every character in the string,
|
||||
* escaping with a slash or encoding to UTF-8 where necessary
|
||||
*/
|
||||
for ($c = 0; $c < $strlen_var; ++$c) {
|
||||
|
||||
$ord_var_c = ord($var{$c});
|
||||
|
||||
switch (true) {
|
||||
case $ord_var_c == 0x08:
|
||||
$ascii .= '\b';
|
||||
break;
|
||||
case $ord_var_c == 0x09:
|
||||
$ascii .= '\t';
|
||||
break;
|
||||
case $ord_var_c == 0x0A:
|
||||
$ascii .= '\n';
|
||||
break;
|
||||
case $ord_var_c == 0x0C:
|
||||
$ascii .= '\f';
|
||||
break;
|
||||
case $ord_var_c == 0x0D:
|
||||
$ascii .= '\r';
|
||||
break;
|
||||
|
||||
case $ord_var_c == 0x22:
|
||||
case $ord_var_c == 0x2F:
|
||||
case $ord_var_c == 0x5C:
|
||||
// double quote, slash, slosh
|
||||
$ascii .= '\\'.$var{$c};
|
||||
break;
|
||||
|
||||
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
|
||||
// characters U-00000000 - U-0000007F (same as ASCII)
|
||||
$ascii .= $var{$c};
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xE0) == 0xC0):
|
||||
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c, ord($var{$c + 1}));
|
||||
$c += 1;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xF0) == 0xE0):
|
||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}));
|
||||
$c += 2;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xF8) == 0xF0):
|
||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}));
|
||||
$c += 3;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xFC) == 0xF8):
|
||||
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}),
|
||||
ord($var{$c + 4}));
|
||||
$c += 4;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xFE) == 0xFC):
|
||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}),
|
||||
ord($var{$c + 4}),
|
||||
ord($var{$c + 5}));
|
||||
$c += 5;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return '"'.$ascii.'"';
|
||||
|
||||
case 'array':
|
||||
/*
|
||||
* As per JSON spec if any array key is not an integer
|
||||
* we must treat the the whole array as an object. We
|
||||
* also try to catch a sparsely populated associative
|
||||
* array with numeric keys here because some JS engines
|
||||
* will create an array with empty indexes up to
|
||||
* max_index which can cause memory issues and because
|
||||
* the keys, which may be relevant, will be remapped
|
||||
* otherwise.
|
||||
*
|
||||
* As per the ECMA and JSON specification an object may
|
||||
* have any string as a property. Unfortunately due to
|
||||
* a hole in the ECMA specification if the key is a
|
||||
* ECMA reserved word or starts with a digit the
|
||||
* parameter is only accessible using ECMAScript's
|
||||
* bracket notation.
|
||||
*/
|
||||
|
||||
// treat as a JSON object
|
||||
if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
|
||||
$properties = array_map(array($this, 'name_value'),
|
||||
array_keys($var),
|
||||
array_values($var));
|
||||
|
||||
foreach($properties as $property) {
|
||||
if(Services_JSON::isError($property)) {
|
||||
return $property;
|
||||
}
|
||||
}
|
||||
|
||||
return '{' . join(',', $properties) . '}';
|
||||
}
|
||||
|
||||
// treat it like a regular array
|
||||
$elements = array_map(array($this, 'encode'), $var);
|
||||
|
||||
foreach($elements as $element) {
|
||||
if(Services_JSON::isError($element)) {
|
||||
return $element;
|
||||
}
|
||||
}
|
||||
|
||||
return '[' . join(',', $elements) . ']';
|
||||
|
||||
case 'object':
|
||||
$vars = get_object_vars($var);
|
||||
|
||||
$properties = array_map(array($this, 'name_value'),
|
||||
array_keys($vars),
|
||||
array_values($vars));
|
||||
|
||||
foreach($properties as $property) {
|
||||
if(Services_JSON::isError($property)) {
|
||||
return $property;
|
||||
}
|
||||
}
|
||||
|
||||
return '{' . join(',', $properties) . '}';
|
||||
|
||||
default:
|
||||
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
|
||||
? 'null'
|
||||
: new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* array-walking function for use in generating JSON-formatted name-value pairs
|
||||
*
|
||||
* @param string $name name of key to use
|
||||
* @param mixed $value reference to an array element to be encoded
|
||||
*
|
||||
* @return string JSON-formatted name-value pair, like '"name":value'
|
||||
* @access private
|
||||
*/
|
||||
function name_value($name, $value)
|
||||
{
|
||||
$encoded_value = $this->encode($value);
|
||||
|
||||
if(Services_JSON::isError($encoded_value)) {
|
||||
return $encoded_value;
|
||||
}
|
||||
|
||||
return $this->encode(strval($name)) . ':' . $encoded_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* reduce a string by removing leading and trailing comments and whitespace
|
||||
*
|
||||
* @param $str string string value to strip of comments and whitespace
|
||||
*
|
||||
* @return string string value stripped of comments and whitespace
|
||||
* @access private
|
||||
*/
|
||||
function reduce_string($str)
|
||||
{
|
||||
$str = preg_replace(array(
|
||||
|
||||
// eliminate single line comments in '// ...' form
|
||||
'#^\s*//(.+)$#m',
|
||||
|
||||
// eliminate multi-line comments in '/* ... */' form, at start of string
|
||||
'#^\s*/\*(.+)\*/#Us',
|
||||
|
||||
// eliminate multi-line comments in '/* ... */' form, at end of string
|
||||
'#/\*(.+)\*/\s*$#Us'
|
||||
|
||||
), '', $str);
|
||||
|
||||
// eliminate extraneous space
|
||||
return trim($str);
|
||||
}
|
||||
|
||||
/**
|
||||
* decodes a JSON string into appropriate variable
|
||||
*
|
||||
* @param string $str JSON-formatted string
|
||||
*
|
||||
* @return mixed number, boolean, string, array, or object
|
||||
* corresponding to given JSON input string.
|
||||
* See argument 1 to Services_JSON() above for object-output behavior.
|
||||
* Note that decode() always returns strings
|
||||
* in ASCII or UTF-8 format!
|
||||
* @access public
|
||||
*/
|
||||
function decode($str)
|
||||
{
|
||||
$str = $this->reduce_string($str);
|
||||
|
||||
switch (strtolower($str)) {
|
||||
case 'true':
|
||||
return true;
|
||||
|
||||
case 'false':
|
||||
return false;
|
||||
|
||||
case 'null':
|
||||
return null;
|
||||
|
||||
default:
|
||||
$m = array();
|
||||
|
||||
if (is_numeric($str)) {
|
||||
// Lookie-loo, it's a number
|
||||
|
||||
// This would work on its own, but I'm trying to be
|
||||
// good about returning integers where appropriate:
|
||||
// return (float)$str;
|
||||
|
||||
// Return float or int, as appropriate
|
||||
return ((float)$str == (integer)$str)
|
||||
? (integer)$str
|
||||
: (float)$str;
|
||||
|
||||
} elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
|
||||
// STRINGS RETURNED IN UTF-8 FORMAT
|
||||
$delim = substr($str, 0, 1);
|
||||
$chrs = substr($str, 1, -1);
|
||||
$utf8 = '';
|
||||
$strlen_chrs = strlen($chrs);
|
||||
|
||||
for ($c = 0; $c < $strlen_chrs; ++$c) {
|
||||
|
||||
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
||||
$ord_chrs_c = ord($chrs{$c});
|
||||
|
||||
switch (true) {
|
||||
case $substr_chrs_c_2 == '\b':
|
||||
$utf8 .= chr(0x08);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\t':
|
||||
$utf8 .= chr(0x09);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\n':
|
||||
$utf8 .= chr(0x0A);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\f':
|
||||
$utf8 .= chr(0x0C);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\r':
|
||||
$utf8 .= chr(0x0D);
|
||||
++$c;
|
||||
break;
|
||||
|
||||
case $substr_chrs_c_2 == '\\"':
|
||||
case $substr_chrs_c_2 == '\\\'':
|
||||
case $substr_chrs_c_2 == '\\\\':
|
||||
case $substr_chrs_c_2 == '\\/':
|
||||
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
|
||||
($delim == "'" && $substr_chrs_c_2 != '\\"')) {
|
||||
$utf8 .= $chrs{++$c};
|
||||
}
|
||||
break;
|
||||
|
||||
case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
|
||||
// single, escaped unicode character
|
||||
$utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
|
||||
. chr(hexdec(substr($chrs, ($c + 4), 2)));
|
||||
$utf8 .= $this->utf162utf8($utf16);
|
||||
$c += 5;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
|
||||
$utf8 .= $chrs{$c};
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xE0) == 0xC0:
|
||||
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
||||
//see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 2);
|
||||
++$c;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xF0) == 0xE0:
|
||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 3);
|
||||
$c += 2;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xF8) == 0xF0:
|
||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 4);
|
||||
$c += 3;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xFC) == 0xF8:
|
||||
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 5);
|
||||
$c += 4;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xFE) == 0xFC:
|
||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 6);
|
||||
$c += 5;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $utf8;
|
||||
|
||||
} elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
|
||||
// array, or object notation
|
||||
|
||||
if ($str{0} == '[') {
|
||||
$stk = array(SERVICES_JSON_IN_ARR);
|
||||
$arr = array();
|
||||
} else {
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$stk = array(SERVICES_JSON_IN_OBJ);
|
||||
$obj = array();
|
||||
} else {
|
||||
$stk = array(SERVICES_JSON_IN_OBJ);
|
||||
$obj = new stdClass();
|
||||
}
|
||||
}
|
||||
|
||||
array_push($stk, array('what' => SERVICES_JSON_SLICE,
|
||||
'where' => 0,
|
||||
'delim' => false));
|
||||
|
||||
$chrs = substr($str, 1, -1);
|
||||
$chrs = $this->reduce_string($chrs);
|
||||
|
||||
if ($chrs == '') {
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
return $arr;
|
||||
|
||||
} else {
|
||||
return $obj;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//print("\nparsing {$chrs}\n");
|
||||
|
||||
$strlen_chrs = strlen($chrs);
|
||||
|
||||
for ($c = 0; $c <= $strlen_chrs; ++$c) {
|
||||
|
||||
$top = end($stk);
|
||||
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
||||
|
||||
if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
|
||||
// found a comma that is not inside a string, array, etc.,
|
||||
// OR we've reached the end of the character list
|
||||
$slice = substr($chrs, $top['where'], ($c - $top['where']));
|
||||
array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
|
||||
//print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
// we are in an array, so just push an element onto the stack
|
||||
array_push($arr, $this->decode($slice));
|
||||
|
||||
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
|
||||
// we are in an object, so figure
|
||||
// out the property name and set an
|
||||
// element in an associative array,
|
||||
// for now
|
||||
$parts = array();
|
||||
|
||||
if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
|
||||
// "name":value pair
|
||||
$key = $this->decode($parts[1]);
|
||||
$val = $this->decode($parts[2]);
|
||||
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$obj[$key] = $val;
|
||||
} else {
|
||||
$obj->$key = $val;
|
||||
}
|
||||
} elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
|
||||
// name:value pair, where name is unquoted
|
||||
$key = $parts[1];
|
||||
$val = $this->decode($parts[2]);
|
||||
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$obj[$key] = $val;
|
||||
} else {
|
||||
$obj->$key = $val;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
|
||||
// found a quote, and we are not inside a string
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
|
||||
//print("Found start of string at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == $top['delim']) &&
|
||||
($top['what'] == SERVICES_JSON_IN_STR) &&
|
||||
((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
|
||||
// found a quote, we're in a string, and it's not escaped
|
||||
// we know that it's not escaped becase there is _not_ an
|
||||
// odd number of backslashes at the end of the string so far
|
||||
array_pop($stk);
|
||||
//print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($chrs{$c} == '[') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a left-bracket, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
|
||||
//print("Found start of array at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
|
||||
// found a right-bracket, and we're in an array
|
||||
array_pop($stk);
|
||||
//print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($chrs{$c} == '{') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a left-brace, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
|
||||
//print("Found start of object at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
|
||||
// found a right-brace, and we're in an object
|
||||
array_pop($stk);
|
||||
//print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($substr_chrs_c_2 == '/*') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a comment start, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
|
||||
$c++;
|
||||
//print("Found start of comment at {$c}\n");
|
||||
|
||||
} elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
|
||||
// found a comment end, and we're in one now
|
||||
array_pop($stk);
|
||||
$c++;
|
||||
|
||||
for ($i = $top['where']; $i <= $c; ++$i)
|
||||
$chrs = substr_replace($chrs, ' ', $i, 1);
|
||||
|
||||
//print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
return $arr;
|
||||
|
||||
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
|
||||
return $obj;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Ultimately, this should just call PEAR::isError()
|
||||
*/
|
||||
function isError($data, $code = null)
|
||||
{
|
||||
if (class_exists('pear')) {
|
||||
return PEAR::isError($data, $code);
|
||||
} elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
|
||||
is_subclass_of($data, 'services_json_error'))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (class_exists('PEAR_Error')) {
|
||||
|
||||
class Services_JSON_Error extends PEAR_Error
|
||||
{
|
||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
||||
$mode = null, $options = null, $userinfo = null)
|
||||
{
|
||||
parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
/**
|
||||
* @todo Ultimately, this class shall be descended from PEAR_Error
|
||||
*/
|
||||
class Services_JSON_Error
|
||||
{
|
||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
||||
$mode = null, $options = null, $userinfo = null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
137
static/plugins/kindeditor/php/file_manager_json.php
Executable file
@ -0,0 +1,137 @@
|
||||
<?php
|
||||
/**
|
||||
* KindEditor PHP
|
||||
*
|
||||
* 本PHP程序是演示程序,建议不要直接在实际项目中使用。
|
||||
* 如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。
|
||||
*
|
||||
*/
|
||||
|
||||
require_once 'JSON.php';
|
||||
|
||||
$php_path = dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/';
|
||||
$php_url = dirname(dirname(dirname(dirname(dirname($_SERVER['PHP_SELF']))))) . '/';
|
||||
|
||||
//根目录路径,可以指定绝对路径,比如 /var/www/attached/
|
||||
$root_path = $php_path . 'upload/';
|
||||
//根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/
|
||||
$root_url = $php_url . 'upload/';
|
||||
//图片扩展名
|
||||
$ext_arr = array('gif', 'jpg', 'jpeg', 'png', 'bmp');
|
||||
|
||||
//目录名
|
||||
$dir_name = empty($_GET['dir']) ? '' : trim($_GET['dir']);
|
||||
if (!in_array($dir_name, array('image', 'flash', 'media', 'file'))) {
|
||||
echo "Invalid Directory name.";
|
||||
exit;
|
||||
}
|
||||
if ($dir_name !== '') {
|
||||
$root_path .= $dir_name . "/";
|
||||
$root_url .= $dir_name . "/";
|
||||
if (!file_exists($root_path)) {
|
||||
mkdir($root_path);
|
||||
}
|
||||
}
|
||||
|
||||
//根据path参数,设置各路径和URL
|
||||
if (empty($_GET['path'])) {
|
||||
$current_path = realpath($root_path) . '/';
|
||||
$current_url = $root_url;
|
||||
$current_dir_path = '';
|
||||
$moveup_dir_path = '';
|
||||
} else {
|
||||
$current_path = realpath($root_path) . '/' . $_GET['path'];
|
||||
$current_url = $root_url . $_GET['path'];
|
||||
$current_dir_path = $_GET['path'];
|
||||
$moveup_dir_path = preg_replace('/(.*?)[^\/]+\/$/', '$1', $current_dir_path);
|
||||
}
|
||||
//echo realpath($root_path);
|
||||
//排序形式,name or size or type
|
||||
$order = empty($_GET['order']) ? 'name' : strtolower($_GET['order']);
|
||||
|
||||
//不允许使用..移动到上一级目录
|
||||
if (preg_match('/\.\./', $current_path)) {
|
||||
echo 'Access is not allowed.';
|
||||
exit;
|
||||
}
|
||||
//最后一个字符不是/
|
||||
if (!preg_match('/\/$/', $current_path)) {
|
||||
echo 'Parameter is not valid.';
|
||||
exit;
|
||||
}
|
||||
//目录不存在或不是目录
|
||||
if (!file_exists($current_path) || !is_dir($current_path)) {
|
||||
echo 'Directory does not exist.';
|
||||
exit;
|
||||
}
|
||||
|
||||
//遍历目录取得文件信息
|
||||
$file_list = array();
|
||||
if ($handle = opendir($current_path)) {
|
||||
$i = 0;
|
||||
while (false !== ($filename = readdir($handle))) {
|
||||
if ($filename{0} == '.') continue;
|
||||
$file = $current_path . $filename;
|
||||
if (is_dir($file)) {
|
||||
$file_list[$i]['is_dir'] = true; //是否文件夹
|
||||
$file_list[$i]['has_file'] = (count(scandir($file)) > 2); //文件夹是否包含文件
|
||||
$file_list[$i]['filesize'] = 0; //文件大小
|
||||
$file_list[$i]['is_photo'] = false; //是否图片
|
||||
$file_list[$i]['filetype'] = ''; //文件类别,用扩展名判断
|
||||
} else {
|
||||
$file_list[$i]['is_dir'] = false;
|
||||
$file_list[$i]['has_file'] = false;
|
||||
$file_list[$i]['filesize'] = filesize($file);
|
||||
$file_list[$i]['dir_path'] = '';
|
||||
$file_ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
|
||||
$file_list[$i]['is_photo'] = in_array($file_ext, $ext_arr);
|
||||
$file_list[$i]['filetype'] = $file_ext;
|
||||
}
|
||||
$file_list[$i]['filename'] = $filename; //文件名,包含扩展名
|
||||
$file_list[$i]['datetime'] = date('Y-m-d H:i:s', filemtime($file)); //文件最后修改时间
|
||||
$i++;
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
//排序
|
||||
function cmp_func($a, $b) {
|
||||
global $order;
|
||||
if ($a['is_dir'] && !$b['is_dir']) {
|
||||
return -1;
|
||||
} else if (!$a['is_dir'] && $b['is_dir']) {
|
||||
return 1;
|
||||
} else {
|
||||
if ($order == 'size') {
|
||||
if ($a['filesize'] > $b['filesize']) {
|
||||
return 1;
|
||||
} else if ($a['filesize'] < $b['filesize']) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else if ($order == 'type') {
|
||||
return strcmp($a['filetype'], $b['filetype']);
|
||||
} else {
|
||||
return strcmp($a['filename'], $b['filename']);
|
||||
}
|
||||
}
|
||||
}
|
||||
usort($file_list, 'cmp_func');
|
||||
|
||||
$result = array();
|
||||
//相对于根目录的上一级目录
|
||||
$result['moveup_dir_path'] = $moveup_dir_path;
|
||||
//相对于根目录的当前目录
|
||||
$result['current_dir_path'] = $current_dir_path;
|
||||
//当前目录的URL
|
||||
$result['current_url'] = $current_url;
|
||||
//文件数
|
||||
$result['total_count'] = count($file_list);
|
||||
//文件列表数组
|
||||
$result['file_list'] = $file_list;
|
||||
|
||||
//输出JSON字符串
|
||||
header('Content-type: application/json; charset=UTF-8');
|
||||
$json = new Services_JSON();
|
||||
echo $json->encode($result);
|
141
static/plugins/kindeditor/php/upload_json.php
Executable file
@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/**
|
||||
* KindEditor PHP
|
||||
*
|
||||
* 本PHP程序是演示程序,建议不要直接在实际项目中使用。
|
||||
* 如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。
|
||||
*
|
||||
*/
|
||||
|
||||
require_once 'JSON.php';
|
||||
|
||||
|
||||
|
||||
$php_path = dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/';
|
||||
$php_url = '/';
|
||||
|
||||
//文件保存目录路径
|
||||
$save_path = $php_path . 'upload/';
|
||||
//文件保存目录URL
|
||||
$save_url = $php_url . 'upload/';
|
||||
//定义允许上传的文件扩展名
|
||||
$ext_arr = array(
|
||||
'image' => array('gif', 'jpg', 'jpeg', 'png', 'bmp'),
|
||||
'flash' => array('swf', 'flv'),
|
||||
'media' => array('swf', 'flv', 'mp3', 'wav', 'wma', 'wmv', 'mid', 'avi', 'mpg', 'asf', 'rm', 'rmvb'),
|
||||
'file' => array('doc', 'docx', 'xls', 'xlsx', 'ppt', 'txt', 'zip', 'rar', 'gz', 'bz2'),
|
||||
);
|
||||
//最大文件大小
|
||||
$max_size = 1000000;
|
||||
|
||||
$save_path = realpath($save_path) . '/';
|
||||
|
||||
//PHP上传失败
|
||||
if (!empty($_FILES['imgFile']['error'])) {
|
||||
switch($_FILES['imgFile']['error']){
|
||||
case '1':
|
||||
$error = '超过php.ini允许的大小。';
|
||||
break;
|
||||
case '2':
|
||||
$error = '超过表单允许的大小。';
|
||||
break;
|
||||
case '3':
|
||||
$error = '图片只有部分被上传。';
|
||||
break;
|
||||
case '4':
|
||||
$error = '请选择图片。';
|
||||
break;
|
||||
case '6':
|
||||
$error = '找不到临时目录。';
|
||||
break;
|
||||
case '7':
|
||||
$error = '写文件到硬盘出错。';
|
||||
break;
|
||||
case '8':
|
||||
$error = 'File upload stopped by extension。';
|
||||
break;
|
||||
case '999':
|
||||
default:
|
||||
$error = '未知错误。';
|
||||
}
|
||||
alert($error);
|
||||
}
|
||||
|
||||
//有上传文件时
|
||||
if (empty($_FILES) === false) {
|
||||
//原文件名
|
||||
$file_name = $_FILES['imgFile']['name'];
|
||||
//服务器上临时文件名
|
||||
$tmp_name = $_FILES['imgFile']['tmp_name'];
|
||||
//文件大小
|
||||
$file_size = $_FILES['imgFile']['size'];
|
||||
//检查文件名
|
||||
if (!$file_name) {
|
||||
alert("请选择文件。");
|
||||
}
|
||||
//检查目录
|
||||
if (@is_dir($save_path) === false) {
|
||||
alert("上传目录不存在。");
|
||||
}
|
||||
//检查目录写权限
|
||||
if (@is_writable($save_path) === false) {
|
||||
alert("上传目录没有写权限。");
|
||||
}
|
||||
//检查是否已上传
|
||||
if (@is_uploaded_file($tmp_name) === false) {
|
||||
alert("上传失败。");
|
||||
}
|
||||
//检查文件大小
|
||||
if ($file_size > $max_size) {
|
||||
alert("上传文件大小超过限制。");
|
||||
}
|
||||
//检查目录名
|
||||
$dir_name = empty($_GET['dir']) ? 'image' : trim($_GET['dir']);
|
||||
if (empty($ext_arr[$dir_name])) {
|
||||
alert("目录名不正确。");
|
||||
}
|
||||
//获得文件扩展名
|
||||
$temp_arr = explode(".", $file_name);
|
||||
$file_ext = array_pop($temp_arr);
|
||||
$file_ext = trim($file_ext);
|
||||
$file_ext = strtolower($file_ext);
|
||||
//检查扩展名
|
||||
if (in_array($file_ext, $ext_arr[$dir_name]) === false) {
|
||||
alert("上传文件扩展名是不允许的扩展名。\n只允许" . implode(",", $ext_arr[$dir_name]) . "格式。");
|
||||
}
|
||||
//创建文件夹
|
||||
if ($dir_name !== '') {
|
||||
$save_path .= $dir_name . "/";
|
||||
$save_url .= $dir_name . "/";
|
||||
if (!file_exists($save_path)) {
|
||||
mkdir($save_path);
|
||||
}
|
||||
}
|
||||
$ymd = date("Ymd");
|
||||
$save_path .= $ymd . "/";
|
||||
$save_url .= $ymd . "/";
|
||||
if (!file_exists($save_path)) {
|
||||
mkdir($save_path);
|
||||
}
|
||||
//新文件名
|
||||
$new_file_name = date("YmdHis") . '_' . rand(10000, 99999) . '.' . $file_ext;
|
||||
//移动文件
|
||||
$file_path = $save_path . $new_file_name;
|
||||
if (move_uploaded_file($tmp_name, $file_path) === false) {
|
||||
alert("上传文件失败。");
|
||||
}
|
||||
@chmod($file_path, 0644);
|
||||
$file_url = $save_url . $new_file_name;
|
||||
|
||||
header('Content-type: text/html; charset=UTF-8');
|
||||
$json = new Services_JSON();
|
||||
echo $json->encode(array('error' => 0, 'url' => $file_url));
|
||||
exit;
|
||||
}
|
||||
|
||||
function alert($msg) {
|
||||
header('Content-type: text/html; charset=UTF-8');
|
||||
$json = new Services_JSON();
|
||||
echo $json->encode(array('error' => 1, 'message' => $msg));
|
||||
exit;
|
||||
}
|
46
static/plugins/kindeditor/plugins/anchor/anchor.js
Executable file
@ -0,0 +1,46 @@
|
||||
/*******************************************************************************
|
||||
* KindEditor - WYSIWYG HTML Editor for Internet
|
||||
* Copyright (C) 2006-2011 kindsoft.net
|
||||
*
|
||||
* @author Roddy <luolonghao@gmail.com>
|
||||
* @site http://www.kindsoft.net/
|
||||
* @licence http://www.kindsoft.net/license.php
|
||||
*******************************************************************************/
|
||||
|
||||
KindEditor.plugin('anchor', function(K) {
|
||||
var self = this, name = 'anchor', lang = self.lang(name + '.');
|
||||
self.plugin.anchor = {
|
||||
edit : function() {
|
||||
var html = ['<div style="padding:20px;">',
|
||||
'<div class="ke-dialog-row">',
|
||||
'<label for="keName">' + lang.name + '</label>',
|
||||
'<input class="ke-input-text" type="text" id="keName" name="name" value="" style="width:100px;" />',
|
||||
'</div>',
|
||||
'</div>'].join('');
|
||||
var dialog = self.createDialog({
|
||||
name : name,
|
||||
width : 300,
|
||||
title : self.lang(name),
|
||||
body : html,
|
||||
yesBtn : {
|
||||
name : self.lang('yes'),
|
||||
click : function(e) {
|
||||
self.insertHtml('<a name="' + nameBox.val() + '">').hideDialog().focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
var div = dialog.div,
|
||||
nameBox = K('input[name="name"]', div);
|
||||
var img = self.plugin.getSelectedAnchor();
|
||||
if (img) {
|
||||
nameBox.val(unescape(img.attr('data-ke-name')));
|
||||
}
|
||||
nameBox[0].focus();
|
||||
nameBox[0].select();
|
||||
},
|
||||
'delete' : function() {
|
||||
self.plugin.getSelectedAnchor().remove();
|
||||
}
|
||||
};
|
||||
self.clickToolbar(name, self.plugin.anchor.edit);
|
||||
});
|
54
static/plugins/kindeditor/plugins/autoheight/autoheight.js
Executable file
@ -0,0 +1,54 @@
|
||||
/*******************************************************************************
|
||||
* KindEditor - WYSIWYG HTML Editor for Internet
|
||||
* Copyright (C) 2006-2011 kindsoft.net
|
||||
*
|
||||
* @author Roddy <luolonghao@gmail.com>
|
||||
* @site http://www.kindsoft.net/
|
||||
* @licence http://www.kindsoft.net/license.php
|
||||
*******************************************************************************/
|
||||
|
||||
KindEditor.plugin('autoheight', function(K) {
|
||||
var self = this;
|
||||
|
||||
if (!self.autoHeightMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
var minHeight;
|
||||
|
||||
function hideScroll() {
|
||||
var edit = self.edit;
|
||||
var body = edit.doc.body;
|
||||
edit.iframe[0].scroll = 'no';
|
||||
body.style.overflowY = 'hidden';
|
||||
}
|
||||
|
||||
function resetHeight() {
|
||||
var edit = self.edit;
|
||||
var body = edit.doc.body;
|
||||
edit.iframe.height(minHeight);
|
||||
self.resize(null, Math.max((K.IE ? body.scrollHeight : body.offsetHeight) + 76, minHeight));
|
||||
}
|
||||
|
||||
function init() {
|
||||
minHeight = K.removeUnit(self.height);
|
||||
|
||||
self.edit.afterChange(resetHeight);
|
||||
hideScroll();
|
||||
resetHeight();
|
||||
}
|
||||
|
||||
if (self.isCreated) {
|
||||
init();
|
||||
} else {
|
||||
self.afterCreate(init);
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* 如何实现真正的自动高度?
|
||||
* 修改编辑器高度之后,再次获取body内容高度时,最小值只会是当前iframe的设置高度,这样就导致高度只增不减。
|
||||
* 所以每次获取body内容高度之前,先将iframe的高度重置为最小高度,这样就能获取body的实际高度。
|
||||
* 由此就实现了真正的自动高度
|
||||
* 测试:chrome、firefox、IE9、IE8
|
||||
* */
|
93
static/plugins/kindeditor/plugins/baidumap/baidumap.js
Executable file
@ -0,0 +1,93 @@
|
||||
/*******************************************************************************
|
||||
* KindEditor - WYSIWYG HTML Editor for Internet
|
||||
* Copyright (C) 2006-2011 kindsoft.net
|
||||
*
|
||||
* @author Roddy <luolonghao@gmail.com>
|
||||
* @site http://www.kindsoft.net/
|
||||
* @licence http://www.kindsoft.net/license.php
|
||||
*******************************************************************************/
|
||||
|
||||
// Baidu Maps: http://dev.baidu.com/wiki/map/index.php?title=%E9%A6%96%E9%A1%B5
|
||||
|
||||
KindEditor.plugin('baidumap', function(K) {
|
||||
var self = this, name = 'baidumap', lang = self.lang(name + '.');
|
||||
var mapWidth = K.undef(self.mapWidth, 558);
|
||||
var mapHeight = K.undef(self.mapHeight, 360);
|
||||
self.clickToolbar(name, function() {
|
||||
var html = ['<div style="padding:10px 20px;">',
|
||||
'<div class="ke-header">',
|
||||
// left start
|
||||
'<div class="ke-left">',
|
||||
lang.address + ' <input id="kindeditor_plugin_map_address" name="address" class="ke-input-text" value="" style="width:200px;" /> ',
|
||||
'<span class="ke-button-common ke-button-outer">',
|
||||
'<input type="button" name="searchBtn" class="ke-button-common ke-button" value="' + lang.search + '" />',
|
||||
'</span>',
|
||||
'</div>',
|
||||
// right start
|
||||
'<div class="ke-right">',
|
||||
'<input type="checkbox" id="keInsertDynamicMap" name="insertDynamicMap" value="1" /> <label for="keInsertDynamicMap">' + lang.insertDynamicMap + '</label>',
|
||||
'</div>',
|
||||
'<div class="ke-clearfix"></div>',
|
||||
'</div>',
|
||||
'<div class="ke-map" style="width:' + mapWidth + 'px;height:' + mapHeight + 'px;"></div>',
|
||||
'</div>'].join('');
|
||||
var dialog = self.createDialog({
|
||||
name : name,
|
||||
width : mapWidth + 42,
|
||||
title : self.lang(name),
|
||||
body : html,
|
||||
yesBtn : {
|
||||
name : self.lang('yes'),
|
||||
click : function(e) {
|
||||
var map = win.map;
|
||||
var centerObj = map.getCenter();
|
||||
var center = centerObj.lng + ',' + centerObj.lat;
|
||||
var zoom = map.getZoom();
|
||||
var url = [checkbox[0].checked ? self.pluginsPath + 'baidumap/index.html' : 'http://api.map.baidu.com/staticimage',
|
||||
'?center=' + encodeURIComponent(center),
|
||||
'&zoom=' + encodeURIComponent(zoom),
|
||||
'&width=' + mapWidth,
|
||||
'&height=' + mapHeight,
|
||||
'&markers=' + encodeURIComponent(center),
|
||||
'&markerStyles=' + encodeURIComponent('l,A')].join('');
|
||||
if (checkbox[0].checked) {
|
||||
self.insertHtml('<iframe src="' + url + '" frameborder="0" style="width:' + (mapWidth + 2) + 'px;height:' + (mapHeight + 2) + 'px;"></iframe>');
|
||||
} else {
|
||||
self.exec('insertimage', url);
|
||||
}
|
||||
self.hideDialog().focus();
|
||||
}
|
||||
},
|
||||
beforeRemove : function() {
|
||||
searchBtn.remove();
|
||||
if (doc) {
|
||||
doc.write('');
|
||||
}
|
||||
iframe.remove();
|
||||
}
|
||||
});
|
||||
var div = dialog.div,
|
||||
addressBox = K('[name="address"]', div),
|
||||
searchBtn = K('[name="searchBtn"]', div),
|
||||
checkbox = K('[name="insertDynamicMap"]', dialog.div),
|
||||
win, doc;
|
||||
var iframe = K('<iframe class="ke-textarea" frameborder="0" src="' + self.pluginsPath + 'baidumap/map.html" style="width:' + mapWidth + 'px;height:' + mapHeight + 'px;"></iframe>');
|
||||
function ready() {
|
||||
win = iframe[0].contentWindow;
|
||||
doc = K.iframeDoc(iframe);
|
||||
}
|
||||
iframe.bind('load', function() {
|
||||
iframe.unbind('load');
|
||||
if (K.IE) {
|
||||
ready();
|
||||
} else {
|
||||
setTimeout(ready, 0);
|
||||
}
|
||||
});
|
||||
K('.ke-map', div).replaceWith(iframe);
|
||||
// search map
|
||||
searchBtn.click(function() {
|
||||
win.search(addressBox.val());
|
||||
});
|
||||
});
|
||||
});
|
83
static/plugins/kindeditor/plugins/baidumap/index.html
Executable file
@ -0,0 +1,83 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="keywords" content="百度地图,百度地图API,百度地图自定义工具,百度地图所见即所得工具" />
|
||||
<meta name="description" content="百度地图API自定义地图,帮助用户在可视化操作下生成百度地图" />
|
||||
<title>百度地图API自定义地图</title>
|
||||
<!--引用百度地图API-->
|
||||
<style type="text/css">
|
||||
html,body{margin:0;padding:0;}
|
||||
.iw_poi_title {color:#CC5522;font-size:14px;font-weight:bold;overflow:hidden;padding-right:13px;white-space:nowrap}
|
||||
.iw_poi_content {font:12px arial,sans-serif;overflow:visible;padding-top:4px;white-space:-moz-pre-wrap;word-wrap:break-word}
|
||||
</style>
|
||||
<script type="text/javascript" src="http://api.map.baidu.com/api?key=&v=1.1&services=true"></script>
|
||||
</head>
|
||||
|
||||
<body onload="initMap();">
|
||||
<!--百度地图容器-->
|
||||
<div style="width:697px;height:550px;border:#ccc solid 1px;" id="dituContent"></div>
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
function getParam(name) {
|
||||
return location.href.match(new RegExp('[?&]' + name + '=([^?&]+)', 'i')) ? decodeURIComponent(RegExp.$1) : '';
|
||||
}
|
||||
var centerParam = getParam('center');
|
||||
var zoomParam = getParam('zoom');
|
||||
var widthParam = getParam('width');
|
||||
var heightParam = getParam('height');
|
||||
var markersParam = getParam('markers');
|
||||
var markerStylesParam = getParam('markerStyles');
|
||||
|
||||
//创建和初始化地图函数:
|
||||
function initMap(){
|
||||
// [FF]切换模式后报错
|
||||
if (!window.BMap) {
|
||||
return;
|
||||
}
|
||||
var dituContent = document.getElementById('dituContent');
|
||||
dituContent.style.width = widthParam + 'px';
|
||||
dituContent.style.height = heightParam + 'px';
|
||||
|
||||
createMap();//创建地图
|
||||
setMapEvent();//设置地图事件
|
||||
addMapControl();//向地图添加控件
|
||||
|
||||
// 创建标注
|
||||
var markersArr = markersParam.split(',');
|
||||
var point = new BMap.Point(markersArr[0], markersArr[1]);
|
||||
var marker = new BMap.Marker(point);
|
||||
map.addOverlay(marker); // 将标注添加到地图中
|
||||
}
|
||||
|
||||
//创建地图函数:
|
||||
function createMap(){
|
||||
var map = new BMap.Map("dituContent");//在百度地图容器中创建一个地图
|
||||
var centerArr = centerParam.split(',');
|
||||
var point = new BMap.Point(centerArr[0], centerArr[1]);//定义一个中心点坐标
|
||||
map.centerAndZoom(point, zoomParam);//设定地图的中心点和坐标并将地图显示在地图容器中
|
||||
window.map = map;//将map变量存储在全局
|
||||
}
|
||||
|
||||
//地图事件设置函数:
|
||||
function setMapEvent(){
|
||||
map.enableDragging();//启用地图拖拽事件,默认启用(可不写)
|
||||
map.enableScrollWheelZoom();//启用地图滚轮放大缩小
|
||||
map.enableDoubleClickZoom();//启用鼠标双击放大,默认启用(可不写)
|
||||
map.enableKeyboard();//启用键盘上下左右键移动地图
|
||||
}
|
||||
|
||||
//地图控件添加函数:
|
||||
function addMapControl(){
|
||||
//向地图中添加缩放控件
|
||||
var ctrl_nav = new BMap.NavigationControl({anchor:BMAP_ANCHOR_TOP_LEFT,type:BMAP_NAVIGATION_CONTROL_LARGE});
|
||||
map.addControl(ctrl_nav);
|
||||
//向地图中添加缩略图控件
|
||||
var ctrl_ove = new BMap.OverviewMapControl({anchor:BMAP_ANCHOR_BOTTOM_RIGHT,isOpen:1});
|
||||
map.addControl(ctrl_ove);
|
||||
//向地图中添加比例尺控件
|
||||
var ctrl_sca = new BMap.ScaleControl({anchor:BMAP_ANCHOR_BOTTOM_LEFT});
|
||||
map.addControl(ctrl_sca);
|
||||
}
|
||||
</script>
|
||||
</html>
|
43
static/plugins/kindeditor/plugins/baidumap/map.html
Executable file
@ -0,0 +1,43 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Baidu Maps</title>
|
||||
<style>
|
||||
html { height: 100% }
|
||||
body { height: 100%; margin: 0; padding: 0; background-color: #FFF }
|
||||
</style>
|
||||
<script charset="utf-8" src="http://api.map.baidu.com/api?v=1.3"></script>
|
||||
<script>
|
||||
var map, geocoder;
|
||||
function initialize() {
|
||||
map = new BMap.Map('map_canvas');
|
||||
var point = new BMap.Point(121.473704, 31.230393);
|
||||
map.centerAndZoom(point, 11);
|
||||
map.addControl(new BMap.NavigationControl());
|
||||
map.enableScrollWheelZoom();
|
||||
|
||||
var gc = new BMap.Geocoder();
|
||||
gc.getLocation(point, function(rs){
|
||||
var addComp = rs.addressComponents;
|
||||
var address = [addComp.city].join('');
|
||||
parent.document.getElementById("kindeditor_plugin_map_address").value = address;
|
||||
});
|
||||
}
|
||||
function search(address) {
|
||||
if (!map) return;
|
||||
var local = new BMap.LocalSearch(map, {
|
||||
renderOptions: {
|
||||
map: map,
|
||||
autoViewport: true,
|
||||
selectFirstResult: false
|
||||
}
|
||||
});
|
||||
local.search(address);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="initialize();">
|
||||
<div id="map_canvas" style="width:100%; height:100%"></div>
|
||||
</body>
|
||||
</html>
|
29
static/plugins/kindeditor/plugins/clearhtml/clearhtml.js
Executable file
@ -0,0 +1,29 @@
|
||||
/*******************************************************************************
|
||||
* KindEditor - WYSIWYG HTML Editor for Internet
|
||||
* Copyright (C) 2006-2011 kindsoft.net
|
||||
*
|
||||
* @author Roddy <luolonghao@gmail.com>
|
||||
* @site http://www.kindsoft.net/
|
||||
* @licence http://www.kindsoft.net/license.php
|
||||
*******************************************************************************/
|
||||
|
||||
KindEditor.plugin('clearhtml', function(K) {
|
||||
var self = this, name = 'clearhtml';
|
||||
self.clickToolbar(name, function() {
|
||||
self.focus();
|
||||
var html = self.html();
|
||||
html = html.replace(/(<script[^>]*>)([\s\S]*?)(<\/script>)/ig, '');
|
||||
html = html.replace(/(<style[^>]*>)([\s\S]*?)(<\/style>)/ig, '');
|
||||
html = K.formatHtml(html, {
|
||||
a : ['href', 'target'],
|
||||
embed : ['src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess'],
|
||||
img : ['src', 'width', 'height', 'border', 'alt', 'title', '.width', '.height'],
|
||||
table : ['border'],
|
||||
'td,th' : ['rowspan', 'colspan'],
|
||||
'div,hr,br,tbody,tr,p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : []
|
||||
});
|
||||
self.html(html);
|
||||
self.cmd.selection(true);
|
||||
self.addBookmark();
|
||||
});
|
||||
});
|
62
static/plugins/kindeditor/plugins/code/code.js
Executable file
@ -0,0 +1,62 @@
|
||||
/*******************************************************************************
|
||||
* KindEditor - WYSIWYG HTML Editor for Internet
|
||||
* Copyright (C) 2006-2011 kindsoft.net
|
||||
*
|
||||
* @author Roddy <luolonghao@gmail.com>
|
||||
* @site http://www.kindsoft.net/
|
||||
* @licence http://www.kindsoft.net/license.php
|
||||
*******************************************************************************/
|
||||
|
||||
// google code prettify: http://google-code-prettify.googlecode.com/
|
||||
// http://google-code-prettify.googlecode.com/
|
||||
|
||||
KindEditor.plugin('code', function(K) {
|
||||
var self = this, name = 'code';
|
||||
self.clickToolbar(name, function() {
|
||||
var lang = self.lang(name + '.'),
|
||||
html = ['<div style="padding:10px 20px;">',
|
||||
'<div class="ke-dialog-row">',
|
||||
'<select class="ke-code-type">',
|
||||
'<option value="js">JavaScript</option>',
|
||||
'<option value="html">HTML</option>',
|
||||
'<option value="css">CSS</option>',
|
||||
'<option value="php">PHP</option>',
|
||||
'<option value="pl">Perl</option>',
|
||||
'<option value="py">Python</option>',
|
||||
'<option value="rb">Ruby</option>',
|
||||
'<option value="java">Java</option>',
|
||||
'<option value="vb">ASP/VB</option>',
|
||||
'<option value="cpp">C/C++</option>',
|
||||
'<option value="cs">C#</option>',
|
||||
'<option value="xml">XML</option>',
|
||||
'<option value="bsh">Shell</option>',
|
||||
'<option value="">Other</option>',
|
||||
'</select>',
|
||||
'</div>',
|
||||
'<textarea class="ke-textarea" style="width:408px;height:260px;"></textarea>',
|
||||
'</div>'].join(''),
|
||||
dialog = self.createDialog({
|
||||
name : name,
|
||||
width : 450,
|
||||
title : self.lang(name),
|
||||
body : html,
|
||||
yesBtn : {
|
||||
name : self.lang('yes'),
|
||||
click : function(e) {
|
||||
var type = K('.ke-code-type', dialog.div).val(),
|
||||
code = textarea.val(),
|
||||
cls = type === '' ? '' : ' lang-' + type,
|
||||
html = '<pre class="prettyprint' + cls + '">\n' + K.escape(code) + '</pre> ';
|
||||
if (K.trim(code) === '') {
|
||||
alert(lang.pleaseInput);
|
||||
textarea[0].focus();
|
||||
return;
|
||||
}
|
||||
self.insertHtml(html).hideDialog().focus();
|
||||
}
|
||||
}
|
||||
}),
|
||||
textarea = K('textarea', dialog.div);
|
||||
textarea[0].focus();
|
||||
});
|
||||
});
|
13
static/plugins/kindeditor/plugins/code/prettify.css
Executable file
@ -0,0 +1,13 @@
|
||||
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
|
||||
|
||||
pre.prettyprint {
|
||||
border: 0;
|
||||
border-left: 3px solid rgb(204, 204, 204);
|
||||
margin-left: 2em;
|
||||
padding: 0.5em;
|
||||
font-size: 110%;
|
||||
display: block;
|
||||
font-family: "Consolas", "Monaco", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace;
|
||||
margin: 1em 0px;
|
||||
white-space: pre;
|
||||
}
|
28
static/plugins/kindeditor/plugins/code/prettify.js
Executable file
@ -0,0 +1,28 @@
|
||||
var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
|
||||
(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a=
|
||||
[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c<i;++c){var j=f[c];if(/\\[bdsw]/i.test(j))a.push(j);else{var j=m(j),d;c+2<i&&"-"===f[c+1]?(d=m(f[c+2]),c+=2):d=j;b.push([j,d]);d<65||j>122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;c<b.length;++c)i=b[c],i[0]<=j[1]+1?j[1]=Math.max(j[1],i[1]):f.push(j=i);b=["["];o&&b.push("^");b.push.apply(b,a);for(c=0;c<
|
||||
f.length;++c)i=f[c],b.push(e(i[0])),i[1]>i[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c<b;++c){var j=f[c];j==="("?++i:"\\"===j.charAt(0)&&(j=+j.substring(1))&&j<=i&&(d[j]=-1)}for(c=1;c<d.length;++c)-1===d[c]&&(d[c]=++t);for(i=c=0;c<b;++c)j=f[c],j==="("?(++i,d[i]===void 0&&(f[c]="(?:")):"\\"===j.charAt(0)&&
|
||||
(j=+j.substring(1))&&j<=i&&(f[c]="\\"+d[i]);for(i=c=0;c<b;++c)"^"===f[c]&&"^"!==f[c+1]&&(f[c]="");if(a.ignoreCase&&s)for(c=0;c<b;++c)j=f[c],a=j.charAt(0),j.length>=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p<d;++p){var g=a[p];if(g.ignoreCase)l=!0;else if(/[a-z]/i.test(g.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){s=!0;l=!1;break}}for(var r=
|
||||
{b:8,t:9,n:10,v:11,f:12,r:13},n=[],p=0,d=a.length;p<d;++p){g=a[p];if(g.global||g.multiline)throw Error(""+g);n.push("(?:"+y(g)+")")}return RegExp(n.join("|"),l?"gi":"g")}function M(a){function m(a){switch(a.nodeType){case 1:if(e.test(a.className))break;for(var g=a.firstChild;g;g=g.nextSibling)m(g);g=a.nodeName;if("BR"===g||"LI"===g)h[s]="\n",t[s<<1]=y++,t[s++<<1|1]=a;break;case 3:case 4:g=a.nodeValue,g.length&&(g=p?g.replace(/\r\n?/g,"\n"):g.replace(/[\t\n\r ]+/g," "),h[s]=g,t[s<<1]=y,y+=g.length,
|
||||
t[s++<<1|1]=a)}}var e=/(?:^|\s)nocode(?:\s|$)/,h=[],y=0,t=[],s=0,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=document.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);m(a);return{a:h.join("").replace(/\n$/,""),c:t}}function B(a,m,e,h){m&&(a={a:m,d:a},e(a),h.push.apply(h,a.e))}function x(a,m){function e(a){for(var l=a.d,p=[l,"pln"],d=0,g=a.a.match(y)||[],r={},n=0,z=g.length;n<z;++n){var f=g[n],b=r[f],o=void 0,c;if(typeof b===
|
||||
"string")c=!1;else{var i=h[f.charAt(0)];if(i)o=f.match(i[1]),b=i[0];else{for(c=0;c<t;++c)if(i=m[c],o=f.match(i[1])){b=i[0];break}o||(b="pln")}if((c=b.length>=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),
|
||||
l=[],p={},d=0,g=e.length;d<g;++d){var r=e[d],n=r[3];if(n)for(var k=n.length;--k>=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
|
||||
q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/,
|
||||
q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g,
|
||||
"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a),
|
||||
a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}
|
||||
for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g<d.length;++g)e(d[g]);m===(m|0)&&d[0].setAttribute("value",
|
||||
m);var r=s.createElement("OL");r.className="linenums";for(var n=Math.max(0,m-1|0)||0,g=0,z=d.length;g<z;++g)l=d[g],l.className="L"+(g+n)%10,l.firstChild||l.appendChild(s.createTextNode("\xa0")),r.appendChild(l);a.appendChild(r)}function k(a,m){for(var e=m.length;--e>=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*</.test(m)?"default-markup":"default-code";return A[a]}function E(a){var m=
|
||||
a.g;try{var e=M(a.h),h=e.a;a.a=h;a.c=e.c;a.d=0;C(m,h)(a);var k=/\bMSIE\b/.test(navigator.userAgent),m=/\n/g,t=a.a,s=t.length,e=0,l=a.c,p=l.length,h=0,d=a.e,g=d.length,a=0;d[g]=s;var r,n;for(n=r=0;n<g;)d[n]!==d[n+2]?(d[r++]=d[n++],d[r++]=d[n++]):n+=2;g=r;for(n=r=0;n<g;){for(var z=d[n],f=d[n+1],b=n+2;b+2<=g&&d[b+1]===f;)b+=2;d[r++]=z;d[r++]=f;n=b}for(d.length=r;h<p;){var o=l[h+2]||s,c=d[a+2]||s,b=Math.min(o,c),i=l[h+1],j;if(i.nodeType!==1&&(j=t.substring(e,b))){k&&(j=j.replace(m,"\r"));i.nodeValue=
|
||||
j;var u=i.ownerDocument,v=u.createElement("SPAN");v.className=d[a+1];var x=i.parentNode;x.replaceChild(v,i);v.appendChild(i);e<o&&(l[h+1]=i=u.createTextNode(t.substring(b,o)),x.insertBefore(i,v.nextSibling))}e=b;e>=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
|
||||
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],
|
||||
H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
|
||||
J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+
|
||||
I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),
|
||||
["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",
|
||||
/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),
|
||||
["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",
|
||||
hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p<h.length&&l.now()<e;p++){var n=h[p],k=n.className;if(k.indexOf("prettyprint")>=0){var k=k.match(g),f,b;if(b=
|
||||
!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p<h.length?setTimeout(m,
|
||||
250):a&&a()}for(var e=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],h=[],k=0;k<e.length;++k)for(var t=0,s=e[k].length;t<s;++t)h.push(e[k][t]);var e=q,l=Date;l.now||(l={now:function(){return+new Date}});var p=0,d,g=/\blang(?:uage)?-([\w.]+)(?!\S)/;m()};window.PR={createSimpleLexer:x,registerLangHandler:k,sourceDecorator:u,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",
|
||||
PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}})();
|
129
static/plugins/kindeditor/plugins/emoticons/emoticons.js
Executable file
@ -0,0 +1,129 @@
|
||||
/*******************************************************************************
|
||||
* KindEditor - WYSIWYG HTML Editor for Internet
|
||||
* Copyright (C) 2006-2011 kindsoft.net
|
||||
*
|
||||
* @author Roddy <luolonghao@gmail.com>
|
||||
* @site http://www.kindsoft.net/
|
||||
* @licence http://www.kindsoft.net/license.php
|
||||
*******************************************************************************/
|
||||
|
||||
KindEditor.plugin('emoticons', function(K) {
|
||||
var self = this, name = 'emoticons',
|
||||
path = (self.emoticonsPath || self.pluginsPath + 'emoticons/images/'),
|
||||
allowPreview = self.allowPreviewEmoticons === undefined ? true : self.allowPreviewEmoticons,
|
||||
currentPageNum = 1;
|
||||
self.clickToolbar(name, function() {
|
||||
var rows = 5, cols = 9, total = 135, startNum = 0,
|
||||
cells = rows * cols, pages = Math.ceil(total / cells),
|
||||
colsHalf = Math.floor(cols / 2),
|
||||
wrapperDiv = K('<div class="ke-plugin-emoticons"></div>'),
|
||||
elements = [],
|
||||
menu = self.createMenu({
|
||||
name : name,
|
||||
beforeRemove : function() {
|
||||
removeEvent();
|
||||
}
|
||||
});
|
||||
menu.div.append(wrapperDiv);
|
||||
var previewDiv, previewImg;
|
||||
if (allowPreview) {
|
||||
previewDiv = K('<div class="ke-preview"></div>').css('right', 0);
|
||||
previewImg = K('<img class="ke-preview-img" src="' + path + startNum + '.gif" />');
|
||||
wrapperDiv.append(previewDiv);
|
||||
previewDiv.append(previewImg);
|
||||
}
|
||||
function bindCellEvent(cell, j, num) {
|
||||
if (previewDiv) {
|
||||
cell.mouseover(function() {
|
||||
if (j > colsHalf) {
|
||||
previewDiv.css('left', 0);
|
||||
previewDiv.css('right', '');
|
||||
} else {
|
||||
previewDiv.css('left', '');
|
||||
previewDiv.css('right', 0);
|
||||
}
|
||||
previewImg.attr('src', path + num + '.gif');
|
||||
K(this).addClass('ke-on');
|
||||
});
|
||||
} else {
|
||||
cell.mouseover(function() {
|
||||
K(this).addClass('ke-on');
|
||||
});
|
||||
}
|
||||
cell.mouseout(function() {
|
||||
K(this).removeClass('ke-on');
|
||||
});
|
||||
cell.click(function(e) {
|
||||
self.insertHtml('<img src="' + path + num + '.gif" border="0" alt="" />').hideMenu().focus();
|
||||
e.stop();
|
||||
});
|
||||
}
|
||||
function createEmoticonsTable(pageNum, parentDiv) {
|
||||
var table = document.createElement('table');
|
||||
parentDiv.append(table);
|
||||
if (previewDiv) {
|
||||
K(table).mouseover(function() {
|
||||
previewDiv.show('block');
|
||||
});
|
||||
K(table).mouseout(function() {
|
||||
previewDiv.hide();
|
||||
});
|
||||
elements.push(K(table));
|
||||
}
|
||||
table.className = 'ke-table';
|
||||
table.cellPadding = 0;
|
||||
table.cellSpacing = 0;
|
||||
table.border = 0;
|
||||
var num = (pageNum - 1) * cells + startNum;
|
||||
for (var i = 0; i < rows; i++) {
|
||||
var row = table.insertRow(i);
|
||||
for (var j = 0; j < cols; j++) {
|
||||
var cell = K(row.insertCell(j));
|
||||
cell.addClass('ke-cell');
|
||||
bindCellEvent(cell, j, num);
|
||||
var span = K('<span class="ke-img"></span>')
|
||||
.css('background-position', '-' + (24 * num) + 'px 0px')
|
||||
.css('background-image', 'url(' + path + 'static.gif)');
|
||||
cell.append(span);
|
||||
elements.push(cell);
|
||||
num++;
|
||||
}
|
||||
}
|
||||
return table;
|
||||
}
|
||||
var table = createEmoticonsTable(currentPageNum, wrapperDiv);
|
||||
function removeEvent() {
|
||||
K.each(elements, function() {
|
||||
this.unbind();
|
||||
});
|
||||
}
|
||||
var pageDiv;
|
||||
function bindPageEvent(el, pageNum) {
|
||||
el.click(function(e) {
|
||||
removeEvent();
|
||||
table.parentNode.removeChild(table);
|
||||
pageDiv.remove();
|
||||
table = createEmoticonsTable(pageNum, wrapperDiv);
|
||||
createPageTable(pageNum);
|
||||
currentPageNum = pageNum;
|
||||
e.stop();
|
||||
});
|
||||
}
|
||||
function createPageTable(currentPageNum) {
|
||||
pageDiv = K('<div class="ke-page"></div>');
|
||||
wrapperDiv.append(pageDiv);
|
||||
for (var pageNum = 1; pageNum <= pages; pageNum++) {
|
||||
if (currentPageNum !== pageNum) {
|
||||
var a = K('<a href="javascript:;">[' + pageNum + ']</a>');
|
||||
bindPageEvent(a, pageNum);
|
||||
pageDiv.append(a);
|
||||
elements.push(a);
|
||||
} else {
|
||||
pageDiv.append(K('@[' + pageNum + ']'));
|
||||
}
|
||||
pageDiv.append(K('@ '));
|
||||
}
|
||||
}
|
||||
createPageTable(currentPageNum);
|
||||
});
|
||||
});
|
BIN
static/plugins/kindeditor/plugins/emoticons/images/0.gif
Executable file
After Width: | Height: | Size: 1.8 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/1.gif
Executable file
After Width: | Height: | Size: 1.5 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/10.gif
Executable file
After Width: | Height: | Size: 3.6 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/100.gif
Executable file
After Width: | Height: | Size: 1.7 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/101.gif
Executable file
After Width: | Height: | Size: 2.4 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/102.gif
Executable file
After Width: | Height: | Size: 1.4 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/103.gif
Executable file
After Width: | Height: | Size: 2.1 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/104.gif
Executable file
After Width: | Height: | Size: 2.1 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/105.gif
Executable file
After Width: | Height: | Size: 1.2 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/106.gif
Executable file
After Width: | Height: | Size: 1.0 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/107.gif
Executable file
After Width: | Height: | Size: 1.0 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/108.gif
Executable file
After Width: | Height: | Size: 1.0 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/109.gif
Executable file
After Width: | Height: | Size: 1.1 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/11.gif
Executable file
After Width: | Height: | Size: 7.8 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/110.gif
Executable file
After Width: | Height: | Size: 1.1 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/111.gif
Executable file
After Width: | Height: | Size: 1.0 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/112.gif
Executable file
After Width: | Height: | Size: 1.1 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/113.gif
Executable file
After Width: | Height: | Size: 1015 B |
BIN
static/plugins/kindeditor/plugins/emoticons/images/114.gif
Executable file
After Width: | Height: | Size: 1003 B |
BIN
static/plugins/kindeditor/plugins/emoticons/images/115.gif
Executable file
After Width: | Height: | Size: 1.0 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/116.gif
Executable file
After Width: | Height: | Size: 996 B |
BIN
static/plugins/kindeditor/plugins/emoticons/images/117.gif
Executable file
After Width: | Height: | Size: 1.0 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/118.gif
Executable file
After Width: | Height: | Size: 1012 B |
BIN
static/plugins/kindeditor/plugins/emoticons/images/119.gif
Executable file
After Width: | Height: | Size: 1.1 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/12.gif
Executable file
After Width: | Height: | Size: 2.2 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/120.gif
Executable file
After Width: | Height: | Size: 1008 B |
BIN
static/plugins/kindeditor/plugins/emoticons/images/121.gif
Executable file
After Width: | Height: | Size: 1.0 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/122.gif
Executable file
After Width: | Height: | Size: 999 B |
BIN
static/plugins/kindeditor/plugins/emoticons/images/123.gif
Executable file
After Width: | Height: | Size: 1.0 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/124.gif
Executable file
After Width: | Height: | Size: 1022 B |
BIN
static/plugins/kindeditor/plugins/emoticons/images/125.gif
Executable file
After Width: | Height: | Size: 1013 B |
BIN
static/plugins/kindeditor/plugins/emoticons/images/126.gif
Executable file
After Width: | Height: | Size: 1.0 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/127.gif
Executable file
After Width: | Height: | Size: 956 B |
BIN
static/plugins/kindeditor/plugins/emoticons/images/128.gif
Executable file
After Width: | Height: | Size: 1022 B |
BIN
static/plugins/kindeditor/plugins/emoticons/images/129.gif
Executable file
After Width: | Height: | Size: 972 B |
BIN
static/plugins/kindeditor/plugins/emoticons/images/13.gif
Executable file
After Width: | Height: | Size: 1.7 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/130.gif
Executable file
After Width: | Height: | Size: 980 B |
BIN
static/plugins/kindeditor/plugins/emoticons/images/131.gif
Executable file
After Width: | Height: | Size: 945 B |
BIN
static/plugins/kindeditor/plugins/emoticons/images/132.gif
Executable file
After Width: | Height: | Size: 936 B |
BIN
static/plugins/kindeditor/plugins/emoticons/images/133.gif
Executable file
After Width: | Height: | Size: 1012 B |
BIN
static/plugins/kindeditor/plugins/emoticons/images/134.gif
Executable file
After Width: | Height: | Size: 968 B |
BIN
static/plugins/kindeditor/plugins/emoticons/images/14.gif
Executable file
After Width: | Height: | Size: 3.9 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/15.gif
Executable file
After Width: | Height: | Size: 1.5 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/16.gif
Executable file
After Width: | Height: | Size: 1.4 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/17.gif
Executable file
After Width: | Height: | Size: 3.3 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/18.gif
Executable file
After Width: | Height: | Size: 7.9 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/19.gif
Executable file
After Width: | Height: | Size: 7.9 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/2.gif
Executable file
After Width: | Height: | Size: 1.8 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/20.gif
Executable file
After Width: | Height: | Size: 1.8 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/21.gif
Executable file
After Width: | Height: | Size: 1.8 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/22.gif
Executable file
After Width: | Height: | Size: 2.9 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/23.gif
Executable file
After Width: | Height: | Size: 1.9 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/24.gif
Executable file
After Width: | Height: | Size: 2.2 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/25.gif
Executable file
After Width: | Height: | Size: 2.4 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/26.gif
Executable file
After Width: | Height: | Size: 3.9 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/27.gif
Executable file
After Width: | Height: | Size: 2.8 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/28.gif
Executable file
After Width: | Height: | Size: 3.2 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/29.gif
Executable file
After Width: | Height: | Size: 5.7 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/3.gif
Executable file
After Width: | Height: | Size: 1.8 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/30.gif
Executable file
After Width: | Height: | Size: 1.7 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/31.gif
Executable file
After Width: | Height: | Size: 5.1 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/32.gif
Executable file
After Width: | Height: | Size: 7.0 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/33.gif
Executable file
After Width: | Height: | Size: 4.2 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/34.gif
Executable file
After Width: | Height: | Size: 2.1 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/35.gif
Executable file
After Width: | Height: | Size: 13 KiB |
BIN
static/plugins/kindeditor/plugins/emoticons/images/36.gif
Executable file
After Width: | Height: | Size: 1.4 KiB |