/** * Javascript functionality for the announce-on-publish wordpress plugin. * * @version $Version: 2016.10.23$ * @author Mauricio Villegas * @copyright Copyright(c) 2016, Mauricio Villegas * @license GPLv2 or later */ /* Copyright (C) 2016 Mauricio Villegas This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ (function( WPAPI, $ ) { 'use strict'; $(document).ready( function () { /// Check that WP REST API plugin is active /// if ( announce_on_publish.rest_api !== 'true' ) { alert(announce_on_publish.no_rest_api); return; } /// Create WPAPI object for creating posts /// var wp = new WPAPI({ endpoint: announce_on_publish.root, nonce: announce_on_publish.nonce }); /// Create announcement modal box /// var curr_title = $('#title')[0], curr_content = $('#content')[0], modbox = $('