Skip to content

Commit

Permalink
#79 Adding file and enqueue process for lightbox.
Browse files Browse the repository at this point in the history
  • Loading branch information
ardathksheyna committed Aug 6, 2017
1 parent ada7e3c commit 5716bff
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 31 deletions.
6 changes: 6 additions & 0 deletions assets/js/lightbox.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
var MANGAPRESS = MANGAPRESS || {};

(function ($) {
$(function () {
});
}(jQuery));
51 changes: 20 additions & 31 deletions includes/lib/plugin/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function get_helper($helper_name)
* MangaPress options are updated.
*
* @uses init()
* @see MangaPress\Plugin\Bootstrap::init()
* @see \MangaPress\Plugin\Bootstrap::init()
*
* @return void
*/
Expand Down Expand Up @@ -196,25 +196,16 @@ public function get_option($section, $option_name)
*/
private function load_current_options()
{
$mp_options = $this->get_options();
add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'));

/*
* Disable/Enable Default Navigation CSS
*/
if ($mp_options['nav']['nav_css'] == 'default_css') {
add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'));
}

add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_other_scripts'));

/*
* Comic Page size
*/
if ($mp_options['comic_page']['generate_comic_page']){
$generate_comic_page = $this->get_option('comic_page', 'generate_comic_page');
if ($generate_comic_page){
$page_width = $this->get_option('comic_page', 'comic_page_width');
$page_height = $this->get_option('comic_page', 'comic_page_height');
add_image_size(
'comic-page',
$mp_options['comic_page']['comic_page_width'],
$mp_options['comic_page']['comic_page_height'],
$page_width,
$page_height,
false
);
}
Expand All @@ -223,7 +214,6 @@ private function load_current_options()
* Comic Thumbnail size for Comics Listing screen
*/
add_image_size('comic-admin-thumb', 60, 80, true);

}


Expand All @@ -234,30 +224,30 @@ private function load_current_options()
*/
public function wp_enqueue_scripts()
{
/*
* Navigation style
*/
wp_register_style(
'mangapress-nav',
MP_URLPATH . 'assets/css/nav.css',
null,
MP_VERSION,
'screen'
);

wp_register_script(
'mangapress-bookmark',
MP_URLPATH . 'assets/js/bookmark.js',
'mangapress-lightbox',
MP_URLPATH . 'assets/js/lightbox.js',
array('jquery'),
MP_VERSION,
true
MP_VERSION
);

wp_enqueue_style('mangapress-nav');
}
$nav_css = $this->get_option('nav', 'nav_css');
$light_box = $this->get_option('comic_page', 'enable_comic_lightbox');
if ($nav_css == 'default_css') {
wp_enqueue_style('mangapress-nav');
}

if ($light_box) {
wp_enqueue_script('mangapress-lightbox');
}

public function wp_enqueue_other_scripts()
{
wp_register_script(
'mangapress-bookmark',
MP_URLPATH . 'assets/js/bookmark.js',
Expand All @@ -283,7 +273,6 @@ public function wp_enqueue_other_scripts()
wp_enqueue_script('mangapress-bookmark');
}


/**
* Enqueue admin-related styles
*
Expand Down

0 comments on commit 5716bff

Please sign in to comment.