Skip to content

Commit

Permalink
V 1.5.3 - Merge pull request #6 from JoryHogeveen/1.5.x
Browse files Browse the repository at this point in the history
1.5.3 release (pre WP 4.6)
  • Loading branch information
JoryHogeveen authored Aug 3, 2016
2 parents f8b1021 + 2fdf695 commit b1c0618
Show file tree
Hide file tree
Showing 10 changed files with 992 additions and 702 deletions.
10 changes: 5 additions & 5 deletions assets/css/view-admin-as.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @author Jory Hogeveen <info@keraweb.nl>
* @package view-admin-as
* @version 1.5.2.1
* @version 1.5.3
*/

#vaa-overlay {position: fixed; top: 0; left: 0; height: 100%; width: 100%; background: rgba(255,255,255,0.85); display: none; z-index: 999999999;}
Expand Down Expand Up @@ -41,7 +41,7 @@
#wpadminbar #wp-admin-bar-view-as.menupop .ab-vaa-title .ab-item {font-weight: bold; line-height: 26px; font-size: 1.1em; text-transform: uppercase;}
#wpadminbar #wp-admin-bar-view-as .current > .ab-item,
#wpadminbar #wp-admin-bar-view-as .current-parent > .ab-item {font-weight: bold;}
#wpadminbar #wp-admin-bar-view-as .current > .ab-item::after {content: '\f177'; font-family: 'dashicons'; margin: 0 5px; font-size: 1.3em; vertical-align: middle; font-weight: normal;}
#wpadminbar #wp-admin-bar-view-as .current > .ab-item::after {content: '\f177'; font-family: 'dashicons'; margin: 0 5px; font-size: 17px; vertical-align: middle; font-weight: normal;}

#wpadminbar .ab-top-secondary .menupop .vaa-menupop > .ab-item {padding-left: 2em; padding-right: 1em;}

Expand Down Expand Up @@ -110,7 +110,7 @@
/*#wpadminbar #wp-admin-bar-view-as #wp-admin-bar-caps #wp-admin-bar-filtercaps {clear: both;}*/

#wpadminbar #wp-admin-bar-view-as .ab-vaa-toggle .ab-item:hover {cursor: pointer;}
#wpadminbar #wp-admin-bar-view-as .ab-vaa-toggle .ab-item::after {content: "\f140"; font-family: 'dashicons'; float: right; margin: 0; font-size: 1.5em; vertical-align: middle; font-weight: normal;}
#wpadminbar #wp-admin-bar-view-as .ab-vaa-toggle .ab-item::after {content: "\f140"; font-family: 'dashicons'; position: absolute; right: 10px; margin: 0; font-size: 20px; font-weight: normal;}
#wpadminbar #wp-admin-bar-view-as .ab-vaa-toggle.active .ab-item::after {content: "\f142";}

#wpadminbar #wp-admin-bar-view-as.fullPopupActive .ab-sub-wrapper,
Expand Down Expand Up @@ -138,7 +138,7 @@

#wpadminbar #wp-admin-bar-view-as #wp-admin-bar-caps-title > .ab-item::before,
#wpadminbar #wp-admin-bar-view-as #wp-admin-bar-roles-title > .ab-item::before,
#wpadminbar #wp-admin-bar-view-as #wp-admin-bar-users-title > .ab-item::before {font-family: 'dashicons'; margin: 0 5px 0 -1px; font-size: 1.3em; vertical-align: middle; font-weight: normal;} /*margin: 0 2px 0 -5px;*/
#wpadminbar #wp-admin-bar-view-as #wp-admin-bar-users-title > .ab-item::before {font-family: 'dashicons'; margin: 0 5px 0 -1px; font-size: 18px; vertical-align: middle; font-weight: normal;} /*margin: 0 2px 0 -5px;*/

#wpadminbar #wp-admin-bar-view-as #wp-admin-bar-caps-title > .ab-item::before {content: '\f111';}/*'\f107'*/
#wpadminbar #wp-admin-bar-view-as #wp-admin-bar-roles-title > .ab-item::before {content: '\f307';}
Expand All @@ -148,7 +148,7 @@
#wpadminbar #wp-admin-bar-view-as #wp-admin-bar-role-defaults > .ab-item {padding: 0 10px;}

#wpadminbar #wp-admin-bar-view-as #wp-admin-bar-settings > .ab-item::before,
#wpadminbar #wp-admin-bar-view-as #wp-admin-bar-role-defaults > .ab-item::before {font-family: 'dashicons'; position: static; margin: 2px 6px 0 0; font-size: 1.3em; vertical-align: middle; font-weight: normal;}
#wpadminbar #wp-admin-bar-view-as #wp-admin-bar-role-defaults > .ab-item::before {font-family: 'dashicons'; position: static; margin: 2px 6px 0 0; font-size: 16px; vertical-align: middle; font-weight: normal;}

#wpadminbar #wp-admin-bar-view-as #wp-admin-bar-settings > .ab-item::before {content: '\f108';}
#wpadminbar #wp-admin-bar-view-as #wp-admin-bar-role-defaults > .ab-item::before {content: '\f337';}
4 changes: 2 additions & 2 deletions assets/css/view-admin-as.min.css

Large diffs are not rendered by default.

54 changes: 33 additions & 21 deletions assets/js/view-admin-as.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/**
;/**
* View Admin As
* https://wordpress.org/plugins/view-admin-as/
*
* @author Jory Hogeveen <info@keraweb.nl>
* @package view-admin-as
* @version 1.5.2.1
* @version 1.5.3
*/

;(function($) {
(function($) {

if ( 'undefined' == typeof VAA_View_Admin_As ) {
VAA_View_Admin_As = {};
Expand Down Expand Up @@ -75,11 +75,10 @@
* Apply the selected view
* viewAs format: { VIEWTYPE : VIEWDATA }
*
* @params object viewAs
* @params boolean reload
* @params object viewAs
* @params boolean reload
*/
VAA_View_Admin_As.ajax = function( viewAs, reload ) {
//VAA_View_Admin_As.ajaxurl;

$('#wpadminbar .vaa-update').remove();
$('body').append('<div id="vaa-overlay"><span class="vaa-loader-icon" style="background: transparent url(\'' + VAA_View_Admin_As.siteurl + '/wp-includes/images/spinner-2x.gif\') center center no-repeat; background-size: contain;"></span></div>');
Expand Down Expand Up @@ -114,22 +113,23 @@
if ( false === reload ) {
// Check if we have more detailed data to show
if ( typeof response.data != 'undefined' && typeof response.data.content != 'undefined' ) {
if ( typeof response.data.type == 'undefined' ) {
response.data.type = 'default';
if ( typeof response.data.type == 'undefined' ) {
response.data.type = 'default';
}
if ( typeof response.data.content != 'object' ) {
response.data.content = String( response.data.content );
}
if ( typeof response.data.content != 'object' ) {
response.data.content = String( response.data.content );
}
VAA_View_Admin_As.overlay( response.data.content, String( response.data.type ) );
} else {
$('body #vaa-overlay').addClass('success').fadeOut( 'fast', function() { $(this).remove(); } );
VAA_View_Admin_As.notice( VAA_View_Admin_As.__success, 'success' );
}
} else {
// Reload the page
window.location = window.location.href.replace('?reset-view', '').replace('&reset-view', '');
// Force reload
window.location.reload();
/**
* Reload the page
* Currently I use "replace" since no history seems necessary. Other option would be "assign" which enables history.
*/
window.location.replace( window.location.href.replace('?reset-view', '').replace('&reset-view', '') );
}
} else {
$('body #vaa-overlay').addClass('error').fadeOut( 'fast', function() { $(this).remove(); } );
Expand All @@ -153,7 +153,12 @@
};


// Show notice in the admin bar
/**
* Show notice in the admin bar
* @see VAA_View_Admin_As.ajax
* @param {object} notice
* @param {string} type
*/
VAA_View_Admin_As.notice = function( notice, type ) {
$('#wp-admin-bar-top-secondary').append('<li class="vaa-update vaa-' + type + '"><span class="remove ab-icon dashicons dashicons-dismiss" style="top: 2px;"></span>' + notice + '</li>');
$('#wpadminbar .vaa-update .remove').click( function() { $(this).parent().remove(); } );
Expand All @@ -162,7 +167,12 @@
};


// Show popup with return content
/**
* Show popup with return content
* @see VAA_View_Admin_As.ajax
* @param {object} data
* @param {string} type
*/
VAA_View_Admin_As.overlay = function( data, type ) {
$('body #vaa-overlay').html('<div class="vaa-overlay-container"><span class="remove dashicons dashicons-dismiss"></span><div class="vaa-response-data"></div></div>');
if ( type == 'textarea' ) {
Expand Down Expand Up @@ -197,7 +207,7 @@
$('body #vaa-overlay').fadeOut( 'fast', function() { $(this).remove(); } );
});

// Remove overlay on click outsite of container
// Remove overlay on click outside of container
$(document).mouseup( function(e){
$('body #vaa-overlay .vaa-overlay-container').each( function(){
if ( ! $(this).is(e.target) && 0 === $(this).has(e.target).length ) {
Expand Down Expand Up @@ -258,7 +268,7 @@
VAA_View_Admin_As.ajax( viewAs, true );
return false;
}
});
});
};


Expand All @@ -275,7 +285,7 @@
VAA_View_Admin_As.ajax( viewAs, true );
return false;
}
});
});

// Search users
$(document).on('keyup', VAA_View_Admin_As.prefix+'#wp-admin-bar-users .ab-vaa-search.search-users input', function(e) {
Expand Down Expand Up @@ -522,7 +532,9 @@
var val = $(VAA_View_Admin_As.prefix+'#wp-admin-bar-role-defaults-clear-roles-select select#role-defaults-clear-roles-select').val();
if ( val && '' !== val ) {
var viewAs = { role_defaults : { clear_role_defaults : val } };
VAA_View_Admin_As.ajax( viewAs, false );
if ( confirm( VAA_View_Admin_As.__confirm ) ) {
VAA_View_Admin_As.ajax( viewAs, false );
}
}
return false;
});
Expand Down
Loading

0 comments on commit b1c0618

Please sign in to comment.