Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion app/admin/wp-steem-settings-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public static function init() {

add_action('admin_menu', array($instance, 'register_pages'));
add_action('admin_init', array($instance, 'register_page_settings'));
add_action('admin_enqueue_scripts', array($instance, 'enqueue_settings_scripts_styles'));
}

public static function display_notices() {
Expand Down Expand Up @@ -224,13 +225,30 @@ public static function display_posting_key_field() {
sprintf(
__("Please only provide the %s.", 'wp-steem'),
sprintf(
'<strong style="color: red;">"%s"</strong>',
'<a style="cursor:pointer" id="posting-key-link">%s</a>',
__('PRIVATE POSTING KEY', 'wp-steem')
)
)
);
printf(
'<div id="private-key-details" class="hidden" style="max-width:800px"><p>%1$s</p><p>%2$s</p><p>%3$s</p><p>%4$s</p><p>%5$s</p></div>',
sprintf( __('Your Steemit PRIVATE POSTING KEY is %1$s NOT %2$s your main Steemit password.', 'wp-steem'), "<strong>", "</strong>"),
sprintf( __('Get your PRIVATE POSTING KEY by visiting http://steemit.com/@username/permissions', 'wp-steem')),
sprintf( __('Click the button that says "show private key".', 'wp-steem')),
sprintf( __('The revealed key is what needs to be placed in this field.', 'wp-steem')),
sprintf( '<a href="https://steemit.com/security/@noisy/what-is-the-difference-between-a-password-and-a-private-key-s-on-steemit-how-to-make-your-account-more-secure-by-using-them">%1$s</a> %2$s.',
__("Click Here", 'wp-steem'), __("for more info on Steemit Keys", 'wp-steem'))
);
}

# Popup

public static function enqueue_settings_scripts_styles($page) {
wp_enqueue_script ( 'wp-steem-modal' , // handle
WP_STEEM_DIR_URL . 'public/assets/js/modal.js' , // source
array('jquery', 'jquery-ui-core', 'jquery-ui-dialog'), null, true); // dependencies
wp_enqueue_style ( 'wp-jquery-ui-dialog');
}
/**
* Display "default store" input field
*
Expand Down
34 changes: 34 additions & 0 deletions public/assets/js/modal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
(function($) {
console.log( "ready!" );
var details = $('#private-key-details'),
detailsButton = $('#posting-key-link');
// initalise the dialog
details.dialog({
title: 'Private Hosting Key',
dialogClass: 'wp-dialog',
autoOpen: false,
draggable: false,
width: 'auto',
modal: true,
resizable: false,
closeOnEscape: true,
position: {
my: "center",
at: "center",
of: window
},
create: function(){
$('.ui-dialog-titlebar-close').addClass('ui-button');
},
open: function(){
$('.ui-widget-overlay').bind('click',function(){
details.dialog('close');
});
}
});
// bind a button or a link to open the dialog
detailsButton.click(function(e) {
e.preventDefault();
details.dialog('open');
});
})(jQuery);