function woothemes_add_javascript() { global $woo_options; nxt_register_script('slides', get_template_directory_uri() . '/includes/js/slides.min.jquery.js', array('jquery')); nxt_register_script('prettyPhoto', get_template_directory_uri() . '/includes/js/jquery.prettyPhoto.js', array('jquery')); nxt_register_script('jCarousel', get_template_directory_uri() . '/includes/js/jquery.jcarousel.min.js', array('jquery')); nxt_register_script('portfolio', get_template_directory_uri() . '/includes/js/portfolio.js', array('jquery', 'prettyPhoto', 'jCarousel', 'slides')); nxt_register_script('woo-feedback', get_template_directory_uri() . '/includes/js/feedback.js', array('jquery', 'slides')); // Load the prettyPhoto JavaScript and CSS for use on the portfolio page template. if (is_page_template('template-portfolio.php') || is_front_page() || is_singular() && get_post_type() == 'portfolio' || is_tax('portfolio-gallery')) { nxt_enqueue_script('portfolio'); } // Conditionally load the Feedback JavaScript, where needed. $load_feedback_js = false; if (is_page_template('template-feedback.php')) { $load_feedback_js = true; } // Allow child themes/plugins to load the Feedback JavaScript when they need it. $load_feedback_js = apply_filters('woo_load_feedback_js', $load_feedback_js); if ($load_feedback_js) { nxt_enqueue_script('woo-feedback'); } do_action('woothemes_add_javascript'); $general_dependencies = array('jquery'); if (is_singular()) { $general_dependencies[] = 'jquery-ui-tabs'; } nxt_enqueue_script('general', get_template_directory_uri() . '/includes/js/general.js', $general_dependencies); // Load the JavaScript for the slides and testimonals on the homepage. if (is_home()) { nxt_enqueue_script('slides'); // Load the custom slider settings. $autoStart = false; $autoSpeed = 6; $slideSpeed = 0.5; $effect = 'slide'; $nextprev = 'true'; $pagination = 'true'; $hoverpause = 'true'; $autoheight = 'false'; // Get our values from the database and, if they're there, override the above defaults. $fields = array('autoStart' => 'auto', 'autoSpeed' => 'interval', 'slideSpeed' => 'speed', 'effect' => 'effect', 'nextprev' => 'nextprev', 'pagination' => 'pagination', 'hoverpause' => 'hover', 'autoHeight' => 'autoheight'); foreach ($fields as $k => $v) { if (is_array($woo_options) && isset($woo_options['woo_slider_' . $v]) && $woo_options['woo_slider_' . $v] != '') { ${$k} = $woo_options['woo_slider_' . $v]; } } // Set auto speed to 0 if we want to disable automatic sliding. if ($autoStart == 'false') { $autoSpeed = 0; } $data = array('speed' => $slideSpeed, 'auto' => $autoSpeed, 'effect' => $effect, 'nextprev' => $nextprev, 'pagination' => $pagination, 'hoverpause' => $hoverpause, 'autoheight' => $autoHeight); nxt_localize_script('general', 'woo_slider_settings', $data); } }
/** * @internal copied from bp-default/functions.php */ public function init_scripts() { parent::init_scripts(); // Bump this when changes are made to bust cache $version = '20120110'; // the global BuddyPress JS - Ajax will not work without it nxt_enqueue_script('dtheme-ajax-js', BP_PLUGIN_URL . '/bp-themes/bp-default/_inc/global.js', array('jquery'), $version); // Add words that we need to use in JS to the end of the page so they can be translated and still used. $params = array('my_favs' => __('My Favorites', 'buddypress'), 'accepted' => __('Accepted', 'buddypress'), 'rejected' => __('Rejected', 'buddypress'), 'show_all_comments' => __('Show all comments for this thread', 'buddypress'), 'show_all' => __('Show all', 'buddypress'), 'comments' => __('comments', 'buddypress'), 'close' => __('Close', 'buddypress'), 'view' => __('View', 'buddypress'), 'mark_as_fav' => __('Favorite', 'buddypress'), 'remove_fav' => __('Remove Favorite', 'buddypress')); nxt_localize_script('dtheme-ajax-js', 'BP_DTheme', $params); }
function et_epanel_admin_js() { $epanel_jsfolder = get_template_directory_uri() . '/epanel/js'; nxt_enqueue_script('jquery-ui-tabs'); nxt_enqueue_script('jquery-form'); nxt_enqueue_script('epanel_checkbox', $epanel_jsfolder . '/checkbox.js'); nxt_enqueue_script('epanel_functions_init', $epanel_jsfolder . '/functions-init.js'); nxt_localize_script('epanel_functions_init', 'ePanelSettings', array('clearpath' => get_template_directory_uri() . '/epanel/images/empty.png', 'epanel_nonce' => nxt_create_nonce('epanel_nonce'))); nxt_enqueue_script('epanel_colorpicker', $epanel_jsfolder . '/colorpicker.js'); nxt_enqueue_script('epanel_eye', $epanel_jsfolder . '/eye.js'); }
/** * Enqueues BuddyPress JS and related AJAX functions * * @since 1.2 */ function bp_tpack_enqueue_scripts() { // Do not enqueue JS if it's disabled if (get_option('bp_tpack_disable_js')) { return; } // Add words that we need to use in JS to the end of the page so they can be translated and still used. $params = array('my_favs' => __('My Favorites', 'buddypress'), 'accepted' => __('Accepted', 'buddypress'), 'rejected' => __('Rejected', 'buddypress'), 'show_all_comments' => __('Show all comments for this thread', 'buddypress'), 'show_all' => __('Show all', 'buddypress'), 'comments' => __('comments', 'buddypress'), 'close' => __('Close', 'buddypress')); // BP 1.5+ if (version_compare(BP_VERSION, '1.3', '>')) { // Bump this when changes are made to bust cache $version = '20110818'; $params['view'] = __('View', 'buddypress'); } else { $version = '20110729'; if (bp_displayed_user_id()) { $params['mention_explain'] = sprintf(__("%s is a unique identifier for %s that you can type into any message on this site. %s will be sent a notification and a link to your message any time you use it.", 'buddypress'), '@' . bp_get_displayed_user_username(), bp_get_user_firstname(bp_get_displayed_user_fullname()), bp_get_user_firstname(bp_get_displayed_user_fullname())); } } // Enqueue the global JS - Ajax will not work without it nxt_enqueue_script('dtheme-ajax-js', BP_PLUGIN_URL . '/bp-themes/bp-default/_inc/global.js', array('jquery'), $version); // Localize the JS strings nxt_localize_script('dtheme-ajax-js', 'BP_DTheme', $params); }
/** * Load localized data on print rather than initialization. * * These localizations require information that may not be loaded even by init. * * @since 2.5.0 */ function nxt_just_in_time_script_localization() { nxt_localize_script('autosave', 'autosaveL10n', array('autosaveInterval' => AUTOSAVE_INTERVAL, 'savingText' => __('Saving Draft…'), 'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'))); }
/** * Enqueue theme javascript safely * * @see http://codex.nxtclass.org/Function_Reference/nxt_enqueue_script * @since 1.5 */ function bp_dtheme_enqueue_scripts() { // Bump this when changes are made to bust cache $version = '20120110'; // Enqueue the global JS - Ajax will not work without it nxt_enqueue_script('dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array('jquery'), $version); // Add words that we need to use in JS to the end of the page so they can be translated and still used. $params = array('my_favs' => __('My Favorites', 'buddypress'), 'accepted' => __('Accepted', 'buddypress'), 'rejected' => __('Rejected', 'buddypress'), 'show_all_comments' => __('Show all comments for this thread', 'buddypress'), 'show_all' => __('Show all', 'buddypress'), 'comments' => __('comments', 'buddypress'), 'close' => __('Close', 'buddypress'), 'view' => __('View', 'buddypress'), 'mark_as_fav' => __('Favorite', 'buddypress'), 'remove_fav' => __('Remove Favorite', 'buddypress')); nxt_localize_script('dtheme-ajax-js', 'BP_DTheme', $params); }
/** * Localize the flash uploader class wrapper */ protected function localize_script() { nxt_localize_script('ice-uploader', 'iceEasyFlashUploaderL10n', array('upload_url' => admin_url(ICE_Enqueue::SCRIPT_ASYNC), 'flash_url' => includes_url('js/swfupload/swfupload.swf'), 'pp_auth_cookie' => is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE], 'pp_logged_in_cookie' => $_COOKIE[LOGGED_IN_COOKIE], 'pp_nxtnonce' => nxt_create_nonce('media-form'), 'file_size_limit' => 1024 * 1024, 'button_image_url' => includes_url('images/upload.png?ver=20100531'))); }
/** * Load localized script just in time for MCE. * * These localizations require information that may not be loaded even by init. */ function bb_just_in_time_script_localization() { nxt_localize_script('topic', 'bbTopicJS', array('currentUserId' => bb_get_current_user_info('id'), 'topicId' => get_topic_id(), 'favoritesLink' => get_favorites_link(), 'isFav' => (int) is_user_favorite(bb_get_current_user_info('id')), 'confirmPostDelete' => __("Are you sure you want to delete this post?"), 'confirmPostUnDelete' => __("Are you sure you want to undelete this post?"), 'favLinkYes' => __('favorites'), 'favLinkNo' => __('?'), 'favYes' => __('This topic is one of your %favLinkYes% [%favDel%]'), 'favNo' => __('%favAdd% (%favLinkNo%)'), 'favDel' => __('×'), 'favAdd' => __('Add this topic to your favorites'))); }
/** * Localize internal scripts */ private function localize_scripts() { nxt_localize_script('ice-global', 'iceEasyGlobalL10n', array('ajax_url' => admin_url(self::SCRIPT_AJAX), 'async_url' => admin_url(self::SCRIPT_ASYNC))); }
/** * BPSP_Static() * * Constructor, registers enqueues. */ function BPSP_Static() { if (!defined(BPSP_VERSION)) { define(BPSP_VERSION, ''); } // Scripts // Custom jQuery UI components nxt_register_script('jquery-ui-datepicker', BPSP_WEB_URI . '/static/js/jquery-ui/jquery.ui.datepicker.js', array('jquery-ui-mouse'), '1.8.12', true); nxt_register_script('jquery-ui-slider', BPSP_WEB_URI . '/static/js/jquery-ui/jquery.ui.slider.js', array('jquery-ui-mouse'), '1.8.12', true); // FullCalendar nxt_register_script('fullcalendar', BPSP_WEB_URI . '/static/js/fullcalendar/fullcalendar.min.js', array('jquery-ui-droppable', 'jquery-ui-resizable'), '1.4.7'); nxt_localize_script('fullcalendar', 'fcLanguage', $this->fullcalendar_l10n()); // jQuery UI Date & Time picker nxt_register_script('datetimepicker', BPSP_WEB_URI . '/static/js/datetimepicker/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '0.9.8', true); nxt_localize_script('datetimepicker', 'dtpLanguage', $this->datetimepicker_l10n()); // Flexselect nxt_register_script('liquidmetal', BPSP_WEB_URI . '/static/js/flexselect/liquidmetal.js', null, '0.1'); nxt_register_script('flexselect', BPSP_WEB_URI . '/static/js/flexselect/jquery.flexselect.js', array('jquery', 'liquidmetal'), '0.2'); // DataTables nxt_register_script('datatables', BPSP_WEB_URI . '/static/js/datatables/jquery.dataTables.min.js', array('jquery'), '1.6.2'); // Localize datatables nxt_localize_script('datatables', 'oLanguage', $this->datatables_l10n()); // InputHint nxt_register_script('inputhint', BPSP_WEB_URI . '/static/js/inputhint/jquery.inputhint.js', array('jquery'), '1.0'); // Sprakline nxt_register_script('sparkline', BPSP_WEB_URI . '/static/js/sparkline/jquery.sparkline.min.js', array('jquery'), '1.6'); // jsTree nxt_register_script('jstree', BPSP_WEB_URI . '/static/js/jstree/jquery.jstree.js', array('jquery'), '1.0-rc3'); // formBuilder nxt_register_script('formbuilder', BPSP_WEB_URI . '/static/js/formbuilder/jquery.formbuilder.min.js', array('jquery'), '0.3.1'); nxt_localize_script('formbuilder', 'fbLanguage', $this->formbuilder_l10n()); // WordCounter nxt_register_script('word-counter', site_url() . '/nxt-admin/js/word-count.js', array('jquery')); // Loaders nxt_register_script('courseware-editor', BPSP_WEB_URI . '/static/js/courseware-editor.js', array('inputhint', 'word-counter'), BPSP_VERSION, true); nxt_register_script('list-assignments', BPSP_WEB_URI . '/static/js/list-assignments.js', array('datatables'), BPSP_VERSION, true); nxt_register_script('single-assignment', BPSP_WEB_URI . '/static/js/single-assignment.js', array('jquery'), BPSP_VERSION, true); nxt_register_script('assignments', BPSP_WEB_URI . '/static/js/assignments.js', array('datetimepicker'), BPSP_VERSION, true); nxt_register_script('bibliography', BPSP_WEB_URI . '/static/js/bibliography.js', array('flexselect', 'datatables'), BPSP_VERSION, true); nxt_register_script('new-bibliograpy', BPSP_WEB_URI . '/static/js/new-bibliograpy.js', array('inputhint'), BPSP_VERSION, true); nxt_register_script('edit-bibliograpy', BPSP_WEB_URI . '/static/js/edit-bibliograpy.js', array('inputhint'), BPSP_VERSION, true); nxt_register_script('gradebook', BPSP_WEB_URI . '/static/js/gradebook.js', array('datatables'), BPSP_VERSION, true); nxt_register_script('schedules', BPSP_WEB_URI . '/static/js/schedules.js', array('datatables', 'datetimepicker', 'inputhint'), BPSP_VERSION, true); nxt_register_script('list-schedules', BPSP_WEB_URI . '/static/js/list-schedules.js', array('fullcalendar', 'datatables'), BPSP_VERSION, true); nxt_register_script('delete-schedule', BPSP_WEB_URI . '/static/js/delete-schedule.js', array('datatables'), BPSP_VERSION, true); nxt_register_script('group-dashboard', BPSP_WEB_URI . '/static/js/group-dashboard.js', array('sparkline'), BPSP_VERSION, true); nxt_register_script('lectures', BPSP_WEB_URI . '/static/js/lectures.js', array('jstree'), BPSP_VERSION, true); nxt_register_script('new-assignment', BPSP_WEB_URI . '/static/js/new-assignment.js', array('courseware-editor', 'formbuilder', 'jquery-ui-sortable'), BPSP_VERSION, true); nxt_register_script('edit-assignment', BPSP_WEB_URI . '/static/js/edit-assignment.js', array('courseware-editor', 'formbuilder', 'jquery-ui-sortable'), BPSP_VERSION, true); // Styles nxt_register_style('courseware', BPSP_WEB_URI . '/static/css/courseware.css', null, BPSP_VERSION); nxt_register_style('courseware-editor', BPSP_WEB_URI . '/static/css/courseware-editor.css', null, BPSP_VERSION); nxt_register_style('jquery-ui-courseware-custom', BPSP_WEB_URI . '/static/css/jquery-ui-custom/theme/smoothness/jquery-ui-custom.css', '1.8.2'); nxt_register_style('fullcalendar', BPSP_WEB_URI . '/static/css/fullcalendar/jquery.fullcalendar.css', null, '1.4.7'); nxt_register_style('datatables', BPSP_WEB_URI . '/static/css/datatables/jquery.datatables.css', null, '1.6.2'); nxt_register_style('datetimepicker', BPSP_WEB_URI . '/static/css/datetimepicker/jquery.timepicker.css', array('jquery-ui-courseware-custom'), '0.5'); nxt_register_style('flexselect', BPSP_WEB_URI . '/static/css/flexselect/jquery.flexselect.css', null, '0.2'); nxt_register_style('formbuilder', BPSP_WEB_URI . '/static/css/formbuilder/jquery.formbuilder.css', null, '0.3-beta'); // Hooks add_action('bp_head', array(&$this, 'load_courseware_css')); add_action('courseware_editor', array(&$this, 'courseware_editor_enqueues')); add_action('courseware_list_schedules_screen', array(&$this, 'list_schedules_enqueues')); add_action('courseware_list_assignments_screen', array(&$this, 'list_assignments_enqueues')); add_action('courseware_assignment_screen', array(&$this, 'assignment_enqueues')); add_action('courseware_bibliography_screen', array(&$this, 'bibs_enqueues')); add_action('courseware_new_bibliography_screen', array(&$this, 'new_bib_enqueues')); add_action('courseware_edit_bibliography_screen', array(&$this, 'edit_bib_enqueues')); add_action('courseware_new_schedule_screen', array(&$this, 'schedules_enqueues')); add_action('courseware_edit_schedule_screen', array(&$this, 'schedules_enqueues')); add_action('courseware_delete_schedule_screen', array(&$this, 'delete_schedule_enqueues')); add_action('courseware_gradebook_screen', array(&$this, 'gradebook_enqueues')); add_action('courseware_group_dashboard', array(&$this, 'group_dashboard_enqueues')); add_action('courseware_lectures_screen', array(&$this, 'lectures_enqueues')); add_action('courseware_new_assignment_screen', array(&$this, 'new_assignment_enqueues')); add_action('courseware_edit_assignment_screen', array(&$this, 'edit_assignment_enqueues')); }
function handle_membership_dashboard_updates() { global $page, $action; nxt_reset_vars(array('action', 'page')); switch ($action) { case 'activate': check_admin_referer('toggle-plugin'); update_option('membership_active', 'yes'); nxt_safe_redirect(nxt_get_referer()); break; case 'deactivate': check_admin_referer('toggle-plugin'); update_option('membership_active', 'no'); nxt_safe_redirect(nxt_get_referer()); break; } nxt_enqueue_script('flot_js', membership_url('membershipincludes/js/jquery.flot.min.js'), array('jquery')); nxt_enqueue_script('mdash_js', membership_url('membershipincludes/js/dashboard.js'), array('jquery')); nxt_localize_script('mdash_js', 'membership', array('signups' => __('Signups', 'membership'), 'members' => __('Members', 'membership'))); add_action('admin_head', array(&$this, 'dashboard_iehead')); add_action('admin_head', array(&$this, 'dashboard_chartdata')); }
function add_subscription_styles($posts) { foreach ($posts as $key => $post) { if (strstr($post->post_content, '[subscriptionform]') !== false) { // The shortcode is in a post on this page, add the header nxt_enqueue_style('subscriptionformcss', membership_url('membershipincludes/css/subscriptionform.css')); } if (strstr($post->post_content, '[accountform]') !== false) { // The shortcode is in a post on this page, add the header nxt_enqueue_style('accountformcss', membership_url('membershipincludes/css/accountform.css')); nxt_enqueue_script('accountformjs', membership_url('membershipincludes/js/accountform.js'), array('jquery')); } if (strstr($post->post_content, '[upgradeform]') !== false) { // The shortcode is in a post on this page, add the header nxt_enqueue_style('upgradeformcss', membership_url('membershipincludes/css/upgradeform.css')); } if (strstr($post->post_content, '[renewform]') !== false) { // The shortcode is in a post on this page, add the header nxt_enqueue_style('renewformcss', membership_url('membershipincludes/css/renewform.css')); nxt_enqueue_script('renewformjs', membership_url('membershipincludes/js/renewform.js'), array('jquery')); nxt_localize_script('renewformjs', 'membership', array('unsubscribe' => __('Are you sure you want to unsubscribe from this subscription?', 'membership'), 'deactivatelevel' => __('Are you sure you want to deactivate this level?', 'membership'))); } } return $posts; }