-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated to pass the initial plugin screen
- Loading branch information
Carl Alberto
committed
Oct 27, 2019
0 parents
commit 6e6e361
Showing
22 changed files
with
2,496 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* phpcs:ignore */ |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* phpcs:ignore */ |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Plugin Template admin js. | ||
* | ||
* @package WordPress Plugin Template/JS | ||
*/ | ||
|
||
jQuery( document ).ready( | ||
function ( e ) { | ||
|
||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
jQuery(document).ready(function(){}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Plugin Template frontend js. | ||
* | ||
* @package WordPress Plugin Template/JS | ||
*/ | ||
|
||
jQuery( document ).ready( | ||
function ( e ) { | ||
|
||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
jQuery(document).ready(function(){}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/** | ||
* Plugin Template js settings. | ||
* | ||
* @package WordPress Plugin Template/Settings | ||
*/ | ||
|
||
jQuery( document ).ready( | ||
function ($) { | ||
|
||
/***** Colour picker *****/ | ||
|
||
$( '.colorpicker' ).hide(); | ||
$( '.colorpicker' ).each( | ||
function () { | ||
$( this ).farbtastic( $( this ).closest( '.color-picker' ).find( '.color' ) ); | ||
} | ||
); | ||
|
||
$( '.color' ).click( | ||
function () { | ||
$( this ).closest( '.color-picker' ).find( '.colorpicker' ).fadeIn(); | ||
} | ||
); | ||
|
||
$( document ).mousedown( | ||
function () { | ||
$( '.colorpicker' ).each( | ||
function () { | ||
var display = $( this ).css( 'display' ); | ||
if (display == 'block') { | ||
$( this ).fadeOut(); | ||
} | ||
} | ||
); | ||
} | ||
); | ||
|
||
/***** Uploading images *****/ | ||
|
||
var file_frame; | ||
|
||
jQuery.fn.uploadMediaFile = function (button, preview_media) { | ||
var button_id = button.attr( 'id' ); | ||
var field_id = button_id.replace( '_button', '' ); | ||
var preview_id = button_id.replace( '_button', '_preview' ); | ||
|
||
// If the media frame already exists, reopen it. | ||
if (file_frame) { | ||
file_frame.open(); | ||
return; | ||
} | ||
|
||
// Create the media frame. | ||
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 | ||
} | ||
); | ||
|
||
// When an image is selected, run a callback. | ||
file_frame.on( | ||
'select', | ||
function () { | ||
attachment = file_frame.state().get( 'selection' ).first().toJSON(); | ||
jQuery( "#" + field_id ).val( attachment.id ); | ||
if (preview_media) { | ||
jQuery( "#" + preview_id ).attr( 'src', attachment.sizes.thumbnail.url ); | ||
} | ||
file_frame = false; | ||
} | ||
); | ||
|
||
// Finally, open the modal. | ||
file_frame.open(); | ||
} | ||
|
||
jQuery( '.image_upload_button' ).click( | ||
function () { | ||
jQuery.fn.uploadMediaFile( jQuery( this ), true ); | ||
} | ||
); | ||
|
||
jQuery( '.image_delete_button' ).click( | ||
function () { | ||
jQuery( this ).closest( 'td' ).find( '.image_data_field' ).val( '' ); | ||
jQuery( this ).closest( 'td' ).find( '.image_preview' ).remove(); | ||
return false; | ||
} | ||
); | ||
|
||
} | ||
); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.