-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
0 parents
commit 51607c9
Showing
276 changed files
with
41,944 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 @@ | ||
bump: | ||
- readme.txt | ||
- site-reviews.php | ||
dest: | ||
css: assets/styles/ | ||
js: assets/scripts/ | ||
lang: languages/ | ||
language: | ||
domain: site-reviews | ||
team: Gemini Labs <support@geminilabs.io> | ||
translator: Paul Ryley <paul@geminilabs.io> | ||
scripts: | ||
mce-plugin.js: +/scripts/mce-plugin.js | ||
recaptcha.js: +/scripts/recaptcha.js | ||
site-reviews-admin.js: | ||
- +/scripts/admin/init.js | ||
- +/scripts/admin/functions.js | ||
- +/scripts/admin/pinned.js | ||
- +/scripts/admin/search.js | ||
- +/scripts/admin/shortcode.js | ||
- +/scripts/admin/ready.js | ||
site-reviews.js: | ||
- node_modules/star-rating.js/src/star-rating.js | ||
- +/scripts/helper-functions.js | ||
- +/scripts/site-reviews.js | ||
watch: | ||
js: +/scripts/**/*.js | ||
php: | ||
- plugin/**/*.php | ||
- views/**/*.php | ||
- '*.php' | ||
scss: +/styles/**/*.scss |
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.
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.
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.
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.
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.
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.
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.
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.
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,203 @@ | ||
GLSR.colorControls = function() | ||
{ | ||
if( typeof x.wp !== 'object' || typeof x.wp.wpColorPicker !== 'function' )return; | ||
|
||
x( document ).find( 'input[type="text"].color-picker-hex' ).each( function() { | ||
var t = x( this ); | ||
var options = t.data( 'colorpicker' ) || {}; | ||
t.wpColorPicker( options ); | ||
}); | ||
}; | ||
|
||
GLSR.dismissNotices = function() | ||
{ | ||
x( '.notice.is-dismissible' ).each( function() { | ||
var notice = x( this ); | ||
notice.fadeTo( 100, 0, function() { | ||
notice.slideUp( 100, function() { | ||
notice.remove(); | ||
}); | ||
}); | ||
}); | ||
}; | ||
|
||
GLSR.getURLParameter = function( name ) | ||
{ | ||
return decodeURIComponent( | ||
(new RegExp( '[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)' ).exec( location.search ) || [null, ''])[1].replace( /\+/g, '%20' ) | ||
) || null; | ||
}; | ||
|
||
GLSR.insertNotices = function( notices ) | ||
{ | ||
notices = notices || false; | ||
|
||
if( !notices )return; | ||
|
||
if( !x( '#glsr-notices' ).length ) { | ||
x( '#message.notice' ).remove(); | ||
x( 'form#post' ).before( '<div id="glsr-notices" />' ); | ||
} | ||
|
||
x( '#glsr-notices' ).html( notices ); | ||
|
||
x( document ).trigger( 'wp-updates-notice-added' ); | ||
}; | ||
|
||
GLSR.isUndefined = function( value ) | ||
{ | ||
var is_undefined = void(0); | ||
return value === is_undefined; | ||
}; | ||
|
||
GLSR.normalizeValue = function( value ) | ||
{ | ||
if(['true','on','1'].indexOf( value ) > -1 ) { | ||
return true; | ||
} | ||
|
||
if(['false','off','0'].indexOf( value ) > -1 ) { | ||
return false; | ||
} | ||
|
||
return value; | ||
}; | ||
|
||
GLSR.normalizeValues = function( array ) | ||
{ | ||
return array.map( GLSR.normalizeValue ); | ||
}; | ||
|
||
GLSR.onChangeStatus = function( ev ) | ||
{ | ||
var post_id = this.href.match(/post=([0-9]+)/)[1]; | ||
var status = this.href.match(/action=([a-z]+)/)[1]; | ||
|
||
if( GLSR.isUndefined( status ) || GLSR.isUndefined( post_id ))return; | ||
|
||
var request = { | ||
action: 'change-review-status', | ||
status : status, | ||
post_id: post_id, | ||
}; | ||
|
||
GLSR.postAjax( ev, request, function( response ) | ||
{ | ||
var el = x( ev.target ); | ||
|
||
el.closest( 'tr' ).removeClass( 'status-pending status-publish' ).addClass( response.class ); | ||
el.closest( 'td.column-title' ).find( 'strong' ).html( response.link ); | ||
}); | ||
}; | ||
|
||
GLSR.onClearLog = function( ev ) | ||
{ | ||
var request = { | ||
action: 'clear-log', | ||
}; | ||
GLSR.postAjax( ev, request, function( response ) | ||
{ | ||
GLSR.insertNotices( response.notices ); | ||
x( '#log-file' ).val( response.logger ); | ||
}); | ||
}; | ||
|
||
GLSR.onFieldChange = function() | ||
{ | ||
var depends = x( this ).closest( 'form' ).find( '[data-depends]' ); | ||
|
||
if( !depends.length )return; | ||
|
||
var name = this.getAttribute( 'name' ); | ||
var type = this.getAttribute( 'type' ); | ||
|
||
for( var i = 0; i < depends.length; i++ ) { | ||
|
||
try { | ||
var data = JSON.parse( depends[i].getAttribute( 'data-depends' ) ); | ||
var bool; | ||
|
||
if( data.name !== name )continue; | ||
|
||
if( 'checkbox' === type ) { | ||
bool = !!this.checked; | ||
} | ||
else if( x.isArray( data.value ) ) { | ||
bool = x.inArray( GLSR.normalizeValue( this.value ), GLSR.normalizeValues( data.value ) ) !== -1; | ||
} | ||
else { | ||
bool = GLSR.normalizeValue( data.value ) === GLSR.normalizeValue( this.value ); | ||
} | ||
|
||
GLSR.toggleHiddenField( depends[i], bool ); | ||
} | ||
catch( e ) { | ||
console.error( 'JSON Error: ' + depends[i] ); | ||
} | ||
} | ||
}; | ||
|
||
GLSR.pointers = function( pointer ) | ||
{ | ||
x( pointer.target ).pointer({ | ||
content: pointer.options.content, | ||
position: pointer.options.position, | ||
close: function() { | ||
x.post( ajaxurl, { | ||
pointer: pointer.id, | ||
action: 'dismiss-wp-pointer', | ||
}); | ||
}, | ||
}) | ||
.pointer( 'open' ) | ||
.pointer( 'sendToTop' ); | ||
|
||
x( document ).on( 'wp-window-resized', function() { | ||
x( pointer.target ).pointer( 'reposition' ); | ||
}); | ||
}; | ||
|
||
GLSR.postAjax = function( ev, request, callback ) | ||
{ | ||
ev.preventDefault(); | ||
var el = x( ev.target ); | ||
if( el.is( ':disabled' ))return; | ||
request.nonce = request.nonce || el.closest( 'form' ).find( '#_wpnonce' ).val(); | ||
var data = { | ||
action: site_reviews.action, | ||
request: request, | ||
}; | ||
el.prop( 'disabled', true ); | ||
x.post( site_reviews.ajaxurl, data, function( response ) { | ||
if( typeof callback === 'function' ) { | ||
callback( response ); | ||
} | ||
el.prop( 'disabled', false ); | ||
}); | ||
}; | ||
|
||
GLSR.textareaResize = function( el ) | ||
{ | ||
var minHeight = 320; | ||
var textarea = el[0]; | ||
|
||
textarea.style.height = 'auto'; | ||
|
||
textarea.style.height = textarea.scrollHeight > minHeight ? | ||
textarea.scrollHeight + 'px' : | ||
minHeight + 'px'; | ||
}; | ||
|
||
GLSR.toggleHiddenField = function( el, bool ) | ||
{ | ||
var row = x( el ).closest( '.glsr-field' ); | ||
|
||
if( !row.length )return; | ||
|
||
if( bool ) { | ||
row.removeClass( 'hidden' ); | ||
} | ||
else { | ||
row.addClass( 'hidden' ); | ||
} | ||
}; |
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,16 @@ | ||
// jshint unused:false | ||
var x = jQuery.noConflict(); | ||
|
||
var GLSR = { | ||
addons: {}, | ||
keys: { | ||
ENTER: 13, | ||
ESC: 27, | ||
SPACE: 32, | ||
UP: 38, | ||
DOWN: 40, | ||
}, | ||
pinned: {}, | ||
shortcode: {}, | ||
translation: {}, | ||
}; |
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,72 @@ | ||
/** global: GLSR, site_reviews, x */ | ||
|
||
GLSR.pinned.events = function() | ||
{ | ||
var pinnedSelect = x( '#pinned-status-select' ); | ||
|
||
x( 'a.cancel-pinned-status' ).on( 'click', function( e ) { | ||
e.preventDefault(); | ||
pinnedSelect.slideUp( 'fast' ).siblings( 'a.edit-pinned-status' ).show().focus(); | ||
pinnedSelect.find( 'select' ).val( x( '#hidden-pinned-status' ).val() === '0' ? 1 : 0 ); | ||
}); | ||
|
||
x( 'a.edit-pinned-status' ).on( 'click', function( e ) { | ||
e.preventDefault(); | ||
if( pinnedSelect.is( ':hidden' ) ) { | ||
pinnedSelect.slideDown( 'fast', function() { | ||
pinnedSelect.find( 'select' ).focus(); | ||
}); | ||
x( this ).hide(); | ||
} | ||
}); | ||
|
||
x( 'a.save-pinned-status' ).on( 'click', function( e ) { | ||
e.preventDefault(); | ||
pinnedSelect.slideUp( 'fast' ).siblings( 'a.edit-pinned-status' ).show().focus(); | ||
GLSR.pinned.save( x( this ) ); | ||
}); | ||
|
||
x( 'table' ).on( 'click', 'td.sticky i', GLSR.pinned.onToggle ); | ||
}; | ||
|
||
GLSR.pinned.onToggle = function() | ||
{ | ||
var el = x( this ); | ||
|
||
var data = { | ||
action: site_reviews.action, | ||
request: { | ||
action: 'toggle-pinned', | ||
id: el[0].getAttribute( 'data-id' ), | ||
}, | ||
}; | ||
|
||
x.post( site_reviews.ajaxurl, data, function( response ) { | ||
if( response.pinned ) { | ||
el.addClass( 'pinned' ); | ||
} | ||
else { | ||
el.removeClass( 'pinned' ); | ||
} | ||
}); | ||
}; | ||
|
||
GLSR.pinned.save = function( el ) | ||
{ | ||
var data = { | ||
action: site_reviews.action, | ||
request: { | ||
action: 'toggle-pinned', | ||
id: x( '#post_ID' ).val(), | ||
pinned: x( '#pinned-status' ).val(), | ||
}, | ||
}; | ||
|
||
x.post( site_reviews.ajaxurl, data, function( response ) { | ||
x( '#pinned-status' ).val( !response.pinned|0 ); | ||
x( '#hidden-pinned-status' ).val( response.pinned|0 ); | ||
x( '#pinned-status-text' ).text( response.pinned ? el.data( 'yes' ) : el.data( 'no' ) ); | ||
|
||
GLSR.insertNotices( response.notices ); | ||
}); | ||
}; |
Oops, something went wrong.