Skip to content

Commit 6e6e361

Browse files
author
Carl Alberto
committed
updated to pass the initial plugin screen
0 parents  commit 6e6e361

22 files changed

+2496
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

LICENSE

Lines changed: 339 additions & 0 deletions
Large diffs are not rendered by default.

assets/css/admin.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* phpcs:ignore */

assets/css/admin.less

Whitespace-only changes.

assets/css/frontend.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* phpcs:ignore */

assets/css/frontend.less

Whitespace-only changes.

assets/js/admin.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* Plugin Template admin js.
3+
*
4+
* @package WordPress Plugin Template/JS
5+
*/
6+
7+
jQuery( document ).ready(
8+
function ( e ) {
9+
10+
}
11+
);

assets/js/admin.min.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
jQuery(document).ready(function(){});

assets/js/frontend.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* Plugin Template frontend js.
3+
*
4+
* @package WordPress Plugin Template/JS
5+
*/
6+
7+
jQuery( document ).ready(
8+
function ( e ) {
9+
10+
}
11+
);

assets/js/frontend.min.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
jQuery(document).ready(function(){});

assets/js/settings.js

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/**
2+
* Plugin Template js settings.
3+
*
4+
* @package WordPress Plugin Template/Settings
5+
*/
6+
7+
jQuery( document ).ready(
8+
function ($) {
9+
10+
/***** Colour picker *****/
11+
12+
$( '.colorpicker' ).hide();
13+
$( '.colorpicker' ).each(
14+
function () {
15+
$( this ).farbtastic( $( this ).closest( '.color-picker' ).find( '.color' ) );
16+
}
17+
);
18+
19+
$( '.color' ).click(
20+
function () {
21+
$( this ).closest( '.color-picker' ).find( '.colorpicker' ).fadeIn();
22+
}
23+
);
24+
25+
$( document ).mousedown(
26+
function () {
27+
$( '.colorpicker' ).each(
28+
function () {
29+
var display = $( this ).css( 'display' );
30+
if (display == 'block') {
31+
$( this ).fadeOut();
32+
}
33+
}
34+
);
35+
}
36+
);
37+
38+
/***** Uploading images *****/
39+
40+
var file_frame;
41+
42+
jQuery.fn.uploadMediaFile = function (button, preview_media) {
43+
var button_id = button.attr( 'id' );
44+
var field_id = button_id.replace( '_button', '' );
45+
var preview_id = button_id.replace( '_button', '_preview' );
46+
47+
// If the media frame already exists, reopen it.
48+
if (file_frame) {
49+
file_frame.open();
50+
return;
51+
}
52+
53+
// Create the media frame.
54+
file_frame = wp.media.frames.file_frame = wp.media(
55+
{
56+
title: jQuery( this ).data( 'uploader_title' ),
57+
button: {
58+
text: jQuery( this ).data( 'uploader_button_text' ),
59+
},
60+
multiple: false
61+
}
62+
);
63+
64+
// When an image is selected, run a callback.
65+
file_frame.on(
66+
'select',
67+
function () {
68+
attachment = file_frame.state().get( 'selection' ).first().toJSON();
69+
jQuery( "#" + field_id ).val( attachment.id );
70+
if (preview_media) {
71+
jQuery( "#" + preview_id ).attr( 'src', attachment.sizes.thumbnail.url );
72+
}
73+
file_frame = false;
74+
}
75+
);
76+
77+
// Finally, open the modal.
78+
file_frame.open();
79+
}
80+
81+
jQuery( '.image_upload_button' ).click(
82+
function () {
83+
jQuery.fn.uploadMediaFile( jQuery( this ), true );
84+
}
85+
);
86+
87+
jQuery( '.image_delete_button' ).click(
88+
function () {
89+
jQuery( this ).closest( 'td' ).find( '.image_data_field' ).val( '' );
90+
jQuery( this ).closest( 'td' ).find( '.image_preview' ).remove();
91+
return false;
92+
}
93+
);
94+
95+
}
96+
);

assets/js/settings.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)