@ -0,0 +1,288 @@ |
|||
<?php |
|||
/** |
|||
* PHPExcel |
|||
* |
|||
* Copyright (c) 2006 - 2013 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library 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 |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version 1.7.9, 2013-06-02 |
|||
*/ |
|||
|
|||
|
|||
/** PHPExcel root directory */ |
|||
if (!defined('PHPEXCEL_ROOT')) { |
|||
/** |
|||
* @ignore |
|||
*/ |
|||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../'); |
|||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|||
} |
|||
|
|||
/** |
|||
* PHPExcel_IOFactory |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_IOFactory |
|||
{ |
|||
/** |
|||
* Search locations |
|||
* |
|||
* @var array |
|||
* @access private |
|||
* @static |
|||
*/ |
|||
private static $_searchLocations = array( |
|||
array( 'type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'PHPExcel_Writer_{0}' ), |
|||
array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'PHPExcel_Reader_{0}' ) |
|||
); |
|||
|
|||
/** |
|||
* Autoresolve classes |
|||
* |
|||
* @var array |
|||
* @access private |
|||
* @static |
|||
*/ |
|||
private static $_autoResolveClasses = array( |
|||
'Excel2007', |
|||
'Excel5', |
|||
'Excel2003XML', |
|||
'OOCalc', |
|||
'SYLK', |
|||
'Gnumeric', |
|||
'HTML', |
|||
'CSV', |
|||
); |
|||
|
|||
/** |
|||
* Private constructor for PHPExcel_IOFactory |
|||
*/ |
|||
private function __construct() { } |
|||
|
|||
/** |
|||
* Get search locations |
|||
* |
|||
* @static |
|||
* @access public |
|||
* @return array |
|||
*/ |
|||
public static function getSearchLocations() { |
|||
return self::$_searchLocations; |
|||
} // function getSearchLocations() |
|||
|
|||
/** |
|||
* Set search locations |
|||
* |
|||
* @static |
|||
* @access public |
|||
* @param array $value |
|||
* @throws PHPExcel_Reader_Exception |
|||
*/ |
|||
public static function setSearchLocations($value) { |
|||
if (is_array($value)) { |
|||
self::$_searchLocations = $value; |
|||
} else { |
|||
throw new PHPExcel_Reader_Exception('Invalid parameter passed.'); |
|||
} |
|||
} // function setSearchLocations() |
|||
|
|||
/** |
|||
* Add search location |
|||
* |
|||
* @static |
|||
* @access public |
|||
* @param string $type Example: IWriter |
|||
* @param string $location Example: PHPExcel/Writer/{0}.php |
|||
* @param string $classname Example: PHPExcel_Writer_{0} |
|||
*/ |
|||
public static function addSearchLocation($type = '', $location = '', $classname = '') { |
|||
self::$_searchLocations[] = array( 'type' => $type, 'path' => $location, 'class' => $classname ); |
|||
} // function addSearchLocation() |
|||
|
|||
/** |
|||
* Create PHPExcel_Writer_IWriter |
|||
* |
|||
* @static |
|||
* @access public |
|||
* @param PHPExcel $phpExcel |
|||
* @param string $writerType Example: Excel2007 |
|||
* @return PHPExcel_Writer_IWriter |
|||
* @throws PHPExcel_Reader_Exception |
|||
*/ |
|||
public static function createWriter(PHPExcel $phpExcel, $writerType = '') { |
|||
// Search type |
|||
$searchType = 'IWriter'; |
|||
|
|||
// Include class |
|||
foreach (self::$_searchLocations as $searchLocation) { |
|||
if ($searchLocation['type'] == $searchType) { |
|||
$className = str_replace('{0}', $writerType, $searchLocation['class']); |
|||
|
|||
$instance = new $className($phpExcel); |
|||
if ($instance !== NULL) { |
|||
return $instance; |
|||
} |
|||
} |
|||
} |
|||
|
|||
// Nothing found... |
|||
throw new PHPExcel_Reader_Exception("No $searchType found for type $writerType"); |
|||
} // function createWriter() |
|||
|
|||
/** |
|||
* Create PHPExcel_Reader_IReader |
|||
* |
|||
* @static |
|||
* @access public |
|||
* @param string $readerType Example: Excel2007 |
|||
* @return PHPExcel_Reader_IReader |
|||
* @throws PHPExcel_Reader_Exception |
|||
*/ |
|||
public static function createReader($readerType = '') { |
|||
// Search type |
|||
$searchType = 'IReader'; |
|||
|
|||
// Include class |
|||
foreach (self::$_searchLocations as $searchLocation) { |
|||
if ($searchLocation['type'] == $searchType) { |
|||
$className = str_replace('{0}', $readerType, $searchLocation['class']); |
|||
|
|||
$instance = new $className(); |
|||
if ($instance !== NULL) { |
|||
return $instance; |
|||
} |
|||
} |
|||
} |
|||
|
|||
// Nothing found... |
|||
throw new PHPExcel_Reader_Exception("No $searchType found for type $readerType"); |
|||
} // function createReader() |
|||
|
|||
/** |
|||
* Loads PHPExcel from file using automatic PHPExcel_Reader_IReader resolution |
|||
* |
|||
* @static |
|||
* @access public |
|||
* @param string $pFilename The name of the spreadsheet file |
|||
* @return PHPExcel |
|||
* @throws PHPExcel_Reader_Exception |
|||
*/ |
|||
public static function load($pFilename) { |
|||
$reader = self::createReaderForFile($pFilename); |
|||
return $reader->load($pFilename); |
|||
} // function load() |
|||
|
|||
/** |
|||
* Identify file type using automatic PHPExcel_Reader_IReader resolution |
|||
* |
|||
* @static |
|||
* @access public |
|||
* @param string $pFilename The name of the spreadsheet file to identify |
|||
* @return string |
|||
* @throws PHPExcel_Reader_Exception |
|||
*/ |
|||
public static function identify($pFilename) { |
|||
$reader = self::createReaderForFile($pFilename); |
|||
$className = get_class($reader); |
|||
$classType = explode('_',$className); |
|||
unset($reader); |
|||
return array_pop($classType); |
|||
} // function identify() |
|||
|
|||
/** |
|||
* Create PHPExcel_Reader_IReader for file using automatic PHPExcel_Reader_IReader resolution |
|||
* |
|||
* @static |
|||
* @access public |
|||
* @param string $pFilename The name of the spreadsheet file |
|||
* @return PHPExcel_Reader_IReader |
|||
* @throws PHPExcel_Reader_Exception |
|||
*/ |
|||
public static function createReaderForFile($pFilename) { |
|||
|
|||
// First, lucky guess by inspecting file extension |
|||
$pathinfo = pathinfo($pFilename); |
|||
|
|||
$extensionType = NULL; |
|||
if (isset($pathinfo['extension'])) { |
|||
switch (strtolower($pathinfo['extension'])) { |
|||
case 'xlsx': // Excel (OfficeOpenXML) Spreadsheet |
|||
case 'xlsm': // Excel (OfficeOpenXML) Macro Spreadsheet (macros will be discarded) |
|||
case 'xltx': // Excel (OfficeOpenXML) Template |
|||
case 'xltm': // Excel (OfficeOpenXML) Macro Template (macros will be discarded) |
|||
$extensionType = 'Excel2007'; |
|||
break; |
|||
case 'xls': // Excel (BIFF) Spreadsheet |
|||
case 'xlt': // Excel (BIFF) Template |
|||
$extensionType = 'Excel5'; |
|||
break; |
|||
case 'ods': // Open/Libre Offic Calc |
|||
case 'ots': // Open/Libre Offic Calc Template |
|||
$extensionType = 'OOCalc'; |
|||
break; |
|||
case 'slk': |
|||
$extensionType = 'SYLK'; |
|||
break; |
|||
case 'xml': // Excel 2003 SpreadSheetML |
|||
$extensionType = 'Excel2003XML'; |
|||
break; |
|||
case 'gnumeric': |
|||
$extensionType = 'Gnumeric'; |
|||
break; |
|||
case 'htm': |
|||
case 'html': |
|||
$extensionType = 'HTML'; |
|||
break; |
|||
case 'csv': |
|||
// Do nothing |
|||
// We must not try to use CSV reader since it loads |
|||
// all files including Excel files etc. |
|||
break; |
|||
default: |
|||
break; |
|||
} |
|||
|
|||
if ($extensionType !== NULL) { |
|||
$reader = self::createReader($extensionType); |
|||
// Let's see if we are lucky |
|||
if (isset($reader) && $reader->canRead($pFilename)) { |
|||
return $reader; |
|||
} |
|||
} |
|||
} |
|||
|
|||
// If we reach here then "lucky guess" didn't give any result |
|||
// Try walking through all the options in self::$_autoResolveClasses |
|||
foreach (self::$_autoResolveClasses as $autoResolveClass) { |
|||
// Ignore our original guess, we know that won't work |
|||
if ($autoResolveClass !== $extensionType) { |
|||
$reader = self::createReader($autoResolveClass); |
|||
if ($reader->canRead($pFilename)) { |
|||
return $reader; |
|||
} |
|||
} |
|||
} |
|||
|
|||
throw new PHPExcel_Reader_Exception('Unable to identify a reader for this file'); |
|||
} // function createReaderForFile() |
|||
} |
|||
@ -0,0 +1,200 @@ |
|||
<?php |
|||
/** |
|||
* PHPExcel |
|||
* |
|||
* Copyright (c) 2006 - 2013 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library 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 |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Worksheet |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version 1.7.9, 2013-06-02 |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* PHPExcel_Worksheet_MemoryDrawing |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Worksheet |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable |
|||
{ |
|||
/* Rendering functions */ |
|||
const RENDERING_DEFAULT = 'imagepng'; |
|||
const RENDERING_PNG = 'imagepng'; |
|||
const RENDERING_GIF = 'imagegif'; |
|||
const RENDERING_JPEG = 'imagejpeg'; |
|||
|
|||
/* MIME types */ |
|||
const MIMETYPE_DEFAULT = 'image/png'; |
|||
const MIMETYPE_PNG = 'image/png'; |
|||
const MIMETYPE_GIF = 'image/gif'; |
|||
const MIMETYPE_JPEG = 'image/jpeg'; |
|||
|
|||
/** |
|||
* Image resource |
|||
* |
|||
* @var resource |
|||
*/ |
|||
private $_imageResource; |
|||
|
|||
/** |
|||
* Rendering function |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_renderingFunction; |
|||
|
|||
/** |
|||
* Mime type |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_mimeType; |
|||
|
|||
/** |
|||
* Unique name |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_uniqueName; |
|||
|
|||
/** |
|||
* Create a new PHPExcel_Worksheet_MemoryDrawing |
|||
*/ |
|||
public function __construct() |
|||
{ |
|||
// Initialise values |
|||
$this->_imageResource = null; |
|||
$this->_renderingFunction = self::RENDERING_DEFAULT; |
|||
$this->_mimeType = self::MIMETYPE_DEFAULT; |
|||
$this->_uniqueName = md5(rand(0, 9999). time() . rand(0, 9999)); |
|||
|
|||
// Initialize parent |
|||
parent::__construct(); |
|||
} |
|||
|
|||
/** |
|||
* Get image resource |
|||
* |
|||
* @return resource |
|||
*/ |
|||
public function getImageResource() { |
|||
return $this->_imageResource; |
|||
} |
|||
|
|||
/** |
|||
* Set image resource |
|||
* |
|||
* @param $value resource |
|||
* @return PHPExcel_Worksheet_MemoryDrawing |
|||
*/ |
|||
public function setImageResource($value = null) { |
|||
$this->_imageResource = $value; |
|||
|
|||
if (!is_null($this->_imageResource)) { |
|||
// Get width/height |
|||
$this->_width = imagesx($this->_imageResource); |
|||
$this->_height = imagesy($this->_imageResource); |
|||
} |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get rendering function |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getRenderingFunction() { |
|||
return $this->_renderingFunction; |
|||
} |
|||
|
|||
/** |
|||
* Set rendering function |
|||
* |
|||
* @param string $value |
|||
* @return PHPExcel_Worksheet_MemoryDrawing |
|||
*/ |
|||
public function setRenderingFunction($value = PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT) { |
|||
$this->_renderingFunction = $value; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get mime type |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getMimeType() { |
|||
return $this->_mimeType; |
|||
} |
|||
|
|||
/** |
|||
* Set mime type |
|||
* |
|||
* @param string $value |
|||
* @return PHPExcel_Worksheet_MemoryDrawing |
|||
*/ |
|||
public function setMimeType($value = PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT) { |
|||
$this->_mimeType = $value; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get indexed filename (using image index) |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getIndexedFilename() { |
|||
$extension = strtolower($this->getMimeType()); |
|||
$extension = explode('/', $extension); |
|||
$extension = $extension[1]; |
|||
|
|||
return $this->_uniqueName . $this->getImageIndex() . '.' . $extension; |
|||
} |
|||
|
|||
/** |
|||
* Get hash code |
|||
* |
|||
* @return string Hash code |
|||
*/ |
|||
public function getHashCode() { |
|||
return md5( |
|||
$this->_renderingFunction |
|||
. $this->_mimeType |
|||
. $this->_uniqueName |
|||
. parent::getHashCode() |
|||
. __CLASS__ |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* Implement PHP __clone to create a deep clone, not just a shallow copy. |
|||
*/ |
|||
public function __clone() { |
|||
$vars = get_object_vars($this); |
|||
foreach ($vars as $key => $value) { |
|||
if (is_object($value)) { |
|||
$this->$key = clone $value; |
|||
} else { |
|||
$this->$key = $value; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
<?php |
|||
/** |
|||
* PHPExcel |
|||
* |
|||
* Copyright (c) 2006 - 2013 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library 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 |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version 1.7.9, 2013-06-02 |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* PHPExcel_Writer_IWriter |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
interface PHPExcel_Writer_IWriter |
|||
{ |
|||
/** |
|||
* Save PHPExcel to file |
|||
* |
|||
* @param string $pFilename Name of the file to save |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function save($pFilename = NULL); |
|||
|
|||
} |
|||
@ -0,0 +1,95 @@ |
|||
<?php |
|||
|
|||
/** |
|||
* PHPExcel_Writer_OpenDocument_Meta |
|||
* |
|||
* Copyright (c) 2006 - 2015 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library 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 |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer_OpenDocument |
|||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version ##VERSION##, ##DATE## |
|||
*/ |
|||
class PHPExcel_Writer_OpenDocument_Meta extends PHPExcel_Writer_OpenDocument_WriterPart |
|||
{ |
|||
/** |
|||
* Write meta.xml to XML format |
|||
* |
|||
* @param PHPExcel $pPHPExcel |
|||
* @return string XML Output |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function write(PHPExcel $pPHPExcel = null) |
|||
{ |
|||
if (!$pPHPExcel) { |
|||
$pPHPExcel = $this->getParentWriter()->getPHPExcel(); |
|||
} |
|||
|
|||
$objWriter = null; |
|||
if ($this->getParentWriter()->getUseDiskCaching()) { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); |
|||
} else { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); |
|||
} |
|||
|
|||
// XML header |
|||
$objWriter->startDocument('1.0', 'UTF-8'); |
|||
|
|||
// Meta |
|||
$objWriter->startElement('office:document-meta'); |
|||
|
|||
$objWriter->writeAttribute('xmlns:office', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0'); |
|||
$objWriter->writeAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink'); |
|||
$objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/'); |
|||
$objWriter->writeAttribute('xmlns:meta', 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0'); |
|||
$objWriter->writeAttribute('xmlns:ooo', 'http://openoffice.org/2004/office'); |
|||
$objWriter->writeAttribute('xmlns:grddl', 'http://www.w3.org/2003/g/data-view#'); |
|||
$objWriter->writeAttribute('office:version', '1.2'); |
|||
|
|||
$objWriter->startElement('office:meta'); |
|||
|
|||
$objWriter->writeElement('meta:initial-creator', $pPHPExcel->getProperties()->getCreator()); |
|||
$objWriter->writeElement('dc:creator', $pPHPExcel->getProperties()->getCreator()); |
|||
$objWriter->writeElement('meta:creation-date', date(DATE_W3C, $pPHPExcel->getProperties()->getCreated())); |
|||
$objWriter->writeElement('dc:date', date(DATE_W3C, $pPHPExcel->getProperties()->getCreated())); |
|||
$objWriter->writeElement('dc:title', $pPHPExcel->getProperties()->getTitle()); |
|||
$objWriter->writeElement('dc:description', $pPHPExcel->getProperties()->getDescription()); |
|||
$objWriter->writeElement('dc:subject', $pPHPExcel->getProperties()->getSubject()); |
|||
$keywords = explode(' ', $pPHPExcel->getProperties()->getKeywords()); |
|||
foreach ($keywords as $keyword) { |
|||
$objWriter->writeElement('meta:keyword', $keyword); |
|||
} |
|||
|
|||
//<meta:document-statistic meta:table-count="XXX" meta:cell-count="XXX" meta:object-count="XXX"/> |
|||
$objWriter->startElement('meta:user-defined'); |
|||
$objWriter->writeAttribute('meta:name', 'Company'); |
|||
$objWriter->writeRaw($pPHPExcel->getProperties()->getCompany()); |
|||
$objWriter->endElement(); |
|||
|
|||
$objWriter->startElement('meta:user-defined'); |
|||
$objWriter->writeAttribute('meta:name', 'category'); |
|||
$objWriter->writeRaw($pPHPExcel->getProperties()->getCategory()); |
|||
$objWriter->endElement(); |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
return $objWriter->getData(); |
|||
} |
|||
} |
|||
@ -0,0 +1,87 @@ |
|||
<?php |
|||
|
|||
/** |
|||
* PHPExcel_Writer_OpenDocument_MetaInf |
|||
* |
|||
* Copyright (c) 2006 - 2015 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library 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 |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer_OpenDocument |
|||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version ##VERSION##, ##DATE## |
|||
*/ |
|||
class PHPExcel_Writer_OpenDocument_MetaInf extends PHPExcel_Writer_OpenDocument_WriterPart |
|||
{ |
|||
/** |
|||
* Write META-INF/manifest.xml to XML format |
|||
* |
|||
* @param PHPExcel $pPHPExcel |
|||
* @return string XML Output |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function writeManifest(PHPExcel $pPHPExcel = null) |
|||
{ |
|||
if (!$pPHPExcel) { |
|||
$pPHPExcel = $this->getParentWriter()->getPHPExcel(); |
|||
} |
|||
|
|||
$objWriter = null; |
|||
if ($this->getParentWriter()->getUseDiskCaching()) { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); |
|||
} else { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); |
|||
} |
|||
|
|||
// XML header |
|||
$objWriter->startDocument('1.0', 'UTF-8'); |
|||
|
|||
// Manifest |
|||
$objWriter->startElement('manifest:manifest'); |
|||
$objWriter->writeAttribute('xmlns:manifest', 'urn:oasis:names:tc:opendocument:xmlns:manifest:1.0'); |
|||
$objWriter->writeAttribute('manifest:version', '1.2'); |
|||
|
|||
$objWriter->startElement('manifest:file-entry'); |
|||
$objWriter->writeAttribute('manifest:full-path', '/'); |
|||
$objWriter->writeAttribute('manifest:version', '1.2'); |
|||
$objWriter->writeAttribute('manifest:media-type', 'application/vnd.oasis.opendocument.spreadsheet'); |
|||
$objWriter->endElement(); |
|||
$objWriter->startElement('manifest:file-entry'); |
|||
$objWriter->writeAttribute('manifest:full-path', 'meta.xml'); |
|||
$objWriter->writeAttribute('manifest:media-type', 'text/xml'); |
|||
$objWriter->endElement(); |
|||
$objWriter->startElement('manifest:file-entry'); |
|||
$objWriter->writeAttribute('manifest:full-path', 'settings.xml'); |
|||
$objWriter->writeAttribute('manifest:media-type', 'text/xml'); |
|||
$objWriter->endElement(); |
|||
$objWriter->startElement('manifest:file-entry'); |
|||
$objWriter->writeAttribute('manifest:full-path', 'content.xml'); |
|||
$objWriter->writeAttribute('manifest:media-type', 'text/xml'); |
|||
$objWriter->endElement(); |
|||
$objWriter->startElement('manifest:file-entry'); |
|||
$objWriter->writeAttribute('manifest:full-path', 'Thumbnails/thumbnail.png'); |
|||
$objWriter->writeAttribute('manifest:media-type', 'image/png'); |
|||
$objWriter->endElement(); |
|||
$objWriter->startElement('manifest:file-entry'); |
|||
$objWriter->writeAttribute('manifest:full-path', 'styles.xml'); |
|||
$objWriter->writeAttribute('manifest:media-type', 'text/xml'); |
|||
$objWriter->endElement(); |
|||
$objWriter->endElement(); |
|||
|
|||
return $objWriter->getData(); |
|||
} |
|||
} |
|||
@ -0,0 +1,41 @@ |
|||
<?php |
|||
|
|||
/** |
|||
* PHPExcel |
|||
* |
|||
* PHPExcel_Writer_OpenDocument_Mimetype |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library 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 |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer_OpenDocument |
|||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version ##VERSION##, ##DATE## |
|||
*/ |
|||
class PHPExcel_Writer_OpenDocument_Mimetype extends PHPExcel_Writer_OpenDocument_WriterPart |
|||
{ |
|||
/** |
|||
* Write mimetype to plain text format |
|||
* |
|||
* @param PHPExcel $pPHPExcel |
|||
* @return string XML Output |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function write(PHPExcel $pPHPExcel = null) |
|||
{ |
|||
return 'application/vnd.oasis.opendocument.spreadsheet'; |
|||
} |
|||
} |
|||
@ -0,0 +1,130 @@ |
|||
<?php |
|||
/** |
|||
* PHPExcel |
|||
* |
|||
* Copyright (c) 2006 - 2013 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library 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 |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer_PDF |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version 1.7.9, 2013-06-02 |
|||
*/ |
|||
|
|||
|
|||
/** Require mPDF library */ |
|||
$pdfRendererClassFile = PHPExcel_Settings::getPdfRendererPath() . '/mpdf.php'; |
|||
if (file_exists($pdfRendererClassFile)) { |
|||
require_once $pdfRendererClassFile; |
|||
} else { |
|||
throw new PHPExcel_Writer_Exception('Unable to load PDF Rendering library'); |
|||
} |
|||
|
|||
/** |
|||
* PHPExcel_Writer_PDF_mPDF |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer_PDF |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Writer_PDF_mPDF extends PHPExcel_Writer_PDF_Core implements PHPExcel_Writer_IWriter |
|||
{ |
|||
/** |
|||
* Create a new PHPExcel_Writer_PDF |
|||
* |
|||
* @param PHPExcel $phpExcel PHPExcel object |
|||
*/ |
|||
public function __construct(PHPExcel $phpExcel) |
|||
{ |
|||
parent::__construct($phpExcel); |
|||
} |
|||
|
|||
/** |
|||
* Save PHPExcel to file |
|||
* |
|||
* @param string $pFilename Name of the file to save as |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function save($pFilename = NULL) |
|||
{ |
|||
$fileHandle = parent::prepareForSave($pFilename); |
|||
|
|||
// Default PDF paper size |
|||
$paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) |
|||
|
|||
// Check for paper size and page orientation |
|||
if (is_null($this->getSheetIndex())) { |
|||
$orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() |
|||
== PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) |
|||
? 'L' |
|||
: 'P'; |
|||
$printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize(); |
|||
$printMargins = $this->_phpExcel->getSheet(0)->getPageMargins(); |
|||
} else { |
|||
$orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() |
|||
== PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) |
|||
? 'L' |
|||
: 'P'; |
|||
$printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); |
|||
$printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins(); |
|||
} |
|||
$this->setOrientation($orientation); |
|||
|
|||
// Override Page Orientation |
|||
if (!is_null($this->getOrientation())) { |
|||
$orientation = ($this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT) |
|||
? PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT |
|||
: $this->getOrientation(); |
|||
} |
|||
$orientation = strtoupper($orientation); |
|||
|
|||
// Override Paper Size |
|||
if (!is_null($this->getPaperSize())) { |
|||
$printPaperSize = $this->getPaperSize(); |
|||
} |
|||
|
|||
if (isset(self::$_paperSizes[$printPaperSize])) { |
|||
$paperSize = self::$_paperSizes[$printPaperSize]; |
|||
} |
|||
|
|||
// Create PDF |
|||
$pdf = new mpdf(); |
|||
$ortmp = $orientation; |
|||
$pdf->_setPageSize(strtoupper($paperSize), $ortmp); |
|||
$pdf->DefOrientation = $orientation; |
|||
$pdf->AddPage($orientation); |
|||
|
|||
// Document info |
|||
$pdf->SetTitle($this->_phpExcel->getProperties()->getTitle()); |
|||
$pdf->SetAuthor($this->_phpExcel->getProperties()->getCreator()); |
|||
$pdf->SetSubject($this->_phpExcel->getProperties()->getSubject()); |
|||
$pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords()); |
|||
$pdf->SetCreator($this->_phpExcel->getProperties()->getCreator()); |
|||
|
|||
$pdf->WriteHTML( |
|||
$this->generateHTMLHeader(FALSE) . |
|||
$this->generateSheetData() . |
|||
$this->generateHTMLFooter() |
|||
); |
|||
|
|||
// Write to file |
|||
fwrite($fileHandle, $pdf->Output('', 'S')); |
|||
|
|||
parent::restoreStateAfterSave($fileHandle); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,39 @@ |
|||
<!doctype html> |
|||
<html> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<title>恭喜,站点创建成功!</title> |
|||
<style> |
|||
.container { |
|||
width: 60%; |
|||
margin: 10% auto 0; |
|||
background-color: #f0f0f0; |
|||
padding: 2% 5%; |
|||
border-radius: 10px |
|||
} |
|||
|
|||
ul { |
|||
padding-left: 20px; |
|||
} |
|||
|
|||
ul li { |
|||
line-height: 2.3 |
|||
} |
|||
|
|||
a { |
|||
color: #20a53a |
|||
} |
|||
</style> |
|||
</head> |
|||
<body> |
|||
<div class="container"> |
|||
<h1>恭喜, 站点创建成功!</h1> |
|||
<h3>这是默认index.html,本页面由系统自动生成</h3> |
|||
<ul> |
|||
<li>本页面在FTP根目录下的index.html</li> |
|||
<li>您可以修改、删除或覆盖本页面</li> |
|||
<li>FTP相关信息,请到“面板系统后台 > FTP” 查看</li> |
|||
</ul> |
|||
</div> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,10 @@ |
|||
<?php |
|||
require './framework/bootstrap.inc.php'; |
|||
|
|||
$host = $_SERVER['HTTP_HOST']; |
|||
|
|||
if (!empty($_SERVER['QUERY_STRING'])) { |
|||
header('Location: ' . $_W['siteroot'] . 'web/index.php?' . $_SERVER['QUERY_STRING']); |
|||
} else { |
|||
header('Location: ' . $_W['siteroot'] . 'web/home.php'); |
|||
} |
|||
@ -0,0 +1,216 @@ |
|||
<?php |
|||
|
|||
define('IN_SYS', true); |
|||
require '../framework/bootstrap.inc.php'; |
|||
require IA_ROOT . '/web/common/bootstrap.sys.inc.php'; |
|||
|
|||
if (empty($_W['isfounder']) && !empty($_W['user']) && ($_W['user']['status'] == USER_STATUS_CHECK || $_W['user']['status'] == USER_STATUS_BAN)) { |
|||
isetcookie('__session', '', -10000); |
|||
itoast('您的账号正在审核或是已经被系统禁止,请联系网站管理员解决!', url('user/login'), 'info'); |
|||
} |
|||
$acl = require IA_ROOT . '/web/common/permission.inc.php'; |
|||
|
|||
$_W['page'] = array(); |
|||
$_W['page']['copyright'] = $_W['setting']['copyright']; |
|||
|
|||
if (($_W['setting']['copyright']['status'] == 1) && empty($_W['isfounder']) && 'cloud' != $controller && 'utility' != $controller && 'account' != $controller) { |
|||
$_W['siteclose'] = true; |
|||
if ('account' == $controller && 'welcome' == $action) { |
|||
template('account/welcome'); |
|||
exit(); |
|||
} |
|||
if ('user' == $controller && 'login' == $action) { |
|||
if (checksubmit() || $_W['isajax'] && $_W['ispost']) { |
|||
require _forward($controller, $action); |
|||
} |
|||
$login_template = !empty($_W['setting']['basic']['login_template']) ? $_W['setting']['basic']['login_template'] : 'half'; |
|||
$login_template = 'half'; |
|||
template('user/login-' . $login_template); |
|||
exit(); |
|||
} |
|||
isetcookie('__session', '', -10000); |
|||
if ($_W['isajax']) { |
|||
iajax(-1, '站点已关闭,关闭原因:' . $_W['setting']['copyright']['reason']); |
|||
} |
|||
itoast('站点已关闭,关闭原因:' . $_W['setting']['copyright']['reason'], $_W['siteroot'], 'info'); |
|||
} |
|||
|
|||
$controllers = array(); |
|||
$handle = opendir(IA_ROOT . '/web/source/'); |
|||
if (!empty($handle)) { |
|||
while ($dir = readdir($handle)) { |
|||
if ('.' != $dir && '..' != $dir) { |
|||
$controllers[] = $dir; |
|||
} |
|||
} |
|||
} |
|||
if (!in_array($controller, $controllers)) { |
|||
$controller = 'home'; |
|||
} |
|||
|
|||
$init = IA_ROOT . "/web/source/{$controller}/__init.php"; |
|||
if (is_file($init)) { |
|||
require $init; |
|||
} |
|||
|
|||
$need_account_info = uni_need_account_info(); |
|||
if (defined('FRAME') && $need_account_info) { |
|||
if (!empty($_W['uniacid'])) { |
|||
$_W['uniaccount'] = $_W['account'] = uni_fetch($_W['uniacid']); |
|||
if (is_error($_W['account'])) { |
|||
itoast('', $_W['siteroot'] . 'web/home.php'); |
|||
} |
|||
if (!empty($_W['uniaccount']['endtime']) && TIMESTAMP > $_W['uniaccount']['endtime'] && !in_array($_W['uniaccount']['endtime'], array(USER_ENDTIME_GROUP_EMPTY_TYPE, USER_ENDTIME_GROUP_UNLIMIT_TYPE))) { |
|||
empty($_W['isajax']) ? itoast('抱歉,您的平台账号服务已过期,请及时联系管理员') : iajax(-1, '抱歉,您的平台账号服务已过期,请及时联系管理员'); |
|||
} |
|||
$_W['acid'] = $_W['account']['acid']; |
|||
$_W['weid'] = $_W['uniacid']; |
|||
} |
|||
} |
|||
|
|||
$actions = array(); |
|||
$actions_path = file_tree(IA_ROOT . '/web/source/' . $controller); |
|||
foreach ($actions_path as $action_path) { |
|||
$action_name = str_replace('.ctrl.php', '', basename($action_path)); |
|||
|
|||
$section = basename(dirname($action_path)); |
|||
if ($section !== $controller) { |
|||
$action_name = $section . '-' . $action_name; |
|||
} |
|||
$actions[] = $action_name; |
|||
} |
|||
|
|||
//if (empty($actions)) { |
|||
// header('location: ?refresh'); |
|||
//} |
|||
|
|||
if (!in_array($action, $actions)) { |
|||
$action = $action . '-' . $action; |
|||
} |
|||
if (!in_array($action, $actions)) { |
|||
$action = $acl[$controller]['default'] ? $acl[$controller]['default'] : $actions[0]; |
|||
} |
|||
if (!defined('FRAME')) { |
|||
define('FRAME', ''); |
|||
} |
|||
$_W['iscontroller'] = current_operate_is_controller(); |
|||
if (is_array($acl[$controller]['direct']) && in_array($action, $acl[$controller]['direct'])) { |
|||
require _forward($controller, $action); |
|||
exit(); |
|||
} |
|||
|
|||
checklogin($_W['siteurl']); |
|||
if (ACCOUNT_MANAGE_NAME_FOUNDER != $_W['highest_role']) { |
|||
if (ACCOUNT_MANAGE_NAME_UNBIND_USER == $_W['highest_role']) { |
|||
itoast('', url('user/third-bind')); |
|||
} |
|||
if (empty($_W['uniacid']) && in_array(FRAME, array('account', 'wxapp')) && 'store' != $_GPC['module_name'] && !$_GPC['system_welcome']) { |
|||
itoast('', url('account/display/platform'), 'info'); |
|||
} |
|||
|
|||
$acl = permission_build(); |
|||
if (in_array(FRAME, array('system', 'site', 'account_manage', 'platform', 'module', 'welcome', 'myself', 'user_manage', 'permission'))) { |
|||
$checked_role = $_W['highest_role']; |
|||
} else { |
|||
$checked_role = $_W['role']; |
|||
} |
|||
if (empty($acl[$controller][$checked_role]) || |
|||
(!in_array($controller . '*', $acl[$controller][$checked_role]) && !in_array($action, $acl[$controller][$checked_role]))) { |
|||
empty($_W['isajax']) ? itoast('不能访问, 需要相应的权限才能访问!') : iajax('-1', '不能访问, 需要相应的权限才能访问!'); |
|||
} |
|||
unset($checked_role); |
|||
} |
|||
|
|||
require _forward($controller, $action); |
|||
|
|||
define('ENDTIME', microtime()); |
|||
|
|||
function _forward($c, $a) |
|||
{ |
|||
$file = IA_ROOT . '/web/source/' . $c . '/' . $a . '.ctrl.php'; |
|||
if (!file_exists($file)) { |
|||
list($section, $a) = explode('-', $a); |
|||
$file = IA_ROOT . '/web/source/' . $c . '/' . $section . '/' . $a . '.ctrl.php'; |
|||
} |
|||
|
|||
return $file; |
|||
} |
|||
|
|||
function _calc_current_frames(&$frames) |
|||
{ |
|||
global $_W, $controller, $action; |
|||
$_W['page']['title'] = (isset($_W['page']['title']) && !empty($_W['page']['title'])) ? $_W['page']['title'] : ((2 == $frames['dimension'] && !('account' == $controller && 'welcome' == $action)) ? $frames['title'] : ''); |
|||
if (in_array(FRAME, array('account', 'wxapp'))) { |
|||
$_W['breadcrumb'] = $_W['account']['name']; |
|||
} |
|||
if (in_array(FRAME, array('myself', 'message'))) { |
|||
$_W['breadcrumb'] = $frames['title']; |
|||
} |
|||
if (defined('IN_MODULE')) { |
|||
$_W['breadcrumb'] = ($_W['current_module']['name'] == 'store' ? '' : ('<a href="' . $_W['account']['switchurl'] . '">' . $_W['account']['name'] . '</a> / ')) . $_W['current_module']['title']; |
|||
} |
|||
if (empty($frames['section']) || !is_array($frames['section'])) { |
|||
return true; |
|||
} |
|||
foreach ($frames['section'] as &$frame) { |
|||
if (empty($frame['menu'])) { |
|||
continue; |
|||
} |
|||
$finished = false; |
|||
foreach ($frame['menu'] as $key => &$menu) { |
|||
if (defined('IN_MODULE') && $menu['multilevel']) { |
|||
foreach ($menu['childs'] as $module_child_key => $module_child_menu) { |
|||
$query = parse_url($module_child_menu['url'], PHP_URL_QUERY); |
|||
$server_query = parse_url($_W['siteurl'], PHP_URL_QUERY); |
|||
if (0 === strpos($server_query, $query)) { |
|||
$menu['childs'][$module_child_key]['active'] = 'active'; |
|||
break; |
|||
} |
|||
} |
|||
} else { |
|||
$query = parse_url($menu['url'], PHP_URL_QUERY); |
|||
parse_str($query, $urls); |
|||
if (empty($urls)) { |
|||
continue; |
|||
} |
|||
if (defined('ACTIVE_FRAME_URL')) { |
|||
$query = parse_url(ACTIVE_FRAME_URL, PHP_URL_QUERY); |
|||
parse_str($query, $get); |
|||
} else { |
|||
$get = $_GET; |
|||
$get['c'] = $controller; |
|||
$get['a'] = $action; |
|||
} |
|||
if (!empty($do)) { |
|||
$get['do'] = $do; |
|||
} |
|||
if (false !== strpos($get['do'], 'post') && !in_array($key, array('platform_menu', 'platform_masstask'))) { |
|||
$_W['page']['title'] = ''; |
|||
continue; |
|||
} |
|||
$diff = array_diff_assoc($urls, $get); |
|||
|
|||
if (empty($diff) || |
|||
'platform_menu' == $key && 'menu' == $get['a'] && in_array($get['do'], array('display')) || |
|||
'platform_site' == $key && in_array($get['a'], array('style', 'article', 'category')) || |
|||
'mc_member' == $key && in_array($get['a'], array('editor', 'group', 'fields')) || |
|||
'profile_setting' == $key && in_array($get['a'], array('passport', 'tplnotice', 'notify', 'common')) || |
|||
'profile_payment' == $key && in_array($get['a'], array('refund')) || |
|||
'statistics_visit' == $key && in_array($get['a'], array('site', 'setting')) || |
|||
'platform_reply' == $key && in_array($get['a'], array('reply-setting')) || |
|||
'system_setting_thirdlogin' == $key && in_array($get['a'], array('thirdlogin')) || |
|||
'system_cloud_sms' == $key && in_array($get['a'], array('profile')) || |
|||
'wxapp_profile_payment' == $key && in_array($get['a'], array('refund'))) { |
|||
$menu['active'] = ' active'; |
|||
$_W['page']['title'] = !empty($_W['page']['title']) ? $_W['page']['title'] : $menu['title']; |
|||
$finished = true; |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
if ($finished) { |
|||
break; |
|||
} |
|||
} |
|||
return true; |
|||
} |
|||
@ -0,0 +1,182 @@ |
|||
/* KindEditor 4.1.10 (2013-11-23), Copyright (C) kindsoft.net, Licence: http://www.kindsoft.net/license.php */(function(w,i){function Z(a){if(!a)return!1;return Object.prototype.toString.call(a)==="[object Array]"}function wa(a){if(!a)return!1;return Object.prototype.toString.call(a)==="[object Function]"}function J(a,b){for(var c=0,d=b.length;c<d;c++)if(a===b[c])return c;return-1}function m(a,b){if(Z(a))for(var c=0,d=a.length;c<d;c++){if(b.call(a[c],c,a[c])===!1)break}else for(c in a)if(a.hasOwnProperty(c)&&b.call(a[c],c,a[c])===!1)break}function B(a){return a.replace(/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g, |
|||
"")}function xa(a,b,c){c=c===i?",":c;return(c+b+c).indexOf(c+a+c)>=0}function s(a,b){b=b||"px";return a&&/^\d+$/.test(a)?a+b:a}function t(a){var b;return a&&(b=/(\d+)/.exec(a))?parseInt(b[1],10):0}function C(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function fa(a){return a.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function ga(a){var b=a.split("-"),a="";m(b,function(b,d){a+=b>0?d.charAt(0).toUpperCase()+ |
|||
d.substr(1):d});return a}function ya(a){function b(a){a=parseInt(a,10).toString(16).toUpperCase();return a.length>1?a:"0"+a}return a.replace(/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/ig,function(a,d,e,g){return"#"+b(d)+b(e)+b(g)})}function u(a,b){var b=b===i?",":b,c={},d=Z(a)?a:a.split(b),e;m(d,function(a,b){if(e=/^(\d+)\.\.(\d+)$/.exec(b))for(var d=parseInt(e[1],10);d<=parseInt(e[2],10);d++)c[d.toString()]=!0;else c[b]=!0});return c}function Ja(a,b){return Array.prototype.slice.call(a,b||0)} |
|||
function l(a,b){return a===i?b:a}function E(a,b,c){c||(c=b,b=null);var d;if(b){var e=function(){};e.prototype=b.prototype;d=new e;m(c,function(a,b){d[a]=b})}else d=c;d.constructor=a;a.prototype=d;a.parent=b?b.prototype:null}function eb(a){var b;if(b=/\{[\s\S]*\}|\[[\s\S]*\]/.exec(a))a=b[0];b=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;b.lastIndex=0;b.test(a)&&(a=a.replace(b,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})); |
|||
if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return eval("("+a+")");throw"JSON parse error";}function Rb(a,b,c){a.addEventListener?a.addEventListener(b,c,fb):a.attachEvent&&a.attachEvent("on"+b,c)}function za(a,b,c){a.removeEventListener?a.removeEventListener(b,c,fb):a.detachEvent&&a.detachEvent("on"+b,c)}function gb(a,b){this.init(a,b)}function hb(a){try{delete a[$]}catch(b){a.removeAttribute&& |
|||
a.removeAttribute($)}}function aa(a,b,c){if(b.indexOf(",")>=0)m(b.split(","),function(){aa(a,this,c)});else{var d=a[$]||null;d||(a[$]=++ib,d=ib);v[d]===i&&(v[d]={});var e=v[d][b];e&&e.length>0?za(a,b,e[0]):(v[d][b]=[],v[d].el=a);e=v[d][b];e.length===0&&(e[0]=function(b){var c=b?new gb(a,b):i;m(e,function(b,d){b>0&&d&&d.call(a,c)})});J(c,e)<0&&e.push(c);Rb(a,b,e[0])}}function ha(a,b,c){if(b&&b.indexOf(",")>=0)m(b.split(","),function(){ha(a,this,c)});else{var d=a[$]||null;if(d)if(b===i)d in v&&(m(v[d], |
|||
function(b,c){b!="el"&&c.length>0&&za(a,b,c[0])}),delete v[d],hb(a));else if(v[d]){var e=v[d][b];if(e&&e.length>0){c===i?(za(a,b,e[0]),delete v[d][b]):(m(e,function(a,b){a>0&&b===c&&e.splice(a,1)}),e.length==1&&(za(a,b,e[0]),delete v[d][b]));var g=0;m(v[d],function(){g++});g<2&&(delete v[d],hb(a))}}}}function jb(a,b){if(b.indexOf(",")>=0)m(b.split(","),function(){jb(a,this)});else{var c=a[$]||null;if(c){var d=v[c][b];if(v[c]&&d&&d.length>0)d[0]()}}}function Ka(a,b,c){b=/^\d{2,}$/.test(b)?b:b.toUpperCase().charCodeAt(0); |
|||
aa(a,"keydown",function(d){d.ctrlKey&&d.which==b&&!d.shiftKey&&!d.altKey&&(c.call(a),d.stop())})}function ba(a){for(var b={},c=/\s*([\w\-]+)\s*:([^;]*)(;|$)/g,d;d=c.exec(a);){var e=B(d[1].toLowerCase());d=B(ya(d[2]));b[e]=d}return b}function I(a){for(var b={},c=/\s+(?:([\w\-:]+)|(?:([\w\-:]+)=([^\s"'<>]+))|(?:([\w\-:"]+)="([^"]*)")|(?:([\w\-:"]+)='([^']*)'))(?=(?:\s|\/|>)+)/g,d;d=c.exec(a);){var e=(d[1]||d[2]||d[4]||d[6]).toLowerCase();b[e]=(d[2]?d[3]:d[4]?d[5]:d[7])||""}return b}function Sb(a,b){return a= |
|||
/\s+class\s*=/.test(a)?a.replace(/(\s+class=["']?)([^"']*)(["']?[\s>])/,function(a,d,e,g){return(" "+e+" ").indexOf(" "+b+" ")<0?e===""?d+b+g:d+e+" "+b+g:a}):a.substr(0,a.length-1)+' class="'+b+'">'}function Tb(a){var b="";m(ba(a),function(a,d){b+=a+":"+d+";"});return b}function ia(a,b,c,d){function e(a){for(var a=a.split("/"),b=[],c=0,d=a.length;c<d;c++){var e=a[c];e==".."?b.length>0&&b.pop():e!==""&&e!="."&&b.push(e)}return"/"+b.join("/")}function g(b,c){if(a.substr(0,b.length)===b){for(var e=[], |
|||
h=0;h<c;h++)e.push("..");h=".";e.length>0&&(h+="/"+e.join("/"));d=="/"&&(h+="/");return h+a.substr(b.length)}else if(f=/^(.*)\//.exec(b))return g(f[1],++c)}b=l(b,"").toLowerCase();a.substr(0,5)!="data:"&&(a=a.replace(/([^:])\/\//g,"$1/"));if(J(b,["absolute","relative","domain"])<0)return a;c=c||location.protocol+"//"+location.host;if(d===i)var h=location.pathname.match(/^(\/.*)\//),d=h?h[1]:"";var f;if(f=/^(\w+:\/\/[^\/]*)/.exec(a)){if(f[1]!==c)return a}else if(/^\w+:/.test(a))return a;/^\//.test(a)? |
|||
a=c+e(a.substr(1)):/^\w+:\/\//.test(a)||(a=c+e(d+"/"+a));b==="relative"?a=g(c+d,0).substr(2):b==="absolute"&&a.substr(0,c.length)===c&&(a=a.substr(c.length));return a}function U(a,b,c,d,e){a==null&&(a="");var c=c||"",d=l(d,!1),e=l(e,"\t"),g="xx-small,x-small,small,medium,large,x-large,xx-large".split(","),a=a.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/ig,function(a,b,c,d){return b+c.replace(/<(?:br|br\s[^>]*)>/ig,"\n")+d}),a=a.replace(/<(?:br|br\s[^>]*)\s*\/?>\s*<\/p>/ig,"</p>"),a=a.replace(/(<(?:p|p\s[^>]*)>)\s*(<\/p>)/ig, |
|||
"$1<br />$2"),a=a.replace(/\u200B/g,""),a=a.replace(/\u00A9/g,"©"),a=a.replace(/\u00AE/g,"®"),a=a.replace(/<[^>]+/g,function(a){return a.replace(/\s+/g," ")}),h={};b&&(m(b,function(a,b){for(var c=a.split(","),d=0,e=c.length;d<e;d++)h[c[d]]=u(b)}),h.script||(a=a.replace(/(<(?:script|script\s[^>]*)>)([\s\S]*?)(<\/script>)/ig,"")),h.style||(a=a.replace(/(<(?:style|style\s[^>]*)>)([\s\S]*?)(<\/style>)/ig,"")));var f=[],a=a.replace(/(\s*)<(\/)?([\w\-:]+)((?:\s+|(?:\s+[\w\-:]+)|(?:\s+[\w\-:]+=[^\s"'<>]+)|(?:\s+[\w\-:"]+="[^"]*")|(?:\s+[\w\-:"]+='[^']*'))*)(\/)?>(\s*)/g, |
|||
function(a,n,q,r,K,ja,i){var n=n||"",q=q||"",l=r.toLowerCase(),o=K||"",r=ja?" "+ja:"",i=i||"";if(b&&!h[l])return"";r===""&&kb[l]&&(r=" /");lb[l]&&(n&&(n=" "),i&&(i=" "));La[l]&&(q?i="\n":n="\n");d&&l=="br"&&(i="\n");if(mb[l]&&!La[l])if(d){q&&f.length>0&&f[f.length-1]===l?f.pop():f.push(l);i=n="\n";K=0;for(ja=q?f.length:f.length-1;K<ja;K++)n+=e,q||(i+=e);r?f.pop():q||(i+=e)}else n=i="";if(o!==""){var z=I(a);if(l==="font"){var L={},F="";m(z,function(a,b){if(a==="color")L.color=b,delete z[a];a==="size"&& |
|||
(L["font-size"]=g[parseInt(b,10)-1]||"",delete z[a]);a==="face"&&(L["font-family"]=b,delete z[a]);a==="style"&&(F=b)});F&&!/;$/.test(F)&&(F+=";");m(L,function(a,b){b!==""&&(/\s/.test(b)&&(b="'"+b+"'"),F+=a+":"+b+";")});z.style=F}m(z,function(a,d){Ub[a]&&(z[a]=a);J(a,["src","href"])>=0&&(z[a]=ia(d,c));(b&&a!=="style"&&!h[l]["*"]&&!h[l][a]||l==="body"&&a==="contenteditable"||/^kindeditor_\d+$/.test(a))&&delete z[a];if(a==="style"&&d!==""){var e=ba(d);m(e,function(a){b&&!h[l].style&&!h[l]["."+a]&&delete e[a]}); |
|||
var g="";m(e,function(a,b){g+=a+":"+b+";"});z.style=g}});o="";m(z,function(a,b){a==="style"&&b===""||(b=b.replace(/"/g,"""),o+=" "+a+'="'+b+'"')})}l==="font"&&(l="span");return n+"<"+q+l+o+r+">"+i}),a=a.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/ig,function(a,b,c,d){return b+c.replace(/\n/g,'<span id="__kindeditor_pre_newline__">\n')+d}),a=a.replace(/\n\s*\n/g,"\n"),a=a.replace(/<span id="__kindeditor_pre_newline__">\n/g,"\n");return B(a)}function nb(a,b){a=a.replace(/<meta[\s\S]*?>/ig, |
|||
"").replace(/<![\s\S]*?>/ig,"").replace(/<style[^>]*>[\s\S]*?<\/style>/ig,"").replace(/<script[^>]*>[\s\S]*?<\/script>/ig,"").replace(/<w:[^>]+>[\s\S]*?<\/w:[^>]+>/ig,"").replace(/<o:[^>]+>[\s\S]*?<\/o:[^>]+>/ig,"").replace(/<xml>[\s\S]*?<\/xml>/ig,"").replace(/<(?:table|td)[^>]*>/ig,function(a){return a.replace(/border-bottom:([#\w\s]+)/ig,"border:$1")});return U(a,b)}function ob(a){if(/\.(rm|rmvb)(\?|$)/i.test(a))return"audio/x-pn-realaudio-plugin";if(/\.(swf|flv)(\?|$)/i.test(a))return"application/x-shockwave-flash"; |
|||
return"video/x-ms-asf-plugin"}function pb(a){return I(unescape(a))}function Ma(a){var b="<embed ";m(a,function(a,d){b+=a+'="'+d+'" '});b+="/>";return b}function qb(a,b){var c=b.width,d=b.height,e=b.type||ob(b.src),g=Ma(b),h="";/\D/.test(c)?h+="width:"+c+";":c>0&&(h+="width:"+c+"px;");/\D/.test(d)?h+="height:"+d+";":d>0&&(h+="height:"+d+"px;");c=/realaudio/i.test(e)?"ke-rm":/flash/i.test(e)?"ke-flash":"ke-media";c='<img class="'+c+'" src="'+a+'" ';h!==""&&(c+='style="'+h+'" ');c+='data-ke-tag="'+escape(g)+ |
|||
'" alt="" />';return c}function Aa(a,b){if(a.nodeType==9&&b.nodeType!=9)return!0;for(;b=b.parentNode;)if(b==a)return!0;return!1}function Ba(a,b){var b=b.toLowerCase(),c=null;if(!Vb&&a.nodeName.toLowerCase()!="script"){var d=a.ownerDocument.createElement("div");d.appendChild(a.cloneNode(!1));d=I(fa(d.innerHTML));b in d&&(c=d[b])}else try{c=a.getAttribute(b,2)}catch(e){c=a.getAttribute(b,1)}b==="style"&&c!==null&&(c=Tb(c));return c}function Ca(a,b){function c(a){if(typeof a!="string")return a;return a.replace(/([^\w\-])/g, |
|||
"\\$1")}function d(a,b){return a==="*"||a.toLowerCase()===c(b.toLowerCase())}function e(a,b,c){var e=[];(a=(c.ownerDocument||c).getElementById(a.replace(/\\/g,"")))&&d(b,a.nodeName)&&Aa(c,a)&&e.push(a);return e}function g(a,b,c){var e=c.ownerDocument||c,g=[],h,f,j;if(c.getElementsByClassName){e=c.getElementsByClassName(a.replace(/\\/g,""));h=0;for(f=e.length;h<f;h++)j=e[h],d(b,j.nodeName)&&g.push(j)}else if(e.querySelectorAll){e=e.querySelectorAll((c.nodeName!=="#document"?c.nodeName+" ":"")+b+"."+ |
|||
a);h=0;for(f=e.length;h<f;h++)j=e[h],Aa(c,j)&&g.push(j)}else{e=c.getElementsByTagName(b);a=" "+a+" ";h=0;for(f=e.length;h<f;h++)if(j=e[h],j.nodeType==1)(b=j.className)&&(" "+b+" ").indexOf(a)>-1&&g.push(j)}return g}function h(a,b,d,e){for(var g=[],d=e.getElementsByTagName(d),h=0,f=d.length;h<f;h++)e=d[h],e.nodeType==1&&(b===null?Ba(e,a)!==null&&g.push(e):b===c(Ba(e,a))&&g.push(e));return g}function f(a,b){var c=[],j,k=(j=/^((?:\\.|[^.#\s\[<>])+)/.exec(a))?j[1]:"*";if(j=/#((?:[\w\-]|\\.)+)$/.exec(a))c= |
|||
e(j[1],k,b);else if(j=/\.((?:[\w\-]|\\.)+)$/.exec(a))c=g(j[1],k,b);else if(j=/\[((?:[\w\-]|\\.)+)\]/.exec(a))c=h(j[1].toLowerCase(),null,k,b);else if(j=/\[((?:[\w\-]|\\.)+)\s*=\s*['"]?((?:\\.|[^'"]+)+)['"]?\]/.exec(a)){c=j[1].toLowerCase();j=j[2];if(c==="id")k=e(j,k,b);else if(c==="class")k=g(j,k,b);else if(c==="name"){c=[];j=(b.ownerDocument||b).getElementsByName(j.replace(/\\/g,""));for(var n,r=0,q=j.length;r<q;r++)n=j[r],d(k,n.nodeName)&&Aa(b,n)&&n.getAttribute("name")!==null&&c.push(n);k=c}else k= |
|||
h(c,j,k,b);c=k}else{k=b.getElementsByTagName(k);n=0;for(r=k.length;n<r;n++)j=k[n],j.nodeType==1&&c.push(j)}return c}var k=a.split(",");if(k.length>1){var n=[];m(k,function(){m(Ca(this,b),function(){J(this,n)<0&&n.push(this)})});return n}for(var b=b||document,k=[],q,r=/((?:\\.|[^\s>])+|[\s>])/g;q=r.exec(a);)q[1]!==" "&&k.push(q[1]);q=[];if(k.length==1)return f(k[0],b);var r=!1,K,l,i,o,p,z,L,F,s,t;z=0;for(lenth=k.length;z<lenth;z++)if(K=k[z],K===">")r=!0;else{if(z>0){l=[];L=0;for(s=q.length;L<s;L++){o= |
|||
q[L];i=f(K,o);F=0;for(t=i.length;F<t;F++)p=i[F],r?o===p.parentNode&&l.push(p):l.push(p)}q=l}else q=f(K,b);if(q.length===0)return[]}return q}function V(a){if(!a)return document;return a.ownerDocument||a.document||a}function W(a){if(!a)return w;a=V(a);return a.parentWindow||a.defaultView}function Wb(a,b){if(a.nodeType==1){var c=V(a);try{a.innerHTML='<img id="__kindeditor_temp_tag__" width="0" height="0" style="display:none;" />'+b;var d=c.getElementById("__kindeditor_temp_tag__");d.parentNode.removeChild(d)}catch(e){f(a).empty(), |
|||
f("@"+b,c).each(function(){a.appendChild(this)})}}}function Na(a,b,c){o&&A<8&&b.toLowerCase()=="class"&&(b="className");a.setAttribute(b,""+c)}function Oa(a){if(!a||!a.nodeName)return"";return a.nodeName.toLowerCase()}function Xb(a,b){var c=W(a),d=ga(b),e="";c.getComputedStyle?(c=c.getComputedStyle(a,null),e=c[d]||c.getPropertyValue(b)||a.style[d]):a.currentStyle&&(e=a.currentStyle[d]||a.style[d]);return e}function G(a){a=a||document;return P?a.body:a.documentElement}function ca(a){var a=a||document, |
|||
b;o||Yb||Pa?(b=G(a).scrollLeft,a=G(a).scrollTop):(b=W(a).scrollX,a=W(a).scrollY);return{x:b,y:a}}function D(a){this.init(a)}function rb(a){a.collapsed=a.startContainer===a.endContainer&&a.startOffset===a.endOffset;return a}function Qa(a,b,c){function d(d,e,g){var h=d.nodeValue.length,k;b&&(k=d.cloneNode(!0),k=e>0?k.splitText(e):k,g<h&&k.splitText(g-e));if(c){var n=d;e>0&&(n=d.splitText(e),a.setStart(d,e));g<h&&(d=n.splitText(g-e),a.setEnd(d,0));f.push(n)}return k}function e(){c&&a.up().collapse(!0); |
|||
for(var b=0,d=f.length;b<d;b++){var e=f[b];e.parentNode&&e.parentNode.removeChild(e)}}function g(e,l){for(var i=e.firstChild,o;i;){o=(new M(h)).selectNode(i);n=o.compareBoundaryPoints(ka,a);n>=0&&q<=0&&(q=o.compareBoundaryPoints(la,a));q>=0&&r<=0&&(r=o.compareBoundaryPoints(da,a));r>=0&&m<=0&&(m=o.compareBoundaryPoints(ma,a));if(m>=0)return!1;o=i.nextSibling;if(n>0)if(i.nodeType==1)if(q>=0&&r<=0)b&&l.appendChild(i.cloneNode(!0)),c&&f.push(i);else{var p;b&&(p=i.cloneNode(!1),l.appendChild(p));if(g(i, |
|||
p)===!1)return!1}else if(i.nodeType==3&&(i=i==k.startContainer?d(i,k.startOffset,i.nodeValue.length):i==k.endContainer?d(i,0,k.endOffset):d(i,0,i.nodeValue.length),b))try{l.appendChild(i)}catch(ja){}i=o}}var h=a.doc,f=[],k=a.cloneRange().down(),n=-1,q=-1,r=-1,m=-1,l=a.commonAncestor(),i=h.createDocumentFragment();if(l.nodeType==3)return l=d(l,a.startOffset,a.endOffset),b&&i.appendChild(l),e(),b?i:a;g(l,i);c&&a.up().collapse(!0);for(var l=0,o=f.length;l<o;l++){var p=f[l];p.parentNode&&p.parentNode.removeChild(p)}return b? |
|||
i:a}function na(a,b){for(var c=b;c;){var d=f(c);if(d.name=="marquee"||d.name=="select")return;c=c.parentNode}try{a.moveToElementText(b)}catch(e){}}function sb(a,b){var c=a.parentElement().ownerDocument,d=a.duplicate();d.collapse(b);var e=d.parentElement(),g=e.childNodes;if(g.length===0)return{node:e.parentNode,offset:f(e).index()};var h=c,j=0,k=-1,n=a.duplicate();na(n,e);for(var q=0,r=g.length;q<r;q++){var i=g[q],k=n.compareEndPoints("StartToStart",d);if(k===0)return{node:i.parentNode,offset:q};if(i.nodeType== |
|||
1){var l=a.duplicate(),m,o=f(i),p=i;o.isControl()&&(m=c.createElement("span"),o.after(m),p=m,j+=o.text().replace(/\r\n|\n|\r/g,"").length);na(l,p);n.setEndPoint("StartToEnd",l);k>0?j+=l.text.replace(/\r\n|\n|\r/g,"").length:j=0;m&&f(m).remove()}else i.nodeType==3&&(n.moveStart("character",i.nodeValue.length),j+=i.nodeValue.length);k<0&&(h=i)}if(k<0&&h.nodeType==1)return{node:e,offset:f(e.lastChild).index()+1};if(k>0)for(;h.nextSibling&&h.nodeType==1;)h=h.nextSibling;n=a.duplicate();na(n,e);n.setEndPoint("StartToEnd", |
|||
d);j-=n.text.replace(/\r\n|\n|\r/g,"").length;if(k>0&&h.nodeType==3)for(c=h.previousSibling;c&&c.nodeType==3;)j-=c.nodeValue.length,c=c.previousSibling;return{node:h,offset:j}}function tb(a,b){var c=a.ownerDocument||a,d=c.body.createTextRange();if(c==a)return d.collapse(!0),d;if(a.nodeType==1&&a.childNodes.length>0){var e=a.childNodes,g;b===0?(g=e[0],e=!0):(g=e[b-1],e=!1);if(!g)return d;if(f(g).name==="head")return b===1&&(e=!0),b===2&&(e=!1),d.collapse(e),d;if(g.nodeType==1){var h=f(g),j;h.isControl()&& |
|||
(j=c.createElement("span"),e?h.before(j):h.after(j),g=j);na(d,g);d.collapse(e);j&&f(j).remove();return d}a=g;b=e?0:g.nodeValue.length}c=c.createElement("span");f(a).before(c);na(d,c);d.moveStart("character",b);f(c).remove();return d}function ub(a){function b(a){if(f(a.node).name=="tr")a.node=a.node.cells[a.offset],a.offset=0}var c;if(H){if(a.item)return c=V(a.item(0)),c=new M(c),c.selectNode(a.item(0)),c;c=a.parentElement().ownerDocument;var d=sb(a,!0),a=sb(a,!1);b(d);b(a);c=new M(c);c.setStart(d.node, |
|||
d.offset);c.setEnd(a.node,a.offset);return c}d=a.startContainer;c=d.ownerDocument||d;c=new M(c);c.setStart(d,a.startOffset);c.setEnd(a.endContainer,a.endOffset);return c}function M(a){this.init(a)}function Ra(a){if(!a.nodeName)return a.constructor===M?a:ub(a);return new M(a)}function Q(a,b,c){try{a.execCommand(b,!1,c)}catch(d){}}function vb(a,b){var c="";try{c=a.queryCommandValue(b)}catch(d){}typeof c!=="string"&&(c="");return c}function Sa(a){var b=W(a);return H?a.selection:b.getSelection()}function wb(a){var b= |
|||
{},c,d;m(a,function(a,g){c=a.split(",");for(var h=0,f=c.length;h<f;h++)d=c[h],b[d]=g});return b}function Ta(a,b){return xb(a,b,"*")||xb(a,b)}function xb(a,b,c){c=c||a.name;if(a.type!==1)return!1;b=wb(b);if(!b[c])return!1;for(var c=b[c].split(","),b=0,d=c.length;b<d;b++){var e=c[b];if(e==="*")return!0;var g=/^(\.?)([^=]+)(?:=([^=]*))?$/.exec(e),h=g[1]?"css":"attr",e=g[2],g=g[3]||"";if(g===""&&a[h](e)!=="")return!0;if(g!==""&&a[h](e)===g)return!0}return!1}function Ua(a,b){a.type==1&&(yb(a,b,"*"),yb(a, |
|||
b))}function yb(a,b,c){c=c||a.name;if(a.type===1&&(b=wb(b),b[c])){for(var c=b[c].split(","),b=!1,d=0,e=c.length;d<e;d++){var g=c[d];if(g==="*"){b=!0;break}var h=/^(\.?)([^=]+)(?:=([^=]*))?$/.exec(g),g=h[2];h[1]?(g=ga(g),a[0].style[g]&&(a[0].style[g]="")):a.removeAttr(g)}b&&a.remove(!0)}}function Va(a){for(;a.first();)a=a.first();return a}function ea(a){if(a.type!=1||a.isSingle())return!1;return a.html().replace(/<[^>]+>/g,"")===""}function Zb(a,b,c){m(b,function(b,c){b!=="style"&&a.attr(b,c)});m(c, |
|||
function(b,c){a.css(b,c)})}function oa(a){this.init(a)}function zb(a){a.nodeName&&(a=V(a),a=Ra(a).selectNodeContents(a.body).collapse(!1));return new oa(a)}function Wa(a){var b=a.moveEl,c=a.moveFn,d=a.clickEl||b,e=a.beforeDrag,g=[document];(a.iframeFix===i||a.iframeFix)&&f("iframe").each(function(){if(!/^https?:\/\//.test(ia(this.src||"","absolute"))){var a;try{a=Xa(this)}catch(b){}if(a){var c=f(this).pos();f(a).data("pos-x",c.x);f(a).data("pos-y",c.y);g.push(a)}}});d.mousedown(function(a){function j(a){a.preventDefault(); |
|||
var b=f(V(a.target)),e=R((b.data("pos-x")||0)+a.pageX-p),a=R((b.data("pos-y")||0)+a.pageY-s);c.call(d,r,l,m,o,e,a)}function k(a){a.preventDefault()}function n(a){a.preventDefault();f(g).unbind("mousemove",j).unbind("mouseup",n).unbind("selectstart",k);i.releaseCapture&&i.releaseCapture()}a.stopPropagation();var i=d.get(),r=t(b.css("left")),l=t(b.css("top")),m=b.width(),o=b.height(),p=a.pageX,s=a.pageY;e&&e();f(g).mousemove(j).mouseup(n).bind("selectstart",k);i.setCapture&&i.setCapture()})}function S(a){this.init(a)} |
|||
function Ya(a){return new S(a)}function Xa(a){a=f(a)[0];return a.contentDocument||a.contentWindow.document}function $b(a,b,c,d){var e=[Za===""?"<html>":'<html dir="'+Za+'">','<head><meta charset="utf-8" /><title></title>',"<style>","html {margin:0;padding:0;}","body {margin:0;padding:5px;}",'body, td {font:12px/1.5 "sans serif",tahoma,verdana,helvetica;}',"body, p, div {word-wrap: break-word;}","p {margin:5px 0;}","table {border-collapse:collapse;}","img {border:0;}","noscript {display:none;}","table.ke-zeroborder td {border:1px dotted #AAA;}", |
|||
"img.ke-flash {","\tborder:1px solid #AAA;","\tbackground-image:url("+a+"common/flash.gif);","\tbackground-position:center center;","\tbackground-repeat:no-repeat;","\twidth:100px;","\theight:100px;","}","img.ke-rm {","\tborder:1px solid #AAA;","\tbackground-image:url("+a+"common/rm.gif);","\tbackground-position:center center;","\tbackground-repeat:no-repeat;","\twidth:100px;","\theight:100px;","}","img.ke-media {","\tborder:1px solid #AAA;","\tbackground-image:url("+a+"common/media.gif);","\tbackground-position:center center;", |
|||
"\tbackground-repeat:no-repeat;","\twidth:100px;","\theight:100px;","}","img.ke-anchor {","\tborder:1px dashed #666;","\twidth:16px;","\theight:16px;","}",".ke-script, .ke-noscript, .ke-display-none {","\tdisplay:none;","\tfont-size:0;","\twidth:0;","\theight:0;","}",".ke-pagebreak {","\tborder:1px dotted #AAA;","\tfont-size:0;","\theight:2px;","}","</style>"];Z(c)||(c=[c]);m(c,function(a,b){b&&e.push('<link href="'+b+'" rel="stylesheet" />')});d&&e.push("<style>"+d+"</style>");e.push("</head><body "+ |
|||
(b?'class="'+b+'"':"")+"></body></html>");return e.join("\n")}function pa(a,b){if(a.hasVal()){if(b===i){var c=a.val();return c=c.replace(/(<(?:p|p\s[^>]*)>) *(<\/p>)/ig,"")}return a.val(b)}return a.html(b)}function qa(a){this.init(a)}function Ab(a){return new qa(a)}function Bb(a,b){var c=this.get(a);c&&!c.hasClass("ke-disabled")&&b(c)}function Da(a){this.init(a)}function Cb(a){return new Da(a)}function ra(a){this.init(a)}function $a(a){return new ra(a)}function sa(a){this.init(a)}function Db(a){return new sa(a)} |
|||
function ab(a){this.init(a)}function ta(a){this.init(a)}function Eb(a){return new ta(a)}function bb(a,b){var c=document.getElementsByTagName("head")[0]||(P?document.body:document.documentElement),d=document.createElement("script");c.appendChild(d);d.src=a;d.charset="utf-8";d.onload=d.onreadystatechange=function(){if(!this.readyState||this.readyState==="loaded")b&&b(),d.onload=d.onreadystatechange=null,c.removeChild(d)}}function Fb(a){var b=a.indexOf("?");return b>0?a.substr(0,b):a}function cb(a){for(var b= |
|||
document.getElementsByTagName("head")[0]||(P?document.body:document.documentElement),c=document.createElement("link"),d=Fb(ia(a,"absolute")),e=f('link[rel="stylesheet"]',b),g=0,h=e.length;g<h;g++)if(Fb(ia(e[g].href,"absolute"))===d)return;b.appendChild(c);c.href=a;c.rel="stylesheet"}function Gb(a,b){if(a===i)return N;if(!b)return N[a];N[a]=b}function Hb(a){var b,c="core";if(b=/^(\w+)\.(\w+)$/.exec(a))c=b[1],a=b[2];return{ns:c,key:a}}function Ib(a,b){b=b===i?f.options.langType:b;if(typeof a==="string"){if(!O[b])return"no language"; |
|||
var c=a.length-1;if(a.substr(c)===".")return O[b][a.substr(0,c)];c=Hb(a);return O[b][c.ns][c.key]}m(a,function(a,c){var g=Hb(a);O[b]||(O[b]={});O[b][g.ns]||(O[b][g.ns]={});O[b][g.ns][g.key]=c})}function Ea(a,b){if(!a.collapsed){var a=a.cloneRange().up(),c=a.startContainer,d=a.startOffset;if(X||a.isControl())if((c=f(c.childNodes[d]))&&c.name=="img"&&b(c))return c}}function ac(){var a=this;f(a.edit.doc).contextmenu(function(b){a.menu&&a.hideMenu();if(a.useContextmenu){if(a._contextmenus.length!==0){var c= |
|||
0,d=[];for(m(a._contextmenus,function(){if(this.title=="-")d.push(this);else if(this.cond&&this.cond()&&(d.push(this),this.width&&this.width>c))c=this.width});d.length>0&&d[0].title=="-";)d.shift();for(;d.length>0&&d[d.length-1].title=="-";)d.pop();var e=null;m(d,function(a){this.title=="-"&&e.title=="-"&&delete d[a];e=this});if(d.length>0){b.preventDefault();var g=f(a.edit.iframe).pos(),h=$a({x:g.x+b.clientX,y:g.y+b.clientY,width:c,css:{visibility:"hidden"},shadowMode:a.shadowMode});m(d,function(){this.title&& |
|||
h.addItem(this)});var g=G(h.doc),j=h.div.height();b.clientY+j>=g.clientHeight-100&&h.pos(h.x,t(h.y)-j);h.div.css("visibility","visible");a.menu=h}}}else b.preventDefault()})}function bc(){function a(a){for(a=f(a.commonAncestor());a;){if(a.type==1&&!a.isStyle())break;a=a.parent()}return a.name}var b=this,c=b.edit.doc,d=b.newlineTag;if(!(o&&d!=="br")&&(!Y||!(A<3&&d!=="p"))&&!(Pa&&A<9)){var e=u("h1,h2,h3,h4,h5,h6,pre,li"),g=u("p,h1,h2,h3,h4,h5,h6,pre,li,blockquote");f(c).keydown(function(f){if(!(f.which!= |
|||
13||f.shiftKey||f.ctrlKey||f.altKey)){b.cmd.selection();var j=a(b.cmd.range);j=="marquee"||j=="select"||(d==="br"&&!e[j]?(f.preventDefault(),b.insertHtml("<br />"+(o&&A<9?"":"\u200b"))):g[j]||Q(c,"formatblock","<p>"))}});f(c).keyup(function(e){if(!(e.which!=13||e.shiftKey||e.ctrlKey||e.altKey)&&d!="br")if(Y){var e=b.cmd.commonAncestor("p"),j=b.cmd.commonAncestor("a");j&&j.text()==""&&(j.remove(!0),b.cmd.range.selectNodeContents(e[0]).collapse(!0),b.cmd.select())}else if(b.cmd.selection(),e=a(b.cmd.range), |
|||
!(e=="marquee"||e=="select"))if(g[e]||Q(c,"formatblock","<p>"),e=b.cmd.commonAncestor("div")){for(var j=f("<p></p>"),k=e[0].firstChild;k;){var n=k.nextSibling;j.append(k);k=n}e.before(j);e.remove();b.cmd.range.selectNodeContents(j[0]);b.cmd.select()}})}}function cc(){var a=this,b=a.edit.doc;f(b).keydown(function(c){if(c.which==9)if(c.preventDefault(),a.afterTab)a.afterTab.call(a,c);else{var c=a.cmd,d=c.range;d.shrink();d.collapsed&&d.startContainer.nodeType==1&&(d.insertNode(f("@ ",b)[0]),c.select()); |
|||
a.insertHtml(" ")}})}function dc(){var a=this;f(a.edit.textarea[0],a.edit.win).focus(function(b){a.afterFocus&&a.afterFocus.call(a,b)}).blur(function(b){a.afterBlur&&a.afterBlur.call(a,b)})}function T(a){return B(a.replace(/<span [^>]*id="?__kindeditor_bookmark_\w+_\d+__"?[^>]*><\/span>/ig,""))}function Fa(a){return a.replace(/<div[^>]+class="?__kindeditor_paste__"?[^>]*>[\s\S]*?<\/div>/ig,"")}function Jb(a,b){if(a.length===0)a.push(b);else{var c=a[a.length-1];T(b.html)!==T(c.html)&& |
|||
a.push(b)}}function Kb(a,b){var c=this.edit,d=c.doc.body,e,g;if(a.length===0)return this;c.designMode?(e=this.cmd.range,g=e.createBookmark(!0),g.html=d.innerHTML):g={html:d.innerHTML};Jb(b,g);var h=a.pop();T(g.html)===T(h.html)&&a.length>0&&(h=a.pop());c.designMode?(c.html(h.html),h.start&&(e.moveToBookmark(h),this.select())):f(d).html(T(h.html));return this}function ua(a){function b(a,b){ua.prototype[a]===i&&(c[a]=b);c.options[a]=b}var c=this;c.options={};m(a,function(c){b(c,a[c])});m(f.options, |
|||
function(a,d){c[a]===i&&b(a,d)});var d=f(c.srcElement||"<textarea/>");if(!c.width)c.width=d[0].style.width||d.width();if(!c.height)c.height=d[0].style.height||d.height();b("width",l(c.width,c.minWidth));b("height",l(c.height,c.minHeight));b("width",s(c.width));b("height",s(c.height));if(ec&&(!fc||A<534))c.designMode=!1;c.srcElement=d;c.initContent="";c.plugin={};c.isCreated=!1;c._handlers={};c._contextmenus=[];c._undoStack=[];c._redoStack=[];c._firstAddBookmark=!0;c.menu=c.contextmenu=null;c.dialogs= |
|||
[]}function Lb(a,b){function c(a){m(N,function(b,c){wa(c)&&c.call(a,KindEditor)});return a.create()}b=b||{};b.basePath=l(b.basePath,f.basePath);b.themesPath=l(b.themesPath,b.basePath+"themes/");b.langPath=l(b.langPath,b.basePath+"lang/");b.pluginsPath=l(b.pluginsPath,b.basePath+"plugins/");if(l(b.loadStyleMode,f.options.loadStyleMode)){var d=l(b.themeType,f.options.themeType);cb(b.themesPath+"default/default.css");cb(b.themesPath+d+"/"+d+".css")}if((d=f(a))&&d.length!==0){if(d.length>1)return d.each(function(){Lb(this, |
|||
b)}),_instances[0];b.srcElement=d[0];var e=new ua(b);_instances.push(e);if(O[e.langType])return c(e);bb(e.langPath+e.langType+".js?ver="+encodeURIComponent(f.DEBUG?Ga:Ha),function(){c(e)});return e}}function va(a,b){f(a).each(function(a,d){f.each(_instances,function(a,c){if(c&&c.srcElement[0]==d)return b.call(c,a),!1})})}if(!w.KindEditor){if(!w.console)w.console={};if(!console.log)console.log=function(){};var Ha="4.1.10 (2013-11-23)",p=navigator.userAgent.toLowerCase(),o=p.indexOf("msie")>-1&&p.indexOf("opera")== |
|||
-1,Yb=p.indexOf("msie")==-1&&p.indexOf("trident")>-1,Y=p.indexOf("gecko")>-1&&p.indexOf("khtml")==-1,X=p.indexOf("applewebkit")>-1,Pa=p.indexOf("opera")>-1,ec=p.indexOf("mobile")>-1,fc=/ipad|iphone|ipod/.test(p),P=document.compatMode!="CSS1Compat",H=!w.getSelection,A=(p=/(?:msie|firefox|webkit|opera)[\/:\s](\d+)/.exec(p))?p[1]:"0",Ga=(new Date).getTime(),R=Math.round,f={DEBUG:!1,VERSION:Ha,IE:o,GECKO:Y,WEBKIT:X,OPERA:Pa,V:A,TIME:Ga,each:m,isArray:Z,isFunction:wa,inArray:J,inString:xa,trim:B,addUnit:s, |
|||
removeUnit:t,escape:C,unescape:fa,toCamel:ga,toHex:ya,toMap:u,toArray:Ja,undef:l,invalidUrl:function(a){return!a||/[<>"]/.test(a)},addParam:function(a,b){return a.indexOf("?")>=0?a+"&"+b:a+"?"+b},extend:E,json:eb},lb=u("a,abbr,acronym,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,img,input,ins,kbd,label,map,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"),mb=u("address,applet,blockquote,body,center,dd,dir,div,dl,dt,fieldset,form,frameset,h1,h2,h3,h4,h5,h6,head,hr,html,iframe,ins,isindex,li,map,menu,meta,noframes,noscript,object,ol,p,pre,script,style,table,tbody,td,tfoot,th,thead,title,tr,ul"), |
|||
kb=u("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed"),Mb=u("b,basefont,big,del,em,font,i,s,small,span,strike,strong,sub,sup,u"),gc=u("img,table,input,textarea,button"),La=u("pre,style,script"),Ia=u("html,head,body,td,tr,table,ol,ul,li");u("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");var Ub=u("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"),Nb=u("input,button,textarea,select");f.basePath=function(){for(var a= |
|||
document.getElementsByTagName("script"),b,c=0,d=a.length;c<d;c++)if(b=a[c].src||"",/kindeditor[\w\-\.]*\.js/.test(b))return b.substring(0,b.lastIndexOf("/")+1);return""}();f.options={designMode:!0,fullscreenMode:!1,filterMode:!0,wellFormatMode:!0,shadowMode:!0,loadStyleMode:!0,basePath:f.basePath,themesPath:f.basePath+"themes/",langPath:f.basePath+"lang/",pluginsPath:f.basePath+"plugins/",themeType:"default",langType:"zh_CN",urlType:"",newlineTag:"p",resizeType:2,syncType:"form",pasteType:2,dialogAlignType:"page", |
|||
useContextmenu:!0,fullscreenShortcut:!1,bodyClass:"ke-content",indentChar:"\t",cssPath:"",cssData:"",minWidth:650,minHeight:100,minChangeSize:50,zIndex:811213,items:["source","|","undo","redo","|","preview","print","template","code","cut","copy","paste","plainpaste","wordpaste","|","justifyleft","justifycenter","justifyright","justifyfull","insertorderedlist","insertunorderedlist","indent","outdent","subscript","superscript","clearhtml","quickformat","selectall","|","fullscreen","/","formatblock", |
|||
"fontname","fontsize","|","forecolor","hilitecolor","bold","italic","underline","strikethrough","lineheight","removeformat","|","image","multiimage","flash","media","insertfile","table","hr","emoticons","baidumap","pagebreak","anchor","link","unlink","|","about"],noDisableItems:["source","fullscreen"],colorTable:[["#E53333","#E56600","#FF9900","#64451D","#DFC5A4","#FFE500"],["#009900","#006600","#99BB00","#B8D100","#60D978","#00D5FF"],["#337FE5","#003399","#4C33E5","#9933E5","#CC33E5","#EE33EE"], |
|||
["#FFFFFF","#CCCCCC","#999999","#666666","#333333","#000000"]],fontSizeTable:["9px","10px","12px","14px","16px","18px","24px","32px"],htmlTags:{font:["id","class","color","size","face",".background-color"],span:["id","class",".color",".background-color",".font-size",".font-family",".background",".font-weight",".font-style",".text-decoration",".vertical-align",".line-height"],div:["id","class","align",".border",".margin",".padding",".text-align",".color",".background-color",".font-size",".font-family", |
|||
".font-weight",".background",".font-style",".text-decoration",".vertical-align",".margin-left"],table:["id","class","border","cellspacing","cellpadding","width","height","align","bordercolor",".padding",".margin",".border","bgcolor",".text-align",".color",".background-color",".font-size",".font-family",".font-weight",".font-style",".text-decoration",".background",".width",".height",".border-collapse"],"td,th":["id","class","align","valign","width","height","colspan","rowspan","bgcolor",".text-align", |
|||
".color",".background-color",".font-size",".font-family",".font-weight",".font-style",".text-decoration",".vertical-align",".background",".border"],a:["id","class","href","target","name"],embed:["id","class","src","width","height","type","loop","autostart","quality",".width",".height","align","allowscriptaccess"],img:["id","class","src","width","height","border","alt","title","align",".width",".height",".border"],"p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6":["id","class","align",".text-align",".color", |
|||
".background-color",".font-size",".font-family",".background",".font-weight",".font-style",".text-decoration",".vertical-align",".text-indent",".margin-left"],pre:["id","class"],hr:["id","class",".page-break-after"],"br,tbody,tr,strong,b,sub,sup,em,i,u,strike,s,del":["id","class"],iframe:["id","class","src","frameborder","width","height",".width",".height"]},layout:'<div class="container"><div class="toolbar"></div><div class="edit"></div><div class="statusbar"></div></div>'};var fb=!1,Ob=u("8,9,13,32,46,48..57,59,61,65..90,106,109..111,188,190..192,219..222"), |
|||
p=u("33..40"),db={};m(Ob,function(a,b){db[a]=b});m(p,function(a,b){db[a]=b});var hc="altKey,attrChange,attrName,bubbles,button,cancelable,charCode,clientX,clientY,ctrlKey,currentTarget,data,detail,eventPhase,fromElement,handler,keyCode,metaKey,newValue,offsetX,offsetY,originalTarget,pageX,pageY,prevValue,relatedNode,relatedTarget,screenX,screenY,shiftKey,srcElement,target,toElement,view,wheelDelta,which".split(",");E(gb,{init:function(a,b){var c=this,d=a.ownerDocument||a.document||a;c.event=b;m(hc, |
|||
function(a,d){c[d]=b[d]});if(!c.target)c.target=c.srcElement||d;if(c.target.nodeType===3)c.target=c.target.parentNode;if(!c.relatedTarget&&c.fromElement)c.relatedTarget=c.fromElement===c.target?c.toElement:c.fromElement;if(c.pageX==null&&c.clientX!=null){var e=d.documentElement,d=d.body;c.pageX=c.clientX+(e&&e.scrollLeft||d&&d.scrollLeft||0)-(e&&e.clientLeft||d&&d.clientLeft||0);c.pageY=c.clientY+(e&&e.scrollTop||d&&d.scrollTop||0)-(e&&e.clientTop||d&&d.clientTop||0)}if(!c.which&&(c.charCode||c.charCode=== |
|||
0?c.charCode:c.keyCode))c.which=c.charCode||c.keyCode;if(!c.metaKey&&c.ctrlKey)c.metaKey=c.ctrlKey;if(!c.which&&c.button!==i)c.which=c.button&1?1:c.button&2?3:c.button&4?2:0;switch(c.which){case 186:c.which=59;break;case 187:case 107:case 43:c.which=61;break;case 189:case 45:c.which=109;break;case 42:c.which=106;break;case 47:c.which=111;break;case 78:c.which=110}c.which>=96&&c.which<=105&&(c.which-=48)},preventDefault:function(){var a=this.event;a.preventDefault?a.preventDefault():a.returnValue= |
|||
!1},stopPropagation:function(){var a=this.event;a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},stop:function(){this.preventDefault();this.stopPropagation()}});var $="kindeditor_"+Ga,ib=0,v={},Pb=!1;o&&w.attachEvent("onunload",function(){m(v,function(a,b){b.el&&ha(b.el)})});f.ctrl=Ka;f.ready=function(a){function b(){e||(e=!0,a(KindEditor),Pb=!0)}function c(){if(!e){try{document.documentElement.doScroll("left")}catch(a){setTimeout(c,100);return}b()}}function d(){document.readyState==="complete"&& |
|||
b()}if(Pb)a(KindEditor);else{var e=!1;if(document.addEventListener)aa(document,"DOMContentLoaded",b);else if(document.attachEvent){aa(document,"readystatechange",d);var g=!1;try{g=w.frameElement==null}catch(f){}document.documentElement.doScroll&&g&&c()}aa(w,"load",b)}};f.formatUrl=ia;f.formatHtml=U;f.getCssList=ba;f.getAttrList=I;f.mediaType=ob;f.mediaAttrs=pb;f.mediaEmbed=Ma;f.mediaImg=qb;f.clearMsWord=nb;f.tmpl=function(a,b){var c=new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+ |
|||
a.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split("\t").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');");return b?c(b):c};p=document.createElement("div");p.setAttribute("className","t");var Vb=p.className!=="t";f.query=function(a,b){var c=Ca(a,b);return c.length>0?c[0]:null};f.queryAll=Ca;E(D,{init:function(a){for(var a=Z(a)?a:[a],b=0,c=0,d=a.length;c<d;c++)a[c]&&(this[c]=a[c].constructor=== |
|||
D?a[c][0]:a[c],b++);this.length=b;this.doc=V(this[0]);this.name=Oa(this[0]);this.type=this.length>0?this[0].nodeType:null;this.win=W(this[0])},each:function(a){for(var b=0;b<this.length;b++)if(a.call(this[b],b,this[b])===!1)break;return this},bind:function(a,b){this.each(function(){aa(this,a,b)});return this},unbind:function(a,b){this.each(function(){ha(this,a,b)});return this},fire:function(a){if(this.length<1)return this;jb(this[0],a);return this},hasAttr:function(a){if(this.length<1)return!1;return!!Ba(this[0], |
|||
a)},attr:function(a,b){var c=this;if(a===i)return I(c.outer());if(typeof a==="object")return m(a,function(a,b){c.attr(a,b)}),c;if(b===i)return b=c.length<1?null:Ba(c[0],a),b===null?"":b;c.each(function(){Na(this,a,b)});return c},removeAttr:function(a){this.each(function(){var b=a;o&&A<8&&b.toLowerCase()=="class"&&(b="className");Na(this,b,"");this.removeAttribute(b)});return this},get:function(a){if(this.length<1)return null;return this[a||0]},eq:function(a){if(this.length<1)return null;return this[a]? |
|||
new D(this[a]):null},hasClass:function(a){if(this.length<1)return!1;return xa(a,this[0].className," ")},addClass:function(a){this.each(function(){if(!xa(a,this.className," "))this.className=B(this.className+" "+a)});return this},removeClass:function(a){this.each(function(){if(xa(a,this.className," "))this.className=B(this.className.replace(RegExp("(^|\\s)"+a+"(\\s|$)")," "))});return this},html:function(a){if(a===i){if(this.length<1||this.type!=1)return"";return U(this[0].innerHTML)}this.each(function(){Wb(this, |
|||
a)});return this},text:function(){if(this.length<1)return"";return o?this[0].innerText:this[0].textContent},hasVal:function(){if(this.length<1)return!1;return!!Nb[Oa(this[0])]},val:function(a){if(a===i){if(this.length<1)return"";return this.hasVal()?this[0].value:this.attr("value")}else return this.each(function(){Nb[Oa(this)]?this.value=a:Na(this,"value",a)}),this},css:function(a,b){var c=this;if(a===i)return ba(c.attr("style"));if(typeof a==="object")return m(a,function(a,b){c.css(a,b)}),c;if(b=== |
|||
i){if(c.length<1)return"";return c[0].style[ga(a)]||Xb(c[0],a)||""}c.each(function(){this.style[ga(a)]=b});return c},width:function(a){if(a===i){if(this.length<1)return 0;return this[0].offsetWidth}return this.css("width",s(a))},height:function(a){if(a===i){if(this.length<1)return 0;return this[0].offsetHeight}return this.css("height",s(a))},opacity:function(a){this.each(function(){this.style.opacity===i?this.style.filter=a==1?"":"alpha(opacity="+a*100+")":this.style.opacity=a==1?"":a});return this}, |
|||
data:function(a,b){a="kindeditor_data_"+a;if(b===i){if(this.length<1)return null;return this[0][a]}this.each(function(){this[a]=b});return this},pos:function(){var a=this[0],b=0,c=0;if(a)if(a.getBoundingClientRect)a=a.getBoundingClientRect(),c=ca(this.doc),b=a.left+c.x,c=a.top+c.y;else for(;a;)b+=a.offsetLeft,c+=a.offsetTop,a=a.offsetParent;return{x:R(b),y:R(c)}},clone:function(a){if(this.length<1)return new D([]);return new D(this[0].cloneNode(a))},append:function(a){this.each(function(){this.appendChild&& |
|||
this.appendChild(f(a)[0])});return this},appendTo:function(a){this.each(function(){f(a)[0].appendChild(this)});return this},before:function(a){this.each(function(){this.parentNode.insertBefore(f(a)[0],this)});return this},after:function(a){this.each(function(){this.nextSibling?this.parentNode.insertBefore(f(a)[0],this.nextSibling):this.parentNode.appendChild(f(a)[0])});return this},replaceWith:function(a){var b=[];this.each(function(c,d){ha(d);var e=f(a)[0];d.parentNode.replaceChild(e,d);b.push(e)}); |
|||
return f(b)},empty:function(){this.each(function(a,b){for(var c=b.firstChild;c;){if(!b.parentNode)break;var d=c.nextSibling;c.parentNode.removeChild(c);c=d}});return this},remove:function(a){var b=this;b.each(function(c,d){if(d.parentNode){ha(d);if(a)for(var e=d.firstChild;e;){var g=e.nextSibling;d.parentNode.insertBefore(e,d);e=g}d.parentNode.removeChild(d);delete b[c]}});b.length=0;return b},show:function(a){a===i&&(a=this._originDisplay||"");if(this.css("display")!="none")return this;return this.css("display", |
|||
a)},hide:function(){if(this.length<1)return this;this._originDisplay=this[0].style.display;return this.css("display","none")},outer:function(){if(this.length<1)return"";var a=this.doc.createElement("div");a.appendChild(this[0].cloneNode(!0));return U(a.innerHTML)},isSingle:function(){return!!kb[this.name]},isInline:function(){return!!lb[this.name]},isBlock:function(){return!!mb[this.name]},isStyle:function(){return!!Mb[this.name]},isControl:function(){return!!gc[this.name]},contains:function(a){if(this.length< |
|||
1)return!1;return Aa(this[0],f(a)[0])},parent:function(){if(this.length<1)return null;var a=this[0].parentNode;return a?new D(a):null},children:function(){if(this.length<1)return new D([]);for(var a=[],b=this[0].firstChild;b;)(b.nodeType!=3||B(b.nodeValue)!=="")&&a.push(b),b=b.nextSibling;return new D(a)},first:function(){var a=this.children();return a.length>0?a.eq(0):null},last:function(){var a=this.children();return a.length>0?a.eq(a.length-1):null},index:function(){if(this.length<1)return-1;for(var a= |
|||
-1,b=this[0];b;)a++,b=b.previousSibling;return a},prev:function(){if(this.length<1)return null;var a=this[0].previousSibling;return a?new D(a):null},next:function(){if(this.length<1)return null;var a=this[0].nextSibling;return a?new D(a):null},scan:function(a,b){function c(d){for(d=b?d.firstChild:d.lastChild;d;){var e=b?d.nextSibling:d.previousSibling;if(a(d)===!1)return!1;if(c(d)===!1)return!1;d=e}}if(!(this.length<1))return b=b===i?!0:b,c(this[0]),this}});m("blur,focus,focusin,focusout,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error,contextmenu".split(","), |
|||
function(a,b){D.prototype[b]=function(a){return a?this.bind(b,a):this.fire(b)}});p=f;f=function(a,b){function c(a){a[0]||(a=[]);return new D(a)}if(!(a===i||a===null)){if(typeof a==="string"){b&&(b=f(b)[0]);var d=a.length;a.charAt(0)==="@"&&(a=a.substr(1));if(a.length!==d||/<.+>/.test(a)){var d=(b?b.ownerDocument||b:document).createElement("div"),e=[];d.innerHTML='<img id="__kindeditor_temp_tag__" width="0" height="0" style="display:none;" />'+a;for(var g=0,h=d.childNodes.length;g<h;g++){var j=d.childNodes[g]; |
|||
j.id!="__kindeditor_temp_tag__"&&e.push(j)}return c(e)}return c(Ca(a,b))}if(a&&a.constructor===D)return a;a.toArray&&(a=a.toArray());if(Z(a))return c(a);return c(Ja(arguments))}};m(p,function(a,b){f[a]=b});f.NodeClass=D;w.KindEditor=f;var la=0,ka=1,da=2,ma=3,Qb=0;E(M,{init:function(a){this.startContainer=a;this.startOffset=0;this.endContainer=a;this.endOffset=0;this.collapsed=!0;this.doc=a},commonAncestor:function(){function a(a){for(var b=[];a;)b.push(a),a=a.parentNode;return b}for(var b=a(this.startContainer), |
|||
c=a(this.endContainer),d=0,e=b.length,g=c.length,f,j;++d;)if(f=b[e-d],j=c[g-d],!f||!j||f!==j)break;return b[e-d+1]},setStart:function(a,b){var c=this.doc;this.startContainer=a;this.startOffset=b;if(this.endContainer===c)this.endContainer=a,this.endOffset=b;return rb(this)},setEnd:function(a,b){var c=this.doc;this.endContainer=a;this.endOffset=b;if(this.startContainer===c)this.startContainer=a,this.startOffset=b;return rb(this)},setStartBefore:function(a){return this.setStart(a.parentNode||this.doc, |
|||
f(a).index())},setStartAfter:function(a){return this.setStart(a.parentNode||this.doc,f(a).index()+1)},setEndBefore:function(a){return this.setEnd(a.parentNode||this.doc,f(a).index())},setEndAfter:function(a){return this.setEnd(a.parentNode||this.doc,f(a).index()+1)},selectNode:function(a){return this.setStartBefore(a).setEndAfter(a)},selectNodeContents:function(a){var b=f(a);if(b.type==3||b.isSingle())return this.selectNode(a);b=b.children();if(b.length>0)return this.setStartBefore(b[0]).setEndAfter(b[b.length- |
|||
1]);return this.setStart(a,0).setEnd(a,0)},collapse:function(a){if(a)return this.setEnd(this.startContainer,this.startOffset);return this.setStart(this.endContainer,this.endOffset)},compareBoundaryPoints:function(a,b){var c=this.get(),d=b.get();if(H){var e={};e[la]="StartToStart";e[ka]="EndToStart";e[da]="EndToEnd";e[ma]="StartToEnd";c=c.compareEndPoints(e[a],d);if(c!==0)return c;var g,h,j,k;if(a===la||a===ma)g=this.startContainer,j=this.startOffset;if(a===ka||a===da)g=this.endContainer,j=this.endOffset; |
|||
if(a===la||a===ka)h=b.startContainer,k=b.startOffset;if(a===da||a===ma)h=b.endContainer,k=b.endOffset;if(g===h)return g=j-k,g>0?1:g<0?-1:0;for(c=h;c&&c.parentNode!==g;)c=c.parentNode;if(c)return f(c).index()>=j?-1:1;for(c=g;c&&c.parentNode!==h;)c=c.parentNode;if(c)return f(c).index()>=k?1:-1;if((c=f(h).next())&&c.contains(g))return 1;if((c=f(g).next())&&c.contains(h))return-1}else return c.compareBoundaryPoints(a,d)},cloneRange:function(){return(new M(this.doc)).setStart(this.startContainer,this.startOffset).setEnd(this.endContainer, |
|||
this.endOffset)},toString:function(){var a=this.get();return(H?a.text:a.toString()).replace(/\r\n|\n|\r/g,"")},cloneContents:function(){return Qa(this,!0,!1)},deleteContents:function(){return Qa(this,!1,!0)},extractContents:function(){return Qa(this,!0,!0)},insertNode:function(a){var b=this.startContainer,c=this.startOffset,d=this.endContainer,e=this.endOffset,g,f,j,k=1;if(a.nodeName.toLowerCase()==="#document-fragment")g=a.firstChild,f=a.lastChild,k=a.childNodes.length;b.nodeType==1?(j=b.childNodes[c])? |
|||
(b.insertBefore(a,j),b===d&&(e+=k)):b.appendChild(a):b.nodeType==3&&(c===0?(b.parentNode.insertBefore(a,b),b.parentNode===d&&(e+=k)):c>=b.nodeValue.length?b.nextSibling?b.parentNode.insertBefore(a,b.nextSibling):b.parentNode.appendChild(a):(j=c>0?b.splitText(c):b,b.parentNode.insertBefore(a,j),b===d&&(d=j,e-=c)));g?this.setStartBefore(g).setEndAfter(f):this.selectNode(a);if(this.compareBoundaryPoints(da,this.cloneRange().setEnd(d,e))>=1)return this;return this.setEnd(d,e)},surroundContents:function(a){a.appendChild(this.extractContents()); |
|||
return this.insertNode(a).selectNode(a)},isControl:function(){var a=this.startContainer,b=this.startOffset,c=this.endContainer,d=this.endOffset;return a.nodeType==1&&a===c&&b+1===d&&f(a.childNodes[b]).isControl()},get:function(a){var b=this.doc;if(!H){b=b.createRange();try{b.setStart(this.startContainer,this.startOffset),b.setEnd(this.endContainer,this.endOffset)}catch(c){}return b}if(a&&this.isControl())return b=b.body.createControlRange(),b.addElement(this.startContainer.childNodes[this.startOffset]), |
|||
b;a=this.cloneRange().down();b=b.body.createTextRange();b.setEndPoint("StartToStart",tb(a.startContainer,a.startOffset));b.setEndPoint("EndToStart",tb(a.endContainer,a.endOffset));return b},html:function(){return f(this.cloneContents()).outer()},down:function(){function a(a,d,e){if(a.nodeType==1&&(a=f(a).children(),a.length!==0)){var g,h,j,k;d>0&&(g=a.eq(d-1));d<a.length&&(h=a.eq(d));if(g&&g.type==3)j=g[0],k=j.nodeValue.length;h&&h.type==3&&(j=h[0],k=0);j&&(e?b.setStart(j,k):b.setEnd(j,k))}}var b= |
|||
this;a(b.startContainer,b.startOffset,!0);a(b.endContainer,b.endOffset,!1);return b},up:function(){function a(a,d,e){a.nodeType==3&&(d===0?e?b.setStartBefore(a):b.setEndBefore(a):d==a.nodeValue.length&&(e?b.setStartAfter(a):b.setEndAfter(a)))}var b=this;a(b.startContainer,b.startOffset,!0);a(b.endContainer,b.endOffset,!1);return b},enlarge:function(a){function b(b,e,g){b=f(b);if(!(b.type==3||Ia[b.name]||!a&&b.isBlock()))if(e===0){for(;!b.prev();){e=b.parent();if(!e||Ia[e.name]||!a&&e.isBlock())break; |
|||
b=e}g?c.setStartBefore(b[0]):c.setEndBefore(b[0])}else if(e==b.children().length){for(;!b.next();){e=b.parent();if(!e||Ia[e.name]||!a&&e.isBlock())break;b=e}g?c.setStartAfter(b[0]):c.setEndAfter(b[0])}}var c=this;c.up();b(c.startContainer,c.startOffset,!0);b(c.endContainer,c.endOffset,!1);return c},shrink:function(){for(var a,b=this.collapsed;this.startContainer.nodeType==1&&(a=this.startContainer.childNodes[this.startOffset])&&a.nodeType==1&&!f(a).isSingle();)this.setStart(a,0);if(b)return this.collapse(b); |
|||
for(;this.endContainer.nodeType==1&&this.endOffset>0&&(a=this.endContainer.childNodes[this.endOffset-1])&&a.nodeType==1&&!f(a).isSingle();)this.setEnd(a,a.childNodes.length);return this},createBookmark:function(a){var b,c=f('<span style="display:none;"></span>',this.doc)[0];c.id="__kindeditor_bookmark_start_"+Qb++ +"__";if(!this.collapsed)b=c.cloneNode(!0),b.id="__kindeditor_bookmark_end_"+Qb++ +"__";b&&this.cloneRange().collapse(!1).insertNode(b).setEndBefore(b);this.insertNode(c).setStartAfter(c); |
|||
return{start:a?"#"+c.id:c,end:b?a?"#"+b.id:b:null}},moveToBookmark:function(a){var b=this.doc,c=f(a.start,b),a=a.end?f(a.end,b):null;if(!c||c.length<1)return this;this.setStartBefore(c[0]);c.remove();a&&a.length>0?(this.setEndBefore(a[0]),a.remove()):this.collapse(!0);return this},dump:function(){console.log("--------------------");console.log(this.startContainer.nodeType==3?this.startContainer.nodeValue:this.startContainer,this.startOffset);console.log(this.endContainer.nodeType==3?this.endContainer.nodeValue: |
|||
this.endContainer,this.endOffset)}});f.RangeClass=M;f.range=Ra;f.START_TO_START=la;f.START_TO_END=ka;f.END_TO_END=da;f.END_TO_START=ma;E(oa,{init:function(a){var b=a.doc;this.doc=b;this.win=W(b);this.sel=Sa(b);this.range=a},selection:function(a){var b=this.doc,c;c=Sa(b);var d;try{d=c.rangeCount>0?c.getRangeAt(0):c.createRange()}catch(e){}c=H&&(!d||!d.item&&d.parentElement().ownerDocument!==b)?null:d;this.sel=Sa(b);if(c)return this.range=Ra(c),f(this.range.startContainer).name=="html"&&this.range.selectNodeContents(b.body).collapse(!1), |
|||
this;a&&this.range.selectNodeContents(b.body).collapse(!1);return this},select:function(a){var a=l(a,!0),b=this.sel,c=this.range.cloneRange().shrink(),d=c.startContainer,e=c.startOffset,g=V(d),h=this.win,j,k=!1;if(a&&d.nodeType==1&&c.collapsed){if(H){b=f("<span> </span>",g);c.insertNode(b[0]);j=g.body.createTextRange();try{j.moveToElementText(b[0])}catch(n){}j.collapse(!1);j.select();b.remove();h.focus();return this}if(X&&(a=d.childNodes,f(d).isInline()||e>0&&f(a[e-1]).isInline()||a[e]&&f(a[e]).isInline()))c.insertNode(g.createTextNode("\u200b")), |
|||
k=!0}if(H)try{j=c.get(!0),j.select()}catch(i){}else k&&c.collapse(!1),j=c.get(!0),b.removeAllRanges(),b.addRange(j),g!==document&&(c=f(j.endContainer).pos(),h.scrollTo(c.x,c.y));h.focus();return this},wrap:function(a){var b=this.range,c;c=f(a,this.doc);if(b.collapsed)return b.shrink(),b.insertNode(c[0]).selectNodeContents(c[0]),this;if(c.isBlock()){for(var d=a=c.clone(!0);d.first();)d=d.first();d.append(b.extractContents());b.insertNode(a[0]).selectNode(a[0]);return this}b.enlarge();var e=b.createBookmark(), |
|||
a=b.commonAncestor(),g=!1;f(a).scan(function(a){if(!g&&a==e.start)g=!0;else if(g){if(a==e.end)return!1;var b=f(a),d;a:{for(d=b;d&&d.name!="body";){if(La[d.name]||d.name=="div"&&d.hasClass("ke-script")){d=!0;break a}d=d.parent()}d=!1}if(!d&&b.type==3&&B(a.nodeValue).length>0){for(var n;(n=b.parent())&&n.isStyle()&&n.children().length==1;)b=n;n=c;n=n.clone(!0);if(b.type==3)Va(n).append(b.clone(!1)),b.replaceWith(n);else{for(var a=b,i;(i=b.first())&&i.children().length==1;)b=i;i=b.first();for(b=b.doc.createDocumentFragment();i;)b.appendChild(i[0]), |
|||
i=i.next();i=a.clone(!0);d=Va(i);for(var r=i,l=!1;n;){for(;r;)r.name===n.name&&(Zb(r,n.attr(),n.css()),l=!0),r=r.first();l||d.append(n.clone(!1));l=!1;n=n.first()}n=i;b.firstChild&&Va(n).append(b);a.replaceWith(n)}}}});b.moveToBookmark(e);return this},split:function(a,b){for(var c=this.range,d=c.doc,e=c.cloneRange().collapse(a),g=e.startContainer,h=e.startOffset,j=g.nodeType==3?g.parentNode:g,k=!1,n;j&&j.parentNode;){n=f(j);if(b){if(!n.isStyle())break;if(!Ta(n,b))break}else if(Ia[n.name])break;k= |
|||
!0;j=j.parentNode}if(k)d=d.createElement("span"),c.cloneRange().collapse(!a).insertNode(d),a?e.setStartBefore(j.firstChild).setEnd(g,h):e.setStart(g,h).setEndAfter(j.lastChild),g=e.extractContents(),h=g.firstChild,k=g.lastChild,a?(e.insertNode(g),c.setStartAfter(k).setEndBefore(d)):(j.appendChild(g),c.setStartBefore(d).setEndBefore(h)),e=d.parentNode,e==c.endContainer&&(j=f(d).prev(),g=f(d).next(),j&&g&&j.type==3&&g.type==3?c.setEnd(j[0],j[0].nodeValue.length):a||c.setEnd(c.endContainer,c.endOffset- |
|||
1)),e.removeChild(d);return this},remove:function(a){var b=this.doc,c=this.range;c.enlarge();if(c.startOffset===0){for(var d=f(c.startContainer),e;(e=d.parent())&&e.isStyle()&&e.children().length==1;)d=e;c.setStart(d[0],0);d=f(c.startContainer);d.isBlock()&&Ua(d,a);(d=d.parent())&&d.isBlock()&&Ua(d,a)}if(c.collapsed){this.split(!0,a);b=c.startContainer;d=c.startOffset;if(d>0&&(e=f(b.childNodes[d-1]))&&ea(e))e.remove(),c.setStart(b,d-1);(d=f(b.childNodes[d]))&&ea(d)&&d.remove();ea(b)&&(c.startBefore(b), |
|||
b.remove());c.collapse(!0);return this}this.split(!0,a);this.split(!1,a);var g=b.createElement("span"),h=b.createElement("span");c.cloneRange().collapse(!1).insertNode(h);c.cloneRange().collapse(!0).insertNode(g);var j=[],k=!1;f(c.commonAncestor()).scan(function(a){if(!k&&a==g)k=!0;else{if(a==h)return!1;k&&j.push(a)}});f(g).remove();f(h).remove();b=c.startContainer;d=c.startOffset;e=c.endContainer;var n=c.endOffset;if(d>0){var i=f(b.childNodes[d-1]);i&&ea(i)&&(i.remove(),c.setStart(b,d-1),b==e&&c.setEnd(e, |
|||
n-1));if((d=f(b.childNodes[d]))&&ea(d))d.remove(),b==e&&c.setEnd(e,n-1)}(b=f(e.childNodes[c.endOffset]))&&ea(b)&&b.remove();b=c.createBookmark(!0);m(j,function(b,c){Ua(f(c),a)});c.moveToBookmark(b);return this},commonNode:function(a){function b(b){for(var c=b;b;){if(Ta(f(b),a))return f(b);b=b.parentNode}for(;c&&(c=c.lastChild);)if(Ta(f(c),a))return f(c);return null}var c=this.range,d=c.endContainer,c=c.endOffset,e=d.nodeType==3||c===0?d:d.childNodes[c-1],g=b(e);if(g)return g;if(e.nodeType==1||d.nodeType== |
|||
3&&c===0)if(d=f(e).prev())return b(d);return null},commonAncestor:function(a){function b(b){for(;b;){if(b.nodeType==1&&b.tagName.toLowerCase()===a)return b;b=b.parentNode}return null}var c=this.range,d=c.startContainer,e=c.startOffset,g=c.endContainer,c=c.endOffset,g=g.nodeType==3||c===0?g:g.childNodes[c-1],d=b(d.nodeType==3||e===0?d:d.childNodes[e-1]),e=b(g);if(d&&e&&d===e)return f(d);return null},state:function(a){var b=this.doc,c=!1;try{c=b.queryCommandState(a)}catch(d){}return c},val:function(a){var b= |
|||
this.doc,a=a.toLowerCase(),c="";if(a==="fontfamily"||a==="fontname")return c=vb(b,"fontname"),c=c.replace(/['"]/g,""),c.toLowerCase();if(a==="formatblock"){c=vb(b,a);if(c===""&&(a=this.commonNode({"h1,h2,h3,h4,h5,h6,p,div,pre,address":"*"})))c=a.name;c==="Normal"&&(c="p");return c.toLowerCase()}if(a==="fontsize")return(a=this.commonNode({"*":".font-size"}))&&(c=a.css("font-size")),c.toLowerCase();if(a==="forecolor")return(a=this.commonNode({"*":".color"}))&&(c=a.css("color")),c=ya(c),c===""&&(c="default"), |
|||
c.toLowerCase();if(a==="hilitecolor")return(a=this.commonNode({"*":".background-color"}))&&(c=a.css("background-color")),c=ya(c),c===""&&(c="default"),c.toLowerCase();return c},toggle:function(a,b){this.commonNode(b)?this.remove(b):this.wrap(a);return this.select()},bold:function(){return this.toggle("<strong></strong>",{span:".font-weight=bold",strong:"*",b:"*"})},italic:function(){return this.toggle("<em></em>",{span:".font-style=italic",em:"*",i:"*"})},underline:function(){return this.toggle("<u></u>", |
|||
{span:".text-decoration=underline",u:"*"})},strikethrough:function(){return this.toggle("<s></s>",{span:".text-decoration=line-through",s:"*"})},forecolor:function(a){return this.wrap('<span style="color:'+a+';"></span>').select()},hilitecolor:function(a){return this.wrap('<span style="background-color:'+a+';"></span>').select()},fontsize:function(a){return this.wrap('<span style="font-size:'+a+';"></span>').select()},fontname:function(a){return this.fontfamily(a)},fontfamily:function(a){return this.wrap('<span style="font-family:'+ |
|||
a+';"></span>').select()},removeformat:function(){var a={"*":".font-weight,.font-style,.text-decoration,.color,.background-color,.font-size,.font-family,.text-indent"};m(Mb,function(b){a[b]="*"});this.remove(a);return this.select()},inserthtml:function(a,b){function c(a,b){var b='<img id="__kindeditor_temp_tag__" width="0" height="0" style="display:none;" />'+b,c=a.get();c.item?c.item(0).outerHTML=b:c.pasteHTML(b);var d=a.doc.getElementById("__kindeditor_temp_tag__");d.parentNode.removeChild(d);c= |
|||
ub(c);a.setEnd(c.endContainer,c.endOffset);a.collapse(!1);e.select(!1)}function d(a,b){var c=a.doc,d=c.createDocumentFragment();f("@"+b,c).each(function(){d.appendChild(this)});a.deleteContents();a.insertNode(d);a.collapse(!1);e.select(!1)}var e=this,g=e.range;if(a==="")return e;if(H&&b){try{c(g,a)}catch(h){d(g,a)}return e}d(g,a);return e},hr:function(){return this.inserthtml("<hr />")},print:function(){this.win.print();return this},insertimage:function(a,b,c,d,e,g){b=l(b,"");l(e,0);a='<img src="'+ |
|||
C(a)+'" data-ke-src="'+C(a)+'" ';c&&(a+='width="'+C(c)+'" ');d&&(a+='height="'+C(d)+'" ');b&&(a+='title="'+C(b)+'" ');g&&(a+='align="'+C(g)+'" ');a+='alt="'+C(b)+'" ';a+="/>";return this.inserthtml(a)},createlink:function(a,b){function c(a,b,c){f(a).attr("href",b).attr("data-ke-src",b);c?f(a).attr("target",c):f(a).removeAttr("target")}var d=this.doc,e=this.range;this.select();var g=this.commonNode({a:"*"});g&&!e.isControl()&&(e.selectNode(g.get()),this.select());g='<a href="'+C(a)+'" data-ke-src="'+ |
|||
C(a)+'" ';b&&(g+=' target="'+C(b)+'"');if(e.collapsed)return g+=">"+C(a)+"</a>",this.inserthtml(g);if(e.isControl()){var h=f(e.startContainer.childNodes[e.startOffset]);g+="></a>";h.after(f(g,d));h.next().append(h);e.selectNode(h[0]);return this.select()}var g=e.startContainer,h=e.startOffset,j=e.endContainer,e=e.endOffset;if(g.nodeType==1&&g===j&&h+1===e&&(e=g.childNodes[h],e.nodeName.toLowerCase()=="a"))return c(e,a,b),this;Q(d,"createlink","__kindeditor_temp_url__");f('a[href="__kindeditor_temp_url__"]', |
|||
d).each(function(){c(this,a,b)});return this},unlink:function(){var a=this.doc,b=this.range;this.select();if(b.collapsed){var c=this.commonNode({a:"*"});c&&(b.selectNode(c.get()),this.select());Q(a,"unlink",null);X&&f(b.startContainer).name==="img"&&(a=f(b.startContainer).parent(),a.name==="a"&&a.remove(!0))}else Q(a,"unlink",null);return this}});m("formatblock,selectall,justifyleft,justifycenter,justifyright,justifyfull,insertorderedlist,insertunorderedlist,indent,outdent,subscript,superscript".split(","), |
|||
function(a,b){oa.prototype[b]=function(a){this.select();Q(this.doc,b,a);H&&J(b,"justifyleft,justifycenter,justifyright,justifyfull".split(","))>=0&&this.selection();(!H||J(b,"formatblock,selectall,insertorderedlist,insertunorderedlist".split(","))>=0)&&this.selection();return this}});m("cut,copy,paste".split(","),function(a,b){oa.prototype[b]=function(){if(!this.doc.queryCommandSupported(b))throw"not supported";this.select();Q(this.doc,b,null);return this}});f.CmdClass=oa;f.cmd=zb;E(S,{init:function(a){var b= |
|||
this;b.name=a.name||"";b.doc=a.doc||document;b.win=W(b.doc);b.x=s(a.x);b.y=s(a.y);b.z=a.z;b.width=s(a.width);b.height=s(a.height);b.div=f('<div style="display:block;"></div>');b.options=a;b._alignEl=a.alignEl;b.width&&b.div.css("width",b.width);b.height&&b.div.css("height",b.height);b.z&&b.div.css({position:"absolute",left:b.x,top:b.y,"z-index":b.z});b.z&&(b.x===i||b.y===i)&&b.autoPos(b.width,b.height);a.cls&&b.div.addClass(a.cls);a.shadowMode&&b.div.addClass("ke-shadow");a.css&&b.div.css(a.css); |
|||
a.src?f(a.src).replaceWith(b.div):f(b.doc.body).append(b.div);a.html&&b.div.html(a.html);if(a.autoScroll)if(o&&A<7||P){var c=ca();f(b.win).bind("scroll",function(){var a=ca(),e=a.x-c.x,a=a.y-c.y;b.pos(t(b.x)+e,t(b.y)+a,!1)})}else b.div.css("position","fixed")},pos:function(a,b,c){c=l(c,!0);if(a!==null&&(a=a<0?0:s(a),this.div.css("left",a),c))this.x=a;if(b!==null&&(b=b<0?0:s(b),this.div.css("top",b),c))this.y=b;return this},autoPos:function(a,b){var c=t(a)||0,d=t(b)||0,e=ca();if(this._alignEl){var g= |
|||
f(this._alignEl),h=g.pos(),c=R(g[0].clientWidth/2-c/2),d=R(g[0].clientHeight/2-d/2);x=c<0?h.x:h.x+c;y=d<0?h.y:h.y+d}else h=G(this.doc),x=R(e.x+(h.clientWidth-c)/2),y=R(e.y+(h.clientHeight-d)/2);o&&A<7||P||(x-=e.x,y-=e.y);return this.pos(x,y)},remove:function(){var a=this;(o&&A<7||P)&&f(a.win).unbind("scroll");a.div.remove();m(a,function(b){a[b]=null});return this},show:function(){this.div.show();return this},hide:function(){this.div.hide();return this},draggable:function(a){var b=this,a=a||{};a.moveEl= |
|||
b.div;a.moveFn=function(a,d,e,g,f,j){if((a+=f)<0)a=0;if((d+=j)<0)d=0;b.pos(a,d)};Wa(a);return b}});f.WidgetClass=S;f.widget=Ya;var Za="";if(p=document.getElementsByTagName("html"))Za=p[0].dir;E(qa,S,{init:function(a){function b(){var b=Xa(c.iframe);b.open();if(j)b.domain=document.domain;b.write($b(d,e,g,h));b.close();c.win=c.iframe[0].contentWindow;c.doc=b;var k=zb(b);c.afterChange(function(){k.selection()});X&&f(b).click(function(a){f(a.target).name==="img"&&(k.selection(!0),k.range.selectNode(a.target), |
|||
k.select())});if(o)c._mousedownHandler=function(){var a=k.range.cloneRange();a.shrink();a.isControl()&&c.blur()},f(document).mousedown(c._mousedownHandler),f(b).keydown(function(a){if(a.which==8){k.selection();var b=k.range;b.isControl()&&(b.collapse(!0),f(b.startContainer.childNodes[b.startOffset]).remove(),a.preventDefault())}});c.cmd=k;c.html(pa(c.srcElement));o?(b.body.disabled=!0,b.body.contentEditable=!0,b.body.removeAttribute("disabled")):b.designMode="on";a.afterCreate&&a.afterCreate.call(c)} |
|||
var c=this;qa.parent.init.call(c,a);c.srcElement=f(a.srcElement);c.div.addClass("ke-edit");c.designMode=l(a.designMode,!0);c.beforeGetHtml=a.beforeGetHtml;c.beforeSetHtml=a.beforeSetHtml;c.afterSetHtml=a.afterSetHtml;var d=l(a.themesPath,""),e=a.bodyClass,g=a.cssPath,h=a.cssData,j=location.protocol!="res:"&&location.host.replace(/:\d+/,"")!==document.domain,k="document.open();"+(j?'document.domain="'+document.domain+'";':"")+"document.close();",k=o?' src="javascript:void(function(){'+encodeURIComponent(k)+ |
|||
'}())"':"";c.iframe=f('<iframe class="ke-edit-iframe" hidefocus="true" frameborder="0"'+k+"></iframe>").css("width","100%");c.textarea=f('<textarea class="ke-edit-textarea" hidefocus="true"></textarea>').css("width","100%");c.tabIndex=isNaN(parseInt(a.tabIndex,10))?c.srcElement.attr("tabindex"):parseInt(a.tabIndex,10);c.iframe.attr("tabindex",c.tabIndex);c.textarea.attr("tabindex",c.tabIndex);c.width&&c.setWidth(c.width);c.height&&c.setHeight(c.height);c.designMode?c.textarea.hide():c.iframe.hide(); |
|||
j&&c.iframe.bind("load",function(){c.iframe.unbind("load");o?b():setTimeout(b,0)});c.div.append(c.iframe);c.div.append(c.textarea);c.srcElement.hide();!j&&b()},setWidth:function(a){this.width=a=s(a);this.div.css("width",a);return this},setHeight:function(a){this.height=a=s(a);this.div.css("height",a);this.iframe.css("height",a);if(o&&A<8||P)a=s(t(a)-2);this.textarea.css("height",a);return this},remove:function(){var a=this.doc;f(a.body).unbind();f(a).unbind();f(this.win).unbind();this._mousedownHandler&& |
|||
f(document).unbind("mousedown",this._mousedownHandler);pa(this.srcElement,this.html());this.srcElement.show();a.write("");this.iframe.unbind();this.textarea.unbind();qa.parent.remove.call(this)},html:function(a,b){var c=this.doc;if(this.designMode){c=c.body;if(a===i)return a=b?"<!doctype html><html>"+c.parentNode.innerHTML+"</html>":c.innerHTML,this.beforeGetHtml&&(a=this.beforeGetHtml(a)),Y&&a=="<br />"&&(a=""),a;this.beforeSetHtml&&(a=this.beforeSetHtml(a));o&&A>=9&&(a=a.replace(/(<.*?checked=")checked(".*>)/ig, |
|||
"$1$2"));f(c).html(a);this.afterSetHtml&&this.afterSetHtml();return this}if(a===i)return this.textarea.val();this.textarea.val(a);return this},design:function(a){if(a===i?!this.designMode:a){if(!this.designMode)a=this.html(),this.designMode=!0,this.html(a),this.textarea.hide(),this.iframe.show()}else if(this.designMode)a=this.html(),this.designMode=!1,this.html(a),this.iframe.hide(),this.textarea.show();return this.focus()},focus:function(){this.designMode?this.win.focus():this.textarea[0].focus(); |
|||
return this},blur:function(){if(o){var a=f('<input type="text" style="float:left;width:0;height:0;padding:0;margin:0;border:0;" value="" />',this.div);this.div.append(a);a[0].focus();a.remove()}else this.designMode?this.win.blur():this.textarea[0].blur();return this},afterChange:function(a){function b(b){setTimeout(function(){a(b)},1)}var c=this.doc,d=c.body;f(c).keyup(function(b){!b.ctrlKey&&!b.altKey&&db[b.which]&&a(b)});f(c).mouseup(a).contextmenu(a);f(this.win).blur(a);f(d).bind("paste",b);f(d).bind("cut", |
|||
b);return this}});f.EditClass=qa;f.edit=Ab;f.iframeDoc=Xa;E(Da,S,{init:function(a){function b(a){a=f(a);if(a.hasClass("ke-outline"))return a;if(a.hasClass("ke-toolbar-icon"))return a.parent()}function c(a,c){var d=b(a.target);if(d&&!d.hasClass("ke-disabled")&&!d.hasClass("ke-selected"))d[c]("ke-on")}var d=this;Da.parent.init.call(d,a);d.disableMode=l(a.disableMode,!1);d.noDisableItemMap=u(l(a.noDisableItems,[]));d._itemMap={};d.div.addClass("ke-toolbar").bind("contextmenu,mousedown,mousemove",function(a){a.preventDefault()}).attr("unselectable", |
|||
"on");d.div.mouseover(function(a){c(a,"addClass")}).mouseout(function(a){c(a,"removeClass")}).click(function(a){var c=b(a.target);c&&!c.hasClass("ke-disabled")&&d.options.click.call(this,a,c.attr("data-name"))})},get:function(a){if(this._itemMap[a])return this._itemMap[a];return this._itemMap[a]=f("span.ke-icon-"+a,this.div).parent()},select:function(a){Bb.call(this,a,function(a){a.addClass("ke-selected")});return self},unselect:function(a){Bb.call(this,a,function(a){a.removeClass("ke-selected").removeClass("ke-on")}); |
|||
return self},enable:function(a){if(a=a.get?a:this.get(a))a.removeClass("ke-disabled"),a.opacity(1);return this},disable:function(a){if(a=a.get?a:this.get(a))a.removeClass("ke-selected").addClass("ke-disabled"),a.opacity(0.5);return this},disableAll:function(a,b){var c=this,d=c.noDisableItemMap;b&&(d=u(b));(a===i?!c.disableMode:a)?(f("span.ke-outline",c.div).each(function(){var a=f(this),b=a[0].getAttribute("data-name",2);d[b]||c.disable(a)}),c.disableMode=!0):(f("span.ke-outline",c.div).each(function(){var a= |
|||
f(this),b=a[0].getAttribute("data-name",2);d[b]||c.enable(a)}),c.disableMode=!1);return c}});f.ToolbarClass=Da;f.toolbar=Cb;E(ra,S,{init:function(a){a.z=a.z||811213;ra.parent.init.call(this,a);this.centerLineMode=l(a.centerLineMode,!0);this.div.addClass("ke-menu").bind("click,mousedown",function(a){a.stopPropagation()}).attr("unselectable","on")},addItem:function(a){if(a.title==="-")this.div.append(f('<div class="ke-menu-separator"></div>'));else{var b=f('<div class="ke-menu-item" unselectable="on"></div>'), |
|||
c=f('<div class="ke-inline-block ke-menu-item-left"></div>'),d=f('<div class="ke-inline-block ke-menu-item-right"></div>'),e=s(a.height),g=l(a.iconClass,"");this.div.append(b);e&&(b.css("height",e),d.css("line-height",e));var h;this.centerLineMode&&(h=f('<div class="ke-inline-block ke-menu-item-center"></div>'),e&&h.css("height",e));b.mouseover(function(){f(this).addClass("ke-menu-item-on");h&&h.addClass("ke-menu-item-center-on")}).mouseout(function(){f(this).removeClass("ke-menu-item-on");h&&h.removeClass("ke-menu-item-center-on")}).click(function(b){a.click.call(f(this)); |
|||
b.stopPropagation()}).append(c);h&&b.append(h);b.append(d);a.checked&&(g="ke-icon-checked");g!==""&&c.html('<span class="ke-inline-block ke-toolbar-icon ke-toolbar-icon-url '+g+'"></span>');d.html(a.title);return this}},remove:function(){this.options.beforeRemove&&this.options.beforeRemove.call(this);f(".ke-menu-item",this.div[0]).unbind();ra.parent.remove.call(this);return this}});f.MenuClass=ra;f.menu=$a;E(sa,S,{init:function(a){a.z=a.z||811213;sa.parent.init.call(this,a);var b=a.colors||[["#E53333", |
|||
"#E56600","#FF9900","#64451D","#DFC5A4","#FFE500"],["#009900","#006600","#99BB00","#B8D100","#60D978","#00D5FF"],["#337FE5","#003399","#4C33E5","#9933E5","#CC33E5","#EE33EE"],["#FFFFFF","#CCCCCC","#999999","#666666","#333333","#000000"]];this.selectedColor=(a.selectedColor||"").toLowerCase();this._cells=[];this.div.addClass("ke-colorpicker").bind("click,mousedown",function(a){a.stopPropagation()}).attr("unselectable","on");a=this.doc.createElement("table");this.div.append(a);a.className="ke-colorpicker-table"; |
|||
a.cellPadding=0;a.cellSpacing=0;a.border=0;var c=a.insertRow(0),d=c.insertCell(0);d.colSpan=b[0].length;this._addAttr(d,"","ke-colorpicker-cell-top");for(var e=0;e<b.length;e++)for(var c=a.insertRow(e+1),g=0;g<b[e].length;g++)d=c.insertCell(g),this._addAttr(d,b[e][g],"ke-colorpicker-cell")},_addAttr:function(a,b,c){var d=this,a=f(a).addClass(c);d.selectedColor===b.toLowerCase()&&a.addClass("ke-colorpicker-cell-selected");a.attr("title",b||d.options.noColor);a.mouseover(function(){f(this).addClass("ke-colorpicker-cell-on")}); |
|||
a.mouseout(function(){f(this).removeClass("ke-colorpicker-cell-on")});a.click(function(a){a.stop();d.options.click.call(f(this),b)});b?a.append(f('<div class="ke-colorpicker-cell-color" unselectable="on"></div>').css("background-color",b)):a.html(d.options.noColor);f(a).attr("unselectable","on");d._cells.push(a)},remove:function(){m(this._cells,function(){this.unbind()});sa.parent.remove.call(this);return this}});f.ColorPickerClass=sa;f.colorpicker=Db;E(ab,{init:function(a){var b=f(a.button),c=a.fieldName|| |
|||
"file",d=a.url||"",e=b.val(),es=b.attr("style"),g=a.extraParams||{},h=b[0].className||"",j=a.target||"kindeditor_upload_iframe_"+(new Date).getTime();a.afterError=a.afterError||function(a){alert(a)};var k=[],i;for(i in g)k.push('<input type="hidden" name="'+i+'" value="'+g[i]+'" />');c=['<div class="ke-inline-block '+h+'" style="'+es+'">',a.target?"":'<iframe name="'+j+'" style="display:none;"></iframe>',a.form?'<div class="ke-upload-area">':'<form class="ke-upload-area ke-form" method="post" enctype="multipart/form-data" target="'+ |
|||
j+'" action="'+d+'">','<span>',k.join(""), e,"</span>",'<input type="file" style="cursor:pointer;" class="ke-upload-file" name="'+c+'" tabindex="-1" />',a.form?"</div>":"</form>","</div>"].join("");c=f(c,b.doc);b.hide();b.before(c);this.div=c;this.button=b;this.iframe=a.target?f('iframe[name="'+j+'"]'):f("iframe",c);this.form=a.form?f(a.form):f("form",c);this.fileBox=f(".ke-upload-file",c);b=a.width||f(".ke-button-common",c).width(); |
|||
/*f(".ke-upload-area",c).width(b)*/;this.options=a},submit:function(){var a=this,b=a.iframe;b.bind("load",function(){b.unbind();var c=document.createElement("form");a.fileBox.before(c);f(c).append(a.fileBox);c.reset();f(c).remove(!0);var c=f.iframeDoc(b),d=c.getElementsByTagName("pre")[0],e="",g,e=d?d.innerHTML:c.body.innerHTML,e=fa(e);b[0].src="javascript:false";try{g=f.json(e)}catch(h){a.options.afterError.call(a,"<!doctype html><html>"+c.body.parentNode.innerHTML+"</html>")}g&&a.options.afterUpload.call(a, |
|||
g)});a.form[0].submit();return a},remove:function(){this.fileBox&&this.fileBox.unbind();this.iframe.remove();this.div.remove();this.button.show();return this}});f.UploadButtonClass=ab;f.uploadbutton=function(a){return new ab(a)};E(ta,S,{init:function(a){var b=l(a.shadowMode,!0);a.z=a.z||811213;a.shadowMode=!1;a.autoScroll=l(a.autoScroll,!0);ta.parent.init.call(this,a);var c=a.title,d=f(a.body,this.doc),e=a.previewBtn,g=a.yesBtn,h=a.noBtn,j=a.closeBtn,k=l(a.showMask,!0);this.div.addClass("ke-dialog").bind("click,mousedown", |
|||
function(a){a.stopPropagation()});var i=f('<div class="ke-dialog-content"></div>').appendTo(this.div);o&&A<7?this.iframeMask=f('<iframe src="about:blank" class="ke-dialog-shadow"></iframe>').appendTo(this.div):b&&f('<div class="ke-dialog-shadow"></div>').appendTo(this.div);b=f('<div class="ke-dialog-header"></div>');i.append(b);b.html(c);this.closeIcon=f('<span class="ke-dialog-icon-close" title="'+j.name+'"></span>').click(j.click);b.append(this.closeIcon);this.draggable({clickEl:b,beforeDrag:a.beforeDrag}); |
|||
a=f('<div class="ke-dialog-body"></div>');i.append(a);a.append(d);var q=f('<div class="ke-dialog-footer"></div>');(e||g||h)&&i.append(q);m([{btn:e,name:"preview"},{btn:g,name:"yes"},{btn:h,name:"no"}],function(){if(this.btn){var a=this.btn,a=a||{},b=a.name||"",c=f('<span class="ke-button-common ke-button-outer" title="'+b+'"></span>'),b=f('<input class="ke-button-common ke-button" type="button" value="'+b+'" />');a.click&&b.click(a.click);c.append(b);c.addClass("ke-dialog-"+this.name);q.append(c)}}); |
|||
this.height&&a.height(t(this.height)-b.height()-q.height());this.div.width(this.div.width());this.div.height(this.div.height());this.mask=null;if(k)d=G(this.doc),this.mask=Ya({x:0,y:0,z:this.z-1,cls:"ke-dialog-mask",width:Math.max(d.scrollWidth,d.clientWidth),height:Math.max(d.scrollHeight,d.clientHeight)});this.autoPos(this.div.width(),this.div.height());this.footerDiv=q;this.bodyDiv=a;this.headerDiv=b;this.isLoading=!1},setMaskIndex:function(a){this.mask.div.css("z-index",a)},showLoading:function(a){var a= |
|||
l(a,""),b=this.bodyDiv;this.loading=f('<div class="ke-dialog-loading"><div class="ke-inline-block ke-dialog-loading-content" style="margin-top:'+Math.round(b.height()/3)+'px;">'+a+"</div></div>").width(b.width()).height(b.height()).css("top",this.headerDiv.height()+"px");b.css("visibility","hidden").after(this.loading);this.isLoading=!0;return this},hideLoading:function(){this.loading&&this.loading.remove();this.bodyDiv.css("visibility","visible");this.isLoading=!1;return this},remove:function(){this.options.beforeRemove&& |
|||
this.options.beforeRemove.call(this);this.mask&&this.mask.remove();this.iframeMask&&this.iframeMask.remove();this.closeIcon.unbind();f("input",this.div).unbind();f("button",this.div).unbind();this.footerDiv.unbind();this.bodyDiv.unbind();this.headerDiv.unbind();f("iframe",this.div).each(function(){f(this).remove()});ta.parent.remove.call(this);return this}});f.DialogClass=ta;f.dialog=Eb;f.tabs=function(a){var b=Ya(a),c=b.remove,d=a.afterSelect,a=b.div,e=[];a.addClass("ke-tabs").bind("contextmenu,mousedown,mousemove", |
|||
function(a){a.preventDefault()});var g=f('<ul class="ke-tabs-ul ke-clearfix"></ul>');a.append(g);b.add=function(a){var b=f('<li class="ke-tabs-li">'+a.title+"</li>");b.data("tab",a);e.push(b);g.append(b)};b.selectedIndex=0;b.select=function(a){b.selectedIndex=a;m(e,function(c,d){d.unbind();c===a?(d.addClass("ke-tabs-li-selected"),f(d.data("tab").panel).show("")):(d.removeClass("ke-tabs-li-selected").removeClass("ke-tabs-li-on").mouseover(function(){f(this).addClass("ke-tabs-li-on")}).mouseout(function(){f(this).removeClass("ke-tabs-li-on")}).click(function(){b.select(c)}), |
|||
f(d.data("tab").panel).hide())});d&&d.call(b,a)};b.remove=function(){m(e,function(){this.remove()});g.remove();c.call(b)};return b};f.loadScript=bb;f.loadStyle=cb;f.ajax=function(a,b,c,d,e){var c=c||"GET",e=e||"json",g=w.XMLHttpRequest?new w.XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");g.open(c,a,!0);g.onreadystatechange=function(){if(g.readyState==4&&g.status==200&&b){var a=B(g.responseText);e=="json"&&(a=eb(a));b(a)}};if(c=="POST"){var f=[];m(d,function(a,b){f.push(encodeURIComponent(a)+ |
|||
"="+encodeURIComponent(b))});try{g.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}catch(j){}g.send(f.join("&"))}else g.send(null)};var N={},O={};ua.prototype={lang:function(a){return Ib(a,this.langType)},loadPlugin:function(a,b){var c=this;if(N[a]){if(!wa(N[a]))return setTimeout(function(){c.loadPlugin(a,b)},100),c;N[a].call(c,KindEditor);b&&b.call(c);return c}N[a]="loading";bb(c.pluginsPath+a+"/"+a+".js?ver="+encodeURIComponent(f.DEBUG?Ga:Ha),function(){setTimeout(function(){N[a]&& |
|||
c.loadPlugin(a,b)},0)});return c},handler:function(a,b){var c=this;c._handlers[a]||(c._handlers[a]=[]);if(wa(b))return c._handlers[a].push(b),c;m(c._handlers[a],function(){b=this.call(c,b)});return b},clickToolbar:function(a,b){var c=this,d="clickToolbar"+a;if(b===i){if(c._handlers[d])return c.handler(d);c.loadPlugin(a,function(){c.handler(d)});return c}return c.handler(d,b)},updateState:function(){var a=this;m("justifyleft,justifycenter,justifyright,justifyfull,insertorderedlist,insertunorderedlist,subscript,superscript,bold,italic,underline,strikethrough".split(","), |
|||
function(b,c){a.cmd.state(c)?a.toolbar.select(c):a.toolbar.unselect(c)});return a},addContextmenu:function(a){this._contextmenus.push(a);return this},afterCreate:function(a){return this.handler("afterCreate",a)},beforeRemove:function(a){return this.handler("beforeRemove",a)},beforeGetHtml:function(a){return this.handler("beforeGetHtml",a)},beforeSetHtml:function(a){return this.handler("beforeSetHtml",a)},afterSetHtml:function(a){return this.handler("afterSetHtml",a)},create:function(){function a(){k.height()=== |
|||
0?setTimeout(a,100):b.resize(d,e,!1)}var b=this,c=b.fullscreenMode;if(b.isCreated)return b;if(b.srcElement.data("kindeditor"))return b;b.srcElement.data("kindeditor","true");c?G().style.overflow="hidden":G().style.overflow="";var d=c?G().clientWidth+"px":b.width,e=c?G().clientHeight+"px":b.height;if(o&&A<8||P)e=s(t(e)+2);var g=b.container=f(b.layout);c?f(document.body).append(g):b.srcElement.before(g);var h=f(".toolbar",g),j=f(".edit",g),k=b.statusbar=f(".statusbar",g);g.removeClass("container").addClass("ke-container ke-container-"+ |
|||
b.themeType).css("width",d);if(c){g.css({position:"absolute",left:0,top:0,"z-index":811211});if(!Y)b._scrollPos=ca();w.scrollTo(0,0);f(document.body).css({height:"1px",overflow:"hidden"});f(document.body.parentNode).css("overflow","hidden");b._fullscreenExecuted=!0}else b._fullscreenExecuted&&(f(document.body).css({height:"",overflow:""}),f(document.body.parentNode).css("overflow","")),b._scrollPos&&w.scrollTo(b._scrollPos.x,b._scrollPos.y);var i=[];f.each(b.items,function(a,c){c=="|"?i.push('<span class="ke-inline-block ke-separator"></span>'): |
|||
c=="/"?i.push('<div class="ke-hr"></div>'):(i.push('<span class="ke-outline" data-name="'+c+'" title="'+b.lang(c)+'" unselectable="on">'),i.push('<span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-'+c+'" unselectable="on"></span></span>'))});var h=b.toolbar=Cb({src:h,html:i.join(""),noDisableItems:b.noDisableItems,click:function(a,c){a.stop();if(b.menu){var d=b.menu.name;b.hideMenu();if(d===c)return}b.clickToolbar(c)}}),l=t(e)-h.div.height(),m=b.edit=Ab({height:l>0&&t(e)>b.minHeight?l:b.minHeight, |
|||
src:j,srcElement:b.srcElement,designMode:b.designMode,themesPath:b.themesPath,bodyClass:b.bodyClass,cssPath:b.cssPath,cssData:b.cssData,beforeGetHtml:function(a){a=b.beforeGetHtml(a);a=T(Fa(a));return U(a,b.filterMode?b.htmlTags:null,b.urlType,b.wellFormatMode,b.indentChar)},beforeSetHtml:function(a){a=U(a,b.filterMode?b.htmlTags:null,"",!1);return b.beforeSetHtml(a)},afterSetHtml:function(){b.edit=m=this;b.afterSetHtml()},afterCreate:function(){b.edit=m=this;b.cmd=m.cmd;b._docMousedownFn=function(){b.menu&& |
|||
b.hideMenu()};f(m.doc,document).mousedown(b._docMousedownFn);ac.call(b);bc.call(b);cc.call(b);dc.call(b);m.afterChange(function(){m.designMode&&(b.updateState(),b.addBookmark(),b.options.afterChange&&b.options.afterChange.call(b))});m.textarea.keyup(function(a){!a.ctrlKey&&!a.altKey&&Ob[a.which]&&b.options.afterChange&&b.options.afterChange.call(b)});b.readonlyMode&&b.readonly();b.isCreated=!0;if(b.initContent==="")b.initContent=b.html();if(b._undoStack.length>0){var a=b._undoStack.pop();a.start&& |
|||
(b.html(a.html),m.cmd.range.moveToBookmark(a),b.select())}b.afterCreate();b.options.afterCreate&&b.options.afterCreate.call(b)}});k.removeClass("statusbar").addClass("ke-statusbar").append('<span class="ke-inline-block ke-statusbar-center-icon"></span>').append('<span class="ke-inline-block ke-statusbar-right-icon"></span>');if(b._fullscreenResizeHandler)f(w).unbind("resize",b._fullscreenResizeHandler),b._fullscreenResizeHandler=null;a();c?(b._fullscreenResizeHandler=function(){b.isCreated&&b.resize(G().clientWidth, |
|||
G().clientHeight,!1)},f(w).bind("resize",b._fullscreenResizeHandler),h.select("fullscreen"),k.first().css("visibility","hidden"),k.last().css("visibility","hidden")):(Y&&f(w).bind("scroll",function(){b._scrollPos=ca()}),b.resizeType>0?Wa({moveEl:g,clickEl:k,moveFn:function(a,c,d,e,g,f){e+=f;b.resize(null,e)}}):k.first().css("visibility","hidden"),b.resizeType===2?Wa({moveEl:g,clickEl:k.last(),moveFn:function(a,c,d,e,g,f){d+=g;e+=f;b.resize(d,e)}}):k.last().css("visibility","hidden"));return b},remove:function(){var a= |
|||
this;if(!a.isCreated)return a;a.beforeRemove();a.srcElement.data("kindeditor","");a.menu&&a.hideMenu();m(a.dialogs,function(){a.hideDialog()});f(document).unbind("mousedown",a._docMousedownFn);a.toolbar.remove();a.edit.remove();a.statusbar.last().unbind();a.statusbar.unbind();a.container.remove();a.container=a.toolbar=a.edit=a.menu=null;a.dialogs=[];a.isCreated=!1;return a},resize:function(a,b,c){c=l(c,!0);if(a&&(/%/.test(a)||(a=t(a),a=a<this.minWidth?this.minWidth:a),this.container.css("width",s(a)), |
|||
c))this.width=s(a);if(b&&(b=t(b),editHeight=t(b)-this.toolbar.div.height()-this.statusbar.height(),editHeight=editHeight<this.minHeight?this.minHeight:editHeight,this.edit.setHeight(editHeight),c))this.height=s(b);return this},select:function(){this.isCreated&&this.cmd.select();return this},html:function(a){if(a===i)return this.isCreated?this.edit.html():pa(this.srcElement);this.isCreated?this.edit.html(a):pa(this.srcElement,a);this.isCreated&&this.cmd.selection();return this},fullHtml:function(){return this.isCreated? |
|||
this.edit.html(i,!0):""},text:function(a){return a===i?B(this.html().replace(/<(?!img|embed).*?>/ig,"").replace(/ /ig," ")):this.html(C(a))},isEmpty:function(){return B(this.text().replace(/\r\n|\n|\r/,""))===""},isDirty:function(){return B(this.initContent.replace(/\r\n|\n|\r|t/g,""))!==B(this.html().replace(/\r\n|\n|\r|t/g,""))},selectedHtml:function(){var a=this.isCreated?this.cmd.range.html():"";return a=T(Fa(a))},count:function(a){a=(a||"html").toLowerCase();if(a==="html")return this.html().length; |
|||
if(a==="text")return this.text().replace(/<(?:img|embed).*?>/ig,"K").replace(/\r\n|\n|\r/g,"").length;return 0},exec:function(a){var a=a.toLowerCase(),b=this.cmd,c=J(a,"selectall,copy,paste,print".split(","))<0;c&&this.addBookmark(!1);b[a].apply(b,Ja(arguments,1));c&&(this.updateState(),this.addBookmark(!1),this.options.afterChange&&this.options.afterChange.call(this));return this},insertHtml:function(a,b){if(!this.isCreated)return this;a=this.beforeSetHtml(a);this.exec("inserthtml",a,b);return this}, |
|||
appendHtml:function(a){this.html(this.html()+a);if(this.isCreated)a=this.cmd,a.range.selectNodeContents(a.doc.body).collapse(!1),a.select();return this},sync:function(){pa(this.srcElement,this.html());return this},focus:function(){this.isCreated?this.edit.focus():this.srcElement[0].focus();return this},blur:function(){this.isCreated?this.edit.blur():this.srcElement[0].blur();return this},addBookmark:function(a){var a=l(a,!0),b=this.edit,c=b.doc.body,d=Fa(c.innerHTML);if(a&&this._undoStack.length> |
|||
0&&Math.abs(d.length-T(this._undoStack[this._undoStack.length-1].html).length)<this.minChangeSize)return this;b.designMode&&!this._firstAddBookmark?(b=this.cmd.range,a=b.createBookmark(!0),a.html=Fa(c.innerHTML),b.moveToBookmark(a)):a={html:d};this._firstAddBookmark=!1;Jb(this._undoStack,a);return this},undo:function(){return Kb.call(this,this._undoStack,this._redoStack)},redo:function(){return Kb.call(this,this._redoStack,this._undoStack)},fullscreen:function(a){this.fullscreenMode=a===i?!this.fullscreenMode: |
|||
a;this.addBookmark(!1);return this.remove().create()},readonly:function(a){var a=l(a,!0),b=this,c=b.edit,d=c.doc;b.designMode?b.toolbar.disableAll(a,[]):m(b.noDisableItems,function(){b.toolbar[a?"disable":"enable"](this)});o?d.body.contentEditable=!a:d.designMode=a?"off":"on";c.textarea[0].disabled=a},createMenu:function(a){var b=this.toolbar.get(a.name),c=b.pos();a.x=c.x;a.y=c.y+b.height();a.z=this.options.zIndex;a.shadowMode=l(a.shadowMode,this.shadowMode);a.selectedColor!==i?(a.cls="ke-colorpicker-"+ |
|||
this.themeType,a.noColor=this.lang("noColor"),this.menu=Db(a)):(a.cls="ke-menu-"+this.themeType,a.centerLineMode=!1,this.menu=$a(a));return this.menu},hideMenu:function(){this.menu.remove();this.menu=null;return this},hideContextmenu:function(){this.contextmenu.remove();this.contextmenu=null;return this},createDialog:function(a){var b=this;a.z=b.options.zIndex;a.shadowMode=l(a.shadowMode,b.shadowMode);a.closeBtn=l(a.closeBtn,{name:b.lang("close"),click:function(){b.hideDialog();o&&b.cmd&&b.cmd.select()}}); |
|||
a.noBtn=l(a.noBtn,{name:b.lang(a.yesBtn?"no":"close"),click:function(){b.hideDialog();o&&b.cmd&&b.cmd.select()}});if(b.dialogAlignType!="page")a.alignEl=b.container;a.cls="ke-dialog-"+b.themeType;if(b.dialogs.length>0){var c=b.dialogs[b.dialogs.length-1];b.dialogs[0].setMaskIndex(c.z+2);a.z=c.z+3;a.showMask=!1}a=Eb(a);b.dialogs.push(a);return a},hideDialog:function(){this.dialogs.length>0&&this.dialogs.pop().remove();this.dialogs.length>0&&this.dialogs[0].setMaskIndex(this.dialogs[this.dialogs.length- |
|||
1].z-1);return this},errorDialog:function(a){var b=this.createDialog({width:750,title:this.lang("uploadError"),body:'<div style="padding:10px 20px;"><iframe frameborder="0" style="width:708px;height:400px;"></iframe></div>'}),b=f("iframe",b.div),c=f.iframeDoc(b);c.open();c.write(a);c.close();f(c.body).css("background-color","#FFF");b[0].contentWindow.focus();return this}};_instances=[];f.remove=function(a){va(a,function(a){this.remove();_instances.splice(a,1)})};f.sync=function(a){va(a,function(){this.sync()})}; |
|||
f.html=function(a,b){va(a,function(){this.html(b)})};f.insertHtml=function(a,b){va(a,function(){this.insertHtml(b)})};f.appendHtml=function(a,b){va(a,function(){this.appendHtml(b)})};o&&A<7&&Q(document,"BackgroundImageCache",!0);f.EditorClass=ua;f.editor=function(a){return new ua(a)};f.create=Lb;f.instances=_instances;f.plugin=Gb;f.lang=Ib;Gb("core",function(a){var b=this,c={undo:"Z",redo:"Y",bold:"B",italic:"I",underline:"U",print:"P",selectall:"A"};b.afterSetHtml(function(){b.options.afterChange&& |
|||
b.options.afterChange.call(b)});b.afterCreate(function(){if(b.syncType=="form"){for(var c=a(b.srcElement),d=!1;c=c.parent();)if(c.name=="form"){d=!0;break}if(d){c.bind("submit",function(){b.sync();a(w).bind("unload",function(){b.edit.textarea.remove()})});var f=a('[type="reset"]',c);f.click(function(){b.html(b.initContent);b.cmd.selection()});b.beforeRemove(function(){c.unbind();f.unbind()})}}});b.clickToolbar("source",function(){b.edit.designMode?(b.toolbar.disableAll(!0),b.edit.design(!1),b.toolbar.select("source")): |
|||
(b.toolbar.disableAll(!1),b.edit.design(!0),b.toolbar.unselect("source"),Y?setTimeout(function(){b.cmd.selection()},0):b.cmd.selection());b.designMode=b.edit.designMode});b.afterCreate(function(){b.designMode||b.toolbar.disableAll(!0).select("source")});b.clickToolbar("fullscreen",function(){b.fullscreen()});if(b.fullscreenShortcut){var d=!1;b.afterCreate(function(){a(b.edit.doc,b.edit.textarea).keyup(function(a){a.which==27&&setTimeout(function(){b.fullscreen()},0)});if(d){if(o&&!b.designMode)return; |
|||
b.focus()}d||(d=!0)})}m("undo,redo".split(","),function(a,d){c[d]&&b.afterCreate(function(){Ka(this.edit.doc,c[d],function(){b.clickToolbar(d)})});b.clickToolbar(d,function(){b[d]()})});b.clickToolbar("formatblock",function(){var a=b.lang("formatblock.formatBlock"),c={h1:28,h2:24,h3:18,H4:14,p:12},d=b.cmd.val("formatblock"),f=b.createMenu({name:"formatblock",width:b.langType=="en"?200:150});m(a,function(a,e){var i="font-size:"+c[a]+"px;";a.charAt(0)==="h"&&(i+="font-weight:bold;");f.addItem({title:'<span style="'+ |
|||
i+'" unselectable="on">'+e+"</span>",height:c[a]+12,checked:d===a||d===e,click:function(){b.select().exec("formatblock","<"+a+">").hideMenu()}})})});b.clickToolbar("fontname",function(){var a=b.cmd.val("fontname"),c=b.createMenu({name:"fontname",width:150});m(b.lang("fontname.fontName"),function(d,f){c.addItem({title:'<span style="font-family: '+d+';" unselectable="on">'+f+"</span>",checked:a===d.toLowerCase()||a===f.toLowerCase(),click:function(){b.exec("fontname",d).hideMenu()}})})});b.clickToolbar("fontsize", |
|||
function(){var a=b.cmd.val("fontsize"),c=b.createMenu({name:"fontsize",width:150});m(b.fontSizeTable,function(d,f){c.addItem({title:'<span style="font-size:'+f+';" unselectable="on">'+f+"</span>",height:t(f)+12,checked:a===f,click:function(){b.exec("fontsize",f).hideMenu()}})})});m("forecolor,hilitecolor".split(","),function(a,c){b.clickToolbar(c,function(){b.createMenu({name:c,selectedColor:b.cmd.val(c)||"default",colors:b.colorTable,click:function(a){b.exec(c,a).hideMenu()}})})});m("cut,copy,paste".split(","), |
|||
function(a,c){b.clickToolbar(c,function(){b.focus();try{b.exec(c,null)}catch(a){alert(b.lang(c+"Error"))}})});b.clickToolbar("about",function(){var a='<div style="margin:20px;"><div>KindEditor '+Ha+'</div><div>Copyright © <a href="http://www.kindsoft.net/" target="_blank">kindsoft.net</a> All rights reserved.</div></div>';b.createDialog({name:"about",width:350,title:b.lang("about"),body:a})});b.plugin.getSelectedLink=function(){return b.cmd.commonAncestor("a")};b.plugin.getSelectedImage=function(){return Ea(b.edit.cmd.range, |
|||
function(a){return!/^ke-\w+$/i.test(a[0].className)})};b.plugin.getSelectedFlash=function(){return Ea(b.edit.cmd.range,function(a){return a[0].className=="ke-flash"})};b.plugin.getSelectedMedia=function(){return Ea(b.edit.cmd.range,function(a){return a[0].className=="ke-media"||a[0].className=="ke-rm"})};b.plugin.getSelectedAnchor=function(){return Ea(b.edit.cmd.range,function(a){return a[0].className=="ke-anchor"})};m("link,image,flash,media,anchor".split(","),function(a,c){var d=c.charAt(0).toUpperCase()+ |
|||
c.substr(1);m("edit,delete".split(","),function(a,e){b.addContextmenu({title:b.lang(e+d),click:function(){b.loadPlugin(c,function(){b.plugin[c][e]();b.hideMenu()})},cond:b.plugin["getSelected"+d],width:150,iconClass:e=="edit"?"ke-icon-"+c:i})});b.addContextmenu({title:"-"})});b.plugin.getSelectedTable=function(){return b.cmd.commonAncestor("table")};b.plugin.getSelectedRow=function(){return b.cmd.commonAncestor("tr")};b.plugin.getSelectedCell=function(){return b.cmd.commonAncestor("td")};m("prop,cellprop,colinsertleft,colinsertright,rowinsertabove,rowinsertbelow,rowmerge,colmerge,rowsplit,colsplit,coldelete,rowdelete,insert,delete".split(","), |
|||
function(a,c){var d=J(c,["prop","delete"])<0?b.plugin.getSelectedCell:b.plugin.getSelectedTable;b.addContextmenu({title:b.lang("table"+c),click:function(){b.loadPlugin("table",function(){b.plugin.table[c]();b.hideMenu()})},cond:d,width:170,iconClass:"ke-icon-table"+c})});b.addContextmenu({title:"-"});m("selectall,justifyleft,justifycenter,justifyright,justifyfull,insertorderedlist,insertunorderedlist,indent,outdent,subscript,superscript,hr,print,bold,italic,underline,strikethrough,removeformat,unlink".split(","), |
|||
function(a,d){c[d]&&b.afterCreate(function(){Ka(this.edit.doc,c[d],function(){b.cmd.selection();b.clickToolbar(d)})});b.clickToolbar(d,function(){b.focus().exec(d,null)})});b.afterCreate(function(){function c(){f.range.moveToBookmark(j);f.select();X&&(a("div."+l,i).each(function(){a(this).after("<br />").remove(!0)}),a("span.Apple-style-span",i).remove(!0),a("span.Apple-tab-span",i).remove(!0),a("span[style]",i).each(function(){a(this).css("white-space")=="nowrap"&&a(this).remove(!0)}),a("meta",i).remove()); |
|||
var d=i[0].innerHTML;i.remove();d!==""&&(X&&(d=d.replace(/(<br>)\1/ig,"$1")),b.pasteType===2&&(d=d.replace(/(<(?:p|p\s[^>]*)>) *(<\/p>)/ig,""),/schemas-microsoft-com|worddocument|mso-\w+/i.test(d)?d=nb(d,b.filterMode?b.htmlTags:a.options.htmlTags):(d=U(d,b.filterMode?b.htmlTags:null),d=b.beforeSetHtml(d))),b.pasteType===1&&(d=d.replace(/ /ig," "),d=d.replace(/\n\s*\n/g,"\n"),d=d.replace(/<br[^>]*>/ig,"\n"),d=d.replace(/<\/p><p[^>]*>/ig,"\n"),d=d.replace(/<[^>]+>/g,""),d=d.replace(/ {2}/g," "), |
|||
b.newlineTag=="p"?/\n/.test(d)&&(d=d.replace(/^/,"<p>").replace(/$/,"<br /></p>").replace(/\n/g,"<br /></p><p>")):d=d.replace(/\n/g,"<br />$&")),b.insertHtml(d,!0))}var d=b.edit.doc,f,j,i,l="__kindeditor_paste__",m=!1;a(d.body).bind("paste",function(p){if(b.pasteType===0)p.stop();else if(!m){m=!0;a("div."+l,d).remove();f=b.cmd.selection();j=f.range.createBookmark();i=a('<div class="'+l+'"></div>',d).css({position:"absolute",width:"1px",height:"1px",overflow:"hidden",left:"-1981px",top:a(j.start).pos().y+ |
|||
"px","white-space":"nowrap"});a(d.body).append(i);if(o){var s=f.range.get(!0);s.moveToElementText(i[0]);s.select();s.execCommand("paste");p.preventDefault()}else f.range.selectNodeContents(i[0]),f.select();setTimeout(function(){c();m=!1},0)}})});b.beforeGetHtml(function(a){o&&A<=8&&(a=a.replace(/<div\s+[^>]*data-ke-input-tag="([^"]*)"[^>]*>([\s\S]*?)<\/div>/ig,function(a,b){return unescape(b)}),a=a.replace(/(<input)((?:\s+[^>]*)?>)/ig,function(a,b,c){if(!/\s+type="[^"]+"/i.test(a))return b+' type="text"'+ |
|||
c;return a}));return a.replace(/(<(?:noscript|noscript\s[^>]*)>)([\s\S]*?)(<\/noscript>)/ig,function(a,b,c,d){return b+fa(c).replace(/\s+/g," ")+d}).replace(/<img[^>]*class="?ke-(flash|rm|media)"?[^>]*>/ig,function(a){var a=I(a),b=ba(a.style||""),c=pb(a["data-ke-tag"]),d=l(b.width,""),b=l(b.height,"");/px/i.test(d)&&(d=t(d));/px/i.test(b)&&(b=t(b));c.width=l(a.width,d);c.height=l(a.height,b);return Ma(c)}).replace(/<img[^>]*class="?ke-anchor"?[^>]*>/ig,function(a){a=I(a);return'<a name="'+unescape(a["data-ke-name"])+ |
|||
'"></a>'}).replace(/<div\s+[^>]*data-ke-script-attr="([^"]*)"[^>]*>([\s\S]*?)<\/div>/ig,function(a,b,c){return"<script"+unescape(b)+">"+unescape(c)+"<\/script>"}).replace(/<div\s+[^>]*data-ke-noscript-attr="([^"]*)"[^>]*>([\s\S]*?)<\/div>/ig,function(a,b,c){return"<noscript"+unescape(b)+">"+unescape(c)+"</noscript>"}).replace(/(<[^>]*)data-ke-src="([^"]*)"([^>]*>)/ig,function(a,b,c){a=a.replace(/(\s+(?:href|src)=")[^"]*(")/i,function(a,b,d){return b+fa(c)+d});return a=a.replace(/\s+data-ke-src="[^"]*"/i, |
|||
"")}).replace(/(<[^>]+\s)data-ke-(on\w+="[^"]*"[^>]*>)/ig,function(a,b,c){return b+c})});b.beforeSetHtml(function(a){o&&A<=8&&(a=a.replace(/<input[^>]*>|<(select|button)[^>]*>[\s\S]*?<\/\1>/ig,function(a){var b=I(a);if(ba(b.style||"").display=="none")return'<div class="ke-display-none" data-ke-input-tag="'+escape(a)+'"></div>';return a}));return a.replace(/<embed[^>]*type="([^"]+)"[^>]*>(?:<\/embed>)?/ig,function(a){a=I(a);a.src=l(a.src,"");a.width=l(a.width,0);a.height=l(a.height,0);return qb(b.themesPath+ |
|||
"common/blank.gif",a)}).replace(/<a[^>]*name="([^"]+)"[^>]*>(?:<\/a>)?/ig,function(a){var c=I(a);if(c.href!==i)return a;return'<img class="ke-anchor" src="'+b.themesPath+'common/anchor.gif" data-ke-name="'+escape(c.name)+'" />'}).replace(/<script([^>]*)>([\s\S]*?)<\/script>/ig,function(a,b,c){return'<div class="ke-script" data-ke-script-attr="'+escape(b)+'">'+escape(c)+"</div>"}).replace(/<noscript([^>]*)>([\s\S]*?)<\/noscript>/ig,function(a,b,c){return'<div class="ke-noscript" data-ke-noscript-attr="'+ |
|||
escape(b)+'">'+escape(c)+"</div>"}).replace(/(<[^>]*)(href|src)="([^"]*)"([^>]*>)/ig,function(a,b,c,d,e){if(a.match(/\sdata-ke-src="[^"]*"/i))return a;return a=b+c+'="'+d+'" data-ke-src="'+C(d)+'"'+e}).replace(/(<[^>]+\s)(on\w+="[^"]*"[^>]*>)/ig,function(a,b,c){return b+"data-ke-"+c}).replace(/<table[^>]*\s+border="0"[^>]*>/ig,function(a){if(a.indexOf("ke-zeroborder")>=0)return a;return Sb(a,"ke-zeroborder")})})})}})(window); |
|||
@ -0,0 +1,83 @@ |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|||
<html xmlns="http://www.w3.org/1999/xhtml"> |
|||
<head> |
|||
<meta charset="utf-8" /> |
|||
<meta name="keywords" content="百度地图,百度地图API,百度地图自定义工具,百度地图所见即所得工具" /> |
|||
<meta name="description" content="百度地图API自定义地图,帮助用户在可视化操作下生成百度地图" /> |
|||
<title>百度地图API自定义地图</title> |
|||
<!--引用百度地图API--> |
|||
<style type="text/css"> |
|||
html,body{margin:0;padding:0;} |
|||
.iw_poi_title {color:#CC5522;font-size:14px;font-weight:bold;overflow:hidden;padding-right:13px;white-space:nowrap} |
|||
.iw_poi_content {font:12px arial,sans-serif;overflow:visible;padding-top:4px;white-space:-moz-pre-wrap;word-wrap:break-word} |
|||
</style> |
|||
<script type="text/javascript" src="http://api.map.baidu.com/api?key=&v=1.1&services=true"></script> |
|||
</head> |
|||
|
|||
<body onload="initMap();"> |
|||
<!--百度地图容器--> |
|||
<div style="width:697px;height:550px;border:#ccc solid 1px;" id="dituContent"></div> |
|||
</body> |
|||
<script type="text/javascript"> |
|||
function getParam(name) { |
|||
return location.href.match(new RegExp('[?&]' + name + '=([^?&]+)', 'i')) ? decodeURIComponent(RegExp.$1) : ''; |
|||
} |
|||
var centerParam = getParam('center'); |
|||
var zoomParam = getParam('zoom'); |
|||
var widthParam = getParam('width'); |
|||
var heightParam = getParam('height'); |
|||
var markersParam = getParam('markers'); |
|||
var markerStylesParam = getParam('markerStyles'); |
|||
|
|||
//创建和初始化地图函数: |
|||
function initMap(){ |
|||
// [FF]切换模式后报错 |
|||
if (!window.BMap) { |
|||
return; |
|||
} |
|||
var dituContent = document.getElementById('dituContent'); |
|||
dituContent.style.width = widthParam + 'px'; |
|||
dituContent.style.height = heightParam + 'px'; |
|||
|
|||
createMap();//创建地图 |
|||
setMapEvent();//设置地图事件 |
|||
addMapControl();//向地图添加控件 |
|||
|
|||
// 创建标注 |
|||
var markersArr = markersParam.split(','); |
|||
var point = new BMap.Point(markersArr[0], markersArr[1]); |
|||
var marker = new BMap.Marker(point); |
|||
map.addOverlay(marker); // 将标注添加到地图中 |
|||
} |
|||
|
|||
//创建地图函数: |
|||
function createMap(){ |
|||
var map = new BMap.Map("dituContent");//在百度地图容器中创建一个地图 |
|||
var centerArr = centerParam.split(','); |
|||
var point = new BMap.Point(centerArr[0], centerArr[1]);//定义一个中心点坐标 |
|||
map.centerAndZoom(point, zoomParam);//设定地图的中心点和坐标并将地图显示在地图容器中 |
|||
window.map = map;//将map变量存储在全局 |
|||
} |
|||
|
|||
//地图事件设置函数: |
|||
function setMapEvent(){ |
|||
map.enableDragging();//启用地图拖拽事件,默认启用(可不写) |
|||
map.enableScrollWheelZoom();//启用地图滚轮放大缩小 |
|||
map.enableDoubleClickZoom();//启用鼠标双击放大,默认启用(可不写) |
|||
map.enableKeyboard();//启用键盘上下左右键移动地图 |
|||
} |
|||
|
|||
//地图控件添加函数: |
|||
function addMapControl(){ |
|||
//向地图中添加缩放控件 |
|||
var ctrl_nav = new BMap.NavigationControl({anchor:BMAP_ANCHOR_TOP_LEFT,type:BMAP_NAVIGATION_CONTROL_LARGE}); |
|||
map.addControl(ctrl_nav); |
|||
//向地图中添加缩略图控件 |
|||
var ctrl_ove = new BMap.OverviewMapControl({anchor:BMAP_ANCHOR_BOTTOM_RIGHT,isOpen:1}); |
|||
map.addControl(ctrl_ove); |
|||
//向地图中添加比例尺控件 |
|||
var ctrl_sca = new BMap.ScaleControl({anchor:BMAP_ANCHOR_BOTTOM_LEFT}); |
|||
map.addControl(ctrl_sca); |
|||
} |
|||
</script> |
|||
</html> |
|||
@ -0,0 +1,43 @@ |
|||
<!doctype html> |
|||
<html> |
|||
<head> |
|||
<meta charset="utf-8" /> |
|||
<title>Baidu Maps</title> |
|||
<style> |
|||
html { height: 100% } |
|||
body { height: 100%; margin: 0; padding: 0; background-color: #FFF } |
|||
</style> |
|||
<script charset="utf-8" src="http://api.map.baidu.com/api?v=1.3"></script> |
|||
<script> |
|||
var map, geocoder; |
|||
function initialize() { |
|||
map = new BMap.Map('map_canvas'); |
|||
var point = new BMap.Point(121.473704, 31.230393); |
|||
map.centerAndZoom(point, 11); |
|||
map.addControl(new BMap.NavigationControl()); |
|||
map.enableScrollWheelZoom(); |
|||
|
|||
var gc = new BMap.Geocoder(); |
|||
gc.getLocation(point, function(rs){ |
|||
var addComp = rs.addressComponents; |
|||
var address = [addComp.city].join(''); |
|||
parent.document.getElementById("kindeditor_plugin_map_address").value = address; |
|||
}); |
|||
} |
|||
function search(address) { |
|||
if (!map) return; |
|||
var local = new BMap.LocalSearch(map, { |
|||
renderOptions: { |
|||
map: map, |
|||
autoViewport: true, |
|||
selectFirstResult: false |
|||
} |
|||
}); |
|||
local.search(address); |
|||
} |
|||
</script> |
|||
</head> |
|||
<body onload="initialize();"> |
|||
<div id="map_canvas" style="width:100%; height:100%"></div> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,309 @@ |
|||
/******************************************************************************* |
|||
* KindEditor - WYSIWYG HTML Editor for Internet |
|||
* Copyright (C) 2006-2011 kindsoft.net |
|||
* |
|||
* @author Roddy <luolonghao@gmail.com> |
|||
* @site http://www.kindsoft.net/
|
|||
* @licence http://www.kindsoft.net/license.php
|
|||
*******************************************************************************/ |
|||
|
|||
KindEditor.plugin('image', function(K) { |
|||
var self = this, name = 'image', |
|||
allowImageUpload = K.undef(self.allowImageUpload, true), |
|||
allowImageRemote = K.undef(self.allowImageRemote, true), |
|||
formatUploadUrl = K.undef(self.formatUploadUrl, true), |
|||
allowFileManager = K.undef(self.allowFileManager, false), |
|||
uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'), |
|||
imageTabIndex = K.undef(self.imageTabIndex, 0), |
|||
imgPath = self.pluginsPath + 'image/images/', |
|||
extraParams = K.undef(self.extraFileUploadParams, {}), |
|||
filePostName = K.undef(self.filePostName, 'imgFile'), |
|||
fillDescAfterUploadImage = K.undef(self.fillDescAfterUploadImage, false), |
|||
lang = self.lang(name + '.'); |
|||
|
|||
self.plugin.imageDialog = function(options) { |
|||
var imageUrl = options.imageUrl, |
|||
imageWidth = K.undef(options.imageWidth, ''), |
|||
imageHeight = K.undef(options.imageHeight, ''), |
|||
imageTitle = K.undef(options.imageTitle, ''), |
|||
imageAlign = K.undef(options.imageAlign, ''), |
|||
showRemote = K.undef(options.showRemote, true), |
|||
showLocal = K.undef(options.showLocal, true), |
|||
tabIndex = K.undef(options.tabIndex, 0), |
|||
clickFn = options.clickFn; |
|||
var target = 'kindeditor_upload_iframe_' + new Date().getTime(); |
|||
var hiddenElements = []; |
|||
for(var k in extraParams){ |
|||
hiddenElements.push('<input type="hidden" name="' + k + '" value="' + extraParams[k] + '" />'); |
|||
} |
|||
var html = [ |
|||
'<div style="padding:20px;">', |
|||
//tabs
|
|||
'<div class="tabs"></div>', |
|||
//remote image - start
|
|||
'<div class="tab1" style="display:none;">', |
|||
//url
|
|||
'<div class="ke-dialog-row">', |
|||
'<label for="remoteUrl" style="width:60px;">' + lang.remoteUrl + '</label>', |
|||
'<input type="text" id="remoteUrl" class="ke-input-text" name="url" value="" style="width:200px;" /> ', |
|||
'<span class="ke-button-common ke-button-outer">', |
|||
'<input type="button" class="ke-button-common ke-button" name="viewServer" value="' + lang.viewServer + '" />', |
|||
'</span>', |
|||
'</div>', |
|||
'</div>', |
|||
//remote image - end
|
|||
//local upload - start
|
|||
'<div class="tab2" style="display:none;">', |
|||
'<iframe name="' + target + '" style="display:none;"></iframe>', |
|||
'<form class="ke-upload-area ke-form" method="post" enctype="multipart/form-data" target="' + target + '" action="' + K.addParam(uploadJson, 'dir=image') + '">', |
|||
//file
|
|||
'<div class="ke-dialog-row">', |
|||
hiddenElements.join(''), |
|||
'<label style="width:60px;">' + lang.localUrl + '</label>', |
|||
'<input type="text" name="localUrl" class="ke-input-text" tabindex="-1" style="width:200px;" readonly="true" /> ', |
|||
'<input type="button" class="ke-upload-button" value="' + lang.upload + '" />', |
|||
'</div>', |
|||
'</form>', |
|||
'</div>', |
|||
//local upload - end
|
|||
'</div>' |
|||
].join(''); |
|||
var dialogWidth = showLocal || allowFileManager ? 450 : 400, |
|||
dialogHeight = showLocal && showRemote ? 300 : 250; |
|||
var dialog = self.createDialog({ |
|||
name : name, |
|||
width : dialogWidth, |
|||
height : dialogHeight, |
|||
title : self.lang(name), |
|||
body : html, |
|||
yesBtn : { |
|||
name : self.lang('yes'), |
|||
click : function(e) { |
|||
// Bugfix: http://code.google.com/p/kindeditor/issues/detail?id=319
|
|||
if (dialog.isLoading) { |
|||
return; |
|||
} |
|||
// insert local image
|
|||
if (showLocal && showRemote && tabs && tabs.selectedIndex === 1 || !showRemote) { |
|||
if (uploadbutton.fileBox.val() == '') { |
|||
alert(self.lang('pleaseSelectFile')); |
|||
return; |
|||
} |
|||
dialog.showLoading(self.lang('uploadLoading')); |
|||
uploadbutton.submit(); |
|||
localUrlBox.val(''); |
|||
return; |
|||
} |
|||
// insert remote image
|
|||
var url = K.trim(urlBox.val()), |
|||
width = widthBox.val(), |
|||
height = heightBox.val(), |
|||
title = titleBox.val(), |
|||
align = ''; |
|||
alignBox.each(function() { |
|||
if (this.checked) { |
|||
align = this.value; |
|||
return false; |
|||
} |
|||
}); |
|||
if (url == 'http://' || K.invalidUrl(url)) { |
|||
alert(self.lang('invalidUrl')); |
|||
urlBox[0].focus(); |
|||
return; |
|||
} |
|||
if (!/^\d*$/.test(width)) { |
|||
alert(self.lang('invalidWidth')); |
|||
widthBox[0].focus(); |
|||
return; |
|||
} |
|||
if (!/^\d*$/.test(height)) { |
|||
alert(self.lang('invalidHeight')); |
|||
heightBox[0].focus(); |
|||
return; |
|||
} |
|||
clickFn.call(self, url, title, width, height, 0, align); |
|||
} |
|||
}, |
|||
beforeRemove : function() { |
|||
viewServerBtn.unbind(); |
|||
widthBox.unbind(); |
|||
heightBox.unbind(); |
|||
refreshBtn.unbind(); |
|||
} |
|||
}), |
|||
div = dialog.div; |
|||
|
|||
var urlBox = K('[name="url"]', div), |
|||
localUrlBox = K('[name="localUrl"]', div), |
|||
viewServerBtn = K('[name="viewServer"]', div), |
|||
widthBox = K('.tab1 [name="width"]', div), |
|||
heightBox = K('.tab1 [name="height"]', div), |
|||
refreshBtn = K('.ke-refresh-btn', div), |
|||
titleBox = K('.tab1 [name="title"]', div), |
|||
alignBox = K('.tab1 [name="align"]', div); |
|||
|
|||
var tabs; |
|||
if (showRemote && showLocal) { |
|||
tabs = K.tabs({ |
|||
src : K('.tabs', div), |
|||
afterSelect : function(i) {} |
|||
}); |
|||
tabs.add({ |
|||
title : lang.remoteImage, |
|||
panel : K('.tab1', div) |
|||
}); |
|||
tabs.add({ |
|||
title : lang.localImage, |
|||
panel : K('.tab2', div) |
|||
}); |
|||
tabs.select(tabIndex); |
|||
} else if (showRemote) { |
|||
K('.tab1', div).show(); |
|||
} else if (showLocal) { |
|||
K('.tab2', div).show(); |
|||
} |
|||
|
|||
var uploadbutton = K.uploadbutton({ |
|||
button : K('.ke-upload-button', div)[0], |
|||
fieldName : filePostName, |
|||
form : K('.ke-form', div), |
|||
target : target, |
|||
width: 60, |
|||
afterUpload : function(data) { |
|||
dialog.hideLoading(); |
|||
if (data.error === 0) { |
|||
var url = data.url; |
|||
if (formatUploadUrl) { |
|||
url = K.formatUrl(url, 'absolute'); |
|||
} |
|||
if (self.afterUpload) { |
|||
self.afterUpload.call(self, url, data, name); |
|||
} |
|||
if (!fillDescAfterUploadImage) { |
|||
clickFn.call(self, url, data.title, data.width, data.height, data.border, data.align); |
|||
} else { |
|||
K(".ke-dialog-row #remoteUrl", div).val(url); |
|||
K(".ke-tabs-li", div)[0].click(); |
|||
K(".ke-refresh-btn", div).click(); |
|||
} |
|||
} else { |
|||
alert(data.message); |
|||
} |
|||
}, |
|||
afterError : function(html) { |
|||
dialog.hideLoading(); |
|||
self.errorDialog(html); |
|||
} |
|||
}); |
|||
uploadbutton.fileBox.change(function(e) { |
|||
localUrlBox.val(uploadbutton.fileBox.val()); |
|||
}); |
|||
if (allowFileManager) { |
|||
viewServerBtn.click(function(e) { |
|||
self.loadPlugin('filemanager', function() { |
|||
self.plugin.filemanagerDialog({ |
|||
viewType : 'VIEW', |
|||
dirName : 'image', |
|||
clickFn : function(url, title) { |
|||
if (self.dialogs.length > 1) { |
|||
K('[name="url"]', div).val(url); |
|||
if (self.afterSelectFile) { |
|||
self.afterSelectFile.call(self, url); |
|||
} |
|||
self.hideDialog(); |
|||
} |
|||
} |
|||
}); |
|||
}); |
|||
}); |
|||
} else { |
|||
viewServerBtn.hide(); |
|||
} |
|||
var originalWidth = 0, originalHeight = 0; |
|||
function setSize(width, height) { |
|||
widthBox.val(width); |
|||
heightBox.val(height); |
|||
originalWidth = width; |
|||
originalHeight = height; |
|||
} |
|||
refreshBtn.click(function(e) { |
|||
var tempImg = K('<img src="' + urlBox.val() + '" />', document).css({ |
|||
position : 'absolute', |
|||
visibility : 'hidden', |
|||
top : 0, |
|||
left : '-1000px' |
|||
}); |
|||
tempImg.bind('load', function() { |
|||
setSize(tempImg.width(), tempImg.height()); |
|||
tempImg.remove(); |
|||
}); |
|||
K(document.body).append(tempImg); |
|||
}); |
|||
widthBox.change(function(e) { |
|||
if (originalWidth > 0) { |
|||
heightBox.val(Math.round(originalHeight / originalWidth * parseInt(this.value, 10))); |
|||
} |
|||
}); |
|||
heightBox.change(function(e) { |
|||
if (originalHeight > 0) { |
|||
widthBox.val(Math.round(originalWidth / originalHeight * parseInt(this.value, 10))); |
|||
} |
|||
}); |
|||
urlBox.val(options.imageUrl); |
|||
setSize(options.imageWidth, options.imageHeight); |
|||
titleBox.val(options.imageTitle); |
|||
alignBox.each(function() { |
|||
if (this.value === options.imageAlign) { |
|||
this.checked = true; |
|||
return false; |
|||
} |
|||
}); |
|||
if (showRemote && tabIndex === 0) { |
|||
urlBox[0].focus(); |
|||
urlBox[0].select(); |
|||
} |
|||
return dialog; |
|||
}; |
|||
self.plugin.image = { |
|||
edit : function() { |
|||
var img = self.plugin.getSelectedImage(); |
|||
self.plugin.imageDialog({ |
|||
imageUrl : img ? img.attr('data-ke-src') : 'http://', |
|||
imageWidth : img ? img.width() : '', |
|||
imageHeight : img ? img.height() : '', |
|||
imageTitle : img ? img.attr('title') : '', |
|||
imageAlign : img ? img.attr('align') : '', |
|||
showRemote : allowImageRemote, |
|||
showLocal : allowImageUpload, |
|||
tabIndex: img ? 0 : imageTabIndex, |
|||
clickFn : function(url, title, width, height, border, align) { |
|||
if (img) { |
|||
img.attr('src', url); |
|||
img.attr('data-ke-src', url); |
|||
img.attr('width', width); |
|||
img.attr('height', height); |
|||
img.attr('title', title); |
|||
img.attr('align', align); |
|||
img.attr('alt', title); |
|||
} else { |
|||
self.exec('insertimage', url, title, width, height, border, align); |
|||
} |
|||
// Bugfix: [Firefox] 上传图片后,总是出现正在加载的样式,需要延迟执行hideDialog
|
|||
setTimeout(function() { |
|||
self.hideDialog().focus(); |
|||
}, 0); |
|||
} |
|||
}); |
|||
}, |
|||
'delete' : function() { |
|||
var target = self.plugin.getSelectedImage(); |
|||
if (target.parent().name == 'a') { |
|||
target = target.parent(); |
|||
} |
|||
target.remove(); |
|||
// [IE] 删除图片后立即点击图片按钮出错
|
|||
self.addBookmark(); |
|||
} |
|||
}; |
|||
self.clickToolbar(name, self.plugin.image.edit); |
|||
}); |
|||
@ -0,0 +1,138 @@ |
|||
/******************************************************************************* |
|||
* KindEditor - WYSIWYG HTML Editor for Internet |
|||
* Copyright (C) 2006-2011 kindsoft.net |
|||
* |
|||
* @author Roddy <luolonghao@gmail.com> |
|||
* @site http://www.kindsoft.net/
|
|||
* @licence http://www.kindsoft.net/license.php
|
|||
*******************************************************************************/ |
|||
|
|||
KindEditor.plugin('insertfile', function(K) { |
|||
var self = this, name = 'insertfile', |
|||
allowFileUpload = K.undef(self.allowFileUpload, true), |
|||
allowFileManager = K.undef(self.allowFileManager, false), |
|||
formatUploadUrl = K.undef(self.formatUploadUrl, true), |
|||
uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'), |
|||
extraParams = K.undef(self.extraFileUploadParams, {}), |
|||
filePostName = K.undef(self.filePostName, 'imgFile'), |
|||
lang = self.lang(name + '.'); |
|||
self.plugin.fileDialog = function(options) { |
|||
var fileUrl = K.undef(options.fileUrl, 'http://'), |
|||
fileTitle = K.undef(options.fileTitle, ''), |
|||
clickFn = options.clickFn; |
|||
var html = [ |
|||
'<div style="padding:20px;">', |
|||
'<div class="ke-dialog-row">', |
|||
'<label for="keUrl" style="width:60px;">' + lang.url + '</label>', |
|||
'<input type="text" id="keUrl" name="url" class="ke-input-text" style="width:160px;" /> ', |
|||
'<input type="button" class="ke-upload-button" value="' + lang.upload + '" /> ', |
|||
'<span class="ke-button-common ke-button-outer">', |
|||
'<input type="button" class="ke-button-common ke-button" name="viewServer" value="' + lang.viewServer + '" />', |
|||
'</span>', |
|||
'</div>', |
|||
//title
|
|||
'<div class="ke-dialog-row">', |
|||
'<label for="keTitle" style="width:60px;">' + lang.title + '</label>', |
|||
'<input type="text" id="keTitle" class="ke-input-text" name="title" value="" style="width:160px;" /></div>', |
|||
'</div>', |
|||
//form end
|
|||
'</form>', |
|||
'</div>' |
|||
].join(''); |
|||
var dialog = self.createDialog({ |
|||
name : name, |
|||
width : 450, |
|||
title : self.lang(name), |
|||
body : html, |
|||
yesBtn : { |
|||
name : self.lang('yes'), |
|||
click : function(e) { |
|||
var url = K.trim(urlBox.val()), |
|||
title = titleBox.val(); |
|||
if (url == 'http://' || K.invalidUrl(url)) { |
|||
alert(self.lang('invalidUrl')); |
|||
urlBox[0].focus(); |
|||
return; |
|||
} |
|||
if (K.trim(title) === '') { |
|||
title = url; |
|||
} |
|||
clickFn.call(self, url, title); |
|||
} |
|||
} |
|||
}), |
|||
div = dialog.div; |
|||
|
|||
var urlBox = K('[name="url"]', div), |
|||
viewServerBtn = K('[name="viewServer"]', div), |
|||
titleBox = K('[name="title"]', div); |
|||
|
|||
if (allowFileUpload) { |
|||
var uploadbutton = K.uploadbutton({ |
|||
button : K('.ke-upload-button', div)[0], |
|||
fieldName : filePostName, |
|||
url : K.addParam(uploadJson, 'dir=file'), |
|||
extraParams : extraParams, |
|||
afterUpload : function(data) { |
|||
dialog.hideLoading(); |
|||
if (data.error === 0) { |
|||
var url = data.url; |
|||
if (formatUploadUrl) { |
|||
url = K.formatUrl(url, 'absolute'); |
|||
} |
|||
urlBox.val(url); |
|||
if (self.afterUpload) { |
|||
self.afterUpload.call(self, url, data, name); |
|||
} |
|||
alert(self.lang('uploadSuccess')); |
|||
} else { |
|||
alert(data.message); |
|||
} |
|||
}, |
|||
afterError : function(html) { |
|||
dialog.hideLoading(); |
|||
self.errorDialog(html); |
|||
} |
|||
}); |
|||
uploadbutton.fileBox.change(function(e) { |
|||
dialog.showLoading(self.lang('uploadLoading')); |
|||
uploadbutton.submit(); |
|||
}); |
|||
} else { |
|||
K('.ke-upload-button', div).hide(); |
|||
} |
|||
if (allowFileManager) { |
|||
viewServerBtn.click(function(e) { |
|||
self.loadPlugin('filemanager', function() { |
|||
self.plugin.filemanagerDialog({ |
|||
viewType : 'LIST', |
|||
dirName : 'file', |
|||
clickFn : function(url, title) { |
|||
if (self.dialogs.length > 1) { |
|||
K('[name="url"]', div).val(url); |
|||
if (self.afterSelectFile) { |
|||
self.afterSelectFile.call(self, url); |
|||
} |
|||
self.hideDialog(); |
|||
} |
|||
} |
|||
}); |
|||
}); |
|||
}); |
|||
} else { |
|||
viewServerBtn.hide(); |
|||
} |
|||
urlBox.val(fileUrl); |
|||
titleBox.val(fileTitle); |
|||
urlBox[0].focus(); |
|||
urlBox[0].select(); |
|||
}; |
|||
self.clickToolbar(name, function() { |
|||
self.plugin.fileDialog({ |
|||
clickFn : function(url, title) { |
|||
var html = '<a class="ke-insertfile" href="' + url + '" data-ke-src="' + url + '" target="_blank">' + title + '</a>'; |
|||
self.insertHtml(html).hideDialog().focus(); |
|||
} |
|||
}); |
|||
}); |
|||
}); |
|||
@ -0,0 +1,38 @@ |
|||
/******************************************************************************* |
|||
* KindEditor - WYSIWYG HTML Editor for Internet |
|||
* Copyright (C) 2006-2011 kindsoft.net |
|||
* |
|||
* @author Roddy <luolonghao@gmail.com> |
|||
* @site http://www.kindsoft.net/
|
|||
* @licence http://www.kindsoft.net/license.php
|
|||
*******************************************************************************/ |
|||
|
|||
KindEditor.plugin('lineheight', function(K) { |
|||
var self = this, name = 'lineheight', lang = self.lang(name + '.'); |
|||
self.clickToolbar(name, function() { |
|||
var curVal = '', commonNode = self.cmd.commonNode({'*' : '.line-height'}); |
|||
if (commonNode) { |
|||
curVal = commonNode.css('line-height'); |
|||
} |
|||
var menu = self.createMenu({ |
|||
name : name, |
|||
width : 150 |
|||
}); |
|||
K.each(lang.lineHeight, function(i, row) { |
|||
K.each(row, function(key, val) { |
|||
menu.addItem({ |
|||
title : val, |
|||
checked : curVal === key, |
|||
click : function() { |
|||
self.cmd.toggle('<span style="line-height:' + key + ';"></span>', { |
|||
span : '.line-height=' + key |
|||
}); |
|||
self.updateState(); |
|||
self.addBookmark(); |
|||
self.hideMenu(); |
|||
} |
|||
}); |
|||
}); |
|||
}); |
|||
}); |
|||
}); |
|||
@ -0,0 +1,66 @@ |
|||
/******************************************************************************* |
|||
* KindEditor - WYSIWYG HTML Editor for Internet |
|||
* Copyright (C) 2006-2011 kindsoft.net |
|||
* |
|||
* @author Roddy <luolonghao@gmail.com> |
|||
* @site http://www.kindsoft.net/
|
|||
* @licence http://www.kindsoft.net/license.php
|
|||
*******************************************************************************/ |
|||
|
|||
KindEditor.plugin('link', function(K) { |
|||
var self = this, name = 'link'; |
|||
self.plugin.link = { |
|||
edit : function() { |
|||
var lang = self.lang(name + '.'), |
|||
html = '<div style="padding:20px;">' + |
|||
//url
|
|||
'<div class="ke-dialog-row">' + |
|||
'<label for="keUrl" style="width:60px;">' + lang.url + '</label>' + |
|||
'<input class="ke-input-text" type="text" id="keUrl" name="url" value="" style="width:260px;" /></div>' + |
|||
//type
|
|||
'<div class="ke-dialog-row"">' + |
|||
'<label for="keType" style="width:60px;">' + lang.linkType + '</label>' + |
|||
'<select id="keType" name="type"></select>' + |
|||
'</div>' + |
|||
'</div>', |
|||
dialog = self.createDialog({ |
|||
name : name, |
|||
width : 450, |
|||
title : self.lang(name), |
|||
body : html, |
|||
yesBtn : { |
|||
name : self.lang('yes'), |
|||
click : function(e) { |
|||
var url = K.trim(urlBox.val()); |
|||
if (url == 'http://' || K.invalidUrl(url)) { |
|||
alert(self.lang('invalidUrl')); |
|||
urlBox[0].focus(); |
|||
return; |
|||
} |
|||
self.exec('createlink', url, typeBox.val()).hideDialog().focus(); |
|||
} |
|||
} |
|||
}), |
|||
div = dialog.div, |
|||
urlBox = K('input[name="url"]', div), |
|||
typeBox = K('select[name="type"]', div); |
|||
urlBox.val('http://'); |
|||
typeBox[0].options[0] = new Option(lang.newWindow, '_blank'); |
|||
typeBox[0].options[1] = new Option(lang.selfWindow, ''); |
|||
self.cmd.selection(); |
|||
var a = self.plugin.getSelectedLink(); |
|||
if (a) { |
|||
self.cmd.range.selectNode(a[0]); |
|||
self.cmd.select(); |
|||
urlBox.val(a.attr('data-ke-src')); |
|||
typeBox.val(a.attr('target')); |
|||
} |
|||
urlBox[0].focus(); |
|||
urlBox[0].select(); |
|||
}, |
|||
'delete' : function() { |
|||
self.exec('unlink', null); |
|||
} |
|||
}; |
|||
self.clickToolbar(name, self.plugin.link.edit); |
|||
}); |
|||
@ -0,0 +1,57 @@ |
|||
<!doctype html> |
|||
<html> |
|||
<head> |
|||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> |
|||
<style> |
|||
html { height: 100% } |
|||
body { height: 100%; margin: 0; padding: 0; background-color: #FFF } |
|||
#map_canvas { height: 100% } |
|||
</style> |
|||
<script src="http://maps.googleapis.com/maps/api/js?sensor=false&language=zh_CN"></script> |
|||
<script> |
|||
var map, geocoder; |
|||
function initialize() { |
|||
var latlng = new google.maps.LatLng(31.230393, 121.473704); |
|||
var options = { |
|||
zoom: 11, |
|||
center: latlng, |
|||
disableDefaultUI: true, |
|||
panControl: true, |
|||
zoomControl: true, |
|||
mapTypeControl: true, |
|||
scaleControl: true, |
|||
streetViewControl: false, |
|||
overviewMapControl: true, |
|||
mapTypeId: google.maps.MapTypeId.ROADMAP |
|||
}; |
|||
map = new google.maps.Map(document.getElementById("map_canvas"), options); |
|||
geocoder = new google.maps.Geocoder(); |
|||
geocoder.geocode({latLng: latlng}, function(results, status) { |
|||
if (status == google.maps.GeocoderStatus.OK) { |
|||
if (results[3]) { |
|||
parent.document.getElementById("kindeditor_plugin_map_address").value = results[3].formatted_address; |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
function search(address) { |
|||
if (!map) return; |
|||
geocoder.geocode({address : address}, function(results, status) { |
|||
if (status == google.maps.GeocoderStatus.OK) { |
|||
map.setZoom(11); |
|||
map.setCenter(results[0].geometry.location); |
|||
var marker = new google.maps.Marker({ |
|||
map: map, |
|||
position: results[0].geometry.location |
|||
}); |
|||
} else { |
|||
alert("Invalid address: " + address); |
|||
} |
|||
}); |
|||
} |
|||
</script> |
|||
</head> |
|||
<body onload="initialize();"> |
|||
<div id="map_canvas" style="width:100%; height:100%"></div> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,137 @@ |
|||
/******************************************************************************* |
|||
* KindEditor - WYSIWYG HTML Editor for Internet |
|||
* Copyright (C) 2006-2011 kindsoft.net |
|||
* |
|||
* @author Roddy <luolonghao@gmail.com> |
|||
* @site http://www.kindsoft.net/
|
|||
* @licence http://www.kindsoft.net/license.php
|
|||
*******************************************************************************/ |
|||
|
|||
// Google Maps: http://code.google.com/apis/maps/index.html
|
|||
|
|||
KindEditor.plugin('map', function(K) { |
|||
var self = this, name = 'map', lang = self.lang(name + '.'); |
|||
self.clickToolbar(name, function() { |
|||
var html = ['<div style="padding:10px 20px;">', |
|||
'<div class="ke-dialog-row">', |
|||
lang.address + ' <input id="kindeditor_plugin_map_address" name="address" class="ke-input-text" value="" style="width:200px;" /> ', |
|||
'<span class="ke-button-common ke-button-outer">', |
|||
'<input type="button" name="searchBtn" class="ke-button-common ke-button" value="' + lang.search + '" />', |
|||
'</span>', |
|||
'</div>', |
|||
'<div class="ke-map" style="width:558px;height:360px;"></div>', |
|||
'</div>'].join(''); |
|||
var dialog = self.createDialog({ |
|||
name : name, |
|||
width : 600, |
|||
title : self.lang(name), |
|||
body : html, |
|||
yesBtn : { |
|||
name : self.lang('yes'), |
|||
click : function(e) { |
|||
var geocoder = win.geocoder, |
|||
map = win.map, |
|||
center = map.getCenter().lat() + ',' + map.getCenter().lng(), |
|||
zoom = map.getZoom(), |
|||
maptype = map.getMapTypeId(), |
|||
url = 'http://maps.googleapis.com/maps/api/staticmap'; |
|||
url += '?center=' + encodeURIComponent(center); |
|||
url += '&zoom=' + encodeURIComponent(zoom); |
|||
url += '&size=558x360'; |
|||
url += '&maptype=' + encodeURIComponent(maptype); |
|||
url += '&markers=' + encodeURIComponent(center); |
|||
url += '&language=' + self.langType; |
|||
url += '&sensor=false'; |
|||
self.exec('insertimage', url).hideDialog().focus(); |
|||
} |
|||
}, |
|||
beforeRemove : function() { |
|||
searchBtn.remove(); |
|||
if (doc) { |
|||
doc.write(''); |
|||
} |
|||
iframe.remove(); |
|||
} |
|||
}); |
|||
var div = dialog.div, |
|||
addressBox = K('[name="address"]', div), |
|||
searchBtn = K('[name="searchBtn"]', div), |
|||
win, doc; |
|||
var iframeHtml = ['<!doctype html><html><head>', |
|||
'<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />', |
|||
'<style>', |
|||
' html { height: 100% }', |
|||
' body { height: 100%; margin: 0; padding: 0; background-color: #FFF }', |
|||
' #map_canvas { height: 100% }', |
|||
'</style>', |
|||
'<script src="http://maps.googleapis.com/maps/api/js?sensor=false&language=' + self.langType + '"></script>', |
|||
'<script>', |
|||
'var map, geocoder;', |
|||
'function initialize() {', |
|||
' var latlng = new google.maps.LatLng(31.230393, 121.473704);', |
|||
' var options = {', |
|||
' zoom: 11,', |
|||
' center: latlng,', |
|||
' disableDefaultUI: true,', |
|||
' panControl: true,', |
|||
' zoomControl: true,', |
|||
' mapTypeControl: true,', |
|||
' scaleControl: true,', |
|||
' streetViewControl: false,', |
|||
' overviewMapControl: true,', |
|||
' mapTypeId: google.maps.MapTypeId.ROADMAP', |
|||
' };', |
|||
' map = new google.maps.Map(document.getElementById("map_canvas"), options);', |
|||
' geocoder = new google.maps.Geocoder();', |
|||
' geocoder.geocode({latLng: latlng}, function(results, status) {', |
|||
' if (status == google.maps.GeocoderStatus.OK) {', |
|||
' if (results[3]) {', |
|||
' parent.document.getElementById("kindeditor_plugin_map_address").value = results[3].formatted_address;', |
|||
' }', |
|||
' }', |
|||
' });', |
|||
'}', |
|||
'function search(address) {', |
|||
' if (!map) return;', |
|||
' geocoder.geocode({address : address}, function(results, status) {', |
|||
' if (status == google.maps.GeocoderStatus.OK) {', |
|||
' map.setZoom(11);', |
|||
' map.setCenter(results[0].geometry.location);', |
|||
' var marker = new google.maps.Marker({', |
|||
' map: map,', |
|||
' position: results[0].geometry.location', |
|||
' });', |
|||
' } else {', |
|||
' alert("Invalid address: " + address);', |
|||
' }', |
|||
' });', |
|||
'}', |
|||
'</script>', |
|||
'</head>', |
|||
'<body onload="initialize();">', |
|||
'<div id="map_canvas" style="width:100%; height:100%"></div>', |
|||
'</body></html>'].join('\n'); |
|||
// TODO:用doc.write(iframeHtml)方式加载时,在IE6上第一次加载报错,暂时使用src方式
|
|||
var iframe = K('<iframe class="ke-textarea" frameborder="0" src="' + self.pluginsPath + 'map/map.html" style="width:558px;height:360px;"></iframe>'); |
|||
function ready() { |
|||
win = iframe[0].contentWindow; |
|||
doc = K.iframeDoc(iframe); |
|||
//doc.open();
|
|||
//doc.write(iframeHtml);
|
|||
//doc.close();
|
|||
} |
|||
iframe.bind('load', function() { |
|||
iframe.unbind('load'); |
|||
if (K.IE) { |
|||
ready(); |
|||
} else { |
|||
setTimeout(ready, 0); |
|||
} |
|||
}); |
|||
K('.ke-map', div).replaceWith(iframe); |
|||
// search map
|
|||
searchBtn.click(function() { |
|||
win.search(addressBox.val()); |
|||
}); |
|||
}); |
|||
}); |
|||
@ -0,0 +1,170 @@ |
|||
/******************************************************************************* |
|||
* KindEditor - WYSIWYG HTML Editor for Internet |
|||
* Copyright (C) 2006-2011 kindsoft.net |
|||
* |
|||
* @author Roddy <luolonghao@gmail.com> |
|||
* @site http://www.kindsoft.net/
|
|||
* @licence http://www.kindsoft.net/license.php
|
|||
*******************************************************************************/ |
|||
|
|||
KindEditor.plugin('media', function(K) { |
|||
var self = this, name = 'media', lang = self.lang(name + '.'), |
|||
allowMediaUpload = K.undef(self.allowMediaUpload, true), |
|||
allowFileManager = K.undef(self.allowFileManager, false), |
|||
formatUploadUrl = K.undef(self.formatUploadUrl, true), |
|||
extraParams = K.undef(self.extraFileUploadParams, {}), |
|||
filePostName = K.undef(self.filePostName, 'imgFile'), |
|||
uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'); |
|||
self.plugin.media = { |
|||
edit : function() { |
|||
var html = [ |
|||
'<div style="padding:20px;">', |
|||
//url
|
|||
'<div class="ke-dialog-row">', |
|||
'<label for="keUrl" style="width:60px;">' + lang.url + '</label>', |
|||
'<input class="ke-input-text" type="text" id="keUrl" name="url" value="" style="width:160px;" /> ', |
|||
'<input type="button" class="ke-upload-button" value="' + lang.upload + '" /> ', |
|||
'<span class="ke-button-common ke-button-outer">', |
|||
'<input type="button" class="ke-button-common ke-button" name="viewServer" value="' + lang.viewServer + '" />', |
|||
'</span>', |
|||
'</div>', |
|||
//width
|
|||
'<div class="ke-dialog-row">', |
|||
'<label for="keWidth" style="width:60px;">' + lang.width + '</label>', |
|||
'<input type="text" id="keWidth" class="ke-input-text ke-input-number" name="width" value="550" maxlength="4" />', |
|||
'</div>', |
|||
//height
|
|||
'<div class="ke-dialog-row">', |
|||
'<label for="keHeight" style="width:60px;">' + lang.height + '</label>', |
|||
'<input type="text" id="keHeight" class="ke-input-text ke-input-number" name="height" value="400" maxlength="4" />', |
|||
'</div>', |
|||
//autostart
|
|||
'<div class="ke-dialog-row">', |
|||
'<label for="keAutostart">' + lang.autostart + '</label>', |
|||
'<input type="checkbox" id="keAutostart" name="autostart" value="" /> ', |
|||
'</div>', |
|||
'</div>' |
|||
].join(''); |
|||
var dialog = self.createDialog({ |
|||
name : name, |
|||
width : 450, |
|||
height : 230, |
|||
title : self.lang(name), |
|||
body : html, |
|||
yesBtn : { |
|||
name : self.lang('yes'), |
|||
click : function(e) { |
|||
var url = K.trim(urlBox.val()), |
|||
width = widthBox.val(), |
|||
height = heightBox.val(); |
|||
if (url == 'http://' || K.invalidUrl(url)) { |
|||
alert(self.lang('invalidUrl')); |
|||
urlBox[0].focus(); |
|||
return; |
|||
} |
|||
if (!/^\d*$/.test(width)) { |
|||
alert(self.lang('invalidWidth')); |
|||
widthBox[0].focus(); |
|||
return; |
|||
} |
|||
if (!/^\d*$/.test(height)) { |
|||
alert(self.lang('invalidHeight')); |
|||
heightBox[0].focus(); |
|||
return; |
|||
} |
|||
var html = K.mediaImg(self.themesPath + 'common/blank.gif', { |
|||
src : url, |
|||
type : K.mediaType(url), |
|||
width : width, |
|||
height : height, |
|||
autostart : autostartBox[0].checked ? 'true' : 'false', |
|||
loop : 'true' |
|||
}); |
|||
self.insertHtml(html).hideDialog().focus(); |
|||
} |
|||
} |
|||
}), |
|||
div = dialog.div, |
|||
urlBox = K('[name="url"]', div), |
|||
viewServerBtn = K('[name="viewServer"]', div), |
|||
widthBox = K('[name="width"]', div), |
|||
heightBox = K('[name="height"]', div), |
|||
autostartBox = K('[name="autostart"]', div); |
|||
urlBox.val('http://'); |
|||
|
|||
if (allowMediaUpload) { |
|||
var uploadbutton = K.uploadbutton({ |
|||
button : K('.ke-upload-button', div)[0], |
|||
fieldName : filePostName, |
|||
extraParams : extraParams, |
|||
url : K.addParam(uploadJson, 'dir=media'), |
|||
afterUpload : function(data) { |
|||
dialog.hideLoading(); |
|||
if (data.error === 0) { |
|||
var url = data.url; |
|||
if (formatUploadUrl) { |
|||
url = K.formatUrl(url, 'absolute'); |
|||
} |
|||
urlBox.val(url); |
|||
if (self.afterUpload) { |
|||
self.afterUpload.call(self, url, data, name); |
|||
} |
|||
alert(self.lang('uploadSuccess')); |
|||
} else { |
|||
alert(data.message); |
|||
} |
|||
}, |
|||
afterError : function(html) { |
|||
dialog.hideLoading(); |
|||
self.errorDialog(html); |
|||
} |
|||
}); |
|||
uploadbutton.fileBox.change(function(e) { |
|||
dialog.showLoading(self.lang('uploadLoading')); |
|||
uploadbutton.submit(); |
|||
}); |
|||
} else { |
|||
K('.ke-upload-button', div).hide(); |
|||
} |
|||
|
|||
if (allowFileManager) { |
|||
viewServerBtn.click(function(e) { |
|||
self.loadPlugin('filemanager', function() { |
|||
self.plugin.filemanagerDialog({ |
|||
viewType : 'LIST', |
|||
dirName : 'media', |
|||
clickFn : function(url, title) { |
|||
if (self.dialogs.length > 1) { |
|||
K('[name="url"]', div).val(url); |
|||
if (self.afterSelectFile) { |
|||
self.afterSelectFile.call(self, url); |
|||
} |
|||
self.hideDialog(); |
|||
} |
|||
} |
|||
}); |
|||
}); |
|||
}); |
|||
} else { |
|||
viewServerBtn.hide(); |
|||
} |
|||
|
|||
var img = self.plugin.getSelectedMedia(); |
|||
if (img) { |
|||
var attrs = K.mediaAttrs(img.attr('data-ke-tag')); |
|||
urlBox.val(attrs.src); |
|||
widthBox.val(K.removeUnit(img.css('width')) || attrs.width || 0); |
|||
heightBox.val(K.removeUnit(img.css('height')) || attrs.height || 0); |
|||
autostartBox[0].checked = (attrs.autostart === 'true'); |
|||
} |
|||
urlBox[0].focus(); |
|||
urlBox[0].select(); |
|||
}, |
|||
'delete' : function() { |
|||
self.plugin.getSelectedMedia().remove(); |
|||
// [IE] 删除图片后立即点击图片按钮出错
|
|||
self.addBookmark(); |
|||
} |
|||
}; |
|||
self.clickToolbar(name, self.plugin.media.edit); |
|||
}); |
|||
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
@ -0,0 +1,623 @@ |
|||
define(['underscore', 'jquery.wookmark', 'jquery.jplayer'], function(_){ |
|||
var material = { |
|||
'defaultoptions' : { |
|||
callback : null, |
|||
type : 'all', |
|||
multiple : false, |
|||
ignore : { |
|||
'basic' : false, |
|||
'wxcard' : true, |
|||
'image' : false, |
|||
'music' : false, |
|||
'news' : false, |
|||
'video' : false, |
|||
'voice' : false, |
|||
'keyword' : false, |
|||
'module' : false |
|||
}, |
|||
others : { |
|||
'basic' : { |
|||
'typeVal' : '' |
|||
}, |
|||
'news' : { |
|||
'showwx' : true, |
|||
'showlocal' : true |
|||
} |
|||
} |
|||
}, |
|||
'init' : function(callback, options) { |
|||
var $this = this; |
|||
$this.options = $.extend({}, $this.defaultoptions, options); |
|||
$this.options.callback = callback; |
|||
$('#material-Modal').remove(); |
|||
$(document.body).append($this.buildHtml().mainDialog); |
|||
$this.modalobj = $('#material-Modal'); |
|||
$this.modalobj.find('.modal-header .nav li a').click(function(){ |
|||
var type = $(this).data('type'); |
|||
switch(type) { |
|||
case 'basic': |
|||
$('#material-Modal').addClass('basic'); |
|||
break; |
|||
case 'news': |
|||
$('#material-Modal').addClass('news'); |
|||
break; |
|||
case 'music': |
|||
$('#material-Modal').addClass('music'); |
|||
break; |
|||
case 'voice': |
|||
$('#material-Modal').addClass('voice'); |
|||
break; |
|||
case 'video': |
|||
$('#material-Modal').addClass('video'); |
|||
break; |
|||
case 'image': |
|||
$('#material-Modal').addClass('image'); |
|||
break; |
|||
case 'keyword': |
|||
$('#material-Modal').addClass('keyword'); |
|||
break; |
|||
case 'module': |
|||
$('#material-Modal').addClass('module'); |
|||
break; |
|||
} |
|||
$this.localPage(type, 1); |
|||
$(this).tab('show'); |
|||
return false; |
|||
}); |
|||
if (!$(this).data('init')) { |
|||
if($this.options.type && $this.options.type != 'all') { |
|||
$this.modalobj.find('.modal-header .nav li.' + $this.options.type + ' a').trigger('click'); |
|||
} else { |
|||
$this.modalobj.find('.modal-header .nav li.show:first a').trigger('click'); |
|||
} |
|||
} |
|||
$this.modalobj.modal('show'); |
|||
initSelectEmotion(); |
|||
return $this.modalobj; |
|||
}, |
|||
//newsmodel: 微信素材wx和本地素材local
|
|||
'localPage' : function(type, page, newsmodel) { |
|||
var $this = this; |
|||
var page = page || 1; |
|||
$('.checkMedia').removeClass('checkedMedia'); |
|||
var $content = $this.modalobj.find('.material-content #' + type); |
|||
$content.html('<div class="info text-center"><i class="fa fa-spinner fa-pulse fa-lg"></i> 数据加载中</div>'); |
|||
|
|||
if(type == 'basic') { |
|||
var Dialog = type + 'Dialog'; |
|||
$this.modalobj.find('#material-footer').show(); |
|||
$content.html(_.template($this.buildHtml()[Dialog])); |
|||
$this.modalobj.find('.modal-footer .btn-primary').unbind('click').click(function(){ |
|||
var attachment = []; |
|||
attachment.content = $('#basictext').val(); |
|||
$this.options.callback(attachment); |
|||
$this.modalobj.modal('hide'); |
|||
}); |
|||
return false; |
|||
} |
|||
if(type == 'music') { |
|||
var Dialog = type + 'Dialog'; |
|||
$this.modalobj.find('#material-footer').show(); |
|||
$content.html(_.template($this.buildHtml()[Dialog])); |
|||
$this.modalobj.find('.modal-footer .btn-primary').unbind('click').click(function(){ |
|||
var attachment = []; |
|||
attachment.title = $(':text[name="musicTitle"]').val(); |
|||
attachment.url = $(':text[name="musicUrl"]').val(); |
|||
attachment.HQUrl = $(':text[name="musicHQUrl"]').val(); |
|||
attachment.description = $(':text[name="musicDescription"]').val(); |
|||
$this.options.callback(attachment); |
|||
$this.modalobj.modal('hide'); |
|||
}); |
|||
return false; |
|||
} |
|||
|
|||
var url = './index.php?c=utility&a=material&do=list&type=' + type; |
|||
if(type == 'wxcard') { |
|||
url = './index.php?c=utility&a=coupon&do=wechat'; |
|||
} |
|||
if(type == 'keyword') { |
|||
url = './index.php?c=utility&a=keyword&do=keyword&type=all'; |
|||
} |
|||
if(type == 'module') { |
|||
url = './index.php?c=utility&a=modules&do=list'; |
|||
} |
|||
if (type == 'news') { |
|||
var newsmodel = newsmodel == 'local' ? 'local' : 'wx'; |
|||
url += newsmodel == 'local' ? '&newsmodel=local' : '&newsmodel=wx'; |
|||
} |
|||
$.getJSON(url, {'page': page}, function(data){ |
|||
data = data.message.message; |
|||
$this.modalobj.find('#material-list-pager').html(''); |
|||
if(!_.isEmpty(data.items)) { |
|||
//$this.modalobj.find('#btn-select').show();
|
|||
$content.data('attachment', data.items); |
|||
$content.empty(); |
|||
var Dialog = type + 'Dialog'; |
|||
$content.html(_.template($this.buildHtml()[Dialog])(data)); |
|||
if(type == 'news') { |
|||
setTimeout(function(){ |
|||
$('.water').wookmark({ |
|||
align: 'center', |
|||
autoResize: false, |
|||
container: $('#news'), |
|||
autoResize :true |
|||
}); |
|||
}, 100); |
|||
$this.modalobj.find('.material-content .newsmodel-type').unbind('click').click(function(){ |
|||
$(this).addClass('active').siblings().removeClass('active'); |
|||
$this.localPage(type, 1, $(this).data('type')); |
|||
return false; |
|||
}); |
|||
} |
|||
$this.selectMedia(); |
|||
$this.playaudio(); |
|||
$this.modalobj.find('#material-list-pager').html(data.pager); |
|||
$this.modalobj.find('#material-list-pager .pagination a').click(function(){ |
|||
$this.localPage(type, $(this).attr('page'), newsmodel); |
|||
return false; |
|||
}); |
|||
} else { |
|||
if (type == 'news') { |
|||
$('#news').html('<div role="tabpanel"><div class="tablepanel-top text-right"><button class="btn btn-primary" type="button"><a href="./index.php?c=platform&a=material-post&new_type=reply" target="_blank">图文编辑</a></button> <button class="btn btn-primary" type="button"><a href="./index.php?c=platform&a=material-post&new_type=link" target="_blank">跳转链接</a></button></div><div class="info text-center"><i class="wi wi-info-circle fa-lg"></i> 暂无数据</div></div>'); |
|||
} else { |
|||
$content.html('<div class="info text-center"><i class="wi wi-info-circle fa-lg"></i> 暂无数据</div>'); |
|||
} |
|||
} |
|||
if (type == 'news') { |
|||
$this.modalobj.find('.material-content .newsmodel-type').unbind('click').click(function(){ |
|||
$(this).addClass('active').siblings().removeClass('active'); |
|||
$this.localPage(type, 1, $(this).data('type')); |
|||
return false; |
|||
}); |
|||
} |
|||
}); |
|||
$this.modalobj.find('#btn-select .btn-primary').unbind('click').click(function(){ |
|||
var attachment = []; |
|||
$content.find('.checkedMedia').each(function(){ |
|||
if (type == 'module') { |
|||
attachment.push($content.data('attachment')[$(this).data('name')]); |
|||
} else { |
|||
attachment.push($content.data('attachment')[$(this).data('attachid')]); |
|||
} |
|||
}); |
|||
$this.finish(attachment); |
|||
}); |
|||
return false; |
|||
}, |
|||
|
|||
'selectMedia' : function(){ |
|||
var $this = this; |
|||
$this.modalobj.find('.checkMedia').unbind('click').click(function(){ |
|||
if(!$this.options.multiple) { |
|||
$('.checkMedia').removeClass('checkedMedia'); |
|||
} |
|||
$(this).addClass('checkedMedia'); |
|||
var type = $(this).data('type'); |
|||
if(type == 'news') { |
|||
if(!$this.options.multiple) { |
|||
$('#news .panel-group').removeClass('selected'); |
|||
} |
|||
$(this).addClass('selected'); |
|||
} else if(type == 'image') { |
|||
if(!$this.options.multiple) { |
|||
$('#image div').removeClass('img-item-selected'); |
|||
} |
|||
$(this).addClass('img-item-selected'); |
|||
} else { |
|||
if(!$this.options.multiple) { |
|||
$('.checkMedia').removeClass('btn-primary'); |
|||
} |
|||
$(this).addClass('btn-primary'); |
|||
} |
|||
if(!$this.options.multiple) { |
|||
$this.modalobj.find('#btn-select .btn-primary').trigger('click'); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
'playaudio' : function(){ |
|||
$("#voice, .panel").on('click', '.audio-player-play', function(){ |
|||
var src = $(this).data("attach"); |
|||
if(!src) { |
|||
return; |
|||
} |
|||
if ($("#player")[0]) { |
|||
var player = $("#player"); |
|||
} else { |
|||
var player = $('<div id="player"></div>'); |
|||
$(document.body).append(player); |
|||
} |
|||
player.data('control', $(this)); |
|||
player.jPlayer({ |
|||
playing: function() { |
|||
$(this).data('control').find("i").removeClass("fa-play").addClass("fa-stop"); |
|||
}, |
|||
pause: function (event) { |
|||
$(this).data('control').find("i").removeClass("fa-stop").addClass("fa-play"); |
|||
}, |
|||
swfPath: "resource/components/jplayer", |
|||
supplied: "mp3,wma,wav,amr", |
|||
solution: "html, flash" |
|||
}); |
|||
player.jPlayer("setMedia", {mp3: $(this).data("attach")}).jPlayer("play"); |
|||
if($(this).find("i").hasClass("fa-stop")) { |
|||
player.jPlayer("stop"); |
|||
} else { |
|||
$('.audio-msg').find('.fa-stop').removeClass("fa-stop").addClass("fa-play"); |
|||
player.jPlayer("setMedia", {mp3: $(this).data("attach")}).jPlayer("play"); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
'finish' : function(attachment) { |
|||
var $this = this; |
|||
if($.isFunction($this.options.callback)) { |
|||
if ($this.options.multiple == false) { |
|||
$this.options.callback(attachment[0]); |
|||
} else { |
|||
$this.options.callback(attachment); |
|||
} |
|||
$this.modalobj.modal('hide'); |
|||
} |
|||
}, |
|||
|
|||
'buildHtml' : function() { |
|||
var dialog = {}; |
|||
dialog['mainDialog'] = '<div id="material-Modal" class="uploader-modal modal fade" role="dialog" aria-hidden="true">\n' + |
|||
' <div class="modal-dialog modal-lg">\n' + |
|||
' <div class="modal-content ">\n' + |
|||
' <div class="modal-header">\n' + |
|||
' <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>\n' + |
|||
' <h3>'+ |
|||
' <ul role="tablist" class="nav nav-pills" style="font-size:14px; margin-top:-20px;">'+ |
|||
' <li role="presentation" class="basic ' + (this.options.ignore.basic ? 'hide' : 'show') + '">'+ |
|||
' <a data-toggle="tab" data-type="basic" role="tab" aria-controls="baisc" href="#basic">文字</a>'+ |
|||
' </li>'+ |
|||
' <li role="presentation" class="news ' + (this.options.ignore.news ? 'hide' : 'show') + '">'+ |
|||
' <a data-toggle="tab" data-type="news" role="tab" aria-controls="news" href="#news">图文</a>'+ |
|||
' </li>'+ |
|||
' <li role="presentation" class="image ' + (this.options.ignore.image ? 'hide' : 'show') + '">'+ |
|||
' <a data-toggle="tab" data-type="image" role="tab" aria-controls="image" href="#image">图片</a>'+ |
|||
' </li>'+ |
|||
' <li role="presentation" class="music ' + (this.options.ignore.music ? 'hide' : 'show') + '">'+ |
|||
' <a data-toggle="tab" data-type="music" role="tab" aria-controls="music" href="#music">音乐</a>'+ |
|||
' </li>'+ |
|||
' <li role="presentation" class="voice ' + (this.options.ignore.voice ? 'hide' : 'show') + '">'+ |
|||
' <a data-toggle="tab" data-type="voice" role="tab" aria-controls="voice" href="#voice">语音</a>'+ |
|||
' </li>'+ |
|||
' <li role="presentation" class="video ' + (this.options.ignore.video ? 'hide' : 'show') + '">'+ |
|||
' <a data-toggle="tab" data-type="video" role="tab" aria-controls="video" href="#video">视频</a>'+ |
|||
' </li>'+ |
|||
' <li role="presentation" class="wxcard ' + (this.options.ignore.wxcard ? 'hide' : 'show') + '">'+ |
|||
' <a data-toggle="tab" data-type="wxcard" role="tab" aria-controls="wxcard" href="#wxcard">微信卡券</a>'+ |
|||
' </li>'+ |
|||
' <li role="presentation" class="keyword ' + (this.options.ignore.keyword ? 'hide' : 'show') + '">'+ |
|||
' <a data-toggle="tab" data-type="keyword" role="tab" aria-controls="keyword" href="#keyword">关键字</a>'+ |
|||
' </li>'+ |
|||
' <li role="presentation" class="module ' + (this.options.ignore.module ? 'hide' : 'show') + '">'+ |
|||
' <a data-toggle="tab" data-type="module" role="tab" aria-controls="module" href="#module">模块</a>'+ |
|||
' </li>'+ |
|||
' </ul>'+ |
|||
' </h3>'+ |
|||
' </div>\n' + |
|||
' <div class="modal-body material-content clearfix">\n' + |
|||
(this.options.ignore.news ? '' : |
|||
' <ul class="nav nav-pills nav-stacked">'+ |
|||
(this.options.others.news.showwx ? |
|||
' <li role="presentation" data-type="wx" class="newsmodel-type active">微信</li>' : '') + |
|||
(this.options.others.news.showlocal ? |
|||
' <li role="presentation" data-type="local" class="newsmodel-type">服务器</li>' : '') + |
|||
' </ul>') + |
|||
' <div class="material-head">'+ |
|||
' <a class="btn btn-primary active we7-margin-vertical-sm active pull-right ' + (this.options.ignore.image ? 'hide' : 'show') + '" href="./index.php?c=platform&a=material&type=image" target="_blank">上传图片</a>'+ |
|||
' <a class="btn btn-primary active we7-margin-vertical-sm active pull-right ' + (this.options.ignore.voice ? 'hide' : 'show') + '" href="./index.php?c=platform&a=material&type=voice" target="_blank">新建语音</a>'+ |
|||
' <a class="btn btn-primary active we7-margin-vertical-sm active pull-right ' + (this.options.ignore.video ? 'hide' : 'show') + '" href="./index.php?c=platform&a=material&type=video" target="_blank">新建视频</a>'+ |
|||
' <a class="btn btn-primary active we7-margin-vertical-sm active pull-right ' + (this.options.ignore.wxcard ? 'hide' : 'show') + '" href="./index.php?c=activity&a=coupon&do=display" target="_blank">新建卡券</a>'+ |
|||
' <a class="btn btn-primary active we7-margin-vertical-sm pull-right ' + (this.options.ignore.keyword ? 'hide' : 'show') + '" href="./index.php?c=platform&a=reply&do=post&m=keyword" target="_blank">新建关键字</a>'+ |
|||
' </div>'+ |
|||
' <div class="tab-content">'+ |
|||
' <div id="basic" class="tab-pane" role="tabpanel"></div>'+ |
|||
' <div id="news" class="tab-pane material clearfix" class="active" role="tabpanel" style="position:relative"></div>'+ |
|||
' <div id="image" class="tab-pane history" role="tabpanel"></div>'+ |
|||
' <div id="music" class="tab-pane history" role="tabpanel"></div>'+ |
|||
' <div id="voice" class="tab-pane" role="tabpanel"></div>'+ |
|||
' <div id="video" class="tab-pane" role="tabpanel"></div>'+ |
|||
' <div id="wxcard" class="tab-pane" role="tabpanel"></div>'+ |
|||
' <div id="keyword" class="tab-pane" role="tabpanel"></div>'+ |
|||
' <div id="module" class="tab-pane history" role="tabpanel"></div>'+ |
|||
' </div>' + |
|||
' <nav id="material-list-pager" class="text-right we7-margin-vertical we7-padding-right">\n' + |
|||
' </nav>\n' + |
|||
' </div>\n' + |
|||
' <div class="modal-footer" id="material-footer" style="display: none">\n' + |
|||
' <div id="btn-select">\n' + |
|||
' <span class="btn btn-default" data-dismiss="modal">取消</span>\n' + |
|||
' <span class="btn btn-primary">确认</span>\n' + |
|||
' </div>\n' + |
|||
' </div>\n'+ |
|||
' </div>\n' + |
|||
' </div>\n' + |
|||
'</div>'; |
|||
|
|||
dialog['basicDialog'] = '<div class="help-block">'+ |
|||
' 您还可以使用表情和链接。'+ |
|||
' <a class="emotion-triggers" href="javascript:;"><i class="fa fa-github-alt"></i> 表情</a>'+ |
|||
' <a class="emoji-triggers" href="javascript:;" onclick="initSelectEmoji()" title="添加表情"><i class="fa fa-github-alt"></i> Emoji</a>'+ |
|||
' </div>'+ |
|||
' <textarea id="basictext" cols="116" rows="10">'+ (this.options.others.basic.typeVal ? this.options.others.basic.typeVal : "") +'</textarea>'; |
|||
|
|||
dialog['imageDialog'] = '<ul class="img-list clearfix">\n' + |
|||
'<%var items = _.sortBy(items, function(item) {return -item.id;});%>' + |
|||
'<%_.each(items, function(item) {%> \n' + |
|||
'<div class="checkMedia" data-media="<%=item.media_id%>" data-type="image" data-attachid="<%=item.id%>">' + |
|||
' <li class="img-item" style="padding:5px">\n' + |
|||
' <div class="img-container" style="background-image: url(\'<%=item.attach%>\');">\n' + |
|||
' <div class="select-status"><span></span></div>\n' + |
|||
' </div>\n' + |
|||
' </li>\n' + |
|||
'</div>\n' + |
|||
'<%});%>\n' + |
|||
'</ul>'; |
|||
|
|||
dialog['musicDialog'] = '<div class="form-group">'+ |
|||
' <div class="col-xs-2">音乐标题</div>'+ |
|||
' <div class="col-xs-10 input-group">'+ |
|||
' <input type="text" value="" name="musicTitle" class="form-control" placeholder="添加音乐消息的标题">'+ |
|||
' </div>'+ |
|||
'</div>'+ |
|||
'<div class="form-group">'+ |
|||
' <div class="col-xs-2">选择音乐</div>'+ |
|||
' <div class="col-xs-10 input-group">'+ |
|||
' <input type="text" value="" name="musicUrl" class="form-control audio-player-media" autocomplete="off">'+ |
|||
' <span class="help-block">选择上传的音频文件或直接输入URL地址,常用格式:mp3</span>'+ |
|||
' <span class="input-group-btn" style="vertical-align: top;">'+ |
|||
' <button class="btn btn-default audio-player-play" type="button" style="display:none;"><i class="fa fa-play"></i></button>'+ |
|||
' <button class="btn btn-default" type="button" onclick="showAudioDialog(this);">选择媒体文件</button>'+ |
|||
' </span>'+ |
|||
' </div>'+ |
|||
' <div class="input-group audio-player"></div>'+ |
|||
'</div>'+ |
|||
'<div class="form-group">'+ |
|||
' <div class="col-xs-2">高品质链接</div>'+ |
|||
' <div class="col-xs-10 input-group">'+ |
|||
' <input type="text" value="" name="musicHQUrl" class="form-control">'+ |
|||
' <span class="help-block">没有高品质音乐链接,请留空。高质量音乐链接,WIFI环境优先使用该链接播放音乐</span>'+ |
|||
' </div>'+ |
|||
'</div>'+ |
|||
'<div class="form-group">'+ |
|||
' <div class="col-xs-2">描述</div>'+ |
|||
' <div class="col-xs-10 input-group">'+ |
|||
' <input type="text" value="" name="musicDescription" class="form-control">'+ |
|||
' <span class="help-block">描述内容将出现在音乐名称下方,建议控制在20个汉字以内最佳</span>'+ |
|||
' </div>'+ |
|||
'</div>'; |
|||
|
|||
dialog['voiceDialog'] ='<table class="table table-hover we7-table" style="margin-bottom:0">'+ |
|||
' <col width=""/>'+ |
|||
' <col width="150px"/>'+ |
|||
' <col width="180px"/>'+ |
|||
' <thead class="navbar-inner">'+ |
|||
' <tr>'+ |
|||
' <th>标题</th>'+ |
|||
' <th style="text-align:center">创建时间</th>'+ |
|||
' <th style="text-align:center"></th>'+ |
|||
' </tr>'+ |
|||
' </thead>'+ |
|||
' <tbody class="history-content">'+ |
|||
' <%var items = _.sortBy(items, function(item) {return -item.createtime;});%>' + |
|||
' <%_.each(items, function(item) {%> \n' + |
|||
' <tr>'+ |
|||
' <td><%=item.filename%></td>'+ |
|||
' <td align="center"><%=item.createtime_cn%></td>'+ |
|||
' <td align="center">'+ |
|||
' <div class="btn-group">'+ |
|||
' <a href="javascript:;" class="btn btn-default btn-sm audio-player-play audio-msg" data-attach="<%=item.attach%>"><i class="fa fa-play"></i></a>'+ |
|||
' <a href="javascript:;" class="btn btn-default btn-sm checkMedia" data-media="<%=item.media_id%>" data-type="voice" data-attachid="<%=item.id%>">选取</a>'+ |
|||
' </div>'+ |
|||
' </td>'+ |
|||
' </tr>'+ |
|||
' <%});%>' + |
|||
' </tbody>'+ |
|||
' </table>'; |
|||
|
|||
dialog['videoDialog'] ='<table class="table table-hover we7-table" style="margin-bottom:0">'+ |
|||
' <col width=""/>'+ |
|||
' <col width="150px"/>'+ |
|||
' <col width="180px"/>'+ |
|||
' <thead class="navbar-inner">'+ |
|||
' <tr>'+ |
|||
' <th>标题</th>'+ |
|||
' <th style="text-align:center">创建时间</th>'+ |
|||
' <th style="text-align:center"></th>'+ |
|||
' </tr>'+ |
|||
' </thead>'+ |
|||
' <tbody class="history-content">'+ |
|||
' <%var items = _.sortBy(items, function(item) {return -item.createtime;});%>' + |
|||
' <%_.each(items, function(item) {%> \n' + |
|||
' <tr>'+ |
|||
' <%if(item.tag.title) {var title = item.tag.title} else {var title =item.filename}%>'+ |
|||
' <td><%=title%></td>'+ |
|||
' <td align="center"><%=item.createtime_cn%></td>'+ |
|||
' <td align="center">'+ |
|||
' <div class="btn-group">'+ |
|||
' <a href="javascript:;" class="btn btn-default btn-sm checkMedia" data-media="<%=item.media_id%>" data-type="video" data-attachid="<%=item.id%>">选取</a>'+ |
|||
' </div>'+ |
|||
' </td>'+ |
|||
' </tr>'+ |
|||
' <%});%>' + |
|||
' </tbody>'+ |
|||
' </table>'; |
|||
|
|||
dialog['wxcardDialog'] ='<table class="table table-hover we7-table">\n'+ |
|||
' <thead>\n'+ |
|||
' <tr>\n'+ |
|||
' <th width="130" class="text-center">标题</th>\n'+ |
|||
' <th class="text-center">类型</th>\n'+ |
|||
' <th width="250" class="text-center">卡券有效期</th>\n'+ |
|||
' <th class="text-center">库存/每人限领</th>\n'+ |
|||
' <th class="text-center">操作</th>\n'+ |
|||
' </tr>'+ |
|||
' </thead>'+ |
|||
' <tbody>'+ |
|||
' <%var items = _.sortBy(items, function(item) {return -item.couponid;});%>' + |
|||
' <%_.each(items, function(item) {%> \n' + |
|||
' <tr title="<%=item.title%>">' + |
|||
' <td><%=item.title%></td>' + |
|||
' <td><%if(item.ctype == "discount") {%><span class="label label-success">折扣券</span><%} else if(item.ctype == "cash") {%><span class="label label-danger">代金券</span><%} else if(item.ctype == "gift") {%><span class="label label-danger">礼品券</span><%} else if(item.ctype == "groupon") {%><span class="label label-danger">团购券</span><%} else if(item.ctype == "general_coupon") {%><span class="label label-danger">优惠券</span><%}%></td>' + |
|||
' <td><%if(item.date_info.time_type == 1) {%><%=item.date_info.time_limit_start%> ~ <%=item.date_info.time_limit_end%><%} else {%>领取后<%=item.date_info.date_info%>天后生效,<%=item.date_info.limit%>天有效期<%}%></td>' + |
|||
' <td><%=item.quantity%>/<strong class="text-danger"><%=item.get_limit%></strong></td>' + |
|||
' <td><a href="javascript:;" class="btn btn-default btn-sm checkMedia" data-title="<%=item.title%>" data-type="wxcard" data-media="<%=item.card_id%>" data-attachid="<%=item.id%>">选取</a></td>' + |
|||
' </tr>' + |
|||
' <%});%>' + |
|||
' </tbody>'+ |
|||
' </table>'; |
|||
|
|||
dialog['newsDialog'] = '<div role="tabpanel">'+ |
|||
' <div class="tablepanel-top text-right">'+ |
|||
' <button class="btn btn-primary" type="button"><a href="./index.php?c=platform&a=material-post&new_type=reply" target="_blank">图文编辑</a></button>'+ |
|||
'<button class="btn btn-primary" style="margin-left:10px" type="button"><a href="./index.php?c=platform&a=material-post&new_type=link" target="_blank">跳转链接</a></button>'+ |
|||
' </div>'+ |
|||
' <div class="tablepanel-con">'+ |
|||
' <div class="graphic-list material clearfix" style="position: relative;">'+ |
|||
' <%var items = _.sortBy(items, function(item) {return -item.createtime;});%>' + |
|||
' <%_.each(items, function(item) {%> \n' + |
|||
' <div class="col-md-5 water">'+ |
|||
' <div class="panel-group checkMedia" data-media="<%=item.media_id%>" data-type="news" data-attachid="<%=item.id%>">'+ |
|||
' <%var index = 0;%>\n' + |
|||
' <%_.each(item.items, function(data) {%>\n' + |
|||
' <%index++;%>\n' + |
|||
' <div class="panel panel-default">'+ |
|||
' <%if(index == 1) {%>\n' + |
|||
' <div class="panel-body">'+ |
|||
' <div class="img">'+ |
|||
' <i class="default">封面图片</i>'+ |
|||
' <img src="<%=data.thumb_url%>" width="100%">'+ |
|||
' <span class="text-left"><%=data.title%></span>'+ |
|||
' </div>'+ |
|||
' </div>'+ |
|||
' <%} else {%>\n' + |
|||
' <div class="panel-body">'+ |
|||
' <div class="text">'+ |
|||
' <h4><%=data.title%></h4>'+ |
|||
' </div>'+ |
|||
' <div class="img">'+ |
|||
' <img src="<%=data.thumb_url%>">'+ |
|||
' <i class="default">缩略图</i>'+ |
|||
' </div>'+ |
|||
' </div>'+ |
|||
' <%}%>\n' + |
|||
' </div>'+ |
|||
' <%});%>'+ |
|||
' <div class="mask"></div>'+ |
|||
' <i class="fa fa-check"></i>'+ |
|||
' </div>'+ |
|||
' </div>'+ |
|||
' <%});%>'+ |
|||
' </div>'+ |
|||
' </div>'+ |
|||
' </div>'; |
|||
dialog['keywordDialog'] = '<div class="row">\n'+ |
|||
'<%_.each(items, function(item) {%>' + |
|||
' <div class="col-sm-2">'+ |
|||
' <a href="javascript:;" class="checkMedia" data-media="<%=item.media_id%>" data-type="keyword" data-attachid="<%=item.id%>">'+ |
|||
' <span>'+ |
|||
' <%=item.content%>' + |
|||
' </span>'+ |
|||
' </a>'+ |
|||
' </div>'+ |
|||
'<%});%>'+ |
|||
'</div>'; |
|||
dialog['moduleDialog'] = '<ul class="img-list clearfix">\n' + |
|||
'<%var items = _.sortBy(items, function(item) {return -item.id;});%>' + |
|||
'<%_.each(items, function(item) {%> \n' + |
|||
'<div class="checkMedia" data-name="<%=item.name%>" data-type="module">' + |
|||
' <li class="img-item" style="padding:5px">\n' + |
|||
' <div class="img-container">\n' + |
|||
' <img src="<%=item.icon%>" width="48px" height="48px">\n' + |
|||
' <div class="text-over"><%=item.title%></div>\n' + |
|||
' <div class="select-status"><span></span></div>\n' + |
|||
' </div>\n' + |
|||
' </li>\n' + |
|||
'</div>\n' + |
|||
'<%});%>\n' + |
|||
'</ul>'; |
|||
|
|||
return dialog; |
|||
} |
|||
}; |
|||
initSelectEmotion = function() { |
|||
var $t = $('#basictext')[0]; |
|||
var textbox = $("#basictext").val(); |
|||
util.emotion($('.emotion-triggers'), $("#basictext"), function(txt, elm, target){ |
|||
if ($t.selectionStart || $t.selectionStart == '0') { |
|||
var startPos = $t.selectionStart; |
|||
var endPos = $t.selectionEnd; |
|||
var scrollTop = $t.scrollTop; |
|||
$("#basictext").val($t.value.substring(0, startPos) + txt + $t.value.substring(endPos, $t.value.length)); |
|||
$("#basictext").focus(); |
|||
$t.selectionStart = startPos + txt.length; |
|||
$t.selectionEnd = startPos + txt.length; |
|||
$t.scrollTop = scrollTop; |
|||
} |
|||
else { |
|||
$("#basictext").val(textbox+txt); |
|||
$("#basictext").focus(); |
|||
} |
|||
}); |
|||
}; |
|||
initSelectEmoji = function() { |
|||
var textbox = $("#basictext").val(); |
|||
util.emojiBrowser(function(emoji){ |
|||
var unshift = '[U+' + emoji.find("span").text() + ']'; |
|||
$("#basictext").val(textbox+unshift); |
|||
}); |
|||
}; |
|||
showAudioDialog = function(elm, base64options, options) { |
|||
var btn = $(elm); |
|||
var ipt = btn.parent().prev().prev(); |
|||
var val = ipt.val(); |
|||
util.audio(val, function(url){ |
|||
if(url && url.attachment && url.url){ |
|||
btn.prev().show(); |
|||
ipt.val(url.attachment); |
|||
ipt.attr("filename",url.filename); |
|||
ipt.attr("url",url.url); |
|||
setAudioPlayer(); |
|||
} |
|||
if(url && url.media_id){ |
|||
ipt.val(url.media_id); |
|||
} |
|||
}, "" , {"direct": true, "multiple": false}); |
|||
}; |
|||
setAudioPlayer = function(){ |
|||
$(function(){ |
|||
$(".audio-player").each(function(){ |
|||
$(this).prev().find("button").eq(0).click(function(){ |
|||
var src = $(this).parent().prev().prev().val(); |
|||
if($(this).find("i").hasClass("fa-stop")) { |
|||
$(this).parent().parent().next().jPlayer("stop"); |
|||
} else { |
|||
if(src) { |
|||
$(this).parent().parent().next().jPlayer("setMedia", {mp3: util.tomedia(src)}).jPlayer("play"); |
|||
} |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
$(".audio-player").jPlayer({ |
|||
playing: function() { |
|||
$(this).prev().find("i").removeClass("fa-play").addClass("fa-stop"); |
|||
}, |
|||
pause: function (event) { |
|||
$(this).prev().find("i").removeClass("fa-stop").addClass("fa-play"); |
|||
}, |
|||
swfPath: "resource/components/jplayer", |
|||
supplied: "mp3" |
|||
}); |
|||
$(".audio-player-media").each(function(){ |
|||
$(this).next().find(".audio-player-play").css("display", $(this).val() == "" ? "none" : ""); |
|||
}); |
|||
}); |
|||
}; |
|||
return material; |
|||
}); |
|||
@ -0,0 +1,504 @@ |
|||
GNU LESSER GENERAL PUBLIC LICENSE |
|||
Version 2.1, February 1999 |
|||
|
|||
Copyright (C) 1991, 1999 Free Software Foundation, Inc. |
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
Everyone is permitted to copy and distribute verbatim copies |
|||
of this license document, but changing it is not allowed. |
|||
|
|||
[This is the first released version of the Lesser GPL. It also counts |
|||
as the successor of the GNU Library Public License, version 2, hence |
|||
the version number 2.1.] |
|||
|
|||
Preamble |
|||
|
|||
The licenses for most software are designed to take away your |
|||
freedom to share and change it. By contrast, the GNU General Public |
|||
Licenses are intended to guarantee your freedom to share and change |
|||
free software--to make sure the software is free for all its users. |
|||
|
|||
This license, the Lesser General Public License, applies to some |
|||
specially designated software packages--typically libraries--of the |
|||
Free Software Foundation and other authors who decide to use it. You |
|||
can use it too, but we suggest you first think carefully about whether |
|||
this license or the ordinary General Public License is the better |
|||
strategy to use in any particular case, based on the explanations below. |
|||
|
|||
When we speak of free software, we are referring to freedom of use, |
|||
not price. Our General Public Licenses are designed to make sure that |
|||
you have the freedom to distribute copies of free software (and charge |
|||
for this service if you wish); that you receive source code or can get |
|||
it if you want it; that you can change the software and use pieces of |
|||
it in new free programs; and that you are informed that you can do |
|||
these things. |
|||
|
|||
To protect your rights, we need to make restrictions that forbid |
|||
distributors to deny you these rights or to ask you to surrender these |
|||
rights. These restrictions translate to certain responsibilities for |
|||
you if you distribute copies of the library or if you modify it. |
|||
|
|||
For example, if you distribute copies of the library, whether gratis |
|||
or for a fee, you must give the recipients all the rights that we gave |
|||
you. You must make sure that they, too, receive or can get the source |
|||
code. If you link other code with the library, you must provide |
|||
complete object files to the recipients, so that they can relink them |
|||
with the library after making changes to the library and recompiling |
|||
it. And you must show them these terms so they know their rights. |
|||
|
|||
We protect your rights with a two-step method: (1) we copyright the |
|||
library, and (2) we offer you this license, which gives you legal |
|||
permission to copy, distribute and/or modify the library. |
|||
|
|||
To protect each distributor, we want to make it very clear that |
|||
there is no warranty for the free library. Also, if the library is |
|||
modified by someone else and passed on, the recipients should know |
|||
that what they have is not the original version, so that the original |
|||
author's reputation will not be affected by problems that might be |
|||
introduced by others. |
|||
|
|||
Finally, software patents pose a constant threat to the existence of |
|||
any free program. We wish to make sure that a company cannot |
|||
effectively restrict the users of a free program by obtaining a |
|||
restrictive license from a patent holder. Therefore, we insist that |
|||
any patent license obtained for a version of the library must be |
|||
consistent with the full freedom of use specified in this license. |
|||
|
|||
Most GNU software, including some libraries, is covered by the |
|||
ordinary GNU General Public License. This license, the GNU Lesser |
|||
General Public License, applies to certain designated libraries, and |
|||
is quite different from the ordinary General Public License. We use |
|||
this license for certain libraries in order to permit linking those |
|||
libraries into non-free programs. |
|||
|
|||
When a program is linked with a library, whether statically or using |
|||
a shared library, the combination of the two is legally speaking a |
|||
combined work, a derivative of the original library. The ordinary |
|||
General Public License therefore permits such linking only if the |
|||
entire combination fits its criteria of freedom. The Lesser General |
|||
Public License permits more lax criteria for linking other code with |
|||
the library. |
|||
|
|||
We call this license the "Lesser" General Public License because it |
|||
does Less to protect the user's freedom than the ordinary General |
|||
Public License. It also provides other free software developers Less |
|||
of an advantage over competing non-free programs. These disadvantages |
|||
are the reason we use the ordinary General Public License for many |
|||
libraries. However, the Lesser license provides advantages in certain |
|||
special circumstances. |
|||
|
|||
For example, on rare occasions, there may be a special need to |
|||
encourage the widest possible use of a certain library, so that it becomes |
|||
a de-facto standard. To achieve this, non-free programs must be |
|||
allowed to use the library. A more frequent case is that a free |
|||
library does the same job as widely used non-free libraries. In this |
|||
case, there is little to gain by limiting the free library to free |
|||
software only, so we use the Lesser General Public License. |
|||
|
|||
In other cases, permission to use a particular library in non-free |
|||
programs enables a greater number of people to use a large body of |
|||
free software. For example, permission to use the GNU C Library in |
|||
non-free programs enables many more people to use the whole GNU |
|||
operating system, as well as its variant, the GNU/Linux operating |
|||
system. |
|||
|
|||
Although the Lesser General Public License is Less protective of the |
|||
users' freedom, it does ensure that the user of a program that is |
|||
linked with the Library has the freedom and the wherewithal to run |
|||
that program using a modified version of the Library. |
|||
|
|||
The precise terms and conditions for copying, distribution and |
|||
modification follow. Pay close attention to the difference between a |
|||
"work based on the library" and a "work that uses the library". The |
|||
former contains code derived from the library, whereas the latter must |
|||
be combined with the library in order to run. |
|||
|
|||
GNU LESSER GENERAL PUBLIC LICENSE |
|||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
|||
|
|||
0. This License Agreement applies to any software library or other |
|||
program which contains a notice placed by the copyright holder or |
|||
other authorized party saying it may be distributed under the terms of |
|||
this Lesser General Public License (also called "this License"). |
|||
Each licensee is addressed as "you". |
|||
|
|||
A "library" means a collection of software functions and/or data |
|||
prepared so as to be conveniently linked with application programs |
|||
(which use some of those functions and data) to form executables. |
|||
|
|||
The "Library", below, refers to any such software library or work |
|||
which has been distributed under these terms. A "work based on the |
|||
Library" means either the Library or any derivative work under |
|||
copyright law: that is to say, a work containing the Library or a |
|||
portion of it, either verbatim or with modifications and/or translated |
|||
straightforwardly into another language. (Hereinafter, translation is |
|||
included without limitation in the term "modification".) |
|||
|
|||
"Source code" for a work means the preferred form of the work for |
|||
making modifications to it. For a library, complete source code means |
|||
all the source code for all modules it contains, plus any associated |
|||
interface definition files, plus the scripts used to control compilation |
|||
and installation of the library. |
|||
|
|||
Activities other than copying, distribution and modification are not |
|||
covered by this License; they are outside its scope. The act of |
|||
running a program using the Library is not restricted, and output from |
|||
such a program is covered only if its contents constitute a work based |
|||
on the Library (independent of the use of the Library in a tool for |
|||
writing it). Whether that is true depends on what the Library does |
|||
and what the program that uses the Library does. |
|||
|
|||
1. You may copy and distribute verbatim copies of the Library's |
|||
complete source code as you receive it, in any medium, provided that |
|||
you conspicuously and appropriately publish on each copy an |
|||
appropriate copyright notice and disclaimer of warranty; keep intact |
|||
all the notices that refer to this License and to the absence of any |
|||
warranty; and distribute a copy of this License along with the |
|||
Library. |
|||
|
|||
You may charge a fee for the physical act of transferring a copy, |
|||
and you may at your option offer warranty protection in exchange for a |
|||
fee. |
|||
|
|||
2. You may modify your copy or copies of the Library or any portion |
|||
of it, thus forming a work based on the Library, and copy and |
|||
distribute such modifications or work under the terms of Section 1 |
|||
above, provided that you also meet all of these conditions: |
|||
|
|||
a) The modified work must itself be a software library. |
|||
|
|||
b) You must cause the files modified to carry prominent notices |
|||
stating that you changed the files and the date of any change. |
|||
|
|||
c) You must cause the whole of the work to be licensed at no |
|||
charge to all third parties under the terms of this License. |
|||
|
|||
d) If a facility in the modified Library refers to a function or a |
|||
table of data to be supplied by an application program that uses |
|||
the facility, other than as an argument passed when the facility |
|||
is invoked, then you must make a good faith effort to ensure that, |
|||
in the event an application does not supply such function or |
|||
table, the facility still operates, and performs whatever part of |
|||
its purpose remains meaningful. |
|||
|
|||
(For example, a function in a library to compute square roots has |
|||
a purpose that is entirely well-defined independent of the |
|||
application. Therefore, Subsection 2d requires that any |
|||
application-supplied function or table used by this function must |
|||
be optional: if the application does not supply it, the square |
|||
root function must still compute square roots.) |
|||
|
|||
These requirements apply to the modified work as a whole. If |
|||
identifiable sections of that work are not derived from the Library, |
|||
and can be reasonably considered independent and separate works in |
|||
themselves, then this License, and its terms, do not apply to those |
|||
sections when you distribute them as separate works. But when you |
|||
distribute the same sections as part of a whole which is a work based |
|||
on the Library, the distribution of the whole must be on the terms of |
|||
this License, whose permissions for other licensees extend to the |
|||
entire whole, and thus to each and every part regardless of who wrote |
|||
it. |
|||
|
|||
Thus, it is not the intent of this section to claim rights or contest |
|||
your rights to work written entirely by you; rather, the intent is to |
|||
exercise the right to control the distribution of derivative or |
|||
collective works based on the Library. |
|||
|
|||
In addition, mere aggregation of another work not based on the Library |
|||
with the Library (or with a work based on the Library) on a volume of |
|||
a storage or distribution medium does not bring the other work under |
|||
the scope of this License. |
|||
|
|||
3. You may opt to apply the terms of the ordinary GNU General Public |
|||
License instead of this License to a given copy of the Library. To do |
|||
this, you must alter all the notices that refer to this License, so |
|||
that they refer to the ordinary GNU General Public License, version 2, |
|||
instead of to this License. (If a newer version than version 2 of the |
|||
ordinary GNU General Public License has appeared, then you can specify |
|||
that version instead if you wish.) Do not make any other change in |
|||
these notices. |
|||
|
|||
Once this change is made in a given copy, it is irreversible for |
|||
that copy, so the ordinary GNU General Public License applies to all |
|||
subsequent copies and derivative works made from that copy. |
|||
|
|||
This option is useful when you wish to copy part of the code of |
|||
the Library into a program that is not a library. |
|||
|
|||
4. You may copy and distribute the Library (or a portion or |
|||
derivative of it, under Section 2) in object code or executable form |
|||
under the terms of Sections 1 and 2 above provided that you accompany |
|||
it with the complete corresponding machine-readable source code, which |
|||
must be distributed under the terms of Sections 1 and 2 above on a |
|||
medium customarily used for software interchange. |
|||
|
|||
If distribution of object code is made by offering access to copy |
|||
from a designated place, then offering equivalent access to copy the |
|||
source code from the same place satisfies the requirement to |
|||
distribute the source code, even though third parties are not |
|||
compelled to copy the source along with the object code. |
|||
|
|||
5. A program that contains no derivative of any portion of the |
|||
Library, but is designed to work with the Library by being compiled or |
|||
linked with it, is called a "work that uses the Library". Such a |
|||
work, in isolation, is not a derivative work of the Library, and |
|||
therefore falls outside the scope of this License. |
|||
|
|||
However, linking a "work that uses the Library" with the Library |
|||
creates an executable that is a derivative of the Library (because it |
|||
contains portions of the Library), rather than a "work that uses the |
|||
library". The executable is therefore covered by this License. |
|||
Section 6 states terms for distribution of such executables. |
|||
|
|||
When a "work that uses the Library" uses material from a header file |
|||
that is part of the Library, the object code for the work may be a |
|||
derivative work of the Library even though the source code is not. |
|||
Whether this is true is especially significant if the work can be |
|||
linked without the Library, or if the work is itself a library. The |
|||
threshold for this to be true is not precisely defined by law. |
|||
|
|||
If such an object file uses only numerical parameters, data |
|||
structure layouts and accessors, and small macros and small inline |
|||
functions (ten lines or less in length), then the use of the object |
|||
file is unrestricted, regardless of whether it is legally a derivative |
|||
work. (Executables containing this object code plus portions of the |
|||
Library will still fall under Section 6.) |
|||
|
|||
Otherwise, if the work is a derivative of the Library, you may |
|||
distribute the object code for the work under the terms of Section 6. |
|||
Any executables containing that work also fall under Section 6, |
|||
whether or not they are linked directly with the Library itself. |
|||
|
|||
6. As an exception to the Sections above, you may also combine or |
|||
link a "work that uses the Library" with the Library to produce a |
|||
work containing portions of the Library, and distribute that work |
|||
under terms of your choice, provided that the terms permit |
|||
modification of the work for the customer's own use and reverse |
|||
engineering for debugging such modifications. |
|||
|
|||
You must give prominent notice with each copy of the work that the |
|||
Library is used in it and that the Library and its use are covered by |
|||
this License. You must supply a copy of this License. If the work |
|||
during execution displays copyright notices, you must include the |
|||
copyright notice for the Library among them, as well as a reference |
|||
directing the user to the copy of this License. Also, you must do one |
|||
of these things: |
|||
|
|||
a) Accompany the work with the complete corresponding |
|||
machine-readable source code for the Library including whatever |
|||
changes were used in the work (which must be distributed under |
|||
Sections 1 and 2 above); and, if the work is an executable linked |
|||
with the Library, with the complete machine-readable "work that |
|||
uses the Library", as object code and/or source code, so that the |
|||
user can modify the Library and then relink to produce a modified |
|||
executable containing the modified Library. (It is understood |
|||
that the user who changes the contents of definitions files in the |
|||
Library will not necessarily be able to recompile the application |
|||
to use the modified definitions.) |
|||
|
|||
b) Use a suitable shared library mechanism for linking with the |
|||
Library. A suitable mechanism is one that (1) uses at run time a |
|||
copy of the library already present on the user's computer system, |
|||
rather than copying library functions into the executable, and (2) |
|||
will operate properly with a modified version of the library, if |
|||
the user installs one, as long as the modified version is |
|||
interface-compatible with the version that the work was made with. |
|||
|
|||
c) Accompany the work with a written offer, valid for at |
|||
least three years, to give the same user the materials |
|||
specified in Subsection 6a, above, for a charge no more |
|||
than the cost of performing this distribution. |
|||
|
|||
d) If distribution of the work is made by offering access to copy |
|||
from a designated place, offer equivalent access to copy the above |
|||
specified materials from the same place. |
|||
|
|||
e) Verify that the user has already received a copy of these |
|||
materials or that you have already sent this user a copy. |
|||
|
|||
For an executable, the required form of the "work that uses the |
|||
Library" must include any data and utility programs needed for |
|||
reproducing the executable from it. However, as a special exception, |
|||
the materials to be distributed need not include anything that is |
|||
normally distributed (in either source or binary form) with the major |
|||
components (compiler, kernel, and so on) of the operating system on |
|||
which the executable runs, unless that component itself accompanies |
|||
the executable. |
|||
|
|||
It may happen that this requirement contradicts the license |
|||
restrictions of other proprietary libraries that do not normally |
|||
accompany the operating system. Such a contradiction means you cannot |
|||
use both them and the Library together in an executable that you |
|||
distribute. |
|||
|
|||
7. You may place library facilities that are a work based on the |
|||
Library side-by-side in a single library together with other library |
|||
facilities not covered by this License, and distribute such a combined |
|||
library, provided that the separate distribution of the work based on |
|||
the Library and of the other library facilities is otherwise |
|||
permitted, and provided that you do these two things: |
|||
|
|||
a) Accompany the combined library with a copy of the same work |
|||
based on the Library, uncombined with any other library |
|||
facilities. This must be distributed under the terms of the |
|||
Sections above. |
|||
|
|||
b) Give prominent notice with the combined library of the fact |
|||
that part of it is a work based on the Library, and explaining |
|||
where to find the accompanying uncombined form of the same work. |
|||
|
|||
8. You may not copy, modify, sublicense, link with, or distribute |
|||
the Library except as expressly provided under this License. Any |
|||
attempt otherwise to copy, modify, sublicense, link with, or |
|||
distribute the Library is void, and will automatically terminate your |
|||
rights under this License. However, parties who have received copies, |
|||
or rights, from you under this License will not have their licenses |
|||
terminated so long as such parties remain in full compliance. |
|||
|
|||
9. You are not required to accept this License, since you have not |
|||
signed it. However, nothing else grants you permission to modify or |
|||
distribute the Library or its derivative works. These actions are |
|||
prohibited by law if you do not accept this License. Therefore, by |
|||
modifying or distributing the Library (or any work based on the |
|||
Library), you indicate your acceptance of this License to do so, and |
|||
all its terms and conditions for copying, distributing or modifying |
|||
the Library or works based on it. |
|||
|
|||
10. Each time you redistribute the Library (or any work based on the |
|||
Library), the recipient automatically receives a license from the |
|||
original licensor to copy, distribute, link with or modify the Library |
|||
subject to these terms and conditions. You may not impose any further |
|||
restrictions on the recipients' exercise of the rights granted herein. |
|||
You are not responsible for enforcing compliance by third parties with |
|||
this License. |
|||
|
|||
11. If, as a consequence of a court judgment or allegation of patent |
|||
infringement or for any other reason (not limited to patent issues), |
|||
conditions are imposed on you (whether by court order, agreement or |
|||
otherwise) that contradict the conditions of this License, they do not |
|||
excuse you from the conditions of this License. If you cannot |
|||
distribute so as to satisfy simultaneously your obligations under this |
|||
License and any other pertinent obligations, then as a consequence you |
|||
may not distribute the Library at all. For example, if a patent |
|||
license would not permit royalty-free redistribution of the Library by |
|||
all those who receive copies directly or indirectly through you, then |
|||
the only way you could satisfy both it and this License would be to |
|||
refrain entirely from distribution of the Library. |
|||
|
|||
If any portion of this section is held invalid or unenforceable under any |
|||
particular circumstance, the balance of the section is intended to apply, |
|||
and the section as a whole is intended to apply in other circumstances. |
|||
|
|||
It is not the purpose of this section to induce you to infringe any |
|||
patents or other property right claims or to contest validity of any |
|||
such claims; this section has the sole purpose of protecting the |
|||
integrity of the free software distribution system which is |
|||
implemented by public license practices. Many people have made |
|||
generous contributions to the wide range of software distributed |
|||
through that system in reliance on consistent application of that |
|||
system; it is up to the author/donor to decide if he or she is willing |
|||
to distribute software through any other system and a licensee cannot |
|||
impose that choice. |
|||
|
|||
This section is intended to make thoroughly clear what is believed to |
|||
be a consequence of the rest of this License. |
|||
|
|||
12. If the distribution and/or use of the Library is restricted in |
|||
certain countries either by patents or by copyrighted interfaces, the |
|||
original copyright holder who places the Library under this License may add |
|||
an explicit geographical distribution limitation excluding those countries, |
|||
so that distribution is permitted only in or among countries not thus |
|||
excluded. In such case, this License incorporates the limitation as if |
|||
written in the body of this License. |
|||
|
|||
13. The Free Software Foundation may publish revised and/or new |
|||
versions of the Lesser General Public License from time to time. |
|||
Such new versions will be similar in spirit to the present version, |
|||
but may differ in detail to address new problems or concerns. |
|||
|
|||
Each version is given a distinguishing version number. If the Library |
|||
specifies a version number of this License which applies to it and |
|||
"any later version", you have the option of following the terms and |
|||
conditions either of that version or of any later version published by |
|||
the Free Software Foundation. If the Library does not specify a |
|||
license version number, you may choose any version ever published by |
|||
the Free Software Foundation. |
|||
|
|||
14. If you wish to incorporate parts of the Library into other free |
|||
programs whose distribution conditions are incompatible with these, |
|||
write to the author to ask for permission. For software which is |
|||
copyrighted by the Free Software Foundation, write to the Free |
|||
Software Foundation; we sometimes make exceptions for this. Our |
|||
decision will be guided by the two goals of preserving the free status |
|||
of all derivatives of our free software and of promoting the sharing |
|||
and reuse of software generally. |
|||
|
|||
NO WARRANTY |
|||
|
|||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO |
|||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. |
|||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR |
|||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY |
|||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE |
|||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE |
|||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME |
|||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. |
|||
|
|||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN |
|||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY |
|||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU |
|||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR |
|||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE |
|||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING |
|||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A |
|||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF |
|||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
|||
DAMAGES. |
|||
|
|||
END OF TERMS AND CONDITIONS |
|||
|
|||
How to Apply These Terms to Your New Libraries |
|||
|
|||
If you develop a new library, and you want it to be of the greatest |
|||
possible use to the public, we recommend making it free software that |
|||
everyone can redistribute and change. You can do so by permitting |
|||
redistribution under these terms (or, alternatively, under the terms of the |
|||
ordinary General Public License). |
|||
|
|||
To apply these terms, attach the following notices to the library. It is |
|||
safest to attach them to the start of each source file to most effectively |
|||
convey the exclusion of warranty; and each file should have at least the |
|||
"copyright" line and a pointer to where the full notice is found. |
|||
|
|||
<one line to give the library's name and a brief idea of what it does.> |
|||
Copyright (C) <year> <name of author> |
|||
|
|||
This library is free software; you can redistribute it and/or |
|||
modify it under the terms of the GNU Lesser General Public |
|||
License as published by the Free Software Foundation; either |
|||
version 2.1 of the License, or (at your option) any later version. |
|||
|
|||
This library 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 |
|||
Lesser General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU Lesser General Public |
|||
License along with this library; if not, write to the Free Software |
|||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
|
|||
Also add information on how to contact you by electronic and paper mail. |
|||
|
|||
You should also get your employer (if you work as a programmer) or your |
|||
school, if any, to sign a "copyright disclaimer" for the library, if |
|||
necessary. Here is a sample; alter the names: |
|||
|
|||
Yoyodyne, Inc., hereby disclaims all copyright interest in the |
|||
library `Frob' (a library for tweaking knobs) written by James Random Hacker. |
|||
|
|||
<signature of Ty Coon>, 1 April 1990 |
|||
Ty Coon, President of Vice |
|||
|
|||
That's all there is to it! |
|||
|
|||
|
|||
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 1012 B |
|
After Width: | Height: | Size: 949 B |
|
After Width: | Height: | Size: 950 B |
|
After Width: | Height: | Size: 986 B |
|
After Width: | Height: | Size: 1001 B |
|
After Width: | Height: | Size: 996 B |
|
After Width: | Height: | Size: 1001 B |
|
After Width: | Height: | Size: 1009 B |
|
After Width: | Height: | Size: 1007 B |
|
After Width: | Height: | Size: 970 B |
|
After Width: | Height: | Size: 1005 B |
|
After Width: | Height: | Size: 453 B |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 40 KiB |
@ -0,0 +1,120 @@ |
|||
<!doctype html> |
|||
<html> |
|||
<head> |
|||
<meta charset="UTF-8"> |
|||
<title>ueditor图片对话框</title> |
|||
<script type="text/javascript" src="../internal.js"></script> |
|||
|
|||
<!-- jquery --> |
|||
<script type="text/javascript" src="../../third-party/jquery-1.10.2.min.js"></script> |
|||
|
|||
<!-- webuploader --> |
|||
<script src="../../third-party/webuploader/webuploader.min.js"></script> |
|||
<link rel="stylesheet" type="text/css" href="../../third-party/webuploader/webuploader.css"> |
|||
|
|||
<!-- image dialog --> |
|||
<link rel="stylesheet" href="image.css" type="text/css" /> |
|||
</head> |
|||
<body> |
|||
|
|||
<div class="wrapper"> |
|||
<div id="tabhead" class="tabhead"> |
|||
<span class="tab" data-content-id="remote"><var id="lang_tab_remote"></var></span> |
|||
<span class="tab focus" data-content-id="upload"><var id="lang_tab_upload"></var></span> |
|||
<span class="tab" data-content-id="online"><var id="lang_tab_online"></var></span> |
|||
<span class="tab" data-content-id="search"><var id="lang_tab_search"></var></span> |
|||
</div> |
|||
<div class="alignBar"> |
|||
<label class="algnLabel"><var id="lang_input_align"></var></label> |
|||
<span id="alignIcon"> |
|||
<span id="noneAlign" class="none-align focus" data-align="none"></span> |
|||
<span id="leftAlign" class="left-align" data-align="left"></span> |
|||
<span id="rightAlign" class="right-align" data-align="right"></span> |
|||
<span id="centerAlign" class="center-align" data-align="center"></span> |
|||
</span> |
|||
<input id="align" name="align" type="hidden" value="none"/> |
|||
</div> |
|||
<div id="tabbody" class="tabbody"> |
|||
|
|||
<!-- 远程图片 --> |
|||
<div id="remote" class="panel"> |
|||
<div class="top"> |
|||
<div class="row"> |
|||
<label for="url"><var id="lang_input_url"></var></label> |
|||
<span><input class="text" id="url" type="text"/></span> |
|||
</div> |
|||
</div> |
|||
<div class="left"> |
|||
<div class="row"> |
|||
<label><var id="lang_input_size"></var></label> |
|||
<span><var id="lang_input_width"> </var><input class="text" type="text" id="width"/>px </span> |
|||
<span><var id="lang_input_height"> </var><input class="text" type="text" id="height"/>px </span> |
|||
<span><input id="lock" type="checkbox" disabled="disabled"><span id="lockicon"></span></span> |
|||
</div> |
|||
<div class="row"> |
|||
<label><var id="lang_input_border"></var></label> |
|||
<span><input class="text" type="text" id="border"/>px </span> |
|||
</div> |
|||
<div class="row"> |
|||
<label><var id="lang_input_vhspace"></var></label> |
|||
<span><input class="text" type="text" id="vhSpace"/>px </span> |
|||
</div> |
|||
<div class="row"> |
|||
<label><var id="lang_input_title"></var></label> |
|||
<span><input class="text" type="text" id="title"/></span> |
|||
</div> |
|||
</div> |
|||
<div class="right"><div id="preview"></div></div> |
|||
</div> |
|||
|
|||
<!-- 上传图片 --> |
|||
<div id="upload" class="panel focus"> |
|||
<div id="queueList" class="queueList"> |
|||
<div class="statusBar element-invisible"> |
|||
<div class="progress"> |
|||
<span class="text">0%</span> |
|||
<span class="percentage"></span> |
|||
</div><div class="info"></div> |
|||
<div class="btns"> |
|||
<div id="filePickerBtn"></div> |
|||
<div class="uploadBtn"><var id="lang_start_upload"></var></div> |
|||
</div> |
|||
</div> |
|||
<div id="dndArea" class="placeholder"> |
|||
<div class="filePickerContainer"> |
|||
<div id="filePickerReady"></div> |
|||
</div> |
|||
</div> |
|||
<ul class="filelist element-invisible"> |
|||
<li id="filePickerBlock" class="filePickerBlock"></li> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- 在线图片 --> |
|||
<div id="online" class="panel"> |
|||
<div id="imageList"><var id="lang_imgLoading"></var></div> |
|||
</div> |
|||
|
|||
<!-- 搜索图片 --> |
|||
<div id="search" class="panel"> |
|||
<div class="searchBar"> |
|||
<input id="searchTxt" class="searchTxt text" type="text" /> |
|||
<select id="searchType" class="searchType"> |
|||
<option value="&s=4&z=0"></option> |
|||
<option value="&s=1&z=19"></option> |
|||
<option value="&s=2&z=0"></option> |
|||
<option value="&s=3&z=0"></option> |
|||
</select> |
|||
<input id="searchReset" type="button" /> |
|||
<input id="searchBtn" type="button" /> |
|||
</div> |
|||
<div id="searchList" class="searchList"><ul id="searchListUl"></ul></div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
<script type="text/javascript" src="image.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
After Width: | Height: | Size: 453 B |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
@ -0,0 +1,98 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
|||
<title></title> |
|||
<script type="text/javascript" src="../internal.js"></script> |
|||
<style type="text/css"> |
|||
.warp {width: 320px;height: 153px;margin-left:5px;padding: 20px 0 0 15px;position: relative;} |
|||
#url {width: 290px; margin-bottom: 2px; margin-left: -6px; margin-left: -2px\9;*margin-left:0;_margin-left:0; } |
|||
.format span{display: inline-block; width: 58px;text-align: center; zoom:1;} |
|||
table td{padding:5px 0;} |
|||
#align{width: 65px;height: 23px;line-height: 22px;} |
|||
</style> |
|||
</head> |
|||
<body> |
|||
<div class="warp"> |
|||
<table width="300" cellpadding="0" cellspacing="0"> |
|||
<tr> |
|||
<td colspan="2" class="format"> |
|||
<span><var id="lang_input_address"></var></span> |
|||
<input style="width:200px" id="url" type="text" value=""/> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td colspan="2" class="format"><span><var id="lang_input_width"></var></span><input style="width:200px" type="text" id="width"/> px</td> |
|||
|
|||
</tr> |
|||
<tr> |
|||
<td colspan="2" class="format"><span><var id="lang_input_height"></var></span><input style="width:200px" type="text" id="height"/> px</td> |
|||
</tr> |
|||
<tr> |
|||
<td><span><var id="lang_input_isScroll"></var></span><input type="checkbox" id="scroll"/> </td> |
|||
<td><span><var id="lang_input_frameborder"></var></span><input type="checkbox" id="frameborder"/> </td> |
|||
</tr> |
|||
|
|||
<tr> |
|||
<td colspan="2"><span><var id="lang_input_alignMode"></var></span> |
|||
<select id="align"> |
|||
<option value=""></option> |
|||
<option value="left"></option> |
|||
<option value="right"></option> |
|||
</select> |
|||
</td> |
|||
</tr> |
|||
</table> |
|||
</div> |
|||
<script type="text/javascript"> |
|||
var iframe = editor._iframe; |
|||
if(iframe){ |
|||
$G("url").value = iframe.getAttribute("src")||""; |
|||
$G("width").value = iframe.getAttribute("width")||iframe.style.width.replace("px","")||""; |
|||
$G("height").value = iframe.getAttribute("height") || iframe.style.height.replace("px","") ||""; |
|||
$G("scroll").checked = (iframe.getAttribute("scrolling") == "yes") ? true : false; |
|||
$G("frameborder").checked = (iframe.getAttribute("frameborder") == "1") ? true : false; |
|||
$G("align").value = iframe.align ? iframe.align : ""; |
|||
} |
|||
function queding(){ |
|||
var url = $G("url").value.replace(/^\s*|\s*$/ig,""), |
|||
width = $G("width").value, |
|||
height = $G("height").value, |
|||
scroll = $G("scroll"), |
|||
frameborder = $G("frameborder"), |
|||
float = $G("align").value, |
|||
newIframe = editor.document.createElement("iframe"), |
|||
div; |
|||
if(!url){ |
|||
alert(lang.enterAddress); |
|||
return false; |
|||
} |
|||
newIframe.setAttribute("src",/http:\/\/|https:\/\//ig.test(url) ? url : "http://"+url); |
|||
/^[1-9]+[.]?\d*$/g.test( width ) ? newIframe.setAttribute("width",width) : ""; |
|||
/^[1-9]+[.]?\d*$/g.test( height ) ? newIframe.setAttribute("height",height) : ""; |
|||
scroll.checked ? newIframe.setAttribute("scrolling","yes") : newIframe.setAttribute("scrolling","no"); |
|||
frameborder.checked ? newIframe.setAttribute("frameborder","1",0) : newIframe.setAttribute("frameborder","0",0); |
|||
float ? newIframe.setAttribute("align",float) : newIframe.setAttribute("align",""); |
|||
if(iframe){ |
|||
iframe.parentNode.insertBefore(newIframe,iframe); |
|||
domUtils.remove(iframe); |
|||
}else{ |
|||
div = editor.document.createElement("div"); |
|||
div.appendChild(newIframe); |
|||
editor.execCommand("inserthtml",div.innerHTML); |
|||
} |
|||
editor._iframe = null; |
|||
dialog.close(); |
|||
} |
|||
dialog.onok = queding; |
|||
$G("url").onkeydown = function(evt){ |
|||
evt = evt || event; |
|||
if(evt.keyCode == 13){ |
|||
queding(); |
|||
} |
|||
}; |
|||
$focus($G( "url" )); |
|||
|
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,81 @@ |
|||
(function () { |
|||
var parent = window.parent; |
|||
//dialog对象
|
|||
dialog = parent.$EDITORUI[window.frameElement.id.replace( /_iframe$/, '' )]; |
|||
//当前打开dialog的编辑器实例
|
|||
editor = dialog.editor; |
|||
|
|||
UE = parent.UE; |
|||
|
|||
domUtils = UE.dom.domUtils; |
|||
|
|||
utils = UE.utils; |
|||
|
|||
browser = UE.browser; |
|||
|
|||
ajax = UE.ajax; |
|||
|
|||
$G = function ( id ) { |
|||
return document.getElementById( id ) |
|||
}; |
|||
//focus元素
|
|||
$focus = function ( node ) { |
|||
setTimeout( function () { |
|||
if ( browser.ie ) { |
|||
var r = node.createTextRange(); |
|||
r.collapse( false ); |
|||
r.select(); |
|||
} else { |
|||
node.focus() |
|||
} |
|||
}, 0 ) |
|||
}; |
|||
utils.loadFile(document,{ |
|||
href:editor.options.themePath + editor.options.theme + "/dialogbase.css?cache="+Math.random(), |
|||
tag:"link", |
|||
type:"text/css", |
|||
rel:"stylesheet" |
|||
}); |
|||
lang = editor.getLang(dialog.className.split( "-" )[2]); |
|||
if(lang){ |
|||
domUtils.on(window,'load',function () { |
|||
|
|||
var langImgPath = editor.options.langPath + editor.options.lang + "/images/"; |
|||
//针对静态资源
|
|||
for ( var i in lang["static"] ) { |
|||
var dom = $G( i ); |
|||
if(!dom) continue; |
|||
var tagName = dom.tagName, |
|||
content = lang["static"][i]; |
|||
if(content.src){ |
|||
//clone
|
|||
content = utils.extend({},content,false); |
|||
content.src = langImgPath + content.src; |
|||
} |
|||
if(content.style){ |
|||
content = utils.extend({},content,false); |
|||
content.style = content.style.replace(/url\s*\(/g,"url(" + langImgPath) |
|||
} |
|||
switch ( tagName.toLowerCase() ) { |
|||
case "var": |
|||
dom.parentNode.replaceChild( document.createTextNode( content ), dom ); |
|||
break; |
|||
case "select": |
|||
var ops = dom.options; |
|||
for ( var j = 0, oj; oj = ops[j]; ) { |
|||
oj.innerHTML = content.options[j++]; |
|||
} |
|||
for ( var p in content ) { |
|||
p != "options" && dom.setAttribute( p, content[p] ); |
|||
} |
|||
break; |
|||
default : |
|||
domUtils.setAttributes( dom, content); |
|||
} |
|||
} |
|||
} ); |
|||
} |
|||
|
|||
|
|||
})(); |
|||
|
|||
@ -0,0 +1,126 @@ |
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
|||
"http://www.w3.org/TR/html4/loose.dtd"> |
|||
<html> |
|||
<head> |
|||
<title></title> |
|||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> |
|||
<script type="text/javascript" src="../internal.js"></script> |
|||
<style type="text/css"> |
|||
*{margin:0;padding:0;color: #838383;} |
|||
table{font-size: 12px;margin: 10px;line-height: 30px} |
|||
.txt{width:300px;height:21px;line-height:21px;border:1px solid #d7d7d7;} |
|||
</style> |
|||
</head> |
|||
<body> |
|||
<table> |
|||
<tr> |
|||
<td><label for="text"> <var id="lang_input_text"></var></label></td> |
|||
<td><input class="txt" id="text" type="text" disabled="true"/></td> |
|||
</tr> |
|||
<tr> |
|||
<td><label for="href"> <var id="lang_input_url"></var></label></td> |
|||
<td><input class="txt" id="href" type="text" /></td> |
|||
</tr> |
|||
<tr> |
|||
<td><label for="title"> <var id="lang_input_title"></var></label></td> |
|||
<td><input class="txt" id="title" type="text"/></td> |
|||
</tr> |
|||
<tr> |
|||
<td colspan="2"> |
|||
<label for="target"><var id="lang_input_target"></var></label> |
|||
<input id="target" type="checkbox"/> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td colspan="2" id="msg"></td> |
|||
</tr> |
|||
</table> |
|||
<script type="text/javascript"> |
|||
var range = editor.selection.getRange(), |
|||
link = range.collapsed ? editor.queryCommandValue( "link" ) : editor.selection.getStart(), |
|||
url, |
|||
text = $G('text'), |
|||
rangeLink = domUtils.findParentByTagName(range.getCommonAncestor(),'a',true), |
|||
orgText; |
|||
link = domUtils.findParentByTagName( link, "a", true ); |
|||
if(link){ |
|||
url = utils.html(link.getAttribute( '_href' ) || link.getAttribute( 'href', 2 )); |
|||
|
|||
if(rangeLink === link && !link.getElementsByTagName('img').length){ |
|||
text.removeAttribute('disabled'); |
|||
orgText = text.value = link[browser.ie ? 'innerText':'textContent']; |
|||
}else{ |
|||
text.setAttribute('disabled','true'); |
|||
text.value = lang.validLink; |
|||
} |
|||
|
|||
}else{ |
|||
if(range.collapsed){ |
|||
text.removeAttribute('disabled'); |
|||
text.value = ''; |
|||
}else{ |
|||
text.setAttribute('disabled','true'); |
|||
text.value = lang.validLink; |
|||
} |
|||
|
|||
} |
|||
$G("title").value = url ? link.title : ""; |
|||
$G("href").value = url ? url: ''; |
|||
$G("target").checked = url && link.target == "_blank" ? true : false; |
|||
$focus($G("href")); |
|||
|
|||
function handleDialogOk(){ |
|||
var href =$G('href').value.replace(/^\s+|\s+$/g, ''); |
|||
if(href){ |
|||
if(!hrefStartWith(href,["http","/","ftp://",'#'])) { |
|||
href = "http://" + href; |
|||
} |
|||
var obj = { |
|||
'href' : href, |
|||
'target' : $G("target").checked ? "_blank" : '_self', |
|||
'title' : $G("title").value.replace(/^\s+|\s+$/g, ''), |
|||
'_href':href |
|||
}; |
|||
//修改链接内容的情况太特殊了,所以先做到这里了 |
|||
//todo:情况多的时候,做到command里 |
|||
if(orgText && text.value != orgText){ |
|||
link[browser.ie ? 'innerText' : 'textContent'] = obj.textValue = text.value; |
|||
range.selectNode(link).select() |
|||
} |
|||
if(range.collapsed){ |
|||
obj.textValue = text.value; |
|||
} |
|||
editor.execCommand('link',utils.clearEmptyAttrs(obj) ); |
|||
dialog.close(); |
|||
} |
|||
} |
|||
dialog.onok = handleDialogOk; |
|||
$G('href').onkeydown = $G('title').onkeydown = function(evt){ |
|||
evt = evt || window.event; |
|||
if (evt.keyCode == 13) { |
|||
handleDialogOk(); |
|||
return false; |
|||
} |
|||
}; |
|||
$G('href').onblur = function(){ |
|||
if(!hrefStartWith(this.value,["http","/","ftp://",'#'])){ |
|||
$G("msg").innerHTML = "<span style='color: red'>"+lang.httpPrompt+"</span>"; |
|||
}else{ |
|||
$G("msg").innerHTML = ""; |
|||
} |
|||
}; |
|||
|
|||
function hrefStartWith(href,arr){ |
|||
href = href.replace(/^\s+|\s+$/g, ''); |
|||
for(var i=0,ai;ai=arr[i++];){ |
|||
if(href.indexOf(ai)==0){ |
|||
return true; |
|||
} |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
|
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,135 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
|||
<title></title> |
|||
<script type="text/javascript" src="../internal.js"></script> |
|||
<script type="text/javascript" src="./api.js?v=1.1&services=true"></script> |
|||
<style type="text/css"> |
|||
.content{width:530px; height: 350px;margin: 10px auto;} |
|||
.content table{width: 100%} |
|||
.content table td{vertical-align: middle;} |
|||
#city,#address{height:21px;background: #FFF;border:1px solid #d7d7d7; line-height: 21px;} |
|||
#city{width:60px} |
|||
#address{width:130px} |
|||
#is_dynamic_label span{vertical-align:middle;margin: 3px 0px 3px 3px;} |
|||
#is_dynamic_label input{vertical-align:middle;margin: 3px 3px 3px 50px;} |
|||
</style> |
|||
</head> |
|||
<body> |
|||
<div class="content"> |
|||
<table> |
|||
<tr> |
|||
<td><var id="lang_city"></var>:</td> |
|||
<td><input id="city" type="text" /></td> |
|||
<td><var id="lang_address"></var>:</td> |
|||
<td><input id="address" type="text" value="" /></td> |
|||
<td><a href="javascript:doSearch()" class="button"><var id="lang_search"></var></a></td> |
|||
<td><label id="is_dynamic_label" for="is_dynamic"><input id="is_dynamic" type="checkbox" name="is_dynamic" /><span><var id="lang_dynamicmap"></var></span></label></td> |
|||
</tr> |
|||
</table> |
|||
<div style="width:100%;height:340px;margin:5px auto;border:1px solid gray" id="container"></div> |
|||
|
|||
</div> |
|||
<script type="text/javascript"> |
|||
var map = new BMap.Map("container"),marker,point,styleStr; |
|||
map.enableScrollWheelZoom(); |
|||
map.enableContinuousZoom(); |
|||
function doSearch(){ |
|||
if (!document.getElementById('city').value) { |
|||
alert(lang.cityMsg); |
|||
return; |
|||
} |
|||
var search = new BMap.LocalSearch(document.getElementById('city').value, { |
|||
onSearchComplete: function (results){ |
|||
if (results && results.getNumPois()) { |
|||
var points = []; |
|||
for (var i=0; i<results.getCurrentNumPois(); i++) { |
|||
points.push(results.getPoi(i).point); |
|||
} |
|||
if (points.length > 1) { |
|||
map.setViewport(points); |
|||
} else { |
|||
map.centerAndZoom(points[0], 13); |
|||
} |
|||
point = map.getCenter(); |
|||
marker.setPoint(point); |
|||
} else { |
|||
alert(lang.errorMsg); |
|||
} |
|||
} |
|||
}); |
|||
search.search(document.getElementById('address').value || document.getElementById('city').value); |
|||
} |
|||
//获得参数 |
|||
function getPars(str,par){ |
|||
var reg = new RegExp(par+"=((\\d+|[.,])*)","g"); |
|||
return reg.exec(str)[1]; |
|||
} |
|||
function init(){ |
|||
var mapNode = editor.selection.getRange().getClosedNode(), |
|||
isMapImg = mapNode && /api[.]map[.]baidu[.]com/ig.test(mapNode.getAttribute("src")), |
|||
isMapIframe = mapNode && domUtils.hasClass(mapNode, 'ueditor_baidumap'); |
|||
if(isMapImg || isMapIframe){ |
|||
var url, centerPos, markerPos; |
|||
if(isMapIframe) { |
|||
url = decodeURIComponent(mapNode.getAttribute("src")); |
|||
$G('is_dynamic').checked = true; |
|||
styleStr = mapNode.style.cssText; |
|||
} else { |
|||
url = mapNode.getAttribute("src"); |
|||
styleStr = mapNode.style.cssText; |
|||
} |
|||
|
|||
centerPos = getPars(url,"center").split(","); |
|||
markerPos = getPars(url, "markers").split(","); |
|||
point = new BMap.Point(Number(centerPos[0]),Number(centerPos[1])); |
|||
marker = new BMap.Marker(new BMap.Point(Number(markerPos[0]), Number(markerPos[1]))); |
|||
map.addControl(new BMap.NavigationControl()); |
|||
map.centerAndZoom(point, Number(getPars(url,"zoom"))); |
|||
}else{ |
|||
point = new BMap.Point(116.404, 39.915); // 创建点坐标 |
|||
marker = new BMap.Marker(point); |
|||
map.addControl(new BMap.NavigationControl()); |
|||
map.centerAndZoom(point, 10); // 初始化地图,设置中心点坐标和地图级别。 |
|||
} |
|||
marker.enableDragging(); |
|||
map.addOverlay(marker); |
|||
} |
|||
init(); |
|||
document.getElementById('address').onkeydown = function (evt){ |
|||
evt = evt || event; |
|||
if (evt.keyCode == 13) { |
|||
doSearch(); |
|||
} |
|||
}; |
|||
dialog.onok = function (){ |
|||
var center = map.getCenter(); |
|||
var zoom = map.zoomLevel; |
|||
var size = map.getSize(); |
|||
var mapWidth = size.width; |
|||
var mapHeight = size.height; |
|||
var point = marker.getPoint(); |
|||
|
|||
if($G('is_dynamic').checked) { |
|||
var URL = editor.options.UEDITOR_HOME_URL, |
|||
url = [URL + (/\/$/.test(URL) ? '':'/') + "dialogs/map/show.html" + |
|||
'#center=' + center.lng + ',' + center.lat, |
|||
'&zoom=' + zoom, |
|||
'&width=' + mapWidth, |
|||
'&height=' + mapHeight, |
|||
'&markers=' + point.lng + ',' + point.lat, |
|||
'&markerStyles=' + 'l,A'].join(''); |
|||
editor.execCommand('inserthtml', '<iframe class="ueditor_baidumap" src="' + url + '"' + (styleStr ? ' style="' + styleStr + '"' :'') + ' frameborder="0" width="' + (mapWidth+4) + '" height="' + (mapHeight+4) + '"></iframe>'); |
|||
} else { |
|||
var url = "https://api.map.baidu.com/staticimage?center=" + center.lng + ',' + center.lat + |
|||
"&zoom=" + zoom + "&width=" + size.width + '&height=' + size.height + "&markers=" + point.lng + ',' + point.lat; |
|||
editor.execCommand('inserthtml', '<img width="'+ size.width +'"height="'+ size.height +'" src="' + url + '"' + (styleStr ? ' style="' + styleStr + '"' :'') + '/>'); |
|||
} |
|||
}; |
|||
document.getElementById("address").focus(); |
|||
</script> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
|
After Width: | Height: | Size: 453 B |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 734 B |
|
After Width: | Height: | Size: 1.0 KiB |
@ -0,0 +1 @@ |
|||
|
|||
@ -0,0 +1,13 @@ |
|||
/* |
|||
Highcharts JS v3.0.6 (2013-10-04) |
|||
MooTools adapter |
|||
|
|||
(c) 2010-2013 Torstein Hønsi |
|||
|
|||
License: www.highcharts.com/license |
|||
*/ |
|||
(function(){var e=window,h=document,f=e.MooTools.version.substring(0,3),i=f==="1.2"||f==="1.1",j=i||f==="1.3",g=e.$extend||function(){return Object.append.apply(Object,arguments)};e.HighchartsAdapter={init:function(a){var b=Fx.prototype,c=b.start,d=Fx.Morph.prototype,e=d.compute;b.start=function(b,d){var e=this.element;if(b.d)this.paths=a.init(e,e.d,this.toD);c.apply(this,arguments);return this};d.compute=function(b,c,d){var f=this.paths;if(f)this.element.attr("d",a.step(f[0],f[1],d,this.toD));else return e.apply(this, |
|||
arguments)}},adapterRun:function(a,b){if(b==="width"||b==="height")return parseInt($(a).getStyle(b),10)},getScript:function(a,b){var c=h.getElementsByTagName("head")[0],d=h.createElement("script");d.type="text/javascript";d.src=a;d.onload=b;c.appendChild(d)},animate:function(a,b,c){var d=a.attr,f=c&&c.complete;if(d&&!a.setStyle)a.getStyle=a.attr,a.setStyle=function(){var a=arguments;this.attr.call(this,a[0],a[1][0])},a.$family=function(){return!0};e.HighchartsAdapter.stop(a);c=new Fx.Morph(d?a:$(a), |
|||
g({transition:Fx.Transitions.Quad.easeInOut},c));if(d)c.element=a;if(b.d)c.toD=b.d;f&&c.addEvent("complete",f);c.start(b);a.fx=c},each:function(a,b){return i?$each(a,b):Array.each(a,b)},map:function(a,b){return a.map(b)},grep:function(a,b){return a.filter(b)},inArray:function(a,b,c){return b?b.indexOf(a,c):-1},offset:function(a){a=a.getPosition();return{left:a.x,top:a.y}},extendWithEvents:function(a){a.addEvent||(a.nodeName?$(a):g(a,new Events))},addEvent:function(a,b,c){typeof b==="string"&&(b=== |
|||
"unload"&&(b="beforeunload"),e.HighchartsAdapter.extendWithEvents(a),a.addEvent(b,c))},removeEvent:function(a,b,c){typeof a!=="string"&&a.addEvent&&(b?(b==="unload"&&(b="beforeunload"),c?a.removeEvent(b,c):a.removeEvents&&a.removeEvents(b)):a.removeEvents())},fireEvent:function(a,b,c,d){b={type:b,target:a};b=j?new Event(b):new DOMEvent(b);b=g(b,c);if(!b.target&&b.event)b.target=b.event.target;b.preventDefault=function(){d=null};a.fireEvent&&a.fireEvent(b.type,b);d&&d(b)},washMouseEvent:function(a){if(a.page)a.pageX= |
|||
a.page.x,a.pageY=a.page.y;return a},stop:function(a){a.fx&&a.fx.cancel()}}})(); |
|||
@ -0,0 +1,313 @@ |
|||
/** |
|||
* @license Highcharts JS v3.0.6 (2013-10-04) |
|||
* MooTools adapter |
|||
* |
|||
* (c) 2010-2013 Torstein Hønsi |
|||
* |
|||
* License: www.highcharts.com/license |
|||
*/ |
|||
|
|||
// JSLint options:
|
|||
/*global Fx, $, $extend, $each, $merge, Events, Event, DOMEvent */ |
|||
|
|||
(function () { |
|||
|
|||
var win = window, |
|||
doc = document, |
|||
mooVersion = win.MooTools.version.substring(0, 3), // Get the first three characters of the version number
|
|||
legacy = mooVersion === '1.2' || mooVersion === '1.1', // 1.1 && 1.2 considered legacy, 1.3 is not.
|
|||
legacyEvent = legacy || mooVersion === '1.3', // In versions 1.1 - 1.3 the event class is named Event, in newer versions it is named DOMEvent.
|
|||
$extend = win.$extend || function () { |
|||
return Object.append.apply(Object, arguments); |
|||
}; |
|||
|
|||
win.HighchartsAdapter = { |
|||
/** |
|||
* Initialize the adapter. This is run once as Highcharts is first run. |
|||
* @param {Object} pathAnim The helper object to do animations across adapters. |
|||
*/ |
|||
init: function (pathAnim) { |
|||
var fxProto = Fx.prototype, |
|||
fxStart = fxProto.start, |
|||
morphProto = Fx.Morph.prototype, |
|||
morphCompute = morphProto.compute; |
|||
|
|||
// override Fx.start to allow animation of SVG element wrappers
|
|||
/*jslint unparam: true*//* allow unused parameters in fx functions */ |
|||
fxProto.start = function (from, to) { |
|||
var fx = this, |
|||
elem = fx.element; |
|||
|
|||
// special for animating paths
|
|||
if (from.d) { |
|||
//this.fromD = this.element.d.split(' ');
|
|||
fx.paths = pathAnim.init( |
|||
elem, |
|||
elem.d, |
|||
fx.toD |
|||
); |
|||
} |
|||
fxStart.apply(fx, arguments); |
|||
|
|||
return this; // chainable
|
|||
}; |
|||
|
|||
// override Fx.step to allow animation of SVG element wrappers
|
|||
morphProto.compute = function (from, to, delta) { |
|||
var fx = this, |
|||
paths = fx.paths; |
|||
|
|||
if (paths) { |
|||
fx.element.attr( |
|||
'd', |
|||
pathAnim.step(paths[0], paths[1], delta, fx.toD) |
|||
); |
|||
} else { |
|||
return morphCompute.apply(fx, arguments); |
|||
} |
|||
}; |
|||
/*jslint unparam: false*/ |
|||
}, |
|||
|
|||
/** |
|||
* Run a general method on the framework, following jQuery syntax |
|||
* @param {Object} el The HTML element |
|||
* @param {String} method Which method to run on the wrapped element |
|||
*/ |
|||
adapterRun: function (el, method) { |
|||
|
|||
// This currently works for getting inner width and height. If adding
|
|||
// more methods later, we need a conditional implementation for each.
|
|||
if (method === 'width' || method === 'height') { |
|||
return parseInt($(el).getStyle(method), 10); |
|||
} |
|||
}, |
|||
|
|||
/** |
|||
* Downloads a script and executes a callback when done. |
|||
* @param {String} scriptLocation |
|||
* @param {Function} callback |
|||
*/ |
|||
getScript: function (scriptLocation, callback) { |
|||
// We cannot assume that Assets class from mootools-more is available so instead insert a script tag to download script.
|
|||
var head = doc.getElementsByTagName('head')[0]; |
|||
var script = doc.createElement('script'); |
|||
|
|||
script.type = 'text/javascript'; |
|||
script.src = scriptLocation; |
|||
script.onload = callback; |
|||
|
|||
head.appendChild(script); |
|||
}, |
|||
|
|||
/** |
|||
* Animate a HTML element or SVG element wrapper |
|||
* @param {Object} el |
|||
* @param {Object} params |
|||
* @param {Object} options jQuery-like animation options: duration, easing, callback |
|||
*/ |
|||
animate: function (el, params, options) { |
|||
var isSVGElement = el.attr, |
|||
effect, |
|||
complete = options && options.complete; |
|||
|
|||
if (isSVGElement && !el.setStyle) { |
|||
// add setStyle and getStyle methods for internal use in Moo
|
|||
el.getStyle = el.attr; |
|||
el.setStyle = function () { // property value is given as array in Moo - break it down
|
|||
var args = arguments; |
|||
this.attr.call(this, args[0], args[1][0]); |
|||
}; |
|||
// dirty hack to trick Moo into handling el as an element wrapper
|
|||
el.$family = function () { return true; }; |
|||
} |
|||
|
|||
// stop running animations
|
|||
win.HighchartsAdapter.stop(el); |
|||
|
|||
// define and run the effect
|
|||
effect = new Fx.Morph( |
|||
isSVGElement ? el : $(el), |
|||
$extend({ |
|||
transition: Fx.Transitions.Quad.easeInOut |
|||
}, options) |
|||
); |
|||
|
|||
// Make sure that the element reference is set when animating svg elements
|
|||
if (isSVGElement) { |
|||
effect.element = el; |
|||
} |
|||
|
|||
// special treatment for paths
|
|||
if (params.d) { |
|||
effect.toD = params.d; |
|||
} |
|||
|
|||
// jQuery-like events
|
|||
if (complete) { |
|||
effect.addEvent('complete', complete); |
|||
} |
|||
|
|||
// run
|
|||
effect.start(params); |
|||
|
|||
// record for use in stop method
|
|||
el.fx = effect; |
|||
}, |
|||
|
|||
/** |
|||
* MooTool's each function |
|||
* |
|||
*/ |
|||
each: function (arr, fn) { |
|||
return legacy ? |
|||
$each(arr, fn) : |
|||
Array.each(arr, fn); |
|||
}, |
|||
|
|||
/** |
|||
* Map an array |
|||
* @param {Array} arr |
|||
* @param {Function} fn |
|||
*/ |
|||
map: function (arr, fn) { |
|||
return arr.map(fn); |
|||
}, |
|||
|
|||
/** |
|||
* Grep or filter an array |
|||
* @param {Array} arr |
|||
* @param {Function} fn |
|||
*/ |
|||
grep: function (arr, fn) { |
|||
return arr.filter(fn); |
|||
}, |
|||
|
|||
/** |
|||
* Return the index of an item in an array, or -1 if not matched |
|||
*/ |
|||
inArray: function (item, arr, from) { |
|||
return arr ? arr.indexOf(item, from) : -1; |
|||
}, |
|||
|
|||
/** |
|||
* Get the offset of an element relative to the top left corner of the web page |
|||
*/ |
|||
offset: function (el) { |
|||
var offsets = el.getPosition(); // #1496
|
|||
return { |
|||
left: offsets.x, |
|||
top: offsets.y |
|||
}; |
|||
}, |
|||
|
|||
/** |
|||
* Extends an object with Events, if its not done |
|||
*/ |
|||
extendWithEvents: function (el) { |
|||
// if the addEvent method is not defined, el is a custom Highcharts object
|
|||
// like series or point
|
|||
if (!el.addEvent) { |
|||
if (el.nodeName) { |
|||
el = $(el); // a dynamically generated node
|
|||
} else { |
|||
$extend(el, new Events()); // a custom object
|
|||
} |
|||
} |
|||
}, |
|||
|
|||
/** |
|||
* Add an event listener |
|||
* @param {Object} el HTML element or custom object |
|||
* @param {String} type Event type |
|||
* @param {Function} fn Event handler |
|||
*/ |
|||
addEvent: function (el, type, fn) { |
|||
if (typeof type === 'string') { // chart broke due to el being string, type function
|
|||
|
|||
if (type === 'unload') { // Moo self destructs before custom unload events
|
|||
type = 'beforeunload'; |
|||
} |
|||
|
|||
win.HighchartsAdapter.extendWithEvents(el); |
|||
|
|||
el.addEvent(type, fn); |
|||
} |
|||
}, |
|||
|
|||
removeEvent: function (el, type, fn) { |
|||
if (typeof el === 'string') { |
|||
// el.removeEvents below apperantly calls this method again. Do not quite understand why, so for now just bail out.
|
|||
return; |
|||
} |
|||
|
|||
if (el.addEvent) { // If el doesn't have an addEvent method, there are no events to remove
|
|||
if (type) { |
|||
if (type === 'unload') { // Moo self destructs before custom unload events
|
|||
type = 'beforeunload'; |
|||
} |
|||
|
|||
if (fn) { |
|||
el.removeEvent(type, fn); |
|||
} else if (el.removeEvents) { // #958
|
|||
el.removeEvents(type); |
|||
} |
|||
} else { |
|||
el.removeEvents(); |
|||
} |
|||
} |
|||
}, |
|||
|
|||
fireEvent: function (el, event, eventArguments, defaultFunction) { |
|||
var eventArgs = { |
|||
type: event, |
|||
target: el |
|||
}; |
|||
// create an event object that keeps all functions
|
|||
event = legacyEvent ? new Event(eventArgs) : new DOMEvent(eventArgs); |
|||
event = $extend(event, eventArguments); |
|||
|
|||
// When running an event on the Chart.prototype, MooTools nests the target in event.event
|
|||
if (!event.target && event.event) { |
|||
event.target = event.event.target; |
|||
} |
|||
|
|||
// override the preventDefault function to be able to use
|
|||
// this for custom events
|
|||
event.preventDefault = function () { |
|||
defaultFunction = null; |
|||
}; |
|||
// if fireEvent is not available on the object, there hasn't been added
|
|||
// any events to it above
|
|||
if (el.fireEvent) { |
|||
el.fireEvent(event.type, event); |
|||
} |
|||
|
|||
// fire the default if it is passed and it is not prevented above
|
|||
if (defaultFunction) { |
|||
defaultFunction(event); |
|||
} |
|||
}, |
|||
|
|||
/** |
|||
* Set back e.pageX and e.pageY that MooTools has abstracted away. #1165, #1346. |
|||
*/ |
|||
washMouseEvent: function (e) { |
|||
if (e.page) { |
|||
e.pageX = e.page.x; |
|||
e.pageY = e.page.y; |
|||
} |
|||
return e; |
|||
}, |
|||
|
|||
/** |
|||
* Stop running animations on the object |
|||
*/ |
|||
stop: function (el) { |
|||
if (el.fx) { |
|||
el.fx.cancel(); |
|||
} |
|||
} |
|||
}; |
|||
|
|||
}()); |
|||
@ -0,0 +1,27 @@ |
|||
/* |
|||
Map plugin v0.1 for Highcharts |
|||
|
|||
(c) 2011-2013 Torstein Hønsi |
|||
|
|||
License: www.highcharts.com/license |
|||
*/ |
|||
(function(g){function x(a,b,c){for(var d=4,e=[];d--;)e[d]=Math.round(b.rgba[d]+(a.rgba[d]-b.rgba[d])*(1-c));return"rgba("+e.join(",")+")"}var r=g.Axis,y=g.Chart,s=g.Point,z=g.Pointer,l=g.each,v=g.extend,p=g.merge,n=g.pick,A=g.numberFormat,B=g.getOptions(),k=g.seriesTypes,q=B.plotOptions,t=g.wrap,u=g.Color,w=function(){};B.mapNavigation={buttonOptions:{align:"right",verticalAlign:"bottom",x:0,width:18,height:18,style:{fontSize:"15px",fontWeight:"bold",textAlign:"center"}},buttons:{zoomIn:{onclick:function(){this.mapZoom(0.5)}, |
|||
text:"+",y:-32},zoomOut:{onclick:function(){this.mapZoom(2)},text:"-",y:0}}};g.splitPath=function(a){var b,a=a.replace(/([A-Za-z])/g," $1 "),a=a.replace(/^\s*/,"").replace(/\s*$/,""),a=a.split(/[ ,]+/);for(b=0;b<a.length;b++)/[a-zA-Z]/.test(a[b])||(a[b]=parseFloat(a[b]));return a};g.maps={};t(r.prototype,"getSeriesExtremes",function(a){var b=this.isXAxis,c,d,e=[];l(this.series,function(a,b){if(a.useMapGeometry)e[b]=a.xData,a.xData=[]});a.call(this);c=n(this.dataMin,Number.MAX_VALUE);d=n(this.dataMax, |
|||
Number.MIN_VALUE);l(this.series,function(a,i){if(a.useMapGeometry)c=Math.min(c,a[b?"minX":"minY"]),d=Math.max(d,a[b?"maxX":"maxY"]),a.xData=e[i]});this.dataMin=c;this.dataMax=d});t(r.prototype,"setAxisTranslation",function(a){var b=this.chart,c=b.plotWidth/b.plotHeight,d=this.isXAxis,e=b.xAxis[0];a.call(this);if(b.options.chart.type==="map"&&!d&&e.transA!==void 0)this.transA=e.transA=Math.min(this.transA,e.transA),a=(e.max-e.min)/(this.max-this.min),e=a>c?this:e,c=(e.max-e.min)*e.transA,e.minPixelPadding= |
|||
(e.len-c)/2});t(y.prototype,"render",function(a){var b=this,c=b.options.mapNavigation;a.call(b);b.renderMapNavigation();c.zoomOnDoubleClick&&g.addEvent(b.container,"dblclick",function(a){b.pointer.onContainerDblClick(a)});c.zoomOnMouseWheel&&g.addEvent(b.container,document.onmousewheel===void 0?"DOMMouseScroll":"mousewheel",function(a){b.pointer.onContainerMouseWheel(a)})});v(z.prototype,{onContainerDblClick:function(a){var b=this.chart,a=this.normalize(a);b.isInsidePlot(a.chartX-b.plotLeft,a.chartY- |
|||
b.plotTop)&&b.mapZoom(0.5,b.xAxis[0].toValue(a.chartX),b.yAxis[0].toValue(a.chartY))},onContainerMouseWheel:function(a){var b=this.chart,c,a=this.normalize(a);c=a.detail||-(a.wheelDelta/120);b.isInsidePlot(a.chartX-b.plotLeft,a.chartY-b.plotTop)&&b.mapZoom(c>0?2:0.5,b.xAxis[0].toValue(a.chartX),b.yAxis[0].toValue(a.chartY))}});t(z.prototype,"init",function(a,b,c){a.call(this,b,c);if(c.mapNavigation.enableTouchZoom)this.pinchX=this.pinchHor=this.pinchY=this.pinchVert=!0});v(y.prototype,{renderMapNavigation:function(){var a= |
|||
this,b=this.options.mapNavigation,c=b.buttons,d,e,f,i=function(){this.handler.call(a)};if(b.enableButtons)for(d in c)if(c.hasOwnProperty(d))f=p(b.buttonOptions,c[d]),e=a.renderer.button(f.text,0,0,i).attr({width:f.width,height:f.height}).css(f.style).add(),e.handler=f.onclick,e.align(v(f,{width:e.width,height:e.height}),null,"spacingBox")},fitToBox:function(a,b){l([["x","width"],["y","height"]],function(c){var d=c[0],c=c[1];a[d]+a[c]>b[d]+b[c]&&(a[c]>b[c]?(a[c]=b[c],a[d]=b[d]):a[d]=b[d]+b[c]-a[c]); |
|||
a[c]>b[c]&&(a[c]=b[c]);a[d]<b[d]&&(a[d]=b[d])});return a},mapZoom:function(a,b,c){if(!this.isMapZooming){var d=this,e=d.xAxis[0],f=e.max-e.min,i=n(b,e.min+f/2),b=f*a,f=d.yAxis[0],h=f.max-f.min,c=n(c,f.min+h/2);a*=h;i-=b/2;h=c-a/2;c=n(d.options.chart.animation,!0);b=d.fitToBox({x:i,y:h,width:b,height:a},{x:e.dataMin,y:f.dataMin,width:e.dataMax-e.dataMin,height:f.dataMax-f.dataMin});e.setExtremes(b.x,b.x+b.width,!1);f.setExtremes(b.y,b.y+b.height,!1);if(e=c?c.duration||500:0)d.isMapZooming=!0,setTimeout(function(){d.isMapZooming= |
|||
!1},e);d.redraw()}}});q.map=p(q.scatter,{animation:!1,nullColor:"#F8F8F8",borderColor:"silver",borderWidth:1,marker:null,stickyTracking:!1,dataLabels:{verticalAlign:"middle"},turboThreshold:0,tooltip:{followPointer:!0,pointFormat:"{point.name}: {point.y}<br/>"},states:{normal:{animation:!0}}});r=g.extendClass(s,{applyOptions:function(a,b){var c=s.prototype.applyOptions.call(this,a,b);if(c.path&&typeof c.path==="string")c.path=c.options.path=g.splitPath(c.path);return c},onMouseOver:function(){clearTimeout(this.colorInterval); |
|||
s.prototype.onMouseOver.call(this)},onMouseOut:function(){var a=this,b=+new Date,c=u(a.options.color),d=u(a.pointAttr.hover.fill),e=a.series.options.states.normal.animation,f=e&&(e.duration||500);if(f&&c.rgba.length===4&&d.rgba.length===4)delete a.pointAttr[""].fill,clearTimeout(a.colorInterval),a.colorInterval=setInterval(function(){var e=(new Date-b)/f,h=a.graphic;e>1&&(e=1);h&&h.attr("fill",x(d,c,e));e>=1&&clearTimeout(a.colorInterval)},13);s.prototype.onMouseOut.call(a)}});k.map=g.extendClass(k.scatter, |
|||
{type:"map",pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color"},colorKey:"y",pointClass:r,trackerGroups:["group","markerGroup","dataLabelsGroup"],getSymbol:w,supportsDrilldown:!0,getExtremesFromAll:!0,useMapGeometry:!0,init:function(a){var b=this,c=a.options.legend.valueDecimals,d=[],e,f,i,h,j,o,m;o=a.options.legend.layout==="horizontal";g.Series.prototype.init.apply(this,arguments);j=b.options.colorRange;if(h=b.options.valueRanges)l(h,function(a){f=a.from;i=a.to;e= |
|||
"";f===void 0?e="< ":i===void 0&&(e="> ");f!==void 0&&(e+=A(f,c));f!==void 0&&i!==void 0&&(e+=" - ");i!==void 0&&(e+=A(i,c));d.push(g.extend({chart:b.chart,name:e,options:{},drawLegendSymbol:k.area.prototype.drawLegendSymbol,visible:!0,setState:function(){},setVisible:function(){}},a))}),b.legendItems=d;else if(j)f=j.from,i=j.to,h=j.fromLabel,j=j.toLabel,m=o?[0,0,1,0]:[0,1,0,0],o||(o=h,h=j,j=o),o={linearGradient:{x1:m[0],y1:m[1],x2:m[2],y2:m[3]},stops:[[0,f],[1,i]]},d=[{chart:b.chart,options:{},fromLabel:h, |
|||
toLabel:j,color:o,drawLegendSymbol:this.drawLegendSymbolGradient,visible:!0,setState:function(){},setVisible:function(){}}],b.legendItems=d},drawLegendSymbol:k.area.prototype.drawLegendSymbol,drawLegendSymbolGradient:function(a,b){var c=a.options.symbolPadding,d=n(a.options.padding,8),e,f,i=this.chart.renderer.fontMetrics(a.options.itemStyle.fontSize).h,h=a.options.layout==="horizontal",j;j=n(a.options.rectangleLength,200);h?(e=-(c/2),f=0):(e=-j+a.baseline-c/2,f=d+i);b.fromText=this.chart.renderer.text(b.fromLabel, |
|||
f,e).attr({zIndex:2}).add(b.legendGroup);f=b.fromText.getBBox();b.legendSymbol=this.chart.renderer.rect(h?f.x+f.width+c:f.x-i-c,f.y,h?j:i,h?i:j,2).attr({zIndex:1}).add(b.legendGroup);j=b.legendSymbol.getBBox();b.toText=this.chart.renderer.text(b.toLabel,j.x+j.width+c,h?e:j.y+j.height-c).attr({zIndex:2}).add(b.legendGroup);e=b.toText.getBBox();h?(a.offsetWidth=f.width+j.width+e.width+c*2+d,a.itemY=i+d):(a.offsetWidth=Math.max(f.width,e.width)+c+j.width+d,a.itemY=j.height+d,a.itemX=c)},getBox:function(a){var b= |
|||
Number.MIN_VALUE,c=Number.MAX_VALUE,d=Number.MIN_VALUE,e=Number.MAX_VALUE;l(a||this.options.data,function(a){for(var i=a.path,h=i.length,j=!1,g=Number.MIN_VALUE,m=Number.MAX_VALUE,k=Number.MIN_VALUE,l=Number.MAX_VALUE;h--;)typeof i[h]==="number"&&!isNaN(i[h])&&(j?(g=Math.max(g,i[h]),m=Math.min(m,i[h])):(k=Math.max(k,i[h]),l=Math.min(l,i[h])),j=!j);a._maxX=g;a._minX=m;a._maxY=k;a._minY=l;b=Math.max(b,g);c=Math.min(c,m);d=Math.max(d,k);e=Math.min(e,l)});this.minY=e;this.maxY=d;this.minX=c;this.maxX= |
|||
b},translatePath:function(a){var b=!1,c=this.xAxis,d=this.yAxis,e,a=[].concat(a);for(e=a.length;e--;)typeof a[e]==="number"&&(a[e]=b?Math.round(c.translate(a[e])):Math.round(d.len-d.translate(a[e])),b=!b);return a},setData:function(){g.Series.prototype.setData.apply(this,arguments);this.getBox()},translate:function(){var a=this,b=Number.MAX_VALUE,c=Number.MIN_VALUE;a.generatePoints();l(a.data,function(d){d.shapeType="path";d.shapeArgs={d:a.translatePath(d.path)};if(typeof d.y==="number")if(d.y>c)c= |
|||
d.y;else if(d.y<b)b=d.y});a.translateColors(b,c)},translateColors:function(a,b){var c=this.options,d=c.valueRanges,e=c.colorRange,f=this.colorKey,i,h;e&&(i=u(e.from),h=u(e.to));l(this.data,function(g){var k=g[f],m,l,n;if(d)for(n=d.length;n--;){if(m=d[n],i=m.from,h=m.to,(i===void 0||k>=i)&&(h===void 0||k<=h)){l=m.color;break}}else e&&k!==void 0&&(m=1-(b-k)/(b-a),l=k===null?c.nullColor:x(i,h,m));if(l)g.color=null,g.options.color=l})},drawGraph:w,drawDataLabels:w,drawPoints:function(){var a=this.xAxis, |
|||
b=this.yAxis,c=this.colorKey;l(this.data,function(a){a.plotY=1;if(a[c]===null)a[c]=0,a.isNull=!0});k.column.prototype.drawPoints.apply(this);l(this.data,function(d){var e=d.dataLabels,f=a.toPixels(d._minX,!0),g=a.toPixels(d._maxX,!0),h=b.toPixels(d._minY,!0),j=b.toPixels(d._maxY,!0);d.plotX=Math.round(f+(g-f)*n(e&&e.anchorX,0.5));d.plotY=Math.round(h+(j-h)*n(e&&e.anchorY,0.5));d.isNull&&(d[c]=null)});g.Series.prototype.drawDataLabels.call(this)},animateDrilldown:function(a){var b=this.chart.plotBox, |
|||
c=this.chart.drilldownLevels[this.chart.drilldownLevels.length-1],d=c.bBox,e=this.chart.options.drilldown.animation;if(!a)a=Math.min(d.width/b.width,d.height/b.height),c.shapeArgs={scaleX:a,scaleY:a,translateX:d.x,translateY:d.y},l(this.points,function(a){a.graphic.attr(c.shapeArgs).animate({scaleX:1,scaleY:1,translateX:0,translateY:0},e)}),delete this.animate},animateDrillupFrom:function(a){k.column.prototype.animateDrillupFrom.call(this,a)},animateDrillupTo:function(a){k.column.prototype.animateDrillupTo.call(this, |
|||
a)}});q.mapline=p(q.map,{lineWidth:1,backgroundColor:"none"});k.mapline=g.extendClass(k.map,{type:"mapline",pointAttrToOptions:{stroke:"color","stroke-width":"lineWidth",fill:"backgroundColor"},drawLegendSymbol:k.line.prototype.drawLegendSymbol});q.mappoint=p(q.scatter,{dataLabels:{enabled:!0,format:"{point.name}",color:"black",style:{textShadow:"0 0 5px white"}}});k.mappoint=g.extendClass(k.scatter,{type:"mappoint"});g.Map=function(a,b){var c={endOnTick:!1,gridLineWidth:0,labels:{enabled:!1},lineWidth:0, |
|||
minPadding:0,maxPadding:0,startOnTick:!1,tickWidth:0,title:null},d;d=a.series;a.series=null;a=p({chart:{type:"map",panning:"xy"},xAxis:c,yAxis:p(c,{reversed:!0})},a,{chart:{inverted:!1}});a.series=d;return new g.Chart(a,b)}})(Highcharts); |
|||
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 360 B |
|
After Width: | Height: | Size: 231 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 631 B |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
@ -0,0 +1 @@ |
|||
|
|||
@ -0,0 +1,22 @@ |
|||
define(function(){ |
|||
/** |
|||
|
|||
参数: |
|||
parentid: 父分类表单 id |
|||
childid: 子分类表单 id |
|||
|
|||
示例: |
|||
<select name="industry_1" id="industry_1" class="form-control" value="{$item['industry1']}"></select> |
|||
<select name="industry_2" id="industry_2" class="form-control" value="{$item['industry2']}"></select> |
|||
<script type="text/javascript"> |
|||
require(['industry'], function(industry){ |
|||
industry.init('industry_1','industry_2'); |
|||
}); |
|||
</script> |
|||
*/ |
|||
var init = function(parentid, childid){ |
|||
var CFD="不限";var CSD="不限";var ShowT=1;var CFData=[];var CSData=[];var CAData='';var CLIST='美食-1$本帮江浙菜-11,川菜-12,粤菜-13,湘菜-14,贵州菜-15,东北菜-16,台湾菜-17,新疆/清真菜-18,西北菜-19,素菜-20,火锅-21,自助餐-22,小吃快餐-23,日本-24,韩国料理-25,东南亚菜-26,西餐-27,面包甜点-28,其他-29#休闲娱乐-2$密室-30,咖啡厅-31,酒吧-32,茶馆-33,KTV-34,电影院-35,文化艺术-36,景点/郊游-37,公园-38,足疗按摩-39,洗浴-40,游乐游艺-41,桌球-42,桌面游戏-43,DIY手工坊-44,其他-45#购物-3$综合商场-46,食品茶酒-47,服饰鞋包-48,珠宝饰品-49,化妆品-50,运动户外-51,亲子购物-52,品牌折扣店-53,数码家电-54,家居建材-55,特色集市-56,书店-57,花店-58,眼镜店-59,超市/便利店-60,药店-61,其他-62#丽人-4$美发-63,美容/SPA-64,化妆品-65,瘦身纤体-66,美甲-67,瑜伽-68,舞蹈-69,个性写真-70,整形-71,齿科-72,其他-73#结婚-5$婚纱摄影-74,婚宴-75,婚戒首饰-76,婚纱礼服-77,婚庆公司-78,彩妆造型-79,司仪主持-80,婚礼跟拍-81,婚车租赁-82,婚礼小商品-83,婚房装修-84,其他-85#亲子-6$幼儿教育-86,亲子摄影-87,亲子游乐-88,亲子购物-89,孕产护理-90,其他-91#运动健身-7$游泳馆-92,羽毛球馆-93,健身中心-94,瑜伽-95,舞蹈-96,篮球场-97,网球场-98,足球场-99,高尔夫场-100,保龄球馆-101,桌球馆-102,乒乓球馆-103,武术场馆-104,体育场馆-105,其他-106#酒店-8$五星级酒店-107,四星级酒店-108,三星级酒店-109,经济型酒店-110,公寓式酒店-111,精品酒店-112,青年旅舍-113,度假村-114,其他-115#爱车-9$4S店/汽车销售-116,汽车保险-117,维修保养-118,配件/车饰-119,驾校-120,汽车租赁-121,停车场-122,加油站-123,其他-124#生活服务-10$旅行社-125,培训-126,室内装潢-127,宠物-128,齿科-129,快照/冲印-130,家政-131,银行-132,学校-133,团购网站-134,其他-135#其他-11$其他-136';function CS(){if(ShowT)CLIST=CFD+"$"+CSD+"#"+CLIST;CAData=CLIST.split("#");for(var i=0;i<CAData.length;i++){parts=CAData[i].split("$");CFData[i]=parts[0];CSData[i]=parts[1].split(",")}var self=this;this.SelF=document.getElementById(parentid);this.SelS=document.getElementById(childid);this.DefF=this.SelF.getAttribute('value');this.DefS=this.SelS.getAttribute('value');this.SelF.CS=this;this.SelS.CS=this;this.SelF.onchange=function(){CS.SetS(self)};CS.SetF(this)};CS.SetF=function(self){for(var i=0;i<CFData.length;i++){var title,value;title=CFData[i].split("-")[0];value=CFData[i].split("-")[0];if(title==CFD){value=""}self.SelF.options.add(new Option(title,value));if(self.DefF==value){self.SelF[i].selected=true}}CS.SetS(self)};CS.SetS=function(self){var fi=self.SelF.selectedIndex;var slist=CSData[fi];self.SelS.length=0;if(self.SelF.value!=""&&ShowT){self.SelS.options.add(new Option(CSD,""))}for(var i=0;i<slist.length;i++){var title,value;title=slist[i].split("-")[0];value=slist[i].split("-")[0];if(title==CSD){value=""}self.SelS.options.add(new Option(title,value));if(self.DefS==value){self.SelS[self.SelF.value!=""?i+1:i].selected=true}}}; |
|||
CS(); |
|||
}; |
|||
return {init: init}; |
|||
}); |
|||
@ -0,0 +1 @@ |
|||
var debug=function(e){console.log(e)},http={ajax:function(e,n,t){var s=new Headers;return s.append("Content-Type","application/json"),s.append("X-Requested-With","XMLHttpRequest"),fetch(e,{method:t,headers:s,credentials:"same-origin"})},get:function(e){return this.ajax(e,{},"get")},post:function(e,n){return this.ajax(e,n,"post")},json:function(e,n,t){return this.ajax(e,n,t).then(function(e){return e.json()})}},JobManager={jobs:{},getJob:function(e){return this.jobs[e]},isRunning:function(e){var n=this.jobs[e];return!(!n||!n.running)&&(debug(e+": isRunning"),!0)},start:function(e){this.isRunning(e.id)?debug(jobId+": 任务正在运行中"):(this.jobs[e.id]=e,this.execute(e))},pause:function(e){delete this.jobs[e.id]},fire:function(e){postMessage(e)},execute:function(n){if((n=this.getJob(n.id))&&!n.runing){n.runing=!0;try{var t=this;http.json(n.relUrl+"?c=system&a=job&do=execute&id="+n.id,"","get").then(function(e){0==e.message.errno&&(t.fire(e.message.message),e.message.message.finished||setTimeout(function(){t.execute(n)},1e3))}),n.runing=!1}catch(e){n.runing=!1}return!0}}};onmessage=function(e){var n=e.data;n.start?JobManager.start(n):JobManager.pause(n)}; |
|||
@ -0,0 +1,340 @@ |
|||
define(['jquery', 'underscore', 'bootstrap', 'jquery.wookmark', 'jquery.jplayer'], function($, _){ |
|||
var material = { |
|||
'defaultoptions' : { |
|||
callback : null, |
|||
type : 'all', |
|||
multiple : false, |
|||
ignore : { |
|||
'wxcard' : true, |
|||
'image' : false, |
|||
'news' : false, |
|||
'video' : false, |
|||
'voice' : false |
|||
} |
|||
}, |
|||
'init' : function(callback, options) { |
|||
var $this = this; |
|||
$this.options = $.extend({}, $this.defaultoptions, options); |
|||
$this.options.callback = callback; |
|||
$('#material-Modal').remove(); |
|||
$(document.body).append($this.buildHtml().mainDialog); |
|||
|
|||
$this.modalobj = $('#material-Modal'); |
|||
$this.modalobj.find('.modal-header .nav li a').click(function(){ |
|||
var type = $(this).data('type'); |
|||
$this.localPage(type, 1); |
|||
$(this).tab('show') |
|||
return false; |
|||
}); |
|||
if (!$(this).data('init')) { |
|||
if($this.options.type && $this.options.type != 'all') { |
|||
$this.modalobj.find('.modal-header .nav li.' + $this.options.type + ' a').trigger('click'); |
|||
} else { |
|||
$this.modalobj.find('.modal-header .nav li.show:first a').trigger('click'); |
|||
} |
|||
} |
|||
$this.modalobj.modal('show'); |
|||
return $this.modalobj; |
|||
}, |
|||
'localPage' : function(type, page) { |
|||
var $this = this; |
|||
var page = page || 1; |
|||
$('.checkMedia').removeClass('checkedMedia'); |
|||
var $content = $this.modalobj.find('.material-content #' + type); |
|||
$content.html('<div class="info text-center"><i class="fa fa-spinner fa-pulse fa-lg"></i> 数据加载中</div>'); |
|||
var url = './index.php?c=utility&a=material&do=list&type=' + type; |
|||
if(type == 'wxcard') { |
|||
url = './index.php?c=utility&a=coupon&do=wechat'; |
|||
} |
|||
$.getJSON(url, {'page': page}, function(data){ |
|||
data = data.message; |
|||
$this.modalobj.find('#material-list-pager').html(''); |
|||
if(!_.isEmpty(data.items)) { |
|||
$this.modalobj.find('#btn-select').show(); |
|||
$content.data('attachment', data.items); |
|||
$content.empty(); |
|||
var Dialog = type + 'Dialog'; |
|||
$content.html(_.template($this.buildHtml()[Dialog])(data)); |
|||
if(type == 'news') { |
|||
setTimeout(function(){ |
|||
$('.water').wookmark({ |
|||
align: 'center', |
|||
autoResize: false, |
|||
container: $('#news'), |
|||
autoResize :true |
|||
}); |
|||
}, 100); |
|||
} |
|||
$this.selectMedia(); |
|||
$this.playaudio(); |
|||
$this.modalobj.find('#material-list-pager').html(data.pager); |
|||
$this.modalobj.find('#material-list-pager .pagination a').click(function(){ |
|||
$this.localPage(type, $(this).attr('page')); |
|||
}); |
|||
} else { |
|||
$content.html('<div class="info text-center"><i class="fa fa-info-circle fa-lg"></i> 暂无数据</div>'); |
|||
} |
|||
}); |
|||
$this.modalobj.find('.modal-footer .btn-primary').unbind('click').click(function(){ |
|||
var attachment = []; |
|||
$content.find('.checkedMedia').each(function(){ |
|||
attachment.push($content.data('attachment')[$(this).data('attachid')]); |
|||
}); |
|||
$this.finish(attachment); |
|||
}); |
|||
return false; |
|||
}, |
|||
|
|||
'selectMedia' : function(){ |
|||
var $this = this; |
|||
$this.modalobj.on('click', '.checkMedia', function(){ |
|||
if(!$this.options.multiple) { |
|||
$('.checkMedia').removeClass('checkedMedia'); |
|||
} |
|||
$(this).addClass('checkedMedia'); |
|||
var type = $(this).data('type'); |
|||
if(type == 'news') { |
|||
if(!$this.options.multiple) { |
|||
$('#news .panel-group').removeClass('selected'); |
|||
} |
|||
$(this).addClass('selected'); |
|||
} else if(type == 'image') { |
|||
if(!$this.options.multiple) { |
|||
$('#image div').removeClass('img-item-selected'); |
|||
} |
|||
$(this).addClass('img-item-selected'); |
|||
} else { |
|||
if(!$this.options.multiple) { |
|||
$('.checkMedia').removeClass('btn-primary'); |
|||
} |
|||
$(this).addClass('btn-primary'); |
|||
} |
|||
if(!$this.options.multiple) { |
|||
$this.modalobj.find('.modal-footer .btn-primary').trigger('click'); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
'playaudio' : function(){ |
|||
$("#voice, .panel").on('click', '.audio-player-play', function(){ |
|||
var src = $(this).data("attach"); |
|||
if(!src) { |
|||
return; |
|||
} |
|||
if ($("#player")[0]) { |
|||
var player = $("#player"); |
|||
} else { |
|||
var player = $('<div id="player"></div>'); |
|||
$(document.body).append(player); |
|||
} |
|||
player.data('control', $(this)); |
|||
player.jPlayer({ |
|||
playing: function() { |
|||
$(this).data('control').find("i").removeClass("fa-play").addClass("fa-stop"); |
|||
}, |
|||
pause: function (event) { |
|||
$(this).data('control').find("i").removeClass("fa-stop").addClass("fa-play"); |
|||
}, |
|||
swfPath: "resource/components/jplayer", |
|||
supplied: "mp3,wma,wav,amr", |
|||
solution: "html, flash" |
|||
}); |
|||
player.jPlayer("setMedia", {mp3: $(this).data("attach")}).jPlayer("play"); |
|||
if($(this).find("i").hasClass("fa-stop")) { |
|||
player.jPlayer("stop"); |
|||
} else { |
|||
$('.audio-msg').find('.fa-stop').removeClass("fa-stop").addClass("fa-play"); |
|||
player.jPlayer("setMedia", {mp3: $(this).data("attach")}).jPlayer("play"); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
'finish' : function(attachment) { |
|||
var $this = this; |
|||
if($.isFunction($this.options.callback)) { |
|||
if ($this.options.multiple == false) { |
|||
$this.options.callback(attachment[0]); |
|||
} else { |
|||
$this.options.callback(attachment); |
|||
} |
|||
$this.modalobj.modal('hide'); |
|||
} |
|||
}, |
|||
|
|||
'buildHtml' : function() { |
|||
var dialog = {}; |
|||
dialog['mainDialog'] = '<div id="material-Modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">\n' + |
|||
' <div class="modal-dialog">\n' + |
|||
' <div class="modal-content modal-lg">\n' + |
|||
' <div class="modal-header">\n' + |
|||
' <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>\n' + |
|||
' <h3>'+ |
|||
' <ul role="tablist" class="nav nav-pills" style="font-size:14px; margin-top:-20px;">'+ |
|||
' <li role="presentation" class="news ' + (this.options.ignore.news ? 'hide' : 'show') + '">'+ |
|||
' <a data-toggle="tab" data-type="news" role="tab" aria-controls="news" href="#news">图文</a>'+ |
|||
' </li>'+ |
|||
' <li role="presentation" class="image ' + (this.options.ignore.image ? 'hide' : 'show') + '">'+ |
|||
' <a data-toggle="tab" data-type="image" role="tab" aria-controls="image" href="#image">图片</a>'+ |
|||
' </li>'+ |
|||
' <li role="presentation" class="voice ' + (this.options.ignore.voice ? 'hide' : 'show') + '">'+ |
|||
' <a data-toggle="tab" data-type="voice" role="tab" aria-controls="voice" href="#voice">语音</a>'+ |
|||
' </li>'+ |
|||
' <li role="presentation" class="video ' + (this.options.ignore.video ? 'hide' : 'show') + '">'+ |
|||
' <a data-toggle="tab" data-type="video" role="tab" aria-controls="video" href="#video">视频</a>'+ |
|||
' </li>'+ |
|||
' <li role="presentation" class="wxcard ' + (this.options.ignore.wxcard ? 'hide' : 'show') + '">'+ |
|||
' <a data-toggle="tab" data-type="wxcard" role="tab" aria-controls="wxcard" href="#wxcard">微信卡券</a>'+ |
|||
' </li>'+ |
|||
' </ul>'+ |
|||
' </h3>'+ |
|||
' </div>\n' + |
|||
' <div class="modal-body material-content">\n' + |
|||
' <div class="tab-content">'+ |
|||
' <div id="news" class="tab-pane material clearfix" class="active" role="tabpanel" style="position:relative"></div>'+ |
|||
' <div id="image" class="tab-pane history" role="tabpanel"></div>'+ |
|||
' <div id="voice" class="tab-pane" role="tabpanel"></div>'+ |
|||
' <div id="video" class="tab-pane" role="tabpanel"></div>'+ |
|||
' <div id="wxcard" class="tab-pane" role="tabpanel"></div>'+ |
|||
' </div>' + |
|||
' </div>\n' + |
|||
' <div class="modal-footer">\n' + |
|||
' <div style="float: left;">\n' + |
|||
' <nav id="material-list-pager">\n' + |
|||
' </nav>\n' + |
|||
' </div>\n' + |
|||
' <div id="btn-select" style="float: right; display: none">\n' + |
|||
' <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>\n' + |
|||
' <button type="button" class="btn btn-primary">确认</button>\n' + |
|||
' </div>\n' + |
|||
' </div>\n'+ |
|||
' </div>\n' + |
|||
' </div>\n' + |
|||
'</div>'; |
|||
|
|||
dialog['imageDialog'] = '<ul class="img-list clearfix">\n' + |
|||
'<%var items = _.sortBy(items, function(item) {return -item.id;});%>' + |
|||
'<%_.each(items, function(item) {%> \n' + |
|||
'<div class="checkMedia" data-media="<%=item.media_id%>" data-type="image" data-attachid="<%=item.id%>">' + |
|||
' <li class="img-item" style="padding:5px">\n' + |
|||
' <div class="img-container" style="background-image: url(\'<%=item.attach%>\');">\n' + |
|||
' <div class="select-status"><span></span></div>\n' + |
|||
' </div>\n' + |
|||
' </li>\n' + |
|||
'</div>\n' + |
|||
'<%});%>\n' + |
|||
'</ul>'; |
|||
|
|||
dialog['voiceDialog'] ='<table class="table table-hover table-bordered" style="margin-bottom:0">'+ |
|||
' <thead class="navbar-inner">'+ |
|||
' <tr>'+ |
|||
' <th>标题</th>'+ |
|||
' <th style="width:20%;text-align:right">创建时间</th>'+ |
|||
' <th style="width:20%;text-align:right"></th>'+ |
|||
' </tr>'+ |
|||
' </thead>'+ |
|||
' <tbody class="history-content">'+ |
|||
' <%var items = _.sortBy(items, function(item) {return -item.createtime;});%>' + |
|||
' <%_.each(items, function(item) {%> \n' + |
|||
' <tr>'+ |
|||
' <td><%=item.filename%></td>'+ |
|||
' <td align="right"><%=item.createtime_cn%></td>'+ |
|||
' <td align="right">'+ |
|||
' <div class="btn-group">'+ |
|||
' <a href="javascript:;" class="btn btn-default btn-sm audio-player-play audio-msg" data-attach="<%=item.attach%>"><i class="fa fa-play"></i></a>'+ |
|||
' <a href="javascript:;" class="btn btn-default btn-sm checkMedia" data-media="<%=item.media_id%>" data-type="voice" data-attachid="<%=item.id%>">选取</a>'+ |
|||
' </div>'+ |
|||
' </td>'+ |
|||
' </tr>'+ |
|||
' <%});%>' + |
|||
' </tbody>'+ |
|||
' </table>'; |
|||
|
|||
dialog['videoDialog'] ='<table class="table table-hover table-bordered" style="margin-bottom:0">'+ |
|||
' <thead class="navbar-inner">'+ |
|||
' <tr>'+ |
|||
' <th>标题</th>'+ |
|||
' <th style="width:20%;text-align:right">创建时间</th>'+ |
|||
' <th style="width:20%;text-align:right"></th>'+ |
|||
' </tr>'+ |
|||
' </thead>'+ |
|||
' <tbody class="history-content">'+ |
|||
' <%var items = _.sortBy(items, function(item) {return -item.createtime;});%>' + |
|||
' <%_.each(items, function(item) {%> \n' + |
|||
' <tr>'+ |
|||
' <%if(item.tag.title) {var title = item.tag.title} else {var title =item.filename}%>'+ |
|||
' <td><%=title%></td>'+ |
|||
' <td align="right"><%=item.createtime_cn%></td>'+ |
|||
' <td align="right">'+ |
|||
' <div class="btn-group">'+ |
|||
' <a href="javascript:;" class="btn btn-default btn-sm checkMedia" data-media="<%=item.media_id%>" data-type="video" data-attachid="<%=item.id%>">选取</a>'+ |
|||
' </div>'+ |
|||
' </td>'+ |
|||
' </tr>'+ |
|||
' <%});%>' + |
|||
' </tbody>'+ |
|||
' </table>'; |
|||
|
|||
dialog['wxcardDialog'] ='<table class="table table-hover table-bordered">\n'+ |
|||
' <thead>\n'+ |
|||
' <tr>\n'+ |
|||
' <th width="130" class="text-center">标题</th>\n'+ |
|||
' <th class="text-center">类型</th>\n'+ |
|||
' <th width="250" class="text-center">卡券有效期</th>\n'+ |
|||
' <th class="text-center">库存/每人限领</th>\n'+ |
|||
' <th class="text-center">操作</th>\n'+ |
|||
' </tr>'+ |
|||
' </thead>'+ |
|||
' <tbody>'+ |
|||
' <%var items = _.sortBy(items, function(item) {return -item.couponid;});%>' + |
|||
' <%_.each(items, function(item) {%> \n' + |
|||
' <tr title="<%=item.title%>">' + |
|||
' <td><%=item.title%></td>' + |
|||
' <td><%if(item.ctype == "discount") {%><span class="label label-success">折扣券</span><%} else if(item.ctype == "cash") {%><span class="label label-danger">代金券</span><%} else if(item.ctype == "gift") {%><span class="label label-danger">礼品券</span><%} else if(item.ctype == "groupon") {%><span class="label label-danger">团购券</span><%} else if(item.ctype == "general_coupon") {%><span class="label label-danger">优惠券</span><%}%></td>' + |
|||
' <td><%if(item.date_info.time_type == 1) {%><%=item.date_info.time_limit_start%> ~ <%=item.date_info.time_limit_end%><%} else {%>领取后<%=item.date_info.date_info%>天后生效,<%=item.date_info.limit%>天有效期<%}%></td>' + |
|||
' <td><%=item.quantity%>/<strong class="text-danger"><%=item.get_limit%></strong></td>' + |
|||
' <td><a href="javascript:;" class="btn btn-default btn-sm checkMedia" data-title="<%=item.title%>" data-type="wxcard" data-media="<%=item.card_id%>" data-attachid="<%=item.id%>">选取</a></td>' + |
|||
' </tr>' + |
|||
' <%});%>' + |
|||
' </tbody>'+ |
|||
' </table>'; |
|||
|
|||
dialog['newsDialog'] = '<%var items = _.sortBy(items, function(item) {return -item.createtime;});%>' + |
|||
' <%_.each(items, function(item) {%> \n' + |
|||
' <div class="col-md-5 col-md-5 col-md-5 water" style="display:none">'+ |
|||
' <div class="panel-group checkMedia" data-media="<%=item.media_id%>" data-type="news" data-attachid="<%=item.id%>">'+ |
|||
' <%var index = 0;%>\n' + |
|||
' <%_.each(item.items, function(data) {%>\n' + |
|||
' <%index++;%>\n' + |
|||
' <div class="panel panel-default">'+ |
|||
' <%if(index == 1) {%>\n' + |
|||
' <div class="panel-body">'+ |
|||
' <div class="img">'+ |
|||
' <i class="default">封面图片</i>'+ |
|||
' <img src="<%=data.thumb_url%>">'+ |
|||
' <span class="text-left"><%=data.title%></span>'+ |
|||
' </div>'+ |
|||
' </div>'+ |
|||
' <%} else {%>\n' + |
|||
' <div class="panel-body">'+ |
|||
' <div class="text">'+ |
|||
' <h4><%=data.title%></h4>'+ |
|||
' </div>'+ |
|||
' <div class="img">'+ |
|||
' <img src="<%=data.thumb_url%>">'+ |
|||
' <i class="default">缩略图</i>'+ |
|||
' </div>'+ |
|||
' </div>'+ |
|||
' <%}%>\n' + |
|||
' </div>'+ |
|||
' <%});%>'+ |
|||
' <div class="mask"></div>'+ |
|||
' <i class="fa fa-check"></i>'+ |
|||
' </div>'+ |
|||
' </div>'+ |
|||
' <%});%>'; |
|||
|
|||
return dialog; |
|||
} |
|||
}; |
|||
return material; |
|||
}); |
|||