wordpress-starter 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -1
- data/README.md +12 -0
- data/lib/wordpress-starter.rb +2 -1
- data/templates/bootstrap/404.php +24 -0
- data/templates/bootstrap/admin/README.txt +25 -0
- data/templates/bootstrap/admin/assets/css/admin-style.css +838 -0
- data/templates/bootstrap/admin/assets/css/colorpicker.css +177 -0
- data/templates/bootstrap/admin/assets/images/1col.png +0 -0
- data/templates/bootstrap/admin/assets/images/2-col-portfolio.png +0 -0
- data/templates/bootstrap/admin/assets/images/2cl.png +0 -0
- data/templates/bootstrap/admin/assets/images/2cr.png +0 -0
- data/templates/bootstrap/admin/assets/images/3-col-portfolio.png +0 -0
- data/templates/bootstrap/admin/assets/images/3cm.png +0 -0
- data/templates/bootstrap/admin/assets/images/3cr.png +0 -0
- data/templates/bootstrap/admin/assets/images/4-col-portfolio.png +0 -0
- data/templates/bootstrap/admin/assets/images/accept.png +0 -0
- data/templates/bootstrap/admin/assets/images/button_check.png +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/blank.gif +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_background.png +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_hex.png +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_hsb_b.png +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_hsb_h.png +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_hsb_s.png +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_indic.gif +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_overlay.png +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_rgb_b.png +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_rgb_g.png +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_rgb_r.png +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_select.gif +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/colorpicker_submit.png +0 -0
- data/templates/bootstrap/admin/assets/images/colorpicker/select.png +0 -0
- data/templates/bootstrap/admin/assets/images/dropdown-arrow.png +0 -0
- data/templates/bootstrap/admin/assets/images/favicon.ico +0 -0
- data/templates/bootstrap/admin/assets/images/icon-add.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon-backup.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon-delete.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon-docs.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon-edit.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon-home.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon-info.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon-notice.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon-paint.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon-settings.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon-slider.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon-warn.png +0 -0
- data/templates/bootstrap/admin/assets/images/icon_option.png +0 -0
- data/templates/bootstrap/admin/assets/images/loading-bottom.gif +0 -0
- data/templates/bootstrap/admin/assets/images/select.png +0 -0
- data/templates/bootstrap/admin/assets/images/sign_warning.png +0 -0
- data/templates/bootstrap/admin/assets/images/stop.png +0 -0
- data/templates/bootstrap/admin/assets/images/toggle_tabs.png +0 -0
- data/templates/bootstrap/admin/assets/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/templates/bootstrap/admin/assets/images/warning.png +0 -0
- data/templates/bootstrap/admin/assets/images/wrench.png +0 -0
- data/templates/bootstrap/admin/assets/images/wrench16.png +0 -0
- data/templates/bootstrap/admin/assets/js/ajaxupload.js +606 -0
- data/templates/bootstrap/admin/assets/js/colorpicker.js +455 -0
- data/templates/bootstrap/admin/assets/js/cookie.js +1 -0
- data/templates/bootstrap/admin/assets/js/jquery.maskedinput-1.2.2.js +252 -0
- data/templates/bootstrap/admin/assets/js/jquery.tipsy.js +241 -0
- data/templates/bootstrap/admin/assets/js/of-medialibrary-uploader.js +168 -0
- data/templates/bootstrap/admin/assets/js/smof.js +623 -0
- data/templates/bootstrap/admin/classes/class.options-machine.php +627 -0
- data/templates/bootstrap/admin/front-end/options.php +77 -0
- data/templates/bootstrap/admin/functions/functions.admin.php +76 -0
- data/templates/bootstrap/admin/functions/functions.interface.php +232 -0
- data/templates/bootstrap/admin/functions/functions.load.php +14 -0
- data/templates/bootstrap/admin/functions/functions.mediauploader.php +194 -0
- data/templates/bootstrap/admin/functions/functions.options.php +508 -0
- data/templates/bootstrap/admin/functions/functions.php +0 -0
- data/templates/bootstrap/admin/index.php +87 -0
- data/templates/bootstrap/admin/layouts/default.css +0 -0
- data/templates/bootstrap/admin/layouts/placebo.css +0 -0
- data/templates/bootstrap/archive.php +57 -0
- data/templates/bootstrap/category.php +40 -0
- data/templates/bootstrap/comments.php +65 -0
- data/templates/bootstrap/content-aside.php +26 -0
- data/templates/bootstrap/content-image.php +29 -0
- data/templates/bootstrap/content-link.php +27 -0
- data/templates/bootstrap/content-none.php +21 -0
- data/templates/bootstrap/content-page.php +24 -0
- data/templates/bootstrap/content-quote.php +26 -0
- data/templates/bootstrap/content-status.php +33 -0
- data/templates/bootstrap/content.php +67 -0
- data/templates/bootstrap/editor-style.scss +72 -0
- data/templates/bootstrap/footer.php +29 -0
- data/templates/bootstrap/functions.php +1528 -0
- data/templates/bootstrap/header.php +74 -0
- data/templates/bootstrap/ie.scss +1 -0
- data/templates/bootstrap/images/bg/bg0.png +0 -0
- data/templates/bootstrap/images/bg/bg1.png +0 -0
- data/templates/bootstrap/images/bg/bg10.png +0 -0
- data/templates/bootstrap/images/bg/bg11.png +0 -0
- data/templates/bootstrap/images/bg/bg2.png +0 -0
- data/templates/bootstrap/images/bg/bg3.png +0 -0
- data/templates/bootstrap/images/bg/bg4.png +0 -0
- data/templates/bootstrap/images/bg/bg5.png +0 -0
- data/templates/bootstrap/images/bg/bg6.jpg +0 -0
- data/templates/bootstrap/images/bg/bg7.jpg +0 -0
- data/templates/bootstrap/images/bg/bg8.png +0 -0
- data/templates/bootstrap/images/bg/bg9.png +0 -0
- data/templates/bootstrap/images/glyphicons-halflings-white.png +0 -0
- data/templates/bootstrap/images/glyphicons-halflings.png +0 -0
- data/templates/bootstrap/index.php +19 -0
- data/templates/bootstrap/javascripts/app.js +6 -0
- data/templates/bootstrap/javascripts/bootstrap.js +2159 -0
- data/templates/bootstrap/javascripts/bootstrap.min.js +6 -0
- data/templates/{project/javascripts/moderninzr.min.js → bootstrap/javascripts/modernizr.min.js} +0 -0
- data/templates/bootstrap/languages/readme.txt +6 -0
- data/templates/bootstrap/license.txt +281 -0
- data/templates/bootstrap/loop.php +30 -0
- data/templates/bootstrap/manifest.rb +156 -0
- data/templates/bootstrap/options.php +42 -0
- data/templates/bootstrap/page.php +29 -0
- data/templates/bootstrap/print.scss +104 -0
- data/templates/bootstrap/readme.txt +6 -0
- data/templates/bootstrap/sass/_app.scss +10 -0
- data/templates/bootstrap/sass/_settings.scss +301 -0
- data/templates/bootstrap/screen.scss +1 -0
- data/templates/bootstrap/screenshot.png +0 -0
- data/templates/bootstrap/search.php +31 -0
- data/templates/bootstrap/searchform.php +31 -0
- data/templates/bootstrap/sidebar.php +15 -0
- data/templates/bootstrap/single.php +31 -0
- data/templates/bootstrap/style.css +18 -0
- data/templates/bootstrap/tag.php +41 -0
- data/templates/foundation/functions.php +8 -9
- data/templates/foundation/sass/_app.scss +2 -0
- data/templates/project/functions.php +1 -1
- data/templates/project/javascripts/app.js +2 -5
- data/templates/project/javascripts/modernizr.min.js +4 -0
- data/templates/project/manifest.rb +1 -1
- metadata +141 -2
@@ -0,0 +1,168 @@
|
|
1
|
+
/*-----------------------------------------------------------------------------------*/
|
2
|
+
/* WooFramework Media Library-driven AJAX File Uploader Module
|
3
|
+
/* JavaScript Functions (2010-11-05)
|
4
|
+
/*
|
5
|
+
/* The code below is designed to work as a part of the WooFramework Media Library-driven
|
6
|
+
/* AJAX File Uploader Module. It is included only on screens where this module is used.
|
7
|
+
/*
|
8
|
+
/* Used with (very) slight modifications for Options Framework.
|
9
|
+
/*-----------------------------------------------------------------------------------*/
|
10
|
+
|
11
|
+
(function ($) {
|
12
|
+
|
13
|
+
optionsframeworkMLU = {
|
14
|
+
|
15
|
+
/*-----------------------------------------------------------------------------------*/
|
16
|
+
/* Remove file when the "remove" button is clicked.
|
17
|
+
/*-----------------------------------------------------------------------------------*/
|
18
|
+
|
19
|
+
removeFile: function () {
|
20
|
+
|
21
|
+
$('.mlu_remove_button').live('click', function(event) {
|
22
|
+
var clickedObject = $(this);
|
23
|
+
var theID = $(this).attr('title');
|
24
|
+
var image_to_remove = $('#image_' + theID);
|
25
|
+
var button_to_hide = $('#reset_' + theID);
|
26
|
+
image_to_remove.fadeOut(500,function(){ $(this).remove(); });
|
27
|
+
button_to_hide.fadeOut();
|
28
|
+
clickedObject.parent().prev('input').val('');
|
29
|
+
return false;
|
30
|
+
});
|
31
|
+
|
32
|
+
// Hide the delete button on the first row
|
33
|
+
$('a.delete-inline', "#option-1").hide();
|
34
|
+
|
35
|
+
}, // End removeFile
|
36
|
+
|
37
|
+
/*-----------------------------------------------------------------------------------*/
|
38
|
+
/* Replace the default file upload field with a customised version.
|
39
|
+
/*-----------------------------------------------------------------------------------*/
|
40
|
+
|
41
|
+
recreateFileField: function () {
|
42
|
+
|
43
|
+
$('input.file').each(function(){
|
44
|
+
var uploadbutton = '<input class="upload_file_button" type="button" value="Upload" />';
|
45
|
+
$(this).wrap('<div class="file_wrap" />');
|
46
|
+
$(this).addClass('file').css('opacity', 0); //set to invisible
|
47
|
+
$(this).parent().append($('<div class="fake_file" />').append($('<input type="text" class="upload" />').attr('id',$(this).attr('id')+'_file')).val( $(this).val() ).append(uploadbutton));
|
48
|
+
|
49
|
+
$(this).bind('change', function() {
|
50
|
+
$('#'+$(this).attr('id')+'_file').val($(this).val());
|
51
|
+
});
|
52
|
+
$(this).bind('mouseout', function() {
|
53
|
+
$('#'+$(this).attr('id')+'_file').val($(this).val());
|
54
|
+
});
|
55
|
+
});
|
56
|
+
|
57
|
+
}, // End recreateFileField
|
58
|
+
|
59
|
+
/*-----------------------------------------------------------------------------------*/
|
60
|
+
/* Use a custom function when working with the Media Uploads popup.
|
61
|
+
/* Requires jQuery, Media Upload and Thickbox JavaScripts.
|
62
|
+
/*-----------------------------------------------------------------------------------*/
|
63
|
+
|
64
|
+
mediaUpload: function () {
|
65
|
+
|
66
|
+
jQuery.noConflict();
|
67
|
+
|
68
|
+
$( '.media_upload_button' ).removeAttr('style');
|
69
|
+
|
70
|
+
var formfield,
|
71
|
+
formID,
|
72
|
+
btnContent = true,
|
73
|
+
tbframe_interval;
|
74
|
+
// On Click
|
75
|
+
$('.media_upload_button').live("click", function () {
|
76
|
+
clickedObject = $(this);
|
77
|
+
formfield = $(this).parent().prev('input').attr('id');
|
78
|
+
formID = $(this).attr('rel');
|
79
|
+
imgID = $(this).attr('id');
|
80
|
+
|
81
|
+
//Change "insert into post" to "Use this Button"
|
82
|
+
tbframe_interval = setInterval(function() {jQuery('#TB_iframeContent').contents().find('.savesend .button').val('Use This Image');}, 2000);
|
83
|
+
|
84
|
+
// Display a custom title for each Thickbox popup.
|
85
|
+
var woo_title = '';
|
86
|
+
|
87
|
+
if ( $(this).parents('.section').find('.heading') ) { woo_title = $(this).parents('.section').find('.heading').text(); } // End IF Statement
|
88
|
+
|
89
|
+
tb_show( woo_title, 'media-upload.php?post_id='+formID+'&TB_iframe=1' );
|
90
|
+
return false;
|
91
|
+
});
|
92
|
+
|
93
|
+
window.original_send_to_editor = window.send_to_editor;
|
94
|
+
window.send_to_editor = function(html) {
|
95
|
+
|
96
|
+
if (formfield) {
|
97
|
+
|
98
|
+
//clear interval for "Use this Button" so button text resets
|
99
|
+
clearInterval(tbframe_interval);
|
100
|
+
|
101
|
+
// itemurl = $(html).attr('href'); // Use the URL to the main image.
|
102
|
+
|
103
|
+
if ( $(html).html(html).find('img').length > 0 ) {
|
104
|
+
|
105
|
+
itemurl = $(html).html(html).find('img').attr('src'); // Use the URL to the size selected.
|
106
|
+
|
107
|
+
} else {
|
108
|
+
|
109
|
+
// It's not an image. Get the URL to the file instead.
|
110
|
+
|
111
|
+
var htmlBits = html.split("'"); // jQuery seems to strip out XHTML when assigning the string to an object. Use alternate method.
|
112
|
+
itemurl = htmlBits[1]; // Use the URL to the file.
|
113
|
+
|
114
|
+
var itemtitle = htmlBits[2];
|
115
|
+
|
116
|
+
itemtitle = itemtitle.replace( '>', '' );
|
117
|
+
itemtitle = itemtitle.replace( '</a>', '' );
|
118
|
+
|
119
|
+
} // End IF Statement
|
120
|
+
|
121
|
+
var image = /(^.*\.jpg|jpeg|png|gif|ico*)/gi;
|
122
|
+
var document = /(^.*\.pdf|doc|docx|ppt|pptx|odt*)/gi;
|
123
|
+
var audio = /(^.*\.mp3|m4a|ogg|wav*)/gi;
|
124
|
+
var video = /(^.*\.mp4|m4v|mov|wmv|avi|mpg|ogv|3gp|3g2*)/gi;
|
125
|
+
|
126
|
+
if (itemurl.match(image)) {
|
127
|
+
btnContent = '<a class="of-uploaded-image" href="'+itemurl+'"><img id="image_'+imgID+'" class="of-option-image" src="'+itemurl+'" alt="" /></a>';
|
128
|
+
} else {
|
129
|
+
|
130
|
+
// No output preview if it's not an image.
|
131
|
+
// btnContent = '';
|
132
|
+
// Standard generic output if it's not an image.
|
133
|
+
|
134
|
+
html = '<a href="'+itemurl+'" target="_blank" rel="external">View File</a>';
|
135
|
+
btnContent = 'Sorry, but that is not a valid image URL';
|
136
|
+
}
|
137
|
+
|
138
|
+
$('#' + formfield).val(itemurl);
|
139
|
+
// $('#' + formfield).next().next('div').slideDown().html(btnContent);
|
140
|
+
$('#' + formfield).siblings('.screenshot').fadeIn().html(btnContent);
|
141
|
+
clickedObject.next('span').fadeIn();
|
142
|
+
tb_remove();
|
143
|
+
|
144
|
+
} else {
|
145
|
+
window.original_send_to_editor(html);
|
146
|
+
}
|
147
|
+
|
148
|
+
// Clear the formfield value so the other media library popups can work as they are meant to. - 2010-11-11.
|
149
|
+
formfield = '';
|
150
|
+
}
|
151
|
+
|
152
|
+
} // End mediaUpload
|
153
|
+
|
154
|
+
}; // End optionsframeworkMLU Object // Don't remove this, or the sky will fall on your head.
|
155
|
+
|
156
|
+
/*-----------------------------------------------------------------------------------*/
|
157
|
+
/* Execute the above methods in the optionsframeworkMLU object.
|
158
|
+
/*-----------------------------------------------------------------------------------*/
|
159
|
+
|
160
|
+
$(document).ready(function () {
|
161
|
+
|
162
|
+
optionsframeworkMLU.removeFile();
|
163
|
+
optionsframeworkMLU.recreateFileField();
|
164
|
+
optionsframeworkMLU.mediaUpload();
|
165
|
+
|
166
|
+
});
|
167
|
+
|
168
|
+
})(jQuery);
|
@@ -0,0 +1,623 @@
|
|
1
|
+
/**
|
2
|
+
* SMOF js
|
3
|
+
*
|
4
|
+
* contains the core functionalities to be used
|
5
|
+
* inside SMOF
|
6
|
+
*/
|
7
|
+
|
8
|
+
jQuery.noConflict();
|
9
|
+
|
10
|
+
/** Fire up jQuery - let's dance!
|
11
|
+
*/
|
12
|
+
jQuery(document).ready(function($){
|
13
|
+
|
14
|
+
//(un)fold options in a checkbox-group
|
15
|
+
jQuery('.fld').click(function() {
|
16
|
+
var $fold='.f_'+this.id;
|
17
|
+
$($fold).slideToggle('normal', "swing");
|
18
|
+
});
|
19
|
+
|
20
|
+
//delays until AjaxUpload is finished loading
|
21
|
+
//fixes bug in Safari and Mac Chrome
|
22
|
+
if (typeof AjaxUpload != 'function') {
|
23
|
+
return ++counter < 6 && window.setTimeout(init, counter * 500);
|
24
|
+
}
|
25
|
+
|
26
|
+
//hides warning if js is enabled
|
27
|
+
$('#js-warning').hide();
|
28
|
+
|
29
|
+
//Tabify Options
|
30
|
+
$('.group').hide();
|
31
|
+
|
32
|
+
// Display last current tab
|
33
|
+
if ($.cookie("of_current_opt") === null) {
|
34
|
+
$('.group:first').fadeIn('fast');
|
35
|
+
$('#of-nav li:first').addClass('current');
|
36
|
+
} else {
|
37
|
+
|
38
|
+
var hooks = $('#hooks').html();
|
39
|
+
hooks = jQuery.parseJSON(hooks);
|
40
|
+
|
41
|
+
$.each(hooks, function(key, value) {
|
42
|
+
|
43
|
+
if ($.cookie("of_current_opt") == '#of-option-'+ value) {
|
44
|
+
$('.group#of-option-' + value).fadeIn();
|
45
|
+
$('#of-nav li.' + value).addClass('current');
|
46
|
+
}
|
47
|
+
|
48
|
+
});
|
49
|
+
|
50
|
+
}
|
51
|
+
|
52
|
+
//Current Menu Class
|
53
|
+
$('#of-nav li a').click(function(evt){
|
54
|
+
// event.preventDefault();
|
55
|
+
|
56
|
+
$('#of-nav li').removeClass('current');
|
57
|
+
$(this).parent().addClass('current');
|
58
|
+
|
59
|
+
var clicked_group = $(this).attr('href');
|
60
|
+
|
61
|
+
$.cookie('of_current_opt', clicked_group, { expires: 7, path: '/' });
|
62
|
+
|
63
|
+
$('.group').hide();
|
64
|
+
|
65
|
+
$(clicked_group).fadeIn('fast');
|
66
|
+
return false;
|
67
|
+
|
68
|
+
});
|
69
|
+
|
70
|
+
//Expand Options
|
71
|
+
var flip = 0;
|
72
|
+
|
73
|
+
$('#expand_options').click(function(){
|
74
|
+
if(flip == 0){
|
75
|
+
flip = 1;
|
76
|
+
$('#of_container #of-nav').hide();
|
77
|
+
$('#of_container #content').width(755);
|
78
|
+
$('#of_container .group').add('#of_container .group h2').show();
|
79
|
+
|
80
|
+
$(this).removeClass('expand');
|
81
|
+
$(this).addClass('close');
|
82
|
+
$(this).text('Close');
|
83
|
+
|
84
|
+
} else {
|
85
|
+
flip = 0;
|
86
|
+
$('#of_container #of-nav').show();
|
87
|
+
$('#of_container #content').width(595);
|
88
|
+
$('#of_container .group').add('#of_container .group h2').hide();
|
89
|
+
$('#of_container .group:first').show();
|
90
|
+
$('#of_container #of-nav li').removeClass('current');
|
91
|
+
$('#of_container #of-nav li:first').addClass('current');
|
92
|
+
|
93
|
+
$(this).removeClass('close');
|
94
|
+
$(this).addClass('expand');
|
95
|
+
$(this).text('Expand');
|
96
|
+
|
97
|
+
}
|
98
|
+
|
99
|
+
});
|
100
|
+
|
101
|
+
//Update Message popup
|
102
|
+
$.fn.center = function () {
|
103
|
+
this.animate({"top":( $(window).height() - this.height() - 200 ) / 2+$(window).scrollTop() + "px"},100);
|
104
|
+
this.css("left", 250 );
|
105
|
+
return this;
|
106
|
+
}
|
107
|
+
|
108
|
+
|
109
|
+
$('#of-popup-save').center();
|
110
|
+
$('#of-popup-reset').center();
|
111
|
+
$('#of-popup-fail').center();
|
112
|
+
|
113
|
+
$(window).scroll(function() {
|
114
|
+
$('#of-popup-save').center();
|
115
|
+
$('#of-popup-reset').center();
|
116
|
+
$('#of-popup-fail').center();
|
117
|
+
});
|
118
|
+
|
119
|
+
|
120
|
+
//Masked Inputs (images as radio buttons)
|
121
|
+
$('.of-radio-img-img').click(function(){
|
122
|
+
$(this).parent().parent().find('.of-radio-img-img').removeClass('of-radio-img-selected');
|
123
|
+
$(this).addClass('of-radio-img-selected');
|
124
|
+
});
|
125
|
+
$('.of-radio-img-label').hide();
|
126
|
+
$('.of-radio-img-img').show();
|
127
|
+
$('.of-radio-img-radio').hide();
|
128
|
+
|
129
|
+
//Masked Inputs (background images as radio buttons)
|
130
|
+
$('.of-radio-tile-img').click(function(){
|
131
|
+
$(this).parent().parent().find('.of-radio-tile-img').removeClass('of-radio-tile-selected');
|
132
|
+
$(this).addClass('of-radio-tile-selected');
|
133
|
+
});
|
134
|
+
$('.of-radio-tile-label').hide();
|
135
|
+
$('.of-radio-tile-img').show();
|
136
|
+
$('.of-radio-tile-radio').hide();
|
137
|
+
|
138
|
+
//AJAX Upload
|
139
|
+
function of_image_upload() {
|
140
|
+
$('.image_upload_button').each(function(){
|
141
|
+
|
142
|
+
var clickedObject = $(this);
|
143
|
+
var clickedID = $(this).attr('id');
|
144
|
+
|
145
|
+
var nonce = $('#security').val();
|
146
|
+
|
147
|
+
new AjaxUpload(clickedID, {
|
148
|
+
action: ajaxurl,
|
149
|
+
name: clickedID, // File upload name
|
150
|
+
data: { // Additional data to send
|
151
|
+
action: 'of_ajax_post_action',
|
152
|
+
type: 'upload',
|
153
|
+
security: nonce,
|
154
|
+
data: clickedID },
|
155
|
+
autoSubmit: true, // Submit file after selection
|
156
|
+
responseType: false,
|
157
|
+
onChange: function(file, extension){},
|
158
|
+
onSubmit: function(file, extension){
|
159
|
+
clickedObject.text('Uploading'); // change button text, when user selects file
|
160
|
+
this.disable(); // If you want to allow uploading only 1 file at time, you can disable upload button
|
161
|
+
interval = window.setInterval(function(){
|
162
|
+
var text = clickedObject.text();
|
163
|
+
if (text.length < 13){ clickedObject.text(text + '.'); }
|
164
|
+
else { clickedObject.text('Uploading'); }
|
165
|
+
}, 200);
|
166
|
+
},
|
167
|
+
onComplete: function(file, response) {
|
168
|
+
window.clearInterval(interval);
|
169
|
+
clickedObject.text('Upload Image');
|
170
|
+
this.enable(); // enable upload button
|
171
|
+
|
172
|
+
|
173
|
+
// If nonce fails
|
174
|
+
if(response==-1){
|
175
|
+
var fail_popup = $('#of-popup-fail');
|
176
|
+
fail_popup.fadeIn();
|
177
|
+
window.setTimeout(function(){
|
178
|
+
fail_popup.fadeOut();
|
179
|
+
}, 2000);
|
180
|
+
}
|
181
|
+
|
182
|
+
// If there was an error
|
183
|
+
else if(response.search('Upload Error') > -1){
|
184
|
+
var buildReturn = '<span class="upload-error">' + response + '</span>';
|
185
|
+
$(".upload-error").remove();
|
186
|
+
clickedObject.parent().after(buildReturn);
|
187
|
+
|
188
|
+
}
|
189
|
+
else{
|
190
|
+
var buildReturn = '<img class="hide of-option-image" id="image_'+clickedID+'" src="'+response+'" alt="" />';
|
191
|
+
|
192
|
+
$(".upload-error").remove();
|
193
|
+
$("#image_" + clickedID).remove();
|
194
|
+
clickedObject.parent().after(buildReturn);
|
195
|
+
$('img#image_'+clickedID).fadeIn();
|
196
|
+
clickedObject.next('span').fadeIn();
|
197
|
+
clickedObject.parent().prev('input').val(response);
|
198
|
+
}
|
199
|
+
}
|
200
|
+
});
|
201
|
+
|
202
|
+
});
|
203
|
+
|
204
|
+
}
|
205
|
+
|
206
|
+
of_image_upload();
|
207
|
+
|
208
|
+
//AJAX Remove Image (clear option value)
|
209
|
+
$('.image_reset_button').live('click', function(){
|
210
|
+
|
211
|
+
var clickedObject = $(this);
|
212
|
+
var clickedID = $(this).attr('id');
|
213
|
+
var theID = $(this).attr('title');
|
214
|
+
|
215
|
+
var nonce = $('#security').val();
|
216
|
+
|
217
|
+
var data = {
|
218
|
+
action: 'of_ajax_post_action',
|
219
|
+
type: 'image_reset',
|
220
|
+
security: nonce,
|
221
|
+
data: theID
|
222
|
+
};
|
223
|
+
|
224
|
+
$.post(ajaxurl, data, function(response) {
|
225
|
+
|
226
|
+
//check nonce
|
227
|
+
if(response==-1){ //failed
|
228
|
+
|
229
|
+
var fail_popup = $('#of-popup-fail');
|
230
|
+
fail_popup.fadeIn();
|
231
|
+
window.setTimeout(function(){
|
232
|
+
fail_popup.fadeOut();
|
233
|
+
}, 2000);
|
234
|
+
}
|
235
|
+
|
236
|
+
else {
|
237
|
+
|
238
|
+
var image_to_remove = $('#image_' + theID);
|
239
|
+
var button_to_hide = $('#reset_' + theID);
|
240
|
+
image_to_remove.fadeOut(500,function(){ $(this).remove(); });
|
241
|
+
button_to_hide.fadeOut();
|
242
|
+
clickedObject.parent().prev('input').val('');
|
243
|
+
}
|
244
|
+
|
245
|
+
|
246
|
+
});
|
247
|
+
|
248
|
+
});
|
249
|
+
|
250
|
+
// Style Select
|
251
|
+
(function ($) {
|
252
|
+
styleSelect = {
|
253
|
+
init: function () {
|
254
|
+
$('.select_wrapper').each(function () {
|
255
|
+
$(this).prepend('<span>' + $(this).find('.select option:selected').text() + '</span>');
|
256
|
+
});
|
257
|
+
$('.select').live('change', function () {
|
258
|
+
$(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>');
|
259
|
+
});
|
260
|
+
$('.select').bind($.browser.msie ? 'click' : 'change', function(event) {
|
261
|
+
$(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>');
|
262
|
+
});
|
263
|
+
}
|
264
|
+
};
|
265
|
+
$(document).ready(function () {
|
266
|
+
styleSelect.init()
|
267
|
+
})
|
268
|
+
})(jQuery);
|
269
|
+
|
270
|
+
|
271
|
+
/** Aquagraphite Slider MOD */
|
272
|
+
|
273
|
+
//Hide (Collapse) the toggle containers on load
|
274
|
+
$(".slide_body").hide();
|
275
|
+
|
276
|
+
//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
|
277
|
+
$(".slide_edit_button").live( 'click', function(){
|
278
|
+
$(this).parent().toggleClass("active").next().slideToggle("fast");
|
279
|
+
return false; //Prevent the browser jump to the link anchor
|
280
|
+
});
|
281
|
+
|
282
|
+
// Update slide title upon typing
|
283
|
+
function update_slider_title(e) {
|
284
|
+
var element = e;
|
285
|
+
if ( this.timer ) {
|
286
|
+
clearTimeout( element.timer );
|
287
|
+
}
|
288
|
+
this.timer = setTimeout( function() {
|
289
|
+
$(element).parent().prev().find('strong').text( element.value );
|
290
|
+
}, 100);
|
291
|
+
return true;
|
292
|
+
}
|
293
|
+
|
294
|
+
$('.of-slider-title').live('keyup', function(){
|
295
|
+
update_slider_title(this);
|
296
|
+
});
|
297
|
+
|
298
|
+
|
299
|
+
//Remove individual slide
|
300
|
+
$('.slide_delete_button').live('click', function(){
|
301
|
+
// event.preventDefault();
|
302
|
+
var agree = confirm("Are you sure you wish to delete this slide?");
|
303
|
+
if (agree) {
|
304
|
+
var $trash = $(this).parents('li');
|
305
|
+
//$trash.slideUp('slow', function(){ $trash.remove(); }); //chrome + confirm bug made slideUp not working...
|
306
|
+
$trash.animate({
|
307
|
+
opacity: 0.25,
|
308
|
+
height: 0,
|
309
|
+
}, 500, function() {
|
310
|
+
$(this).remove();
|
311
|
+
});
|
312
|
+
return false; //Prevent the browser jump to the link anchor
|
313
|
+
} else {
|
314
|
+
return false;
|
315
|
+
}
|
316
|
+
});
|
317
|
+
|
318
|
+
//Add new slide
|
319
|
+
$(".slide_add_button").live('click', function(){
|
320
|
+
var slidesContainer = $(this).prev();
|
321
|
+
var sliderId = slidesContainer.attr('id');
|
322
|
+
var sliderInt = $('#'+sliderId).attr('rel');
|
323
|
+
|
324
|
+
var numArr = $('#'+sliderId +' li').find('.order').map(function() {
|
325
|
+
var str = this.id;
|
326
|
+
str = str.replace(/\D/g,'');
|
327
|
+
str = parseFloat(str);
|
328
|
+
return str;
|
329
|
+
}).get();
|
330
|
+
|
331
|
+
var maxNum = Math.max.apply(Math, numArr);
|
332
|
+
if (maxNum < 1 ) { maxNum = 0};
|
333
|
+
var newNum = maxNum + 1;
|
334
|
+
|
335
|
+
var newSlide = '<li class="temphide"><div class="slide_header"><strong>Slide ' + newNum + '</strong><input type="hidden" class="slide of-input order" name="' + sliderId + '[' + newNum + '][order]" id="' + sliderId + '_slide_order-' + newNum + '" value="' + newNum + '"><a class="slide_edit_button" href="#">Edit</a></div><div class="slide_body" style="display: none; "><label>Title</label><input class="slide of-input of-slider-title" name="' + sliderId + '[' + newNum + '][title]" id="' + sliderId + '_' + newNum + '_slide_title" value=""><label>Image URL</label><input class="slide of-input" name="' + sliderId + '[' + newNum + '][url]" id="' + sliderId + '_' + newNum + '_slide_url" value=""><div class="upload_button_div"><span class="button media_upload_button" id="' + sliderId + '_' + newNum + '" rel="'+sliderInt+'">Upload</span><span class="button mlu_remove_button hide" id="reset_' + sliderId + '_' + newNum + '" title="' + sliderId + '_' + newNum + '">Remove</span></div><div class="screenshot"></div><label>Link URL (optional)</label><input class="slide of-input" name="' + sliderId + '[' + newNum + '][link]" id="' + sliderId + '_' + newNum + '_slide_link" value=""><label>Description (optional)</label><textarea class="slide of-input" name="' + sliderId + '[' + newNum + '][description]" id="' + sliderId + '_' + newNum + '_slide_description" cols="8" rows="8"></textarea><a class="slide_delete_button" href="#">Delete</a><div class="clear"></div></div></li>';
|
336
|
+
|
337
|
+
slidesContainer.append(newSlide);
|
338
|
+
$('.temphide').fadeIn('fast', function() {
|
339
|
+
$(this).removeClass('temphide');
|
340
|
+
});
|
341
|
+
|
342
|
+
of_image_upload(); // re-initialise upload image..
|
343
|
+
|
344
|
+
return false; //prevent jumps, as always..
|
345
|
+
});
|
346
|
+
|
347
|
+
//Sort slides
|
348
|
+
jQuery('.slider').find('ul').each( function() {
|
349
|
+
var id = jQuery(this).attr('id');
|
350
|
+
$('#'+ id).sortable({
|
351
|
+
placeholder: "placeholder",
|
352
|
+
opacity: 0.6
|
353
|
+
});
|
354
|
+
});
|
355
|
+
|
356
|
+
|
357
|
+
/** Sorter (Layout Manager) */
|
358
|
+
jQuery('.sorter').each( function() {
|
359
|
+
var id = jQuery(this).attr('id');
|
360
|
+
$('#'+ id).find('ul').sortable({
|
361
|
+
items: 'li',
|
362
|
+
placeholder: "placeholder",
|
363
|
+
connectWith: '.sortlist_' + id,
|
364
|
+
opacity: 0.6,
|
365
|
+
update: function() {
|
366
|
+
$(this).find('.position').each( function() {
|
367
|
+
|
368
|
+
var listID = $(this).parent().attr('id');
|
369
|
+
var parentID = $(this).parent().parent().attr('id');
|
370
|
+
parentID = parentID.replace(id + '_', '')
|
371
|
+
var optionID = $(this).parent().parent().parent().attr('id');
|
372
|
+
$(this).prop("name", optionID + '[' + parentID + '][' + listID + ']');
|
373
|
+
|
374
|
+
});
|
375
|
+
}
|
376
|
+
});
|
377
|
+
});
|
378
|
+
|
379
|
+
|
380
|
+
/** Ajax Backup & Restore MOD */
|
381
|
+
//backup button
|
382
|
+
$('#of_backup_button').live('click', function(){
|
383
|
+
|
384
|
+
var answer = confirm("Click OK to backup your current saved options.")
|
385
|
+
|
386
|
+
if (answer){
|
387
|
+
|
388
|
+
var clickedObject = $(this);
|
389
|
+
var clickedID = $(this).attr('id');
|
390
|
+
|
391
|
+
var nonce = $('#security').val();
|
392
|
+
|
393
|
+
var data = {
|
394
|
+
action: 'of_ajax_post_action',
|
395
|
+
type: 'backup_options',
|
396
|
+
security: nonce
|
397
|
+
};
|
398
|
+
|
399
|
+
$.post(ajaxurl, data, function(response) {
|
400
|
+
|
401
|
+
//check nonce
|
402
|
+
if(response==-1){ //failed
|
403
|
+
|
404
|
+
var fail_popup = $('#of-popup-fail');
|
405
|
+
fail_popup.fadeIn();
|
406
|
+
window.setTimeout(function(){
|
407
|
+
fail_popup.fadeOut();
|
408
|
+
}, 2000);
|
409
|
+
}
|
410
|
+
|
411
|
+
else {
|
412
|
+
|
413
|
+
var success_popup = $('#of-popup-save');
|
414
|
+
success_popup.fadeIn();
|
415
|
+
window.setTimeout(function(){
|
416
|
+
location.reload();
|
417
|
+
}, 1000);
|
418
|
+
}
|
419
|
+
|
420
|
+
});
|
421
|
+
|
422
|
+
}
|
423
|
+
|
424
|
+
return false;
|
425
|
+
|
426
|
+
});
|
427
|
+
|
428
|
+
//restore button
|
429
|
+
$('#of_restore_button').live('click', function(){
|
430
|
+
|
431
|
+
var answer = confirm("'Warning: All of your current options will be replaced with the data from your last backup! Proceed?")
|
432
|
+
|
433
|
+
if (answer){
|
434
|
+
|
435
|
+
var clickedObject = $(this);
|
436
|
+
var clickedID = $(this).attr('id');
|
437
|
+
|
438
|
+
var nonce = $('#security').val();
|
439
|
+
|
440
|
+
var data = {
|
441
|
+
action: 'of_ajax_post_action',
|
442
|
+
type: 'restore_options',
|
443
|
+
security: nonce
|
444
|
+
};
|
445
|
+
|
446
|
+
$.post(ajaxurl, data, function(response) {
|
447
|
+
|
448
|
+
//check nonce
|
449
|
+
if(response==-1){ //failed
|
450
|
+
|
451
|
+
var fail_popup = $('#of-popup-fail');
|
452
|
+
fail_popup.fadeIn();
|
453
|
+
window.setTimeout(function(){
|
454
|
+
fail_popup.fadeOut();
|
455
|
+
}, 2000);
|
456
|
+
}
|
457
|
+
|
458
|
+
else {
|
459
|
+
|
460
|
+
var success_popup = $('#of-popup-save');
|
461
|
+
success_popup.fadeIn();
|
462
|
+
window.setTimeout(function(){
|
463
|
+
location.reload();
|
464
|
+
}, 1000);
|
465
|
+
}
|
466
|
+
|
467
|
+
});
|
468
|
+
|
469
|
+
}
|
470
|
+
|
471
|
+
return false;
|
472
|
+
|
473
|
+
});
|
474
|
+
|
475
|
+
/** Ajax Transfer (Import/Export) Option */
|
476
|
+
$('#of_import_button').live('click', function(){
|
477
|
+
|
478
|
+
var answer = confirm("Click OK to import options.")
|
479
|
+
|
480
|
+
if (answer){
|
481
|
+
|
482
|
+
var clickedObject = $(this);
|
483
|
+
var clickedID = $(this).attr('id');
|
484
|
+
|
485
|
+
var nonce = $('#security').val();
|
486
|
+
|
487
|
+
var import_data = $('#export_data').val();
|
488
|
+
|
489
|
+
var data = {
|
490
|
+
action: 'of_ajax_post_action',
|
491
|
+
type: 'import_options',
|
492
|
+
security: nonce,
|
493
|
+
data: import_data
|
494
|
+
};
|
495
|
+
|
496
|
+
$.post(ajaxurl, data, function(response) {
|
497
|
+
var fail_popup = $('#of-popup-fail');
|
498
|
+
var success_popup = $('#of-popup-save');
|
499
|
+
|
500
|
+
//check nonce
|
501
|
+
if(response==-1){ //failed
|
502
|
+
fail_popup.fadeIn();
|
503
|
+
window.setTimeout(function(){
|
504
|
+
fail_popup.fadeOut();
|
505
|
+
}, 2000);
|
506
|
+
}
|
507
|
+
else
|
508
|
+
{
|
509
|
+
success_popup.fadeIn();
|
510
|
+
window.setTimeout(function(){
|
511
|
+
location.reload();
|
512
|
+
}, 1000);
|
513
|
+
}
|
514
|
+
|
515
|
+
});
|
516
|
+
|
517
|
+
}
|
518
|
+
|
519
|
+
return false;
|
520
|
+
|
521
|
+
});
|
522
|
+
|
523
|
+
/** AJAX Save Options */
|
524
|
+
$('#of_save').live('click',function() {
|
525
|
+
|
526
|
+
var nonce = $('#security').val();
|
527
|
+
|
528
|
+
$('.ajax-loading-img').fadeIn();
|
529
|
+
|
530
|
+
//get serialized data from all our option fields
|
531
|
+
var serializedReturn = $('#of_form :input[name][name!="security"][name!="of_reset"]').serialize();
|
532
|
+
|
533
|
+
var data = {
|
534
|
+
type: 'save',
|
535
|
+
action: 'of_ajax_post_action',
|
536
|
+
security: nonce,
|
537
|
+
data: serializedReturn
|
538
|
+
};
|
539
|
+
|
540
|
+
$.post(ajaxurl, data, function(response) {
|
541
|
+
var success = $('#of-popup-save');
|
542
|
+
var fail = $('#of-popup-fail');
|
543
|
+
var loading = $('.ajax-loading-img');
|
544
|
+
loading.fadeOut();
|
545
|
+
|
546
|
+
if (response==1) {
|
547
|
+
success.fadeIn();
|
548
|
+
} else {
|
549
|
+
fail.fadeIn();
|
550
|
+
}
|
551
|
+
|
552
|
+
window.setTimeout(function(){
|
553
|
+
success.fadeOut();
|
554
|
+
fail.fadeOut();
|
555
|
+
}, 2000);
|
556
|
+
});
|
557
|
+
|
558
|
+
return false;
|
559
|
+
|
560
|
+
});
|
561
|
+
|
562
|
+
|
563
|
+
/* AJAX Options Reset */
|
564
|
+
$('#of_reset').click(function() {
|
565
|
+
|
566
|
+
//confirm reset
|
567
|
+
var answer = confirm("Click OK to reset. All settings will be lost and replaced with default settings!");
|
568
|
+
|
569
|
+
//ajax reset
|
570
|
+
if (answer){
|
571
|
+
|
572
|
+
var nonce = $('#security').val();
|
573
|
+
|
574
|
+
$('.ajax-reset-loading-img').fadeIn();
|
575
|
+
|
576
|
+
var data = {
|
577
|
+
|
578
|
+
type: 'reset',
|
579
|
+
action: 'of_ajax_post_action',
|
580
|
+
security: nonce,
|
581
|
+
};
|
582
|
+
|
583
|
+
$.post(ajaxurl, data, function(response) {
|
584
|
+
var success = $('#of-popup-reset');
|
585
|
+
var fail = $('#of-popup-fail');
|
586
|
+
var loading = $('.ajax-reset-loading-img');
|
587
|
+
loading.fadeOut();
|
588
|
+
|
589
|
+
if (response==1)
|
590
|
+
{
|
591
|
+
success.fadeIn();
|
592
|
+
window.setTimeout(function(){
|
593
|
+
location.reload();
|
594
|
+
}, 1000);
|
595
|
+
}
|
596
|
+
else
|
597
|
+
{
|
598
|
+
fail.fadeIn();
|
599
|
+
window.setTimeout(function(){
|
600
|
+
fail.fadeOut();
|
601
|
+
}, 2000);
|
602
|
+
}
|
603
|
+
|
604
|
+
|
605
|
+
});
|
606
|
+
|
607
|
+
}
|
608
|
+
|
609
|
+
return false;
|
610
|
+
|
611
|
+
});
|
612
|
+
|
613
|
+
|
614
|
+
/** Tipsy @since v1.3 */
|
615
|
+
if (jQuery().tipsy) {
|
616
|
+
$('.typography-size, .typography-height, .typography-face, .typography-style, .of-typography-color').tipsy({
|
617
|
+
fade: true,
|
618
|
+
gravity: 's',
|
619
|
+
opacity: 0.7,
|
620
|
+
});
|
621
|
+
}
|
622
|
+
|
623
|
+
}); //end doc ready
|