-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
45 changed files
with
9,814 additions
and
0 deletions.
There are no files selected for viewing
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,32 @@ | ||
#Contributing | ||
|
||
### Getting Started | ||
|
||
Submit a ticket for your issue, assuming one does not already exist. | ||
* Raise it on our [Issue Tracker](https://github.com/deliciousbrains/wp-amazon-s3-and-cloudfront) | ||
* Clearly describe the issue, including steps to reproduce the bug (if applicable). | ||
* If it's a bug, make sure you fill in the earliest version that you know has the issue as well as the version of WordPress you're using. | ||
|
||
## Making Changes | ||
|
||
* Fork the repository on GitHub. | ||
* From the `master` branch on your forked repository, create a new branch and make your changes. | ||
* It is suggested that your new branch use a name that briefly describes the feature or issue. | ||
* Ensure you stick to the [WordPress Coding Standards](http://codex.wordpress.org/WordPress_Coding_Standards). | ||
* When committing, use a [well-formed](http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message) [commit](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) [message](http://who-t.blogspot.com/2009/12/on-commit-messages.html). | ||
* Push the changes to your fork and submit a pull request to the `master` branch of the plugin's repository. | ||
* We appreciate any pull requests, however, as development on this plugin actually takes place in private repo, no PRs will be merged here. Although we will give props for code that gets released. | ||
|
||
## Code Documentation | ||
|
||
* Code comments should be added to all new functions/methods. | ||
* Comments should tell you the "what" & "why". You'll typically want a one-liner that says what it does, hopefully why, but not how. Only very rarely should they tell you how (e.g. when the code is necessarily complex). | ||
* Also see the [WordPress PHP Documentation Standards](http://make.wordpress.org/core/handbook/inline-documentation-standards/php-documentation-standards/) doc for general guidelines and best practices. | ||
* We currently suggest implementing the `@param` & `@return` PHPdoc tags for every function/method if applicable. | ||
|
||
At this point you're waiting on us to merge your pull request. We'll review all pull requests, and make suggestions and changes if necessary. | ||
|
||
# Additional Resources | ||
* [GitHub Help — Forking](https://help.github.com/articles/fork-a-repo) | ||
* [GitHub Help — Syncing a Fork](https://help.github.com/articles/syncing-a-fork) | ||
* [GitHub Help — Pull Requests](https://help.github.com/articles/using-pull-requests#before-you-begin) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,121 @@ | ||
var as3cfModal = (function ( $ ) { | ||
|
||
var modal = { | ||
prefix: 'as3cf', | ||
loading: false | ||
}; | ||
|
||
var modals = {}; | ||
|
||
/** | ||
* Target to key | ||
* | ||
* @param {string} target | ||
* | ||
* @return {string} | ||
*/ | ||
function targetToKey( target ) { | ||
return target.replace( /[^a-z]/g, '' ); | ||
} | ||
|
||
/** | ||
* Open modal | ||
* | ||
* @param {string} target | ||
* @param {function} callback | ||
* @param {string} customClass | ||
*/ | ||
modal.open = function ( target, callback, customClass ) { | ||
var key = targetToKey( target ); | ||
|
||
// Overlay | ||
$( 'body' ).append( '<div id="as3cf-overlay"></div>' ); | ||
var $overlay = $( '#as3cf-overlay' ); | ||
|
||
// Modal container | ||
$overlay.append( '<div id="as3cf-modal"><span class="close-as3cf-modal">×</span></div>' ); | ||
var $modal = $( '#as3cf-modal' ); | ||
|
||
if ( undefined === modals[ key ] ) { | ||
var content = $( target ); | ||
modals[ key ] = content.clone( true ).css( 'display', 'block' ); | ||
content.remove(); | ||
} | ||
$modal.data( 'as3cf-modal-target', target ).append( modals[ key ] ); | ||
|
||
if ( undefined !== customClass ) { | ||
$modal.addClass( customClass ); | ||
} | ||
|
||
if ( 'function' === typeof callback ) { | ||
callback( target ); | ||
} | ||
|
||
// Handle modals taller than window height, | ||
// overflow & padding-right remove duplicate scrollbars. | ||
$( 'body' ).addClass( 'as3cf-modal-open' ); | ||
|
||
$overlay.fadeIn( 150 ); | ||
$modal.fadeIn( 150 ); | ||
|
||
$( 'body' ).trigger( 'as3cf-modal-open', [ target ] ); | ||
}; | ||
|
||
/** | ||
* Close modal | ||
* | ||
* @param {function} callback | ||
*/ | ||
modal.close = function ( callback ) { | ||
if ( modal.loading ) { | ||
return; | ||
} | ||
|
||
var target = $( '#as3cf-modal' ).data( 'as3cf-modal-target' ); | ||
|
||
$( '#as3cf-overlay' ).fadeOut( 150, function () { | ||
if ( 'function' === typeof callback ) { | ||
callback( target ); | ||
} | ||
|
||
$( 'body' ).removeClass( 'as3cf-modal-open' ); | ||
|
||
$( this ).remove(); | ||
} ); | ||
|
||
$( 'body' ).trigger( 'as3cf-modal-close', [ target ] ); | ||
}; | ||
|
||
/** | ||
* Set loading state | ||
* | ||
* @param {bool} state | ||
*/ | ||
modal.setLoadingState = function ( state ) { | ||
modal.loading = state; | ||
}; | ||
|
||
// Setup click handlers | ||
$( document ).ready( function () { | ||
|
||
$( 'body' ).on( 'click', '[data-as3cf-modal]', function ( e ) { | ||
e.preventDefault(); | ||
modal.open( $( this ).data( 'as3cf-modal' ) + '.' + modal.prefix ); | ||
} ); | ||
|
||
$( 'body' ).on( 'click', '#as3cf-overlay, .close-as3cf-modal', function ( e ) { | ||
e.preventDefault(); | ||
|
||
// Don't allow children to bubble up click event | ||
if ( e.target !== this ) { | ||
return false; | ||
} | ||
|
||
modal.close(); | ||
} ); | ||
|
||
} ); | ||
|
||
return modal; | ||
|
||
})( jQuery ); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,24 @@ | ||
(function( $ ) { | ||
|
||
$( 'body' ).on( 'click', '.as3cf-notice .notice-dismiss', function( e ) { | ||
var id = $( this ).parents( '.as3cf-notice' ).attr( 'id' ); | ||
if ( id ) { | ||
var data = { | ||
action : 'as3cf-dismiss-notice', | ||
notice_id: id, | ||
_nonce : as3cf_notice.nonces.dismiss_notice | ||
}; | ||
|
||
$.ajax( { | ||
url : ajaxurl, | ||
type : 'POST', | ||
dataType: 'JSON', | ||
data : data, | ||
error : function( jqXHR, textStatus, errorThrown ) { | ||
alert( as3cf_notice.strings.dismiss_notice_error + errorThrown ); | ||
} | ||
} ); | ||
} | ||
} ); | ||
|
||
})( jQuery ); |
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.