Updating library.
This commit is contained in:
7
.gitmodules
vendored
7
.gitmodules
vendored
@ -1,6 +1,3 @@
|
||||
[submodule "lib/jw-options-framework"]
|
||||
path = lib/jw-options-framework
|
||||
url = git://github.com/JayWood/jw-options-framework.git
|
||||
[submodule "jw_simple_options"]
|
||||
path = jw_simple_options
|
||||
[submodule "lib/jw_simple_options"]
|
||||
path = lib/jw_simple_options
|
||||
url = https://github.com/JayWood/jw_simple_options.git
|
||||
|
Submodule jw_simple_options deleted from 170a7a4e7b
1
lib/jw_simple_options
Submodule
1
lib/jw_simple_options
Submodule
Submodule lib/jw_simple_options added at 901fb058a1
@ -1,16 +0,0 @@
|
||||
/* CSS Document */
|
||||
|
||||
a.addrow{color: #0C0; text-decoration: none;}
|
||||
a.addrow:hover{color: #0F9; text-decoration:underline;}
|
||||
|
||||
a.removerow{color:#C00; text-decoration: none;}
|
||||
a.removerow:hover{color:#c55; text-decoration: underline;}
|
||||
|
||||
label.jw_check_fields{margin-left: 5px; min-width: 128px; display: block; float: left;}
|
||||
label.jw_radio_fields{display: block; width: 225px;}
|
||||
|
||||
table.dataArrayFields thead td{text-align: center;}
|
||||
.form-table td{padding: 4px 5px;}
|
||||
|
||||
/* Color Picker */
|
||||
.sp-replacer{margin-right: 10px;}
|
@ -1,477 +0,0 @@
|
||||
/***
|
||||
Spectrum Colorpicker v1.0.9
|
||||
https://github.com/bgrins/spectrum
|
||||
Author: Brian Grinstead
|
||||
License: MIT
|
||||
***/
|
||||
|
||||
.sp-container {
|
||||
position:absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
display:inline-block;
|
||||
*display: inline;
|
||||
*zoom: 1;
|
||||
z-index: 2147483647;
|
||||
overflow: hidden;
|
||||
}
|
||||
.sp-container.sp-flat {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* http://ansciath.tumblr.com/post/7347495869/css-aspect-ratio */
|
||||
.sp-top {
|
||||
position:relative;
|
||||
width: 100%;
|
||||
display:inline-block;
|
||||
}
|
||||
.sp-top-inner {
|
||||
position:absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
bottom:0;
|
||||
right:0;
|
||||
}
|
||||
.sp-color {
|
||||
position: absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
bottom:0;
|
||||
right:20%;
|
||||
}
|
||||
.sp-hue {
|
||||
position: absolute;
|
||||
top:0;
|
||||
right:0;
|
||||
bottom:0;
|
||||
left:84%;
|
||||
height: 100%;
|
||||
}
|
||||
.sp-fill {
|
||||
padding-top: 80%;
|
||||
}
|
||||
.sp-sat, .sp-val {
|
||||
position: absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
right:0;
|
||||
bottom:0;
|
||||
}
|
||||
|
||||
.sp-alpha-enabled .sp-top
|
||||
{
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
.sp-alpha-enabled .sp-alpha
|
||||
{
|
||||
display: block;
|
||||
}
|
||||
|
||||
.sp-alpha-handle
|
||||
{
|
||||
position:absolute;
|
||||
top:-4px;
|
||||
bottom: -4px;
|
||||
width: 6px;
|
||||
left: 50%;
|
||||
cursor: pointer;
|
||||
border: 1px solid black;
|
||||
background: white;
|
||||
opacity: .8;
|
||||
}
|
||||
|
||||
.sp-alpha
|
||||
{
|
||||
display: none;
|
||||
position: absolute;
|
||||
bottom: -14px;
|
||||
right: 0;
|
||||
left: 0;
|
||||
height: 8px;
|
||||
}
|
||||
.sp-alpha-inner{
|
||||
border: solid 1px #333;
|
||||
}
|
||||
|
||||
/* Don't allow text selection */
|
||||
.sp-container, .sp-replacer, .sp-preview, .sp-dragger, .sp-slider, .sp-alpha, .sp-alpha-handle, .sp-container.sp-dragging .sp-input, .sp-container button {
|
||||
-webkit-user-select:none;
|
||||
-moz-user-select: -moz-none;
|
||||
-o-user-select:none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.sp-container.sp-input-disabled .sp-input-container {
|
||||
display: none;
|
||||
}
|
||||
.sp-container.sp-buttons-disabled .sp-button-container {
|
||||
display: none;
|
||||
}
|
||||
.sp-palette-only .sp-picker-container {
|
||||
display: none;
|
||||
}
|
||||
.sp-palette-disabled .sp-palette-container {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sp-initial-disabled .sp-initial {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
/* Gradients for hue, saturation and value instead of images. Not pretty... but it works */
|
||||
.sp-sat {
|
||||
background-image: -webkit-gradient(linear, 0 0, 100% 0, from(#FFF), to(rgba(204, 154, 129, 0)));
|
||||
background-image: -webkit-linear-gradient(left, #FFF, rgba(204, 154, 129, 0));
|
||||
background-image: -moz-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
|
||||
background-image: -o-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
|
||||
background-image: -ms-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
|
||||
background-image: linear-gradient(to right, #fff, rgba(204, 154, 129, 0));
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr=#FFFFFFFF, endColorstr=#00CC9A81)";
|
||||
filter : progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr='#FFFFFFFF', endColorstr='#00CC9A81');
|
||||
}
|
||||
.sp-val {
|
||||
background-image: -webkit-gradient(linear, 0 100%, 0 0, from(#000000), to(rgba(204, 154, 129, 0)));
|
||||
background-image: -webkit-linear-gradient(bottom, #000000, rgba(204, 154, 129, 0));
|
||||
background-image: -moz-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
|
||||
background-image: -o-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
|
||||
background-image: -ms-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
|
||||
background-image: linear-gradient(to top, #000, rgba(204, 154, 129, 0));
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00CC9A81, endColorstr=#FF000000)";
|
||||
filter : progid:DXImageTransform.Microsoft.gradient(startColorstr='#00CC9A81', endColorstr='#FF000000');
|
||||
}
|
||||
|
||||
.sp-hue {
|
||||
background: -moz-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
||||
background: -ms-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
||||
background: -o-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#ff0000), color-stop(0.17, #ffff00), color-stop(0.33, #00ff00), color-stop(0.5, #00ffff), color-stop(0.67, #0000ff), color-stop(0.83, #ff00ff), to(#ff0000));
|
||||
background: -webkit-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
||||
}
|
||||
|
||||
/* IE filters do not support multiple color stops.
|
||||
Generate 6 divs, line them up, and do two color gradients for each.
|
||||
Yes, really.
|
||||
*/
|
||||
|
||||
.sp-1 {
|
||||
height:17%;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000', endColorstr='#ffff00');
|
||||
}
|
||||
.sp-2 {
|
||||
height:16%;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff00', endColorstr='#00ff00');
|
||||
}
|
||||
.sp-3 {
|
||||
height:17%;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00', endColorstr='#00ffff');
|
||||
}
|
||||
.sp-4 {
|
||||
height:17%;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ffff', endColorstr='#0000ff');
|
||||
}
|
||||
.sp-5 {
|
||||
height:16%;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0000ff', endColorstr='#ff00ff');
|
||||
}
|
||||
.sp-6 {
|
||||
height:17%;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff00ff', endColorstr='#ff0000');
|
||||
}
|
||||
|
||||
/* Clearfix hack */
|
||||
.sp-cf:before, .sp-cf:after { content: ""; display: table; }
|
||||
.sp-cf:after { clear: both; }
|
||||
.sp-cf { *zoom: 1; }
|
||||
|
||||
/* Mobile devices, make hue slider bigger so it is easier to slide */
|
||||
@media (max-device-width: 480px) {
|
||||
.sp-color { right: 40%; }
|
||||
.sp-hue { left: 63%; }
|
||||
.sp-fill { padding-top: 60%; }
|
||||
}
|
||||
|
||||
.sp-dragger {
|
||||
border-radius: 5px;
|
||||
height: 5px;
|
||||
width: 5px;
|
||||
border: 1px solid #fff;
|
||||
background: #000;
|
||||
cursor: pointer;
|
||||
position:absolute;
|
||||
top:0;
|
||||
left: 0;
|
||||
}
|
||||
.sp-slider {
|
||||
position: absolute;
|
||||
top:0;
|
||||
cursor:pointer;
|
||||
height: 3px;
|
||||
left: -1px;
|
||||
right: -1px;
|
||||
border: 1px solid #000;
|
||||
background: white;
|
||||
opacity: .8;
|
||||
}
|
||||
|
||||
/* Basic display options (colors, fonts, global widths) */
|
||||
.sp-container {
|
||||
border-radius: 0;
|
||||
background-color: #ECECEC;
|
||||
border: solid 1px #f0c49B;
|
||||
padding: 0;
|
||||
}
|
||||
.sp-container, .sp-container button, .sp-container input, .sp-color, .sp-hue
|
||||
{
|
||||
font: normal 12px "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-ms-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.sp-top
|
||||
{
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
.sp-color, .sp-hue
|
||||
{
|
||||
border: solid 1px #666;
|
||||
}
|
||||
|
||||
/* Input */
|
||||
.sp-input-container {
|
||||
float:right;
|
||||
width: 100px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.sp-initial-disabled .sp-input-container {
|
||||
width: 100%;
|
||||
}
|
||||
.sp-input {
|
||||
font-size: 12px !important;
|
||||
border: 1px inset;
|
||||
padding: 4px 5px;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
background:transparent;
|
||||
border-radius: 3px;
|
||||
color: #222;
|
||||
}
|
||||
.sp-input:focus {
|
||||
border: 1px solid orange;
|
||||
}
|
||||
.sp-input.sp-validation-error
|
||||
{
|
||||
border: 1px solid red;
|
||||
background: #fdd;
|
||||
}
|
||||
.sp-picker-container , .sp-palette-container
|
||||
{
|
||||
float:left;
|
||||
position: relative;
|
||||
padding: 10px;
|
||||
padding-bottom: 300px;
|
||||
margin-bottom: -290px;
|
||||
}
|
||||
.sp-picker-container
|
||||
{
|
||||
width: 172px;
|
||||
border-left: solid 1px #fff;
|
||||
}
|
||||
|
||||
/* Palettes */
|
||||
.sp-palette-container
|
||||
{
|
||||
border-right: solid 1px #ccc;
|
||||
}
|
||||
|
||||
.sp-palette .sp-thumb-el {
|
||||
display: block;
|
||||
position:relative;
|
||||
float:left;
|
||||
width: 24px;
|
||||
height: 15px;
|
||||
margin: 3px;
|
||||
cursor: pointer;
|
||||
border:solid 2px transparent;
|
||||
}
|
||||
.sp-palette .sp-thumb-el:hover, .sp-palette .sp-thumb-el.sp-thumb-active {
|
||||
border-color: orange;
|
||||
}
|
||||
.sp-thumb-el
|
||||
{
|
||||
position:relative;
|
||||
}
|
||||
|
||||
/* Initial */
|
||||
.sp-initial
|
||||
{
|
||||
float: left;
|
||||
border: solid 1px #333;
|
||||
}
|
||||
.sp-initial span {
|
||||
width: 30px;
|
||||
height: 25px;
|
||||
border:none;
|
||||
display:block;
|
||||
float:left;
|
||||
margin:0;
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
.sp-button-container {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* Replacer (the little preview div that shows up instead of the <input>) */
|
||||
.sp-replacer {
|
||||
margin:0;
|
||||
overflow:hidden;
|
||||
cursor:pointer;
|
||||
padding: 4px;
|
||||
display:inline-block;
|
||||
*zoom: 1;
|
||||
*display: inline;
|
||||
border: solid 1px #91765d;
|
||||
background: #eee;
|
||||
color: #333;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.sp-replacer:hover, .sp-replacer.sp-active {
|
||||
border-color: #F0C49B;
|
||||
color: #111;
|
||||
}
|
||||
.sp-replacer.sp-disabled {
|
||||
cursor:default;
|
||||
border-color: silver;
|
||||
color: silver;
|
||||
}
|
||||
.sp-dd {
|
||||
padding: 2px 0;
|
||||
height: 16px;
|
||||
line-height: 16px;
|
||||
float:left;
|
||||
font-size:10px;
|
||||
}
|
||||
.sp-preview
|
||||
{
|
||||
position:relative;
|
||||
width:25px;
|
||||
height: 20px;
|
||||
border: solid 1px #222;
|
||||
margin-right: 5px;
|
||||
float:left;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.sp-palette
|
||||
{
|
||||
*width: 220px;
|
||||
max-width: 220px;
|
||||
}
|
||||
.sp-palette .sp-thumb-el
|
||||
{
|
||||
width:16px;
|
||||
height: 16px;
|
||||
margin:2px 1px;
|
||||
border: solid 1px #d0d0d0;
|
||||
}
|
||||
|
||||
.sp-container
|
||||
{
|
||||
padding-bottom:0;
|
||||
}
|
||||
|
||||
|
||||
/* Buttons: http://hellohappy.org/css3-buttons/ */
|
||||
.sp-container button {
|
||||
background-color: #eeeeee;
|
||||
background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc);
|
||||
background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
|
||||
background-image: -ms-linear-gradient(top, #eeeeee, #cccccc);
|
||||
background-image: -o-linear-gradient(top, #eeeeee, #cccccc);
|
||||
background-image: -ms-linear-gradient(top, #eeeeee, #cccccc);
|
||||
background-image: linear-gradient(to bottom, #eeeeee, #cccccc);
|
||||
border: 1px solid #ccc;
|
||||
border-bottom: 1px solid #bbb;
|
||||
border-radius: 3px;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
line-height: 1;
|
||||
padding: 5px 4px;
|
||||
text-align: center;
|
||||
text-shadow: 0 1px 0 #eee;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.sp-container button:hover {
|
||||
background-color: #dddddd;
|
||||
background-image: -webkit-linear-gradient(top, #dddddd, #bbbbbb);
|
||||
background-image: -moz-linear-gradient(top, #dddddd, #bbbbbb);
|
||||
background-image: -ms-linear-gradient(top, #dddddd, #bbbbbb);
|
||||
background-image: -o-linear-gradient(top, #dddddd, #bbbbbb);
|
||||
background-image: -ms-linear-gradient(top, #dddddd, #bbbbbb);
|
||||
background-image: linear-gradient(to bottom, #dddddd, #bbbbbb);
|
||||
border: 1px solid #bbb;
|
||||
border-bottom: 1px solid #999;
|
||||
cursor: pointer;
|
||||
text-shadow: 0 1px 0 #ddd;
|
||||
}
|
||||
.sp-container button:active {
|
||||
border: 1px solid #aaa;
|
||||
border-bottom: 1px solid #888;
|
||||
-webkit-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
||||
-moz-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
||||
-ms-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
||||
-o-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
||||
box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
||||
}
|
||||
.sp-cancel
|
||||
{
|
||||
font-size: 11px;
|
||||
color: #d93f3f !important;
|
||||
margin:0;
|
||||
padding:2px;
|
||||
margin-right: 5px;
|
||||
vertical-align: middle;
|
||||
text-decoration:none;
|
||||
|
||||
}
|
||||
.sp-cancel:hover
|
||||
{
|
||||
color: #d93f3f !important;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
|
||||
.sp-palette span:hover, .sp-palette span.sp-thumb-active
|
||||
{
|
||||
border-color: #000;
|
||||
}
|
||||
|
||||
.sp-preview, .sp-alpha, .sp-thumb-el
|
||||
{
|
||||
position:relative;
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==);
|
||||
}
|
||||
.sp-preview-inner, .sp-alpha-inner, .sp-thumb-inner
|
||||
{
|
||||
display:block;
|
||||
position:absolute;
|
||||
top:0;left:0;bottom:0;right:0;
|
||||
}
|
||||
|
||||
.sp-palette .sp-thumb-inner
|
||||
{
|
||||
background-position: 50% 50%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.sp-palette .sp-thumb-light.sp-thumb-active .sp-thumb-inner
|
||||
{
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=);
|
||||
}
|
||||
|
||||
.sp-palette .sp-thumb-dark.sp-thumb-active .sp-thumb-inner
|
||||
{
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=);
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
/* Javascript Document */
|
||||
|
||||
jQuery(document).ready(function($) {
|
||||
var addRow = $('.addrow');
|
||||
var delRow = $('.removerow');
|
||||
|
||||
addRow.click(function(e){
|
||||
var theID = $(this).attr('data_id');
|
||||
var curBlock = $('table#'+theID+' tbody');
|
||||
var curNum = curBlock.children('tr').length;
|
||||
var newRow = $('.data_row.'+theID).last().clone(true);
|
||||
|
||||
newRow.attr('id', 'data_row_'+(curNum+1));
|
||||
newRow.children('td').each(function(index){
|
||||
if( $(this).has('input') ){
|
||||
var name = $(this).children('input').first().attr('name');
|
||||
if(name != undefined){
|
||||
var nName = name.replace(/\[[0-9]\]/, '['+curNum+1+']');
|
||||
//console.log(nName);
|
||||
}
|
||||
$(this).children('input').first().attr('name', nName);
|
||||
$(this).children('input').first().attr('value', '');
|
||||
$(this).children('.removerow').attr('id', (curNum+1));
|
||||
$(this).children('.removerow').addClass(theID);
|
||||
}
|
||||
});
|
||||
|
||||
curBlock.append(newRow);
|
||||
});
|
||||
|
||||
|
||||
delRow.click(function(e){
|
||||
var id = $(this).attr('id');
|
||||
var blockID = $(this).attr('curBlock');
|
||||
var curBlock = $('table#'+blockID+' tbody');
|
||||
var len = curBlock.children('tr').length;
|
||||
console.log(len);
|
||||
if( len != 1 ){
|
||||
$('#data_row_'+id+'.'+blockID).fadeOut(250,function(e){
|
||||
$('#data_row_'+id+'.'+blockID).remove();
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
$('.color_select').spectrum({
|
||||
showButtons: false,
|
||||
showInput: true,
|
||||
preferredFormat: "hex6"
|
||||
});
|
||||
|
||||
// Uploading files
|
||||
var file_frame, uploadID;
|
||||
|
||||
$('.upload_image_button').live('click', function( event ){
|
||||
event.preventDefault();
|
||||
uploadID = $(this).attr('data-id');
|
||||
console.log(event);
|
||||
|
||||
if ( file_frame ) {
|
||||
file_frame.open();
|
||||
return;
|
||||
}
|
||||
|
||||
file_frame = wp.media.frames.file_frame = wp.media({
|
||||
title: jQuery( this ).data( 'uploader_title' ),
|
||||
button: {
|
||||
text: jQuery( this ).data( 'uploader_button_text' ),
|
||||
},
|
||||
multiple: false
|
||||
});
|
||||
|
||||
file_frame.on( 'select', function() {
|
||||
attachment = file_frame.state().get('selection').first().toJSON();
|
||||
|
||||
$('#'+uploadID).val(attachment.url);
|
||||
});
|
||||
|
||||
file_frame.open();
|
||||
});
|
||||
//END UPLOAD FUNCTIONS
|
||||
|
||||
|
||||
|
||||
});
|
File diff suppressed because it is too large
Load Diff
@ -1,504 +0,0 @@
|
||||
<?
|
||||
/**********************************************************************************
|
||||
JW Simple Options
|
||||
Author: Jerry Wood Jr.
|
||||
Email: jay@plugish.com
|
||||
WWW: http://plugish.com
|
||||
|
||||
This sofware is provided free of charge. I use this in my own projects and
|
||||
it's ideal for small options pages when you don't feel like writing the
|
||||
HTML to accompany it. This work is Licensed under the Creative Commons
|
||||
Attribution Share-Alike 3.0 License. All I ask, is you don't sell the
|
||||
software as is. You're more than welcome to include it in a package
|
||||
as long as you give the appropriate credit.
|
||||
**********************************************************************************/
|
||||
|
||||
class JW_SIMPLE_OPTIONS{
|
||||
|
||||
/**
|
||||
* @access private
|
||||
* @var string Class version number.
|
||||
*/
|
||||
private $ver = '1.1';
|
||||
|
||||
/**
|
||||
* @access private
|
||||
* @var array() A map of the options data.
|
||||
*/
|
||||
private $options;
|
||||
|
||||
/**
|
||||
* Location of the plugin/theme menu.
|
||||
*
|
||||
* Accepts: page, link, comment, management, option, theme, plugin, user, dashboard, post, or media.
|
||||
* @access private
|
||||
* @var string Default: 'new'
|
||||
*/
|
||||
private $menu_type = 'new';
|
||||
|
||||
/**
|
||||
* Used in options saving/gathering and menu data.
|
||||
*
|
||||
* @access private
|
||||
* @var string Default: 'jw_'
|
||||
*/
|
||||
private $prefix = 'jw_';
|
||||
|
||||
/**
|
||||
* Reader friendly menu name.
|
||||
*
|
||||
* @access private
|
||||
* @var string Default: 'JW Options'
|
||||
*/
|
||||
private $menu_title = 'JW Options';
|
||||
|
||||
/**
|
||||
* Capability needed by users to see this menu.
|
||||
*
|
||||
* @access private
|
||||
* @var string Default: manage_options
|
||||
* @see add_menu_page()
|
||||
*/
|
||||
private $cap = 'manage_options';
|
||||
|
||||
/**
|
||||
* URL friendly name of the menu, ie. 'options_page'
|
||||
*
|
||||
* Will be prefixed by prefix variable.
|
||||
* @access private
|
||||
* @var string Default: 'options_page'
|
||||
*/
|
||||
private $slug = 'options_page';
|
||||
|
||||
/**
|
||||
* Icon of the top-level menu. Absolute URL.
|
||||
*
|
||||
* @access private
|
||||
* @var string Default: NULL
|
||||
*/
|
||||
private $icon = NULL;
|
||||
|
||||
/**
|
||||
* Menu position of the top-level menu. Used only if menu_type is 'new'.
|
||||
*
|
||||
* @access private
|
||||
* @var integer Default: NULL
|
||||
*/
|
||||
private $pos = NULL;
|
||||
|
||||
/**
|
||||
* Used in menu pages and throughout the plugin
|
||||
*
|
||||
* @access private
|
||||
* @var string Defaults to "JW Options Panel"
|
||||
*/
|
||||
private $plugin_title = 'JW Options Panel';
|
||||
|
||||
/**
|
||||
* Used in menu generation and hooks.
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $hook;
|
||||
|
||||
function JW_SIMPLE_OPTIONS($ops){
|
||||
$this->__construct($ops);
|
||||
}
|
||||
|
||||
function __construct(array $ops){
|
||||
// Setup variables
|
||||
$this->plugin_title = empty($ops['plugin_title']) ? $this->plugin_title : $ops['plugin_title'];
|
||||
$this->menu_title = empty($ops['menu_title']) ? $this->menu_title : $ops['menu_title'];
|
||||
$this->cap = empty($ops['capability']) ? $this->cap : $ops['capability'];
|
||||
$this->slug = empty($ops['slug']) ? $this->prefix.$this->slug : $ops['slug'];
|
||||
$this->options = empty($ops['opData']) ? $this->options : $ops['opData'];
|
||||
$this->icon = empty($ops['icon_url']) ? $this->icon : $ops['icon_url'];
|
||||
$this->pos = empty($ops['menu_pos']) ? $this->pos : $ops['menu_pos'];
|
||||
$this->prefix = empty($ops['prefix']) ? $this->prefix : $ops['prefix'];
|
||||
|
||||
add_action('admin_init', array(&$this, 'register_admin_deps') );
|
||||
add_action('admin_menu', array(&$this, 'load_admin_menu') );
|
||||
add_action('admin_enqueue_scripts', array(&$this, 'load_admin_deps') );
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an array of check boxes.
|
||||
*
|
||||
* @param string $key Option identifier minus prefix.
|
||||
* @param array $data Associative array of data to display.
|
||||
*/
|
||||
public function buildCheckFields($key, $data, $def = false){
|
||||
$opData = get_option($this->prefix.$key, $def);
|
||||
?>
|
||||
<fieldset>
|
||||
<? foreach($data as $k => $v): ?>
|
||||
<label for="<? echo $this->prefix.$key; ?>_<? echo $k; ?>" class="jw_check_fields">
|
||||
<input id="<? echo $this->prefix.$key; ?>_<? echo $k; ?>" type="checkbox" name="<? echo $this->prefix.$key; ?>[]" <? $this->jop_checked($opData, $k, true); ?> value="<? echo $k; ?>"/> <? echo $v; ?>
|
||||
</label>
|
||||
<? endforeach; ?>
|
||||
</fieldset>
|
||||
<?
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an array of data, comparable to a matrix.
|
||||
*
|
||||
* Also provides neat javascript functionality such as adding/removing rows.
|
||||
* @param string $key Option identifier minus prefix.
|
||||
* @param array $fields A regular array of data identifiers, ie. array('field1', 'field2').
|
||||
*/
|
||||
public function buildDataArrayFields($key, $fields, $showhead = false){
|
||||
$opData = get_option($this->prefix.$key);
|
||||
?>
|
||||
<a href="javascript:;" class="addrow" data_id="<? echo $key; ?>">[+] Add Row</a>
|
||||
<table class="dataArrayFields" id="<? echo $key; ?>">
|
||||
<? $rowBase = 1; ?>
|
||||
<? if($showhead): ?>
|
||||
<thead>
|
||||
<tr>
|
||||
<? foreach($fields as $k => $v): ?>
|
||||
<td><? echo $v; ?></td>
|
||||
<? endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<? endif; ?>
|
||||
<? if(!empty($opData) && is_array($opData)) :?>
|
||||
<? foreach ($opData as $row): ?>
|
||||
<tr id="data_row_<? echo $rowBase; ?>" class="data_row <? echo $key; ?>">
|
||||
<? foreach ($fields as $colName => $colLabel): ?>
|
||||
<td class="data_col <? echo $colName; ?>"><input type="text" name="<? echo $this->prefix.$key ?>[<? echo $rowBase; ?>][<? echo $colName; ?>]" value="<? echo $row[$colName]; ?>"/></td>
|
||||
<? endforeach; ?>
|
||||
<td><a href="javascript:;" id="<? echo $rowBase; ?>" class="removerow" curBlock="<? echo $key; ?>">[X]</a></td>
|
||||
</tr>
|
||||
<? $rowBase++; ?>
|
||||
<? endforeach; ?>
|
||||
<? else: ?>
|
||||
<tr id="data_row_<? echo $rowBase; ?>" class="data_row <? echo $key; ?>">
|
||||
<? foreach ($fields as $colName => $colLabel): ?>
|
||||
<td class="data_col <? echo $colName; ?>"><input type="text" name="<? echo $this->prefix.$key ?>[<? echo $rowBase; ?>][<? echo $colName; ?>]" /></td>
|
||||
<? endforeach; ?>
|
||||
<td><a href="javascript:;" id="<? echo $rowBase; ?>" class="removerow <? echo $key; ?>" curBlock="<? echo $key; ?>">[X]</a></td>
|
||||
</tr>
|
||||
<? endif; ?>
|
||||
</table>
|
||||
<?
|
||||
}
|
||||
|
||||
/**
|
||||
* WordPress 3.5 media upload functionality.
|
||||
*
|
||||
* @param string Option identifier minus prefix.
|
||||
*/
|
||||
public function buildMediaOption($key){
|
||||
|
||||
$opData = get_option($this->prefix.$key);
|
||||
|
||||
$output = '<div class="uploader">';
|
||||
$output .= '<input type="text" name="'.$this->prefix.$key.'" id="'.$this->prefix.$key.'" class="regular-text" value="'.$opData.'" />';
|
||||
$output .= '<input type="button" id="'.$this->prefix.$key.'_upload" value="Upload" class="button upload_image_button" data-id="'.$this->prefix.$key.'" />';
|
||||
$output .= '</div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an array of radio buttons.
|
||||
*
|
||||
* @param string $key Option identifier minus prefix.
|
||||
* @param array $data Associative array of data to display.
|
||||
* @param boolean $def If not false, provide a default value if no option exists.
|
||||
*/
|
||||
public function buildRadioFields($key, $data, $def = false){
|
||||
$opData = get_option($this->prefix.$key, $def);
|
||||
?>
|
||||
<fieldset>
|
||||
<? foreach($data as $k => $v): ?>
|
||||
<label for="<? echo $this->prefix.$key; ?>_<? echo $k; ?>" class="jw_radio_fields">
|
||||
<input id="<? echo $this->prefix.$key; ?>_<? echo $k; ?>" type="radio" name="<? echo $this->prefix.$key; ?>" <? checked($opData, $k, true); ?> value="<? echo $k; ?>"/> <? echo $v; ?>
|
||||
</label>
|
||||
<? endforeach; ?>
|
||||
</fieldset>
|
||||
<?
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds dropdown menu.
|
||||
*
|
||||
* @param string $key Option identifier minus prefix.
|
||||
* @param array $data Associative array of data to display.
|
||||
* @param boolean $def If not false, provide a default value if no option exists.
|
||||
*/
|
||||
public function buildSelectOptions($key, $data, $def = false){
|
||||
|
||||
$opData = get_option($this->prefix.$key, $def);
|
||||
|
||||
$output = '<select name="'.$this->prefix.$key.'" id="'.$this->prefix.$key.'">';
|
||||
foreach($data as $k => $v){
|
||||
$output .= '<option value="'.$k.'" '.selected($opData, $k, false).'>'.$v.'</option>';
|
||||
}
|
||||
$output .= '</select>';
|
||||
$output .= '<!-- '.print_r($opData, true).'-->';
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
/**
|
||||
* Builds a timeframe selection that consists of one text input, and one dropdown.
|
||||
*
|
||||
* @param string $key Option identifier minus prefix.
|
||||
* @param mixed $def If not false, provide a default value if no option exists.
|
||||
*/
|
||||
public function buildTimeframe($key, $def = false){
|
||||
// Should be two fields, one input text, one dropdown.
|
||||
$opData = get_option($this->prefix.$key, $def);
|
||||
|
||||
if(empty($opData['multiplier'])) $opData['mulitplier'] = $def['multiplier'];
|
||||
if(empty($opData['time'])) $opData['time'] = $def['time'];
|
||||
|
||||
?>
|
||||
<input type="text" name="<? echo $this->prefix.$key; ?>[multiplier]" value="<? echo $opData['multiplier']; ?>" class="jw_multiplier"/><select name="<? echo $this->prefix.$key; ?>[time]">
|
||||
<option value="60" <? selected($opData['time'], 60, true); ?>>Minutes</option>
|
||||
<option value="<? echo 60*60; ?>" <? selected($opData['time'], 60*60, true); ?>>Hours</option>
|
||||
<option value="<? echo 60*60*24; ?>" <? selected($opData['time'], 60*60*24, true); ?>>Days</option>
|
||||
<option value="<? echo 60*60*24*30; ?>" <? selected($opData['time'], 60*60*24*30, true); ?>>Months</option>
|
||||
<option value="<? echo 60*60*24*365; ?>" <? selected($opData['time'], 60*60*24*365, true); ?>>Years</option>
|
||||
</select>
|
||||
<?
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom Checked
|
||||
*
|
||||
* Allows using arrays in checked variables
|
||||
* @return boolean
|
||||
*/
|
||||
function jop_checked($haystack, $cur, $show = FALSE){
|
||||
if(is_array($haystack) && in_array($cur, $haystack)){
|
||||
$cur = $haystack = 1;
|
||||
}
|
||||
return checked($haystack, $cur, $show);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the admin menu with user-defined flags.
|
||||
*/
|
||||
function load_admin_menu(){
|
||||
switch($this->menu_type){
|
||||
case 'page':
|
||||
$hook = add_pages_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
|
||||
break;
|
||||
case 'link':
|
||||
$hook = add_links_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
|
||||
break;
|
||||
case 'comment':
|
||||
$hook = add_comments_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
|
||||
break;
|
||||
case 'management':
|
||||
$hook = add_management_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
|
||||
break;
|
||||
case 'option':
|
||||
$hook = add_options_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
|
||||
break;
|
||||
case 'theme':
|
||||
$hook = add_theme_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
|
||||
break;
|
||||
case 'plugin':
|
||||
$hook = add_plugins_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
|
||||
break;
|
||||
case 'user':
|
||||
$hook = add_users_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
|
||||
break;
|
||||
case 'dashboard':
|
||||
$hook = add_dashboard_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
|
||||
break;
|
||||
case 'post':
|
||||
$hook = add_posts_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
|
||||
break;
|
||||
case 'media':
|
||||
$hook = add_media_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
|
||||
break;
|
||||
default:
|
||||
$hook = add_menu_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'), $this->icon, $this->menu_pos);
|
||||
break;
|
||||
}
|
||||
$this->hook = $hook;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load up admin dependancies for functionality
|
||||
*/
|
||||
public function load_admin_deps($hook = false){
|
||||
if($hook == $this->hook && $hook != false){
|
||||
|
||||
if(function_exists('wp_enqueue_media')) wp_enqueue_media();
|
||||
|
||||
wp_enqueue_style('spectrum');
|
||||
wp_enqueue_script('spectrum');
|
||||
|
||||
wp_enqueue_style($this->prefix.'admin_css');
|
||||
wp_enqueue_script($this->prefix.'admin_js');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registering Admin information.
|
||||
*/
|
||||
public function register_admin_deps(){
|
||||
foreach($this->options as $k => $v) register_setting($this->prefix.'options', $this->prefix.$k);
|
||||
|
||||
|
||||
if(preg_match('/\/themes\//i', $this->file_data)){
|
||||
$type = 'theme';
|
||||
}elseif(preg_match('/\/plugins\//i', $this->file_data)){
|
||||
$type = 'plugin';
|
||||
}
|
||||
|
||||
if('theme' == $type){
|
||||
$stylesheetDir = get_bloginfo('stylesheet_directory');
|
||||
$urls = array(
|
||||
$stylesheetDir.'/'.basename( dirname( dirname(__FILE__) ) ).'/jw-simple-options/css',
|
||||
$stylesheetDir.'/'.basename( dirname( dirname(__FILE__) ) ).'/jw-simple-options/js',
|
||||
);
|
||||
}else{
|
||||
$urls = array(
|
||||
'css' => plugins_url('css', __FILE__),
|
||||
'js' => plugins_url('js', __FILE__)
|
||||
);
|
||||
}
|
||||
|
||||
wp_register_style('spectrum', $urls['css'].'/spectrum.css', '', '1.0.9');
|
||||
wp_register_script('spectrum', $urls['js'].'/spectrum.js', array('jquery'), '1.0.9' );
|
||||
|
||||
wp_register_style( $this->prefix.'admin_css', $urls['css'].'/jw_simple_options.css', '', '1.0');
|
||||
wp_register_script( $this->prefix.'admin_js', $urls['js'].'/jquery.jw_simple_options.js' , '', '1.0');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Display user-end options page
|
||||
*/
|
||||
public function render_options_page(){
|
||||
|
||||
?>
|
||||
<div class="wrap">
|
||||
<div id="icon-options-general" class="icon32"><br /></div>
|
||||
<h2><? echo $this->plugin_title; ?></h2>
|
||||
<p class="description">Options page powered by: <a href="https://github.com/JayWood/jw_simple_options" title="A simple, easy to configure, flexible, and open-source framework to make options pages on the fly.">JW Simple Options</a></p>
|
||||
<form method="post" action="options.php">
|
||||
<? settings_fields($this->prefix.'options'); ?>
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<?
|
||||
foreach ($this->options as $k => $v){
|
||||
?>
|
||||
<tr valign="top">
|
||||
<th scope="row"><label for="<? echo $this->prefix.$k; ?>"><? echo $v['name']; ?></label></th>
|
||||
<td><? echo $this->render_option_field($k, $v); ?>
|
||||
<? if( isset( $v['desc'] ) ): ?>
|
||||
<p class="description"><? echo $v['desc']; ?></p>
|
||||
<? endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="submit">
|
||||
<input type="submit" name="submit" id="submit" class="button-primary" value="Save Changes">
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
|
||||
/**
|
||||
* Display Spectrum color selection
|
||||
*
|
||||
* @param string $key Option identifier minus prefix.
|
||||
* @param array $data Associative array of field data with value in hex6 format. ie. array('colorID' => '#FFFFFF')
|
||||
*/
|
||||
public function render_color_select($key, $data){
|
||||
|
||||
$opData = get_option($this->prefix.$key, $data);
|
||||
|
||||
$output = '<!-- Color Selects -->';
|
||||
foreach($opData as $k => $v){
|
||||
$output .= '<input type="text" id="'.$key.'_'.$k.'" name="'.$this->prefix.$key.'['.$k.']" value="'.$v.'" class="color_select">';
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch between options data types and display them.
|
||||
*
|
||||
* Offload rendering where necessary.
|
||||
*/
|
||||
public function render_option_field($key, $data){
|
||||
switch($data['type']){
|
||||
case 'text':
|
||||
$output = '<input type="text" name="'.$this->prefix.$key.'" id="'.$this->prefix.$key.'" value="'.get_option($this->prefix.$key, $data['def']).'" class="regular-text" />';
|
||||
break;
|
||||
case 'password':
|
||||
$output = '<input type="password" name="'.$this->prefix.$key.'" id="'.$this->prefix.$key.'" value="'.get_option($this->prefix.$key).'" class="regular-text" />';
|
||||
break;
|
||||
case 'number':
|
||||
$output = '<input type="number" name="'.$this->prefix.$key.'" id="'.$this->prefix.$key.'" value="'.get_option($this->prefix.$key, $data['def']).'" />';
|
||||
break;
|
||||
case 'data_array':
|
||||
$output = $this->buildDataArrayFields($key, $data['fields'], $data['showhead']);
|
||||
break;
|
||||
case 'select':
|
||||
$output = $this->buildSelectOptions($key, $data['fields'], $data['def']);
|
||||
break;
|
||||
case 'color':
|
||||
$output = $this->render_color_select($key, $data['fields']);
|
||||
break;
|
||||
case 'media':
|
||||
if(function_exists('wp_enqueue_media')) $output = $this->buildMediaOption($key);
|
||||
break;
|
||||
case 'check':
|
||||
$output = $this->buildCheckFields($key, $data['fields'], $data['def']);
|
||||
break;
|
||||
case 'radio':
|
||||
$output = $this->buildRadioFields($key, $data['fields'], $data['def']);
|
||||
break;
|
||||
case 'textbox':
|
||||
$output = '<textarea name="'.$this->prefix.$key.'" id="'.$this->prefix.$key.'" rows="10" cols="50" class="large-text code" >'.get_option($this->prefix.$key, $data['def']).'</textarea>';
|
||||
break;
|
||||
case 'timeframe':
|
||||
$output = $this->buildTimeframe($key, $data['def']);
|
||||
break;
|
||||
case 'editor':
|
||||
$opData = get_option($this->prefix.$key, $data['def']);
|
||||
$output = wp_editor($opData, $this->prefix.$key, $data['settings']);
|
||||
default:
|
||||
$output = '<!-- Option ID: '.$key.'.'.$data['type'].' is not a valid option type. -->';
|
||||
break;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstalls any options.
|
||||
*
|
||||
* Needs to be called from functions.php
|
||||
* @see register_uninstall_hook()
|
||||
*/
|
||||
public function uninstall(){
|
||||
if( !defined( 'WP_UNINSTALL_PLUGIN' ) ) return false;
|
||||
// Remove options
|
||||
foreach ($this->options as $k => $v) delete_option($this->prefix.$k);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user