diff --git a/1 b/1 new file mode 100644 index 000000000..4fff486ce --- /dev/null +++ b/1 @@ -0,0 +1,81 @@ +111111101001100000110010111001110100011110010111101110111111100110101000001111111 +100000101101110101010010000011011000001010010110100011101011011000000111101000001 +101110101001101100000101011111100000101011111111110000000000000110001010101011101 +101110100011011110100101111010001110000000101111111111101000000001101010101011101 +101110100110010010000110111110101101000101101101111110100100000010010000001011101 +100000101010001101110100100010110100010011011110100010101110000001001001001000001 +111111101010101010101010101010101010101010101010101010101010101010101010101111111 +000000001010000100100001100011110100101001001010100010101001000110001111000000000 +001110101001010000010001111110001111111111110111111111101010101100000011011100111 +111101000000010101101110111000000001100010111011111010001100110110001110111001111 +100011100101100001101001100011001000001000101100000011000110100100000100000111010 +010001010010110101000011010011110101011111101110111110011010000110111100000100011 +110111100001111111000001101111011010111101100100100011000100111111101010110100111 +000101011000011000111111110101001110011101001000011100110101010100010000001001110 +101001101000011110011110101010110011000111001100100000001111011011010010111010000 +000011011101001000010001000000000111010110000101000100001011000001111110101001000 +101001100011101011011011000111000010010110000110101110001001111111010111000101000 +110001001110001100100101111100001001010100111000000000011110000100011110001111101 +000011101001100111111010011101111110111001100100000001000000001110000011111100010 +111011011100000110000101011110000011000100000010011100111110000010101100111101110 +100110110010000011111010101000000100000100100100110001100110111111100111000000110 +001110011011111100101011001001101001100001101000000100110111000100111100110010010 +100010110010000111000111111001111001111111101000111111001010001111001100100000110 +111111000101011011000011101011101100100101000010110000101000001001110101000001001 +011111111010111101010101111111101000011101100010111110100111110101001001111111100 +101110001011110010101001100010010010101000100100100010000111001100111100100010011 +001010101011110001010100101011001010101011011110101010010010011110000110101010110 +110010001001111100111101100010111001010111001000100010111110100011000010100011110 +000111111001010110010010111111010110001101111110111111000101111101000110111110111 +001101001101001110101000000100000110011011110110010110000111001011100100110100001 +000000111011101000000111101111000110010000010011010010001100111010000110000101110 +001100000100010010000011001011011100101000100101101110101111000001110011110111101 +100011111000110101000000010001110010001100111010111111100100011101000101000001110 +011101000011111110110111010110111010001110111001001000101111100000010100110000010 +000011111111110000100101111101110111100010000000010000001010111011111010000101110 +011000011100110111111000010100000111001010001110011110001100000110100011110111111 +101001101000001100000000011100001101110100011111011010101011101100101011111000110 +111011000101000101111111011111101010110001111010100000000001000010100101100111100 +011000110010111000011001111011011101100000000101100011011011101110000010111110010 +011000010111101110011010101011101111100111100011100110101101000110001011100101101 +010111110010110010110010100001011110001110101000100001101010001101101110011001010 +110011001100001110110001011011100101101100110111001110010101100111011101101010110 +101001110011011001111010010010111001100101011000001011111110111100001011001101110 +010011001010011111110011001000111000001101100000100111001110000110001110110100101 +000011101111000011101110111100000010001100011001000111100010000111101110010001001 +000110011111111110100101110011011011000111101011101000110010101111100100111100011 +100111110101101101010100110000111100000110111001001110000100101111010110001100000 +100111010001000000111101010011101100111100100101010101100101001000001101110001110 +100011111000010111101001111110011011100001111000111111010110000110001100111111001 +110110001101000000101100100010010000101111011110100011111100100000000111100010011 +100110101100111100000010101011011010010101110111101010001010011111010110101010100 +011110001100011000001010100010110101010001011110100011111010010101111011100011110 +100111111010111111001010111110100101010111001000111110010010100000001100111111010 +111000010110001000110101010101110000111011000001101000110100000010001100000000001 +001100110110001111100010010001010001110100011110001001101110111111111010101000110 +001000010101011010101100101001010001001011100111000011111111000010001100011001101 +101000111110011010110101111001000101000001100100100111110110110000001110100110001 +001001011101111100011110000001100001001100101011100101010101101000000100011000000 +001101100110101000101110000111011010101001000010001000000110001101010010000100011 +000111011100101110100111000110110110110000101110010011001001001110011011001000100 +101100110001001100101100010110000100111100111001100000100000000100000010100111000 +110111001110111100111010100001011101001011100010010100111100001100111001011001111 +011010111000101001110100101100011111001010001111011010000111100000000111110101011 +000100011101001011101000101111111101011110011000010111111001011010011100010100101 +111000111101110101110001000100101110000011011010110111000110011111001100110111010 +000010010110000010111011011001100111111000010100101000101100001010100100010000100 +011001101101110111111101001011001111110010001101101100110010111010011001100100110 +000110010101100111000001101011000011111100101001101011001110000101101111011001100 +100110110001011010001000010110110101001001111010001110110000010111101100100100010 +100010010110111111010101111110011000010001001000110100111100001100100110111010110 +011100101111111010000111110011101011010101111010000000111010000100001101111111010 +010001010011001111011111111111000101101111110000011011110111101010101101001011101 +011100100011110000101010111110101111000001001101111110000010011111000000111111010 +000000001001100101111100100011110101101011110001100011101100110110001010100010101 +111111100101011111011000101010100001111011101001101010001110111111001010101010010 +100000100011101011011100100010011111100011001111100010110011001001000110100011000 +101110101011111001001001111111110111011011000101111110000100011110010010111110001 +101110101000001010000011111011000011001001101111101000101111000110000100111001100 +101110101101010111111101000000011001110010001011000001001000001011100100100001000 +100000100110110011111111101011001101100110101010011011011110000111000111010111100 +111111100111010110110100111000000100011101111011110011001111101100101011100001010 \ No newline at end of file diff --git a/Application/Base/Facade/Request.class.php b/Application/Base/Facade/Request.class.php new file mode 100644 index 000000000..8ea6817dc --- /dev/null +++ b/Application/Base/Facade/Request.class.php @@ -0,0 +1,26 @@ +<?php +namespace Base\Facade; + +use Base\Tool\Request as BaseRequest; + +/** + * @author elf<360197197@qq.com> + */ +class Request { + + private static $instance; + + public static function getInstance() + { + if (self::$instance == null) { + self::$instance = new BaseRequest(); + } + return self::$instance; + } + + public static function __callStatic($name, $arguments) + { + $instance = self::getInstance(); + return call_user_func_array([$instance, $name], $arguments); + } +} \ No newline at end of file diff --git a/Application/Base/Service/ApplyService.class.php b/Application/Base/Service/ApplyService.class.php index f1e75a38b..946248dbe 100644 --- a/Application/Base/Service/ApplyService.class.php +++ b/Application/Base/Service/ApplyService.class.php @@ -3,14 +3,51 @@ namespace Base\Service; use Base\Model\PromoteModel; use Base\Model\ApplyModel; +use Base\Facade\Request; class ApplyService { - private $model; + const ENCRYPT_METHOD = 'AES-256-ECB'; + const ENCRYPT_KEY = 'WmtX1@#Landing&Download2048'; + const ENCRYPT_TYPE_DOWNLOAD = 1; + const ENCRYPT_TYPE_LANDING_PAGE = 2; + + public static $enableStatusList = [ + '-1' => '打包失败', + '0' => '打包失败', + '1' => '打包成功 ', + '2' => '准备打包 ', + '3' => '打包中', + ]; public function __construct() { - $this->model = new ApplyModel(); + } + + public function checkApplyStatus($apply) + { + if ($apply['status'] == 0) { + return [ + 'status' => false, + 'message' => '游戏未审核', + ]; + } + if ($apply['offline_status'] == 1) { + return [ + 'status' => false, + 'message' => '游戏已下架', + ]; + } + if ($apply['enable_status'] != 1) { + return [ + 'status' => false, + 'message' => self::$enableStatusList[$apply['enable_status']] ?? '未知错误', + ]; + } + return [ + 'status' => true, + 'message' => '游戏打包成功', + ]; } public function cancelGame($gameId, $promoteId) { @@ -36,4 +73,71 @@ class ApplyService { $data['plist_url'] = $plistUrl; return M('Apply', 'tab_')->save($data); } + + public function getDownloadUrl($apply) + { + $host = Request::getHost(); + $code = $this->encodeApplyCode($apply, self::ENCRYPT_TYPE_DOWNLOAD); + return $host . '/index.php?s=/Home/Download/index/code/' . $code; + } + + public function getLandingPageUrl($apply) + { + $host = Request::getHost(); + $code = $this->encodeApplyCode($apply, self::ENCRYPT_TYPE_LANDING_PAGE); + return $host . '/index.php?s=/Home/Home/landingPage/code/' . $code; + } + + public function encodeApplyCode($apply, $type) + { + $expiresIn = 0; + $data = [ + 'promote_id' => $apply['promote_id'], + 'game_id' => $apply['game_id'], + 'expires_in' => $expiresIn, + 'created_at' => date('Y-m-d H:i:s'), + 'type' => $type + ]; + + $jsonStr = json_encode($data); + return base64_encode(openssl_encrypt($jsonStr, self::ENCRYPT_METHOD, self::ENCRYPT_KEY)); + } + + public function decodeApplyCode($code) + { + $decryptStr = openssl_decrypt(base64_decode($code), self::ENCRYPT_METHOD, self::ENCRYPT_KEY); + return json_decode($decryptStr, true); + } + + public function checkApplyCode($data, $type) + { + if ( + !isset($data['promote_id']) || + !isset($data['game_id']) || + !isset($data['expires_in']) || + !isset($data['created_at']) || + !isset($data['type']) + ) { + return [ + 'status' => false, + 'message' => '参数异常', + ]; + } + if ($data['type'] != $type) { + return [ + 'status' => false, + 'message' => '参数异常', + ]; + } + if ($data['expires_in'] > 0 && time() > (strtotime($data['created_at']) + $data['expires_in'])) { + return [ + 'status' => false, + 'message' => '链接已过期', + ]; + } + return [ + 'status' => true, + 'message' => '验证成功', + ]; + } } \ No newline at end of file diff --git a/Application/Base/Tool/Request.class.php b/Application/Base/Tool/Request.class.php new file mode 100644 index 000000000..68b4f0ffe --- /dev/null +++ b/Application/Base/Tool/Request.class.php @@ -0,0 +1,122 @@ +<?php +namespace Base\Tool; + +/** + * @author elf<360197197@qq.com> + */ +class Request { + + private $serverInfo; + private $scheme; + + public function __construct() + { + $this->serverInfo = $_SERVER; + } + + public function isWechat() + { + $userAgent = $this->getUserAgent(); + if (strpos($userAgent, 'MicroMessenger') == false && strpos($userAgent, 'Windows Phone') == false) { + return false; + } else { + return true; + } + } + + public function getUserAgent() + { + return $this->serverInfo['HTTP_USER_AGENT'] ?? ''; + } + + public function isMobile() + { + $isMobile = false; + $userAgent = $this->getUserAgent(); + $mobileAgents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad','iPod']; + foreach ($mobileAgents as $mobileAgent) { + if (stripos($userAgent, $mobileAgent) !== false) { + $isMobile = true; + } + } + return $isMobile; + } + + public function isIOS() + { + $userAgent = $this->getUserAgent(); + if(stripos($userAgent, 'iphone') !== false || strpos($userAgent, 'ipad') !== false) { + return true; + } + return false; + } + + public function isAndroid() + { + $userAgent = $this->getUserAgent(); + if(strpos($userAgent, 'android')) { + return true; + } + return false; + } + + public function isIOS13() + { + if (preg_match('/OS [1][3-9]_[1-9][_\d]* like Mac OS X/i')) { + return true; + } + return false; + } + + /** + * 获取客户端IP + */ + public function getClientIP() + { + $serverInfo = $this->serverInfo; + $ip = '0.0.0.0'; + if (isset($serverInfo['HTTP_X_FORWARDED_FOR'])) { + $items = explode(',', $serverInfo['HTTP_X_FORWARDED_FOR']); + $position = array_search('unknown', $items); + if (false !== $position) { + unset($items[$position]); + } + $ip = trim($items[0]); + } elseif (isset($serverInfo['HTTP_CLIENT_IP'])) { + $ip = $serverInfo['HTTP_CLIENT_IP']; + } elseif (isset($this->serverInfo['REMOTE_ADDR'])) { + $ip = $serverInfo['REMOTE_ADDR']; + } + return $ip; + } + + public function getHost() + { + $host = $this->getScheme() . '://' . $this->serverInfo['SERVER_NAME']; + if (in_array($this->serverInfo['SERVER_PORT'], [80, 443])) { + return $host; + } + return $host . ':' . $this->serverInfo['SERVER_PORT']; + } + + public function getScheme() + { + if ($this->scheme) { + return $this->scheme; + } + $serverInfo = $this->serverInfo; + if (isset($serverInfo['REQUEST_SCHEME'])) { + $this->scheme = $serverInfo['REQUEST_SCHEME']; + return $this->scheme; + } + if ((isset($serverInfo['HTTPS']) && $serverInfo['HTTPS'] == 'on') + || (isset($serverInfo['HTTP_X_FORWARDED_PROTO']) && $serverInfo['HTTP_X_FORWARDED_PROTO'] == 'https' + || (isset($serverInfo['SERVER_PORT']) && $serverInfo['SERVER_PORT'] == 443)) + ) { + $this->scheme = 'https'; + } else { + $this->scheme = 'http'; + } + return $this->scheme; + } +} \ No newline at end of file diff --git a/Application/Home/Controller/ApplyController.class.php b/Application/Home/Controller/ApplyController.class.php index b754c6d3b..43e6b39c0 100644 --- a/Application/Home/Controller/ApplyController.class.php +++ b/Application/Home/Controller/ApplyController.class.php @@ -5,6 +5,8 @@ namespace Home\Controller; use OT\DataDictionary; use Admin\Model\ApplyModel; use Think\Model; +use Base\Facade\Request; +use Base\Service\ApplyService; /** @@ -633,9 +635,7 @@ class ApplyController extends BaseController if ($_REQUEST['pattern'] != null) { $map['tab_apply.pattern'] = $_REQUEST['pattern']; } -// $map['tab_apply.status'] = 1; -// $map['tab_game.game_status'] = 1;//游戏状态 -// empty(I('sdk_version')) || $map['tab_game.sdk_version'] = I('sdk_version'); + $page = intval(I('get.p', 0)); $page = $page ? $page : 1; //默认显示第一页数据 @@ -1751,7 +1751,80 @@ class ApplyController extends BaseController $this->ajaxReturn($result); } + } + + public function getDownloadUrl() + { + $gameId = I('game_id', 0); + $promote = $this->getLoginPromote(); + $apply = M('apply', 'tab_')->where(['promote_id' => $promote['id'], 'game_id' => $gameId])->find(); + $game = M('game', 'tab_')->field(['icon'])->where(['id' => $gameId])->find(); + if ($apply == null) { + $this->ajaxReturn([ + 'status' => 0, + 'message' => '游戏不存在', + 'data' => [ + ] + ]); + } + + $icon = Request::getHost() . '/' . get_cover($game['icon'], 'path'); + + $applyService = new ApplyService(); + $result = $applyService->checkApplyStatus($apply); + if (!$result['status']) { + $this->ajaxReturn([ + 'status' => 0, + 'message' => $result['message'], + 'data' => [ + ] + ]); + } + $url = $applyService->getDownloadUrl($apply); + $this->ajaxReturn([ + 'status' => 1, + 'message' => '获取成功', + 'data' => [ + 'url' => $url, + ] + ]); + } + + public function getLandingPageUrl() + { + $gameId = I('game_id', 0); + $promote = $this->getLoginPromote(); + $apply = M('apply', 'tab_')->where(['promote_id' => $promote['id'], 'game_id' => $gameId])->find(); + $game = M('game', 'tab_')->field(['icon'])->where(['id' => $gameId])->find(); + if ($apply == null) { + $this->ajaxReturn([ + 'status' => 1, + 'message' => '游戏不存在', + 'data' => [ + ] + ]); + } + $icon = Request::getHost() . '/' . get_cover($game['icon'], 'path'); + + $applyService = new ApplyService(); + $result = $applyService->checkApplyStatus($apply); + if (!$result['status']) { + $this->ajaxReturn([ + 'status' => 0, + 'message' => $result['message'], + 'data' => [ + ] + ]); + } + $url = $applyService->getLandingPageUrl($apply); + $this->ajaxReturn([ + 'status' => 1, + 'message' => '获取成功', + 'data' => [ + 'url' => $url, + ] + ]); } } diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php new file mode 100644 index 000000000..dc69d5d83 --- /dev/null +++ b/Application/Home/Controller/DownloadController.class.php @@ -0,0 +1,86 @@ +<?php + +namespace Home\Controller; +use Think\Controller; +use Base\Facade\Request; +use Base\Service\ApplyService; + +/** + * @author elf<360197197@qq.com> + */ +class DownloadController extends Controller { + + public function downloadError($message) + { + $this->assign('message', $message); + $this->display('error'); + } + + public function index() + { + $code = I('code', ''); + if ($code == '') { + $this->redirect("download/downloadError", ['message' => '访问错误']); + } + $applyService = new ApplyService(); + $data = $applyService->decodeApplyCode($code); + $result = $applyService->checkApplyCode($data, ApplyService::ENCRYPT_TYPE_DOWNLOAD); + if (!$result['status']) { + $this->error($result['message']); + } + + $gameId = $data['game_id']; + $promoteId = $data['promote_id']; + + $map = []; + $map['status'] = 1; + $map['enable_status'] = 1; + $map['game_id'] = $gameId; + $map['promote_id'] = $promoteId; + $columns = ['game_id', 'promote_id', 'promote_account', 'pack_url', 'plist_url', 'status', 'enable_status']; + $apply = M('apply','tab_')->field($columns)->where($map)->find(); + $game = M('game','tab_')->field(['id', 'game_name', 'sdk_version'])->where(['id' => $apply['game_id']])->find(); + + if (Request::isMobile()) { + if (!Request::isAndroid() && $game['sdk_version'] == 1) { + $this->redirect("download/downloadError", ['message' => '请使用安卓浏览器下载']); + } + if (!Request::isIOS() && $game['sdk_version'] == 2) { + $this->redirect("download/downloadError", ['message' => '请使用ios浏览器下载']); + } + } + $packageUrl = $game['sdk_version'] == 1 ? $apply['pack_url'] : $apply['plist_url']; + + M('game','tab_')->where(['id' => $game['id']])->setInc('dow_num'); + if (Request::isAndroid()) { + $this->gotoPkgUrl($packageUrl); + } else if (Request::isIOS()) { + $plistUrl = substr($packageUrl, 1, strlen($packageUrl)); + header("HTTP/1.1 303 See Other"); + header("Location: "."itms-services://?action=download-manifest&url=" . "https://" . Request::getHost() . "/" . $plistUrl); + } else { + $this->gotoPkgUrl($packageUrl); + } + } + + private function gotoPkgUrl($packageUrl) + { + if (preg_match("/oss/", $packageUrl)) { + $url = str_replace('-internal', '', $packageUrl); + echo "<script>window.location.href='$url';</script>"; + } elseif (preg_match("/clouddn/", $packageUrl)) { + $url = "http://".$packageUrl; + redirect($url); + } elseif (preg_match("/myqcloud/", $packageUrl)) { + redirect($packageUrl); + } elseif(preg_match("/bcebos/", $packageUrl)) { + redirect($packageUrl); + } else { + if (!file_exists($packageUrl)) { + $this->error('文件不存在哦,亲!'); + }else{ + redirect(Request::getHost() . ltrim($packageUrl, '.')); + } + } + } +} diff --git a/Application/Home/Controller/HomeController.class.php b/Application/Home/Controller/HomeController.class.php index f8b481a16..2c0e2155b 100644 --- a/Application/Home/Controller/HomeController.class.php +++ b/Application/Home/Controller/HomeController.class.php @@ -1,24 +1,10 @@ <?php - -// +---------------------------------------------------------------------- - -// | OneThink [ WE CAN DO IT JUST THINK IT ] - -// +---------------------------------------------------------------------- - -// | Copyright (c) 2013 http://www.onethink.cn All rights reserved. - -// +---------------------------------------------------------------------- - -// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn> - -// +---------------------------------------------------------------------- - - namespace Home\Controller; use Think\Controller; use User\Api\MemberApi; +use Base\Facade\Request; +use Base\Service\ApplyService; /** * 前台公共控制器 @@ -142,6 +128,80 @@ class HomeController extends Controller $this->display(); } + public function landingPage() + { + $code = I('code', ''); + if ($code == '') { + $this->redirect("download/downloadError", ['message' => '访问错误']); + } + $applyService = new ApplyService(); + $data = $applyService->decodeApplyCode($code); + $result = $applyService->checkApplyCode($data, ApplyService::ENCRYPT_TYPE_LANDING_PAGE); + if (!$result['status']) { + $this->error($result['message']); + } + + $isWechat = Request::isWechat(); + $isIOS = Request::isIOS(); + $isAndroid = Request::isAndroid(); + $isIOS13 = Request::isIOS13(); + + $columns = [ + 'id', + 'sdk_version', + 'icon', + 'screenshot', + 'relation_game_id', + 'relation_game_name', + 'dow_status', + 'features', + 'flooring_page_imgs', + ]; + $map = ['id' => intval($data['game_id'])]; + + $game = M('game', 'tab_')->field($columns)->where($map)->find(); + + if ($game['sdk_version'] == 1 && $isIOS) { + $map['relation_game_id'] = $game['relation_game_id']; + $map['sdk_version'] = 2; + $game = M('game', 'tab_')->field($columns)->where($map)->find(); + } elseif ($game['sdk_version'] == 2 && $isAndroid) { + $map['relation_game_id'] = $game['relation_game_id']; + $map['sdk_version'] = 1; + $game = M('game', 'tab_')->field($columns)->where($map)->find(); + } + $apply = M('apply', 'tab_')->field(['game_id', 'enable_status', 'promote_id']) + ->where(['promote_id' => $data['promote_id'], 'game_id' => $game['id']]) + ->find(); + $game['icon'] = get_cover($game['icon'], 'path'); + + $imageIds = explode(',', $game['flooring_page_imgs']) ?? []; + $imageUrls = []; + foreach ($imageIds as $imageId) { + $imageUrls[] = get_cover($imageId, 'path'); + } + $game['flooring_page_imgs'] = $imageUrls; + + $downloadUrl = ''; + if ($isIOS13) { + $gameSource = M('GameSource', 'tab_')->where(array('game_id' => $game['id']))->getField('org_plist_url'); + $downloadUrl = 'itms-services://?action=download-manifest&url=' . Request::getHost() . ltrim($gameSource['org_plist_url'], '.'); + } else { + $applyService = new ApplyService(); + $downloadUrl = $applyService->getDownloadUrl($apply); + } + + $this->assign('downloadUrl', $downloadUrl); + $this->assign('isIOS13', $isIOS13); + $this->assign('isWechat', $isWechat); + $this->assign('isIOS', $isIOS); + $this->assign('isAndroid', $isAndroid); + $this->assign('apply', $apply); + $this->assign('game', $game); + $this->display(); + } + + public function iosDown() { $gameId = I('get.gid'); diff --git a/Application/Home/View/default/Apply/my_game.html b/Application/Home/View/default/Apply/my_game.html index 3d76bbbcc..4784068f3 100644 --- a/Application/Home/View/default/Apply/my_game.html +++ b/Application/Home/View/default/Apply/my_game.html @@ -3,93 +3,10 @@ <link href="__CSS__/20180207/data.css" rel="stylesheet"> <link href="__CSS__/20180207/game.css" rel="stylesheet"> <link href="__CSS__/game_detailed.css" rel="stylesheet"> + <link href="__CSS__/my_game.css" rel="stylesheet"> <link href="__STATIC__/icons_alibaba/iconfont.css" rel="stylesheet"> <link href="__STATIC__/jqueryselect/css/layui.css" rel="stylesheet"> <script src="__STATIC__/jqueryselect/js/MySearch.js" type="text/javascript" charset="utf-8"></script> - <style> - body { - font: 400 14px/1.5 'Microsoft YaHei','微软雅黑',Tahoma,Verdana,Arial,'宋体',sans-serif; - } - - .zclip embed { - margin-top: -14px; - } - - .trunk-list { - position: relative; - min-height: 66vh; - } - - .pagenation { - position: relative; - text-align: center; - line-height: 5vh; - bottom: 1%; - } - - .pic-prev:hover, .pic-next:hover { - background-color: #4ac5c3; - } - </style> - <style> - .layui-btn{ - background-color: #5fb878; - } - .label{ - padding: 2px 5px; - background: #5FB878; - border-radius: 2px; - color: #fff; - display: block; - line-height: 20px; - height: 20px; - margin: 2px 5px 2px 0; - float: left; - } - i{ - display: inline-block; - width: 18px; - height: 18px; - line-height: 18px; - text-align: center - } - .label:hover{color: white;} - .label i:hover { - background-color: #009E94; - border-radius: 2px; - } - .layui-form-select dl dd:hover { - background-color: #5FB878; - color: white; - } - .AD{ - width: 210px; - margin-left: 40px; - overflow-y: auto; - max-height: 200px; - border: 2px solid #5fb878; - border-radius: 6px; - padding: 1px 2px; - } - - #add_promote_data label { - width: 70px; - margin-right: 0; - padding-left: 0; - text-align: left; - } - - #add_promote_data .AD { - white-space: nowrap; - margin-bottom: 2px; - overflow:scroll; - } - - .btn-role-border { - border-left: 0; - } - </style> - </block> <block name="body"> @@ -108,15 +25,7 @@ <a href="{:U($game, array('type' => 2))}" class="">IOS游戏</a> <a href="{:U($game, array('type' => 1))}" class="">Android游戏</a> <a href="javascript:;" class="current">我的游戏</a> - <!-- <a href="javascript:void(0);" title="集成推广多款游戏,生成游戏大全推广页" style="background:#ffffff;width:68px;height:68px; position:relative" onmouseover="this.style.background='#E3E5E4'" onmouseout="this.style.background='#ffffff'" class="spread"><img src="/Public/Home/images/generalization.png" /> - <img src="/Public/Home/images/hot.png" style="width: 20px; - height: 20px; - position: absolute; - right: 2px;top:0" /> - </a> - --> </div> - <div class="clearfix"></div> <div class="tab marg_top20" style="clear:both;display: flex;"> <div style="display: flex;"> @@ -167,13 +76,6 @@ </if> </div> </div> - -<!-- <div class="zwm_examinediv">--> -<!-- <a class="btn_calc" href="javascript:;">审核通过</a>--> -<!-- <a class="btn_calc examine_a" href="{:U('my_game_ch')}">审核中</a>--> -<!-- </div>--> -<!-- <form class="marg_top20" action="{:U($myGame,array('row'=>I('get.row')))}" method="post"--> -<!-- enctype="multipart/form-data">--> <div class="form-group normal_space fr"> <input type="submit" class="submit" id='submit' url="{:U($myGame,array('model'=>$model['name'],'type'=>$type),false)}" value="查询"> @@ -252,20 +154,6 @@ <span>游戏类型:<span>{$vo.game_type_name}</span> </span> </p> </div> - - <?php - $qrcode = get_cover($vo['icon'],'path'); - if (stripos($qrcode,'http') === false) { - if (stripos($qrcode,'.com') === false) { - $qrcode = 'http://'.C('APPLY_DOWN_DOMAIN').$qrcode; - } else { - $qrcode = 'http://'.$qrcode; - } - } - - $qrcodes = $qrcode; - $qrcode = base64_encode(base64_encode($qrcode)); - ?> <div class="game-operating" data-url="{$qrcodes}" style="width: 35%;"> <if condition="$promoteRole == 1"> <if condition="$loginPromote['level'] eq 1"> @@ -278,10 +166,8 @@ <span class="add-game" game-id="{$vo.id}" promote-type="4" style="cursor: pointer;margin-right: 10px;"><u>添加推广员游戏</u></span> </if> </if> - <?php $downloadUrl = get_apply_dow_url($vo['id'],$vo['promote_id']);?> - <span class="game-link" data-qrcode="{:U('Apply/qrcode',['url'=>base64_encode(base64_encode($downloadUrl)),'logo'=>$qrcode])}" data-url="{$downloadUrl}" data-clipboard-text="{$downloadUrl}" data-apply-id="{$vo.applyid}" style="cursor: pointer;margin-right: 10px;"><u>复制下载链接</u></span> - <?php $flooringPageUrl = 'http://'.C('APPLY_DOWN_DOMAIN').U('Home/promitionofregestion',array('gid'=>$vo['id'],'pid'=>$vo['promote_id']));?> - <span class="game-link" data-qrcode="{:U('Apply/qrcode',['url'=>base64_encode(base64_encode($flooringPageUrl)),'logo'=>$qrcode])}" data-url="{$flooringPageUrl}" data-clipboard-text="{$flooringPageUrl}" data-apply-id="{$vo.applyid}" style="cursor: pointer;margin-right: 10px;"><u>落地页链接</u></span> + <span class="game-link" data-type="download" data-game-id="{$vo.id}" style="cursor: pointer;margin-right: 10px;"><u>复制下载链接</u></span> + <span class="game-link" data-type="landing-page" data-game-id="{$vo.id}" style="cursor: pointer;margin-right: 10px;"><u>落地页链接</u></span> <span class="down-game-btn" data-id="{$vo.id}" style="cursor: pointer;margin-right: 10px;color: #999"><u>下架</u></span> </div> </div> @@ -368,16 +254,11 @@ <div class="game-window-content" style="text-align: center;width: auto;padding-bottom: 0px;"> <div class="game-window-content-eveyone" style="display: block;color: #3A97FF;font-size: 1.1rem;"> <label style="margin-right: 20px;">下载地址:</label> - <span id="game_link_address"></span> + <span id="game_link_address" style="word-wrap: break-word;white-space: normal;"></span> + <button id="clipboard-btn" style="display: none;" data-text="">复制</button> </div> </div> -<!-- <div class="game-window-btns" style="margin-top: 10px;">--> -<!-- <div class="game-window-btn-box">--> -<!-- <input class="game-window-btn btn-blue" type="button" id="download_copy" data-url="" value="复制">--> -<!-- </div>--> -<!-- </div>--> - <div class="game-window-content" style="text-align: center;width: auto;padding-top: 5px;"> <div class="game-window-content-eveyone" style="display: block;color: #999;font-size: 1.1rem;"> <span>复制成功,ctrl+v粘贴即可</span> @@ -385,8 +266,8 @@ </div> <div class="game-window-content" style="text-align: center;width: auto;padding-bottom: 5px;"> - <div class="game-window-content-eveyone" style="display: block;color: #999;font-size: 1.1rem;"> - <img id="game_link_ercode" style="width: 200px;height: 200px;"> + <div id="game_link_ercode" class="game-window-content-eveyone" style="display: block;color: #999;font-size: 1.1rem;"> + <!-- <img id="game_link_ercode" style="width: 200px;height: 200px;"> --> </div> </div> @@ -447,68 +328,16 @@ </div> </div> </div> -<!-- <div class="game-detail-right fr">--> -<!-- <div class="detail-con game-date panel panel-bordered">--> -<!-- <div class="panel-heading"><h3 class="panel-title">游戏开服</h3></div>--> -<!-- <div class="date-box ">--> -<!-- <ul class="date-tit">--> -<!-- <li>时间</li>--> -<!-- <li>服务器名称</li>--> -<!-- </ul>--> -<!-- <div class="list-outer ">--> -<!-- <ul class="date-list">--> -<!-- <li><span class="android"></span></li>--> -<!-- </ul>--> -<!-- <ul class="date-list">--> -<!-- <li><span>09-06 16:00</span></li>--> -<!-- <li>天宫73区</li>--> -<!-- </ul>--> -<!-- <ul class="date-list">--> -<!-- <li><span>09-07 16:00</span></li>--> -<!-- <li>天宫74区</li>--> -<!-- </ul>--> -<!-- <ul class="date-list">--> -<!-- <li><span>09-09 16:00</span></li>--> -<!-- <li>天宫75区</li>--> -<!-- </ul>--> -<!-- <ul class="date-list">--> -<!-- <li><span>09-10 16:00</span></li>--> -<!-- <li>天宫76区</li>--> -<!-- </ul>--> -<!-- </div>--> -<!-- </div>--> -<!-- </div>--> -<!-- <div class="detail-con game-pack panel panel-bordered">--> -<!-- <div class="panel-heading"><h3 class="panel-title">游戏礼包</h3></div>--> -<!-- <div class="pack-box ">--> -<!-- <ul id="GamePackInfo">--> -<!-- <li class="">--> -<!-- <div class="pack-inner">--> -<!-- <p class="pack-tit">《天宫计》新手礼包</p>--> -<!-- <p class="pack-word">天女礼物礼包*1、悬赏令*1、铜币*5000</p>--> -<!-- <p class="pack-num">剩余:<b>82.2%</b></p>--> -<!-- </div>--> -<!-- </li>--> -<!-- <li class="current">--> -<!-- <div class="pack-inner">--> -<!-- <p class="pack-tit">《天宫计》媒体礼包</p>--> -<!-- <p class="pack-word">技能书礼包*1、宠物经验丹*1、铜币*5000</p>--> -<!-- <p class="pack-num">剩余:<b>83.3%</b></p>--> -<!-- </div>--> -<!-- </li>--> -<!-- </ul>--> -<!-- </div>--> -<!-- </div>--> -<!-- </div>--> </div> </div> </div> </div> </block> <block name='script'> - <script src="__STATIC__/clipboard/clipboard.min.js"></script> + <script src="__STATIC__/clipboard.min.js"></script> <script src="__STATIC__/layer/layer.js"></script> <script type="text/javascript" src="__JS__/20170831/select2.min.js"></script> + <script type="text/javascript" src="__JS__/jquery.qrcode.min.js"></script> <script type="text/javascript"> highlight_subnav("{:U('Apply/'.$game)}"); setValue('type', {$Think.request.type |default = '""'}); @@ -536,7 +365,6 @@ if (!thisElement.hasClass('highlight')) { var promoteRole = thisElement.attr('promote-role'); - console.log(promoteRole); setValue('promote_role', promoteRole); @@ -838,37 +666,36 @@ dataType: "json", data: {'game_id': gameId,'promote_type':promoteType}, success: function (data) { - console.log(data); - $('#add_game_name').text(data.game_data.game_name); - $('#add_game_id').val(data.game_data.id); - $('#add_game_features').text(data.game_data.features); - $('#add_sdk_version').text(data.game_data.sdk_name); - console.log(data.game_data.sdk_version); - - var tagData = []; - if (data.promote_data.length > 0) { - var html =''; - - $.each(data.promote_data, function (index, item) { - var promoteName = item.account + '(' + (item.real_name ? item.real_name : '') +')'; - var jsonData = {}; - jsonData.name = promoteName; - jsonData.id = item.id; - tagData.push(jsonData); - }); - } - - if (promoteType == 3) { - $('#add_promote_title').text('添加推广员:'); - } - $.myMethod("#add_promote_data",tagData,"add_promote_ids"); - $(".sumbit").on("click",function(){ - console.log($("form").serialize()) + $('#add_game_name').text(data.game_data.game_name); + $('#add_game_id').val(data.game_data.id); + $('#add_game_features').text(data.game_data.features); + $('#add_sdk_version').text(data.game_data.sdk_name); + + var tagData = []; + if (data.promote_data.length > 0) { + var html =''; + + $.each(data.promote_data, function (index, item) { + var promoteName = item.account + '(' + (item.real_name ? item.real_name : '') +')'; + var jsonData = {}; + jsonData.name = promoteName; + jsonData.id = item.id; + tagData.push(jsonData); }); + } + + if (promoteType == 3) { + $('#add_promote_title').text('添加推广员:'); + } + + $.myMethod("#add_promote_data",tagData,"add_promote_ids"); + $(".sumbit").on("click",function(){ + console.log($("form").serialize()) + }); - $('#add_game').show(); - $('.game-window-bg').show(); + $('#add_game').show(); + $('.game-window-bg').show(); }, error: function (result) { layer.msg('网络异常', {icon: 5}); @@ -907,15 +734,14 @@ dataType: "json", data: {'game_id': gameId,'promote_ids':promoteIds}, success: function (data) { - if (data.status == 0) { - layer.msg(data.msg, {icon: 1}); - setTimeout(function () { - location.reload(); - }, 2000); - } else { - layer.msg(data.msg, {icon: 5}); - } - console.log(data); + if (data.status == 0) { + layer.msg(data.msg, {icon: 1}); + setTimeout(function () { + location.reload(); + }, 2000); + } else { + layer.msg(data.msg, {icon: 5}); + } }, error: function (result) { layer.msg('网络异常', {icon: 5}); @@ -995,69 +821,67 @@ }); $('.game-link').on('click', function () { - var url = $(this).attr('data-url'); - var qrcode = $(this).attr('data-qrcode'); - var applyId = parseInt($(this).attr('data-apply-id')); - - $.ajax({ - type: "post", - url: "__URL__/getEnableStatus", - dataType: "json", - data: {'apply_id': applyId}, - success: function (data) { - if (data.status == 0) { - layer.msg(data.msg, {icon: 5}); - return false; - } - - var enableStatus = parseInt(data.data); - if (enableStatus == 1) { - $('#game_link_ercode').attr('src',qrcode); - $('#game_link_address').text(url); - $('#game_link').show(); - $('.game-window-bg').show(); - } else { - var iconIndex = 7; - var enableStatusName = ''; - - switch (enableStatus) { - case 0: - enableStatusName = '未打包'; - break; - case 2: - case 3: - enableStatusName = '打包中'; - break; - case -1: - iconIndex = 5; - enableStatusName = '打包失败'; - break; - } - - layer.alert(enableStatusName, {icon: iconIndex}); - return false; - } - }, - error: function (result) { - layer.msg('网络异常', {icon: 5}); - } - }); - }); - - var btn = document.getElementsByClassName('game-link'); - var clipboard = new Clipboard(btn); - - clipboard.on('success', function(e) { - // console.log(e); + var linkTag = this + var gameId = parseInt($(this).attr('data-game-id')) + var type = $(this).attr('data-type') + var url = '' + if (type == 'download') { + url = "__URL__/getDownloadUrl" + } else if (type == 'landing-page') { + url = "__URL__/getLandingPageUrl" + } + $.ajax({ + url: url, + type: 'post', + dataType: "json", + data: {game_id: gameId}, + success: function (response) { + if (response.status == 1) { + var qrcodeWidth = 200 + var qrcodeHeight = 200 + var logoWidth = qrcodeWidth/4 + var logoHeight = qrcodeHeight/4 + var options = { + render: 'canvas', + ecLevel: 'H',//识别度 + fill: '#000',//二维码颜色 + background: '#ffffff',//背景颜色 + quiet: 2,//边距 + width: 200,//宽度 + height: 200, + text: response.data.url,//二维码内容 + label: 'jQuery.qrcode', + fontname: 'Ubuntu', + fontcolor: '#ff9818', + }; + var logo = $(linkTag).parents('.game-li').eq(0).find('.img-box').children('img')[0] + $('#game_link_ercode').empty().qrcode(options); + $("#game_link_ercode canvas")[0].getContext('2d').drawImage(logo, (qrcodeWidth - logoWidth) / 2, (qrcodeHeight - logoHeight) / 2, logoWidth, logoHeight); + + $('#clipboard-btn').attr('data-text', response.data.url) + $('#clipboard-btn').click() + + $('#game_link_address').text(response.data.url); + $('#game_link').show(); + $('.game-window-bg').show(); + } else { + layer.alert(response.message, {icon: 7}); + } + }, + error: function (result) { + layer.msg('网络异常', {icon: 5}); + } + }); }); - clipboard.on('error', function(e) { - // console.log(e); - }); + new ClipboardJS('#clipboard-btn', { + text: function(trigger) { + return trigger.getAttribute('data-text'); + } + }) $('#submit').click(function () { var url = $(this).attr('url'); - console.log(url); var query = $('.jssearch').find('input').serialize(); query += "&" + $('.jssearch').find('select').serialize(); query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, ''); diff --git a/Application/Home/View/default/Download/error.html b/Application/Home/View/default/Download/error.html new file mode 100644 index 000000000..91949e1fe --- /dev/null +++ b/Application/Home/View/default/Download/error.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1"> + <link href="{:get_cover(C('CH_SET_ICO'),'path')}" type="image/x-icon" rel="shortcut icon"> + <title>下载失败</title> + <link rel="stylesheet" href="__CSS__/20180207/promition.css"> + <link rel="stylesheet" href="__CSS__/20180207/game.css"> +</head> + +<body class="main_bg"> + <div class="h_wrap p_t_30 p_lr_10" style="padding-top:15px;"> + <p>{$message}</p> + </div> +</body> +</html> \ No newline at end of file diff --git a/Application/Home/View/default/Home/landingPage.html b/Application/Home/View/default/Home/landingPage.html new file mode 100644 index 000000000..e7b79b611 --- /dev/null +++ b/Application/Home/View/default/Home/landingPage.html @@ -0,0 +1,133 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta itemprop="name" content="{$game['relation_game_name']}"/> + <meta itemprop="image" content="{$game['icon']}"/> + <meta name="description" itemprop="description" content="{$game['features']}"/> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1"> + <script type="text/javascript" src="__JS__/jquery-1.11.1.min.js"></script> + <script type="text/javascript" src="https://res2.wx.qq.com/open/js/jweixin-1.4.0.js"></script> + <link href="{:get_cover(C('CH_SET_ICO'),'path')}" type="image/x-icon" rel="shortcut icon"> + <title>{$game['relation_game_name']}</title> + <link rel="stylesheet" href="__CSS__/20180207/promition.css"> + <link rel="stylesheet" href="__CSS__/20180207/game.css"> + <link href="__STATIC__/ios9/css/common.css" rel="stylesheet" type="text/css"> + <link rel="stylesheet" href="__CSS__/landing_page.css"> +</head> +<body class="main_bg" style="background-color: #0a0a0a;height: auto;"> + <input type="hidden" name="title" value="{$game['relation_game_name']}"> + <input type="hidden" name="icon" value="{$game['icon']}"> + <input type="hidden" name="desc" value="{$game['features']}"> + <input type="hidden" name="isIOS13" value="<?php if($isIOS13):?>1<?php else:?>0<?php endif;?>"> + <?php if ($isWechat):?> + <?php if ($isAndroid):?> + <div class="bn-rule" style="display: none;"><img id="rule-img" src="__STATIC__/ios9/images/android-rule.png"></div> + <?php elseif ($isIOS):?> + <div class="bn-rule" style="display: none;"><img id="rule-img" src="__STATIC__/ios9/images/ios-rule.png"></div> + <?php endif;?> + <?php endif;?> + + <div class="h_wrap"> + <div id="data-2"> + <volist name="game['flooring_page_imgs']" id="item"> + <?php if ($downloadUrl == 'https://'.$_SERVER['HTTP_HOST']) :?> + <a href="#" class="no-package"><img src="{$item}" style="width: 100%;"/></a> + <?php else :?> + <a href="javascript:;" class="down-link" down-link="{$downloadUrl}"><img src="{$item}" style="width: 100%;"/></a> + <?php endif ;?> + </volist> + </div> + </div> + <script src="__STATIC__/layer/layer.js"></script> + <script src="__STATIC__/ios9/js/layer/layer.js?VerNo=20190923" type="text/javascript"></script> + <script type="text/javascript"> + $('.down-link').on('click', function () { + if ($('.bn-rule').length > 0) { + $('.bn-rule').css('display','block') + $('.bn-rule').css('z-index','12') + return + } + if ($('input[name=isIOS13]').val() == 1) { + if (parseInt("{:I('get.status')}") > 0) { + location.href = "{:U('iosDown',array('gid'=>$gameId,'pid'=>I('get.pid'),'status'=>1))}" + return + } else { + layer.confirm('请先到官网注册', {title: '提示'}, function () { + location.href = "/mobile.php?s=/User/login/pid/" + "{:I('get.pid')}" + "/gid/" + "{:I('get.gid')}" + ".html" + }) + return + } + } + var downLink = $(this).attr('down-link') + location.href = downLink + }); + + $('.no-package').click(function() { + layer.msg('暂无下载', { + icon: 7, + time: 2000 + }) + }) + $.ajax({ + url: "{:U('Home/generateWechatSign')}", + dataType: 'json', + type: 'post', + data: {url: window.location.href}, + success: function(response) { + if (response.status) { + wx.config({ + // debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 + appId: response.data.appid, + timestamp: response.data.time, + nonceStr: response.data.randStr, + signature: response.data.sign, + jsApiList: ['onMenuShareAppMessage', 'onMenuShareTimeline', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone'] + }) + var title = $('[name=title]').val(); + var description = $('[name=desc]').val(); + var icon = $('[name=icon]').val(); + wxReady(title, description, icon) + } + } + }); + + function wxReady(title, description, img) { + wx.ready(function () { + wx.onMenuShareAppMessage({ + title: title, + desc: description, + link: window.location.href, + imgUrl: img, + type: '', + dataUrl: '' + }); + wx.onMenuShareTimeline({ + title: title, + link: window.location.href, + imgUrl: img + }); + wx.onMenuShareQQ({ + title: title, + desc: description, + link: window.location.href, + imgUrl: img + }); + wx.onMenuShareWeibo({ + title: title, + desc: description, + link: window.location.href, + imgUrl: img + }); + wx.onMenuShareQZone({ + title: title, + desc: description, + link: window.location.href, + imgUrl: img + }); + }); + } + </script> +</body> +</html> \ No newline at end of file diff --git a/Public/Home/css/landing_page.css b/Public/Home/css/landing_page.css new file mode 100644 index 000000000..fcbcc4a93 --- /dev/null +++ b/Public/Home/css/landing_page.css @@ -0,0 +1,102 @@ +.weixin { + position: absolute; + top: -80px; + right: 0; + width: 17rem; + height: 30rem; + margin-top: 2px; + background: url(../images/img_sign.png) left top no-repeat; + background-size: 100% 100%; + z-index: 99; + } + + html { + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; + } + + body, div { + margin: 0; + padding: 0; + } + + .bn-rule { + position: fixed; + left: 0; + top: 0; + width: 100%; + height: 100%; + background: #333; + } + + .bn-rule img { + margin-top: 21px; + width: 100%; + } + + .register-box-max { + width: 80%; + height: 280px; + top: calc(50% - 140px); + left: 10%; + position: fixed; + z-index: 10; + background-color: #fff; + border-radius: 10px; + } + + @media screen and (min-width: 768px) { + .register-box-max { + width: 50%; + left: 25%; + } + } + + .register-bg { + width: 100%; + height: inherit; + position: fixed; + background-color: #0a0a0a; + opacity: 0.5; + } + + .register-title-box { + padding: 10px 10px; + margin-top: 10px; + text-align: center; + font-size: 1.2rem; + } + + .register-title-box span { + font-weight: 600; + } + + .register-input-box { + text-align: center; + font-size: 1rem; + } + + .register-input-box input { + width: calc(80% - 5px); + height: 2rem; + padding-left: 5px; + margin-top: 10px; + margin-bottom: 10px; + border: 1px solid #6f6f6f; + border-radius: 3px; + } + + .register-btn-box { + margin-top: 40px; + text-align: center; + } + + .register-btn-box button { + width: 80%; + height: 2.5rem; + border: 0; + border-radius: 18px; + background-color: #1993ff; + color: #fff; + font-size: 1.1rem; + } \ No newline at end of file diff --git a/Public/Home/css/my_game.css b/Public/Home/css/my_game.css new file mode 100644 index 000000000..681ee19ae --- /dev/null +++ b/Public/Home/css/my_game.css @@ -0,0 +1,76 @@ +body { + font: 400 14px/1.5 'Microsoft YaHei','微软雅黑',Tahoma,Verdana,Arial,'宋体',sans-serif; + } + + .zclip embed { + margin-top: -14px; + } + + .trunk-list { + position: relative; + min-height: 66vh; + } + + .pagenation { + position: relative; + text-align: center; + line-height: 5vh; + bottom: 1%; + } + + .pic-prev:hover, .pic-next:hover { + background-color: #4ac5c3; + } + + .layui-btn{ + background-color: #5fb878; + } + .label{ + padding: 2px 5px; + background: #5FB878; + border-radius: 2px; + color: #fff; + display: block; + line-height: 20px; + height: 20px; + margin: 2px 5px 2px 0; + float: left; + } + i{ + display: inline-block; + width: 18px; + height: 18px; + line-height: 18px; + text-align: center + } + .label:hover{color: white;} + .label i:hover { + background-color: #009E94; + border-radius: 2px; + } + .layui-form-select dl dd:hover { + background-color: #5FB878; + color: white; + } + .AD{ + width: 210px; + margin-left: 40px; + overflow-y: auto; + max-height: 200px; + border: 2px solid #5fb878; + border-radius: 6px; + padding: 1px 2px; + } + + #add_promote_data label { + width: 70px; + margin-right: 0; + padding-left: 0; + text-align: left; + } + + #add_promote_data .AD { + white-space: nowrap; + margin-bottom: 2px; + overflow:scroll; + } \ No newline at end of file diff --git a/Public/Home/js/jquery.qrcode.min.js b/Public/Home/js/jquery.qrcode.min.js new file mode 100644 index 000000000..3bab787de --- /dev/null +++ b/Public/Home/js/jquery.qrcode.min.js @@ -0,0 +1,28 @@ +(function(r){r.fn.qrcode=function(h){var s;function u(a){this.mode=s;this.data=a}function o(a,c){this.typeNumber=a;this.errorCorrectLevel=c;this.modules=null;this.moduleCount=0;this.dataCache=null;this.dataList=[]}function q(a,c){if(void 0==a.length)throw Error(a.length+"/"+c);for(var d=0;d<a.length&&0==a[d];)d++;this.num=Array(a.length-d+c);for(var b=0;b<a.length-d;b++)this.num[b]=a[b+d]}function p(a,c){this.totalCount=a;this.dataCount=c}function t(){this.buffer=[];this.length=0}u.prototype={getLength:function(){return this.data.length}, +write:function(a){for(var c=0;c<this.data.length;c++)a.put(this.data.charCodeAt(c),8)}};o.prototype={addData:function(a){this.dataList.push(new u(a));this.dataCache=null},isDark:function(a,c){if(0>a||this.moduleCount<=a||0>c||this.moduleCount<=c)throw Error(a+","+c);return this.modules[a][c]},getModuleCount:function(){return this.moduleCount},make:function(){if(1>this.typeNumber){for(var a=1,a=1;40>a;a++){for(var c=p.getRSBlocks(a,this.errorCorrectLevel),d=new t,b=0,e=0;e<c.length;e++)b+=c[e].dataCount; +for(e=0;e<this.dataList.length;e++)c=this.dataList[e],d.put(c.mode,4),d.put(c.getLength(),j.getLengthInBits(c.mode,a)),c.write(d);if(d.getLengthInBits()<=8*b)break}this.typeNumber=a}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,c){this.moduleCount=4*this.typeNumber+17;this.modules=Array(this.moduleCount);for(var d=0;d<this.moduleCount;d++){this.modules[d]=Array(this.moduleCount);for(var b=0;b<this.moduleCount;b++)this.modules[d][b]=null}this.setupPositionProbePattern(0,0);this.setupPositionProbePattern(this.moduleCount- +7,0);this.setupPositionProbePattern(0,this.moduleCount-7);this.setupPositionAdjustPattern();this.setupTimingPattern();this.setupTypeInfo(a,c);7<=this.typeNumber&&this.setupTypeNumber(a);null==this.dataCache&&(this.dataCache=o.createData(this.typeNumber,this.errorCorrectLevel,this.dataList));this.mapData(this.dataCache,c)},setupPositionProbePattern:function(a,c){for(var d=-1;7>=d;d++)if(!(-1>=a+d||this.moduleCount<=a+d))for(var b=-1;7>=b;b++)-1>=c+b||this.moduleCount<=c+b||(this.modules[a+d][c+b]= +0<=d&&6>=d&&(0==b||6==b)||0<=b&&6>=b&&(0==d||6==d)||2<=d&&4>=d&&2<=b&&4>=b?!0:!1)},getBestMaskPattern:function(){for(var a=0,c=0,d=0;8>d;d++){this.makeImpl(!0,d);var b=j.getLostPoint(this);if(0==d||a>b)a=b,c=d}return c},createMovieClip:function(a,c,d){a=a.createEmptyMovieClip(c,d);this.make();for(c=0;c<this.modules.length;c++)for(var d=1*c,b=0;b<this.modules[c].length;b++){var e=1*b;this.modules[c][b]&&(a.beginFill(0,100),a.moveTo(e,d),a.lineTo(e+1,d),a.lineTo(e+1,d+1),a.lineTo(e,d+1),a.endFill())}return a}, +setupTimingPattern:function(){for(var a=8;a<this.moduleCount-8;a++)null==this.modules[a][6]&&(this.modules[a][6]=0==a%2);for(a=8;a<this.moduleCount-8;a++)null==this.modules[6][a]&&(this.modules[6][a]=0==a%2)},setupPositionAdjustPattern:function(){for(var a=j.getPatternPosition(this.typeNumber),c=0;c<a.length;c++)for(var d=0;d<a.length;d++){var b=a[c],e=a[d];if(null==this.modules[b][e])for(var f=-2;2>=f;f++)for(var i=-2;2>=i;i++)this.modules[b+f][e+i]=-2==f||2==f||-2==i||2==i||0==f&&0==i?!0:!1}},setupTypeNumber:function(a){for(var c= +j.getBCHTypeNumber(this.typeNumber),d=0;18>d;d++){var b=!a&&1==(c>>d&1);this.modules[Math.floor(d/3)][d%3+this.moduleCount-8-3]=b}for(d=0;18>d;d++)b=!a&&1==(c>>d&1),this.modules[d%3+this.moduleCount-8-3][Math.floor(d/3)]=b},setupTypeInfo:function(a,c){for(var d=j.getBCHTypeInfo(this.errorCorrectLevel<<3|c),b=0;15>b;b++){var e=!a&&1==(d>>b&1);6>b?this.modules[b][8]=e:8>b?this.modules[b+1][8]=e:this.modules[this.moduleCount-15+b][8]=e}for(b=0;15>b;b++)e=!a&&1==(d>>b&1),8>b?this.modules[8][this.moduleCount- +b-1]=e:9>b?this.modules[8][15-b-1+1]=e:this.modules[8][15-b-1]=e;this.modules[this.moduleCount-8][8]=!a},mapData:function(a,c){for(var d=-1,b=this.moduleCount-1,e=7,f=0,i=this.moduleCount-1;0<i;i-=2)for(6==i&&i--;;){for(var g=0;2>g;g++)if(null==this.modules[b][i-g]){var n=!1;f<a.length&&(n=1==(a[f]>>>e&1));j.getMask(c,b,i-g)&&(n=!n);this.modules[b][i-g]=n;e--; -1==e&&(f++,e=7)}b+=d;if(0>b||this.moduleCount<=b){b-=d;d=-d;break}}}};o.PAD0=236;o.PAD1=17;o.createData=function(a,c,d){for(var c=p.getRSBlocks(a, +c),b=new t,e=0;e<d.length;e++){var f=d[e];b.put(f.mode,4);b.put(f.getLength(),j.getLengthInBits(f.mode,a));f.write(b)}for(e=a=0;e<c.length;e++)a+=c[e].dataCount;if(b.getLengthInBits()>8*a)throw Error("code length overflow. ("+b.getLengthInBits()+">"+8*a+")");for(b.getLengthInBits()+4<=8*a&&b.put(0,4);0!=b.getLengthInBits()%8;)b.putBit(!1);for(;!(b.getLengthInBits()>=8*a);){b.put(o.PAD0,8);if(b.getLengthInBits()>=8*a)break;b.put(o.PAD1,8)}return o.createBytes(b,c)};o.createBytes=function(a,c){for(var d= +0,b=0,e=0,f=Array(c.length),i=Array(c.length),g=0;g<c.length;g++){var n=c[g].dataCount,h=c[g].totalCount-n,b=Math.max(b,n),e=Math.max(e,h);f[g]=Array(n);for(var k=0;k<f[g].length;k++)f[g][k]=255&a.buffer[k+d];d+=n;k=j.getErrorCorrectPolynomial(h);n=(new q(f[g],k.getLength()-1)).mod(k);i[g]=Array(k.getLength()-1);for(k=0;k<i[g].length;k++)h=k+n.getLength()-i[g].length,i[g][k]=0<=h?n.get(h):0}for(k=g=0;k<c.length;k++)g+=c[k].totalCount;d=Array(g);for(k=n=0;k<b;k++)for(g=0;g<c.length;g++)k<f[g].length&& +(d[n++]=f[g][k]);for(k=0;k<e;k++)for(g=0;g<c.length;g++)k<i[g].length&&(d[n++]=i[g][k]);return d};s=4;for(var j={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52, +78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(a){for(var c=a<<10;0<=j.getBCHDigit(c)-j.getBCHDigit(j.G15);)c^=j.G15<<j.getBCHDigit(c)-j.getBCHDigit(j.G15);return(a<<10|c)^j.G15_MASK},getBCHTypeNumber:function(a){for(var c=a<<12;0<=j.getBCHDigit(c)- +j.getBCHDigit(j.G18);)c^=j.G18<<j.getBCHDigit(c)-j.getBCHDigit(j.G18);return a<<12|c},getBCHDigit:function(a){for(var c=0;0!=a;)c++,a>>>=1;return c},getPatternPosition:function(a){return j.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,c,d){switch(a){case 0:return 0==(c+d)%2;case 1:return 0==c%2;case 2:return 0==d%3;case 3:return 0==(c+d)%3;case 4:return 0==(Math.floor(c/2)+Math.floor(d/3))%2;case 5:return 0==c*d%2+c*d%3;case 6:return 0==(c*d%2+c*d%3)%2;case 7:return 0==(c*d%3+(c+d)%2)%2;default:throw Error("bad maskPattern:"+ +a);}},getErrorCorrectPolynomial:function(a){for(var c=new q([1],0),d=0;d<a;d++)c=c.multiply(new q([1,l.gexp(d)],0));return c},getLengthInBits:function(a,c){if(1<=c&&10>c)switch(a){case 1:return 10;case 2:return 9;case s:return 8;case 8:return 8;default:throw Error("mode:"+a);}else if(27>c)switch(a){case 1:return 12;case 2:return 11;case s:return 16;case 8:return 10;default:throw Error("mode:"+a);}else if(41>c)switch(a){case 1:return 14;case 2:return 13;case s:return 16;case 8:return 12;default:throw Error("mode:"+ +a);}else throw Error("type:"+c);},getLostPoint:function(a){for(var c=a.getModuleCount(),d=0,b=0;b<c;b++)for(var e=0;e<c;e++){for(var f=0,i=a.isDark(b,e),g=-1;1>=g;g++)if(!(0>b+g||c<=b+g))for(var h=-1;1>=h;h++)0>e+h||c<=e+h||0==g&&0==h||i==a.isDark(b+g,e+h)&&f++;5<f&&(d+=3+f-5)}for(b=0;b<c-1;b++)for(e=0;e<c-1;e++)if(f=0,a.isDark(b,e)&&f++,a.isDark(b+1,e)&&f++,a.isDark(b,e+1)&&f++,a.isDark(b+1,e+1)&&f++,0==f||4==f)d+=3;for(b=0;b<c;b++)for(e=0;e<c-6;e++)a.isDark(b,e)&&!a.isDark(b,e+1)&&a.isDark(b,e+ +2)&&a.isDark(b,e+3)&&a.isDark(b,e+4)&&!a.isDark(b,e+5)&&a.isDark(b,e+6)&&(d+=40);for(e=0;e<c;e++)for(b=0;b<c-6;b++)a.isDark(b,e)&&!a.isDark(b+1,e)&&a.isDark(b+2,e)&&a.isDark(b+3,e)&&a.isDark(b+4,e)&&!a.isDark(b+5,e)&&a.isDark(b+6,e)&&(d+=40);for(e=f=0;e<c;e++)for(b=0;b<c;b++)a.isDark(b,e)&&f++;a=Math.abs(100*f/c/c-50)/5;return d+10*a}},l={glog:function(a){if(1>a)throw Error("glog("+a+")");return l.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;256<=a;)a-=255;return l.EXP_TABLE[a]},EXP_TABLE:Array(256), +LOG_TABLE:Array(256)},m=0;8>m;m++)l.EXP_TABLE[m]=1<<m;for(m=8;256>m;m++)l.EXP_TABLE[m]=l.EXP_TABLE[m-4]^l.EXP_TABLE[m-5]^l.EXP_TABLE[m-6]^l.EXP_TABLE[m-8];for(m=0;255>m;m++)l.LOG_TABLE[l.EXP_TABLE[m]]=m;q.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var c=Array(this.getLength()+a.getLength()-1),d=0;d<this.getLength();d++)for(var b=0;b<a.getLength();b++)c[d+b]^=l.gexp(l.glog(this.get(d))+l.glog(a.get(b)));return new q(c,0)},mod:function(a){if(0> +this.getLength()-a.getLength())return this;for(var c=l.glog(this.get(0))-l.glog(a.get(0)),d=Array(this.getLength()),b=0;b<this.getLength();b++)d[b]=this.get(b);for(b=0;b<a.getLength();b++)d[b]^=l.gexp(l.glog(a.get(b))+c);return(new q(d,0)).mod(a)}};p.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27], +[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146, +116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15, +43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45, +3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19, +55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10, +45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];p.getRSBlocks=function(a,c){var d=p.getRsBlockTable(a,c);if(void 0==d)throw Error("bad rs block @ typeNumber:"+a+"/errorCorrectLevel:"+c);for(var b=d.length/3,e=[],f=0;f<b;f++)for(var h=d[3*f+0],g=d[3*f+1],j=d[3*f+2],l=0;l<h;l++)e.push(new p(g,j));return e};p.getRsBlockTable=function(a,c){switch(c){case 1:return p.RS_BLOCK_TABLE[4*(a-1)+0];case 0:return p.RS_BLOCK_TABLE[4*(a-1)+1];case 3:return p.RS_BLOCK_TABLE[4* +(a-1)+2];case 2:return p.RS_BLOCK_TABLE[4*(a-1)+3]}};t.prototype={get:function(a){return 1==(this.buffer[Math.floor(a/8)]>>>7-a%8&1)},put:function(a,c){for(var d=0;d<c;d++)this.putBit(1==(a>>>c-d-1&1))},getLengthInBits:function(){return this.length},putBit:function(a){var c=Math.floor(this.length/8);this.buffer.length<=c&&this.buffer.push(0);a&&(this.buffer[c]|=128>>>this.length%8);this.length++}};"string"===typeof h&&(h={text:h});h=r.extend({},{render:"canvas",width:256,height:256,typeNumber:-1, +correctLevel:2,background:"#ffffff",foreground:"#000000"},h);return this.each(function(){var a;if("canvas"==h.render){a=new o(h.typeNumber,h.correctLevel);a.addData(h.text);a.make();var c=document.createElement("canvas");c.width=h.width;c.height=h.height;for(var d=c.getContext("2d"),b=h.width/a.getModuleCount(),e=h.height/a.getModuleCount(),f=0;f<a.getModuleCount();f++)for(var i=0;i<a.getModuleCount();i++){d.fillStyle=a.isDark(f,i)?h.foreground:h.background;var g=Math.ceil((i+1)*b)-Math.floor(i*b), +j=Math.ceil((f+1)*b)-Math.floor(f*b);d.fillRect(Math.round(i*b),Math.round(f*e),g,j)}}else{a=new o(h.typeNumber,h.correctLevel);a.addData(h.text);a.make();c=r("<table></table>").css("width",h.width+"px").css("height",h.height+"px").css("border","0px").css("border-collapse","collapse").css("background-color",h.background);d=h.width/a.getModuleCount();b=h.height/a.getModuleCount();for(e=0;e<a.getModuleCount();e++){f=r("<tr></tr>").css("height",b+"px").appendTo(c);for(i=0;i<a.getModuleCount();i++)r("<td></td>").css("width", +d+"px").css("background-color",a.isDark(e,i)?h.foreground:h.background).appendTo(f)}}a=c;jQuery(a).appendTo(this)})}})(jQuery); \ No newline at end of file diff --git a/Public/static/clipboard.min.js b/Public/static/clipboard.min.js new file mode 100644 index 000000000..02c549e35 --- /dev/null +++ b/Public/static/clipboard.min.js @@ -0,0 +1,7 @@ +/*! + * clipboard.js v2.0.4 + * https://zenorocha.github.io/clipboard.js + * + * Licensed MIT © Zeno Rocha + */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return function(n){var o={};function r(t){if(o[t])return o[t].exports;var e=o[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,r),e.l=!0,e.exports}return r.m=n,r.c=o,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function o(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t}}(),a=o(n(1)),c=o(n(3)),u=o(n(4));function o(t){return t&&t.__esModule?t:{default:t}}var l=function(t){function o(t,e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(o.__proto__||Object.getPrototypeOf(o)).call(this));return n.resolveOptions(e),n.listenClick(t),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(o,c.default),i(o,[{key:"resolveOptions",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText,this.container="object"===r(t.container)?t.container:document.body}},{key:"listenClick",value:function(t){var e=this;this.listener=(0,u.default)(t,"click",function(t){return e.onClick(t)})}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new a.default({action:this.action(e),target:this.target(e),text:this.text(e),container:this.container,trigger:e,emitter:this})}},{key:"defaultAction",value:function(t){return s("action",t)}},{key:"defaultTarget",value:function(t){var e=s("target",t);if(e)return document.querySelector(e)}},{key:"defaultText",value:function(t){return s("text",t)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:["copy","cut"],e="string"==typeof t?[t]:t,n=!!document.queryCommandSupported;return e.forEach(function(t){n=n&&!!document.queryCommandSupported(t)}),n}}]),o}();function s(t,e){var n="data-clipboard-"+t;if(e.hasAttribute(n))return e.getAttribute(n)}t.exports=l},function(t,e,n){"use strict";var o,r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function o(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t}}(),a=n(2),c=(o=a)&&o.__esModule?o:{default:o};var u=function(){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.resolveOptions(t),this.initSelection()}return i(e,[{key:"resolveOptions",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.action=t.action,this.container=t.container,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function(){var t=this,e="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[e?"right":"left"]="-9999px";var n=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=n+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,c.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=(0,c.default)(this.target),this.copyText()}},{key:"copyText",value:function(){var e=void 0;try{e=document.execCommand(this.action)}catch(t){e=!1}this.handleResult(e)}},{key:"handleResult",value:function(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(t){if(void 0!==t){if(!t||"object"!==(void 0===t?"undefined":r(t))||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function(){return this._target}}]),e}();t.exports=u},function(t,e){t.exports=function(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var n=t.hasAttribute("readonly");n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var o=window.getSelection(),r=document.createRange();r.selectNodeContents(t),o.removeAllRanges(),o.addRange(r),e=o.toString()}return e}},function(t,e){function n(){}n.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var o=this;function r(){o.off(t,r),e.apply(n,arguments)}return r._=e,this.on(t,r,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,r=n.length;o<r;o++)n[o].fn.apply(n[o].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),o=n[t],r=[];if(o&&e)for(var i=0,a=o.length;i<a;i++)o[i].fn!==e&&o[i].fn._!==e&&r.push(o[i]);return r.length?n[t]=r:delete n[t],this}},t.exports=n},function(t,e,n){var d=n(5),h=n(6);t.exports=function(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!d.string(e))throw new TypeError("Second argument must be a String");if(!d.fn(n))throw new TypeError("Third argument must be a Function");if(d.node(t))return s=e,f=n,(l=t).addEventListener(s,f),{destroy:function(){l.removeEventListener(s,f)}};if(d.nodeList(t))return a=t,c=e,u=n,Array.prototype.forEach.call(a,function(t){t.addEventListener(c,u)}),{destroy:function(){Array.prototype.forEach.call(a,function(t){t.removeEventListener(c,u)})}};if(d.string(t))return o=t,r=e,i=n,h(document.body,o,r,i);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList");var o,r,i,a,c,u,l,s,f}},function(t,n){n.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},n.nodeList=function(t){var e=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===e||"[object HTMLCollection]"===e)&&"length"in t&&(0===t.length||n.node(t[0]))},n.string=function(t){return"string"==typeof t||t instanceof String},n.fn=function(t){return"[object Function]"===Object.prototype.toString.call(t)}},function(t,e,n){var a=n(7);function i(t,e,n,o,r){var i=function(e,n,t,o){return function(t){t.delegateTarget=a(t.target,n),t.delegateTarget&&o.call(e,t)}}.apply(this,arguments);return t.addEventListener(n,i,r),{destroy:function(){t.removeEventListener(n,i,r)}}}t.exports=function(t,e,n,o,r){return"function"==typeof t.addEventListener?i.apply(null,arguments):"function"==typeof n?i.bind(null,document).apply(null,arguments):("string"==typeof t&&(t=document.querySelectorAll(t)),Array.prototype.map.call(t,function(t){return i(t,e,n,o,r)}))}},function(t,e){if("undefined"!=typeof Element&&!Element.prototype.matches){var n=Element.prototype;n.matches=n.matchesSelector||n.mozMatchesSelector||n.msMatchesSelector||n.oMatchesSelector||n.webkitMatchesSelector}t.exports=function(t,e){for(;t&&9!==t.nodeType;){if("function"==typeof t.matches&&t.matches(e))return t;t=t.parentNode}}}])}); \ No newline at end of file diff --git a/Public/static/clipboard/clipboard.js b/Public/static/clipboard/clipboard.js deleted file mode 100644 index 6a28dfb8d..000000000 --- a/Public/static/clipboard/clipboard.js +++ /dev/null @@ -1,745 +0,0 @@ -/*! - * clipboard.js v1.5.5 - * https://zenorocha.github.io/clipboard.js - * - * Licensed MIT © Zeno Rocha - */ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Clipboard = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ -var matches = require('matches-selector') - -module.exports = function (element, selector, checkYoSelf) { - var parent = checkYoSelf ? element : element.parentNode - - while (parent && parent !== document) { - if (matches(parent, selector)) return parent; - parent = parent.parentNode - } -} - -},{"matches-selector":2}],2:[function(require,module,exports){ - -/** - * Element prototype. - */ - -var proto = Element.prototype; - -/** - * Vendor function. - */ - -var vendor = proto.matchesSelector - || proto.webkitMatchesSelector - || proto.mozMatchesSelector - || proto.msMatchesSelector - || proto.oMatchesSelector; - -/** - * Expose `match()`. - */ - -module.exports = match; - -/** - * Match `el` to `selector`. - * - * @param {Element} el - * @param {String} selector - * @return {Boolean} - * @api public - */ - -function match(el, selector) { - if (vendor) return vendor.call(el, selector); - var nodes = el.parentNode.querySelectorAll(selector); - for (var i = 0; i < nodes.length; ++i) { - if (nodes[i] == el) return true; - } - return false; -} -},{}],3:[function(require,module,exports){ -var closest = require('closest'); - -/** - * Delegates event to a selector. - * - * @param {Element} element - * @param {String} selector - * @param {String} type - * @param {Function} callback - * @return {Object} - */ -function delegate(element, selector, type, callback) { - var listenerFn = listener.apply(this, arguments); - - element.addEventListener(type, listenerFn); - - return { - destroy: function() { - element.removeEventListener(type, listenerFn); - } - } -} - -/** - * Finds closest match and invokes callback. - * - * @param {Element} element - * @param {String} selector - * @param {String} type - * @param {Function} callback - * @return {Function} - */ -function listener(element, selector, type, callback) { - return function(e) { - e.delegateTarget = closest(e.target, selector, true); - - if (e.delegateTarget) { - callback.call(element, e); - } - } -} - -module.exports = delegate; - -},{"closest":1}],4:[function(require,module,exports){ -/** - * Check if argument is a HTML element. - * - * @param {Object} value - * @return {Boolean} - */ -exports.node = function(value) { - return value !== undefined - && value instanceof HTMLElement - && value.nodeType === 1; -}; - -/** - * Check if argument is a list of HTML elements. - * - * @param {Object} value - * @return {Boolean} - */ -exports.nodeList = function(value) { - var type = Object.prototype.toString.call(value); - - return value !== undefined - && (type === '[object NodeList]' || type === '[object HTMLCollection]') - && ('length' in value) - && (value.length === 0 || exports.node(value[0])); -}; - -/** - * Check if argument is a string. - * - * @param {Object} value - * @return {Boolean} - */ -exports.string = function(value) { - return typeof value === 'string' - || value instanceof String; -}; - -/** - * Check if argument is a function. - * - * @param {Object} value - * @return {Boolean} - */ -exports.function = function(value) { - var type = Object.prototype.toString.call(value); - - return type === '[object Function]'; -}; - -},{}],5:[function(require,module,exports){ -var is = require('./is'); -var delegate = require('delegate'); - -/** - * Validates all params and calls the right - * listener function based on its target type. - * - * @param {String|HTMLElement|HTMLCollection|NodeList} target - * @param {String} type - * @param {Function} callback - * @return {Object} - */ -function listen(target, type, callback) { - if (!target && !type && !callback) { - throw new Error('Missing required arguments'); - } - - if (!is.string(type)) { - throw new TypeError('Second argument must be a String'); - } - - if (!is.function(callback)) { - throw new TypeError('Third argument must be a Function'); - } - - if (is.node(target)) { - return listenNode(target, type, callback); - } - else if (is.nodeList(target)) { - return listenNodeList(target, type, callback); - } - else if (is.string(target)) { - return listenSelector(target, type, callback); - } - else { - throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList'); - } -} - -/** - * Adds an event listener to a HTML element - * and returns a remove listener function. - * - * @param {HTMLElement} node - * @param {String} type - * @param {Function} callback - * @return {Object} - */ -function listenNode(node, type, callback) { - node.addEventListener(type, callback); - - return { - destroy: function() { - node.removeEventListener(type, callback); - } - } -} - -/** - * Add an event listener to a list of HTML elements - * and returns a remove listener function. - * - * @param {NodeList|HTMLCollection} nodeList - * @param {String} type - * @param {Function} callback - * @return {Object} - */ -function listenNodeList(nodeList, type, callback) { - Array.prototype.forEach.call(nodeList, function(node) { - node.addEventListener(type, callback); - }); - - return { - destroy: function() { - Array.prototype.forEach.call(nodeList, function(node) { - node.removeEventListener(type, callback); - }); - } - } -} - -/** - * Add an event listener to a selector - * and returns a remove listener function. - * - * @param {String} selector - * @param {String} type - * @param {Function} callback - * @return {Object} - */ -function listenSelector(selector, type, callback) { - return delegate(document.body, selector, type, callback); -} - -module.exports = listen; - -},{"./is":4,"delegate":3}],6:[function(require,module,exports){ -function select(element) { - var selectedText; - - if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') { - element.focus(); - element.setSelectionRange(0, element.value.length); - - selectedText = element.value; - } - else { - if (element.hasAttribute('contenteditable')) { - element.focus(); - } - - var selection = window.getSelection(); - var range = document.createRange(); - - range.selectNodeContents(element); - selection.removeAllRanges(); - selection.addRange(range); - - selectedText = selection.toString(); - } - - return selectedText; -} - -module.exports = select; - -},{}],7:[function(require,module,exports){ -function E () { - // Keep this empty so it's easier to inherit from - // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3) -} - -E.prototype = { - on: function (name, callback, ctx) { - var e = this.e || (this.e = {}); - - (e[name] || (e[name] = [])).push({ - fn: callback, - ctx: ctx - }); - - return this; - }, - - once: function (name, callback, ctx) { - var self = this; - function listener () { - self.off(name, listener); - callback.apply(ctx, arguments); - }; - - listener._ = callback - return this.on(name, listener, ctx); - }, - - emit: function (name) { - var data = [].slice.call(arguments, 1); - var evtArr = ((this.e || (this.e = {}))[name] || []).slice(); - var i = 0; - var len = evtArr.length; - - for (i; i < len; i++) { - evtArr[i].fn.apply(evtArr[i].ctx, data); - } - - return this; - }, - - off: function (name, callback) { - var e = this.e || (this.e = {}); - var evts = e[name]; - var liveEvents = []; - - if (evts && callback) { - for (var i = 0, len = evts.length; i < len; i++) { - if (evts[i].fn !== callback && evts[i].fn._ !== callback) - liveEvents.push(evts[i]); - } - } - - // Remove event from queue to prevent memory leak - // Suggested by https://github.com/lazd - // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910 - - (liveEvents.length) - ? e[name] = liveEvents - : delete e[name]; - - return this; - } -}; - -module.exports = E; - -},{}],8:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -var _select = require('select'); - -var _select2 = _interopRequireDefault(_select); - -/** - * Inner class which performs selection from either `text` or `target` - * properties and then executes copy or cut operations. - */ - -var ClipboardAction = (function () { - /** - * @param {Object} options - */ - - function ClipboardAction(options) { - _classCallCheck(this, ClipboardAction); - - this.resolveOptions(options); - this.initSelection(); - } - - /** - * Defines base properties passed from constructor. - * @param {Object} options - */ - - ClipboardAction.prototype.resolveOptions = function resolveOptions() { - var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; - - this.action = options.action; - this.emitter = options.emitter; - this.target = options.target; - this.text = options.text; - this.trigger = options.trigger; - - this.selectedText = ''; - }; - - /** - * Decides which selection strategy is going to be applied based - * on the existence of `text` and `target` properties. - */ - - ClipboardAction.prototype.initSelection = function initSelection() { - if (this.text && this.target) { - throw new Error('Multiple attributes declared, use either "target" or "text"'); - } else if (this.text) { - this.selectFake(); - } else if (this.target) { - this.selectTarget(); - } else { - throw new Error('Missing required attributes, use either "target" or "text"'); - } - }; - - /** - * Creates a fake textarea element, sets its value from `text` property, - * and makes a selection on it. - */ - - ClipboardAction.prototype.selectFake = function selectFake() { - var _this = this; - - this.removeFake(); - - this.fakeHandler = document.body.addEventListener('click', function () { - return _this.removeFake(); - }); - - this.fakeElem = document.createElement('textarea'); - this.fakeElem.style.position = 'absolute'; - this.fakeElem.style.left = '-9999px'; - this.fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + 'px'; - this.fakeElem.setAttribute('readonly', ''); - this.fakeElem.value = this.text; - - document.body.appendChild(this.fakeElem); - - this.selectedText = _select2['default'](this.fakeElem); - this.copyText(); - }; - - /** - * Only removes the fake element after another click event, that way - * a user can hit `Ctrl+C` to copy because selection still exists. - */ - - ClipboardAction.prototype.removeFake = function removeFake() { - if (this.fakeHandler) { - document.body.removeEventListener('click'); - this.fakeHandler = null; - } - - if (this.fakeElem) { - document.body.removeChild(this.fakeElem); - this.fakeElem = null; - } - }; - - /** - * Selects the content from element passed on `target` property. - */ - - ClipboardAction.prototype.selectTarget = function selectTarget() { - this.selectedText = _select2['default'](this.target); - this.copyText(); - }; - - /** - * Executes the copy operation based on the current selection. - */ - - ClipboardAction.prototype.copyText = function copyText() { - var succeeded = undefined; - - try { - succeeded = document.execCommand(this.action); - } catch (err) { - succeeded = false; - } - - this.handleResult(succeeded); - }; - - /** - * Fires an event based on the copy operation result. - * @param {Boolean} succeeded - */ - - ClipboardAction.prototype.handleResult = function handleResult(succeeded) { - if (succeeded) { - this.emitter.emit('success', { - action: this.action, - text: this.selectedText, - trigger: this.trigger, - clearSelection: this.clearSelection.bind(this) - }); - } else { - this.emitter.emit('error', { - action: this.action, - trigger: this.trigger, - clearSelection: this.clearSelection.bind(this) - }); - } - }; - - /** - * Removes current selection and focus from `target` element. - */ - - ClipboardAction.prototype.clearSelection = function clearSelection() { - if (this.target) { - this.target.blur(); - } - - window.getSelection().removeAllRanges(); - }; - - /** - * Sets the `action` to be performed which can be either 'copy' or 'cut'. - * @param {String} action - */ - - /** - * Destroy lifecycle. - */ - - ClipboardAction.prototype.destroy = function destroy() { - this.removeFake(); - }; - - _createClass(ClipboardAction, [{ - key: 'action', - set: function set() { - var action = arguments.length <= 0 || arguments[0] === undefined ? 'copy' : arguments[0]; - - this._action = action; - - if (this._action !== 'copy' && this._action !== 'cut') { - throw new Error('Invalid "action" value, use either "copy" or "cut"'); - } - }, - - /** - * Gets the `action` property. - * @return {String} - */ - get: function get() { - return this._action; - } - - /** - * Sets the `target` property using an element - * that will be have its content copied. - * @param {Element} target - */ - }, { - key: 'target', - set: function set(target) { - if (target !== undefined) { - if (target && typeof target === 'object' && target.nodeType === 1) { - this._target = target; - } else { - throw new Error('Invalid "target" value, use a valid Element'); - } - } - }, - - /** - * Gets the `target` property. - * @return {String|HTMLElement} - */ - get: function get() { - return this._target; - } - }]); - - return ClipboardAction; -})(); - -exports['default'] = ClipboardAction; -module.exports = exports['default']; - -},{"select":6}],9:[function(require,module,exports){ -'use strict'; - -exports.__esModule = true; - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var _clipboardAction = require('./clipboard-action'); - -var _clipboardAction2 = _interopRequireDefault(_clipboardAction); - -var _tinyEmitter = require('tiny-emitter'); - -var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter); - -var _goodListener = require('good-listener'); - -var _goodListener2 = _interopRequireDefault(_goodListener); - -/** - * Base class which takes one or more elements, adds event listeners to them, - * and instantiates a new `ClipboardAction` on each click. - */ - -var Clipboard = (function (_Emitter) { - _inherits(Clipboard, _Emitter); - - /** - * @param {String|HTMLElement|HTMLCollection|NodeList} trigger - * @param {Object} options - */ - - function Clipboard(trigger, options) { - _classCallCheck(this, Clipboard); - - _Emitter.call(this); - - this.resolveOptions(options); - this.listenClick(trigger); - } - - /** - * Helper function to retrieve attribute value. - * @param {String} suffix - * @param {Element} element - */ - - /** - * Defines if attributes would be resolved using internal setter functions - * or custom functions that were passed in the constructor. - * @param {Object} options - */ - - Clipboard.prototype.resolveOptions = function resolveOptions() { - var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; - - this.action = typeof options.action === 'function' ? options.action : this.defaultAction; - this.target = typeof options.target === 'function' ? options.target : this.defaultTarget; - this.text = typeof options.text === 'function' ? options.text : this.defaultText; - }; - - /** - * Adds a click event listener to the passed trigger. - * @param {String|HTMLElement|HTMLCollection|NodeList} trigger - */ - - Clipboard.prototype.listenClick = function listenClick(trigger) { - var _this = this; - - this.listener = _goodListener2['default'](trigger, 'click', function (e) { - return _this.onClick(e); - }); - }; - - /** - * Defines a new `ClipboardAction` on each click event. - * @param {Event} e - */ - - Clipboard.prototype.onClick = function onClick(e) { - var trigger = e.delegateTarget || e.currentTarget; - - if (this.clipboardAction) { - this.clipboardAction = null; - } - - this.clipboardAction = new _clipboardAction2['default']({ - action: this.action(trigger), - target: this.target(trigger), - text: this.text(trigger), - trigger: trigger, - emitter: this - }); - }; - - /** - * Default `action` lookup function. - * @param {Element} trigger - */ - - Clipboard.prototype.defaultAction = function defaultAction(trigger) { - return getAttributeValue('action', trigger); - }; - - /** - * Default `target` lookup function. - * @param {Element} trigger - */ - - Clipboard.prototype.defaultTarget = function defaultTarget(trigger) { - var selector = getAttributeValue('target', trigger); - - if (selector) { - return document.querySelector(selector); - } - }; - - /** - * Default `text` lookup function. - * @param {Element} trigger - */ - - Clipboard.prototype.defaultText = function defaultText(trigger) { - return getAttributeValue('text', trigger); - }; - - /** - * Destroy lifecycle. - */ - - Clipboard.prototype.destroy = function destroy() { - this.listener.destroy(); - - if (this.clipboardAction) { - this.clipboardAction.destroy(); - this.clipboardAction = null; - } - }; - - return Clipboard; -})(_tinyEmitter2['default']); - -function getAttributeValue(suffix, element) { - var attribute = 'data-clipboard-' + suffix; - - if (!element.hasAttribute(attribute)) { - return; - } - - return element.getAttribute(attribute); -} - -exports['default'] = Clipboard; -module.exports = exports['default']; - -},{"./clipboard-action":8,"good-listener":5,"tiny-emitter":7}]},{},[9])(9) -}); \ No newline at end of file diff --git a/Public/static/clipboard/clipboard.min.js b/Public/static/clipboard/clipboard.min.js deleted file mode 100644 index 4e2a012a6..000000000 --- a/Public/static/clipboard/clipboard.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/*! - * clipboard.js v1.5.5 - * https://zenorocha.github.io/clipboard.js - * - * Licensed MIT © Zeno Rocha - */ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Clipboard=t()}}(function(){var t,e,n;return function t(e,n,r){function o(a,c){if(!n[a]){if(!e[a]){var s="function"==typeof require&&require;if(!c&&s)return s(a,!0);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(t,e,n){var r=t("matches-selector");e.exports=function(t,e,n){for(var o=n?t:t.parentNode;o&&o!==document;){if(r(o,e))return o;o=o.parentNode}}},{"matches-selector":2}],2:[function(t,e,n){function r(t,e){if(i)return i.call(t,e);for(var n=t.parentNode.querySelectorAll(e),r=0;r<n.length;++r)if(n[r]==t)return!0;return!1}var o=Element.prototype,i=o.matchesSelector||o.webkitMatchesSelector||o.mozMatchesSelector||o.msMatchesSelector||o.oMatchesSelector;e.exports=r},{}],3:[function(t,e,n){function r(t,e,n,r){var i=o.apply(this,arguments);return t.addEventListener(n,i),{destroy:function(){t.removeEventListener(n,i)}}}function o(t,e,n,r){return function(n){n.delegateTarget=i(n.target,e,!0),n.delegateTarget&&r.call(t,n)}}var i=t("closest");e.exports=r},{closest:1}],4:[function(t,e,n){n.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},n.nodeList=function(t){var e=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===e||"[object HTMLCollection]"===e)&&"length"in t&&(0===t.length||n.node(t[0]))},n.string=function(t){return"string"==typeof t||t instanceof String},n.function=function(t){var e=Object.prototype.toString.call(t);return"[object Function]"===e}},{}],5:[function(t,e,n){function r(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!c.string(e))throw new TypeError("Second argument must be a String");if(!c.function(n))throw new TypeError("Third argument must be a Function");if(c.node(t))return o(t,e,n);if(c.nodeList(t))return i(t,e,n);if(c.string(t))return a(t,e,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function o(t,e,n){return t.addEventListener(e,n),{destroy:function(){t.removeEventListener(e,n)}}}function i(t,e,n){return Array.prototype.forEach.call(t,function(t){t.addEventListener(e,n)}),{destroy:function(){Array.prototype.forEach.call(t,function(t){t.removeEventListener(e,n)})}}}function a(t,e,n){return s(document.body,t,e,n)}var c=t("./is"),s=t("delegate");e.exports=r},{"./is":4,delegate:3}],6:[function(t,e,n){function r(t){var e;if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName)t.focus(),t.setSelectionRange(0,t.value.length),e=t.value;else{t.hasAttribute("contenteditable")&&t.focus();var n=window.getSelection(),r=document.createRange();r.selectNodeContents(t),n.removeAllRanges(),n.addRange(r),e=n.toString()}return e}e.exports=r},{}],7:[function(t,e,n){function r(){}r.prototype={on:function(t,e,n){var r=this.e||(this.e={});return(r[t]||(r[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){function r(){o.off(t,r),e.apply(n,arguments)}var o=this;return r._=e,this.on(t,r,n)},emit:function(t){var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),r=0,o=n.length;for(r;o>r;r++)n[r].fn.apply(n[r].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),r=n[t],o=[];if(r&&e)for(var i=0,a=r.length;a>i;i++)r[i].fn!==e&&r[i].fn._!==e&&o.push(r[i]);return o.length?n[t]=o:delete n[t],this}},e.exports=r},{}],8:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}n.__esModule=!0;var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=t("select"),c=r(a),s=function(){function t(e){o(this,t),this.resolveOptions(e),this.initSelection()}return t.prototype.resolveOptions=function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.action=e.action,this.emitter=e.emitter,this.target=e.target,this.text=e.text,this.trigger=e.trigger,this.selectedText=""},t.prototype.initSelection=function t(){if(this.text&&this.target)throw new Error('Multiple attributes declared, use either "target" or "text"');if(this.text)this.selectFake();else{if(!this.target)throw new Error('Missing required attributes, use either "target" or "text"');this.selectTarget()}},t.prototype.selectFake=function t(){var e=this;this.removeFake(),this.fakeHandler=document.body.addEventListener("click",function(){return e.removeFake()}),this.fakeElem=document.createElement("textarea"),this.fakeElem.style.position="absolute",this.fakeElem.style.left="-9999px",this.fakeElem.style.top=(window.pageYOffset||document.documentElement.scrollTop)+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,document.body.appendChild(this.fakeElem),this.selectedText=c.default(this.fakeElem),this.copyText()},t.prototype.removeFake=function t(){this.fakeHandler&&(document.body.removeEventListener("click"),this.fakeHandler=null),this.fakeElem&&(document.body.removeChild(this.fakeElem),this.fakeElem=null)},t.prototype.selectTarget=function t(){this.selectedText=c.default(this.target),this.copyText()},t.prototype.copyText=function t(){var e=void 0;try{e=document.execCommand(this.action)}catch(n){e=!1}this.handleResult(e)},t.prototype.handleResult=function t(e){e?this.emitter.emit("success",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)}):this.emitter.emit("error",{action:this.action,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})},t.prototype.clearSelection=function t(){this.target&&this.target.blur(),window.getSelection().removeAllRanges()},t.prototype.destroy=function t(){this.removeFake()},i(t,[{key:"action",set:function t(){var e=arguments.length<=0||void 0===arguments[0]?"copy":arguments[0];if(this._action=e,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function t(){return this._action}},{key:"target",set:function t(e){if(void 0!==e){if(!e||"object"!=typeof e||1!==e.nodeType)throw new Error('Invalid "target" value, use a valid Element');this._target=e}},get:function t(){return this._target}}]),t}();n.default=s,e.exports=n.default},{select:6}],9:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t,e){var n="data-clipboard-"+t;if(e.hasAttribute(n))return e.getAttribute(n)}n.__esModule=!0;var c=t("./clipboard-action"),s=r(c),u=t("tiny-emitter"),l=r(u),f=t("good-listener"),d=r(f),h=function(t){function e(n,r){o(this,e),t.call(this),this.resolveOptions(r),this.listenClick(n)}return i(e,t),e.prototype.resolveOptions=function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.action="function"==typeof e.action?e.action:this.defaultAction,this.target="function"==typeof e.target?e.target:this.defaultTarget,this.text="function"==typeof e.text?e.text:this.defaultText},e.prototype.listenClick=function t(e){var n=this;this.listener=d.default(e,"click",function(t){return n.onClick(t)})},e.prototype.onClick=function t(e){var n=e.delegateTarget||e.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new s.default({action:this.action(n),target:this.target(n),text:this.text(n),trigger:n,emitter:this})},e.prototype.defaultAction=function t(e){return a("action",e)},e.prototype.defaultTarget=function t(e){var n=a("target",e);return n?document.querySelector(n):void 0},e.prototype.defaultText=function t(e){return a("text",e)},e.prototype.destroy=function t(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)},e}(l.default);n.default=h,e.exports=n.default},{"./clipboard-action":8,"good-listener":5,"tiny-emitter":7}]},{},[9])(9)}); \ No newline at end of file