init
This commit is contained in:
commit
db843337ce
31 files changed
+4888
No files matched your search
+14
@@ -0,0 +1,14 @@
|
||||
# CakePHP 3
|
||||
|
||||
/vendor/*
|
||||
/config/app.php
|
||||
/tmp/*
|
||||
/logs/*
|
||||
|
||||
# CakePHP 2
|
||||
|
||||
/app/tmp/*
|
||||
/app/Config/core.php
|
||||
/app/Config/database.php
|
||||
/vendors/*
|
||||
.idea
|
||||
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 轶哥
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,447 @@
|
||||
<?php
|
||||
error_reporting(0);
|
||||
require_once 'config.php';
|
||||
require_once 'medoo.php';
|
||||
|
||||
use Medoo\Medoo;
|
||||
|
||||
$database = new Medoo($DBCONFIG);
|
||||
|
||||
$redis = new Redis();
|
||||
$redis->connect($REDISCONFIG['host'], $REDISCONFIG['port'], $REDISCONFIG['database']);
|
||||
$redis->auth($REDISCONFIG['password']);
|
||||
|
||||
header('Access-Control-Allow-Headers: Authorization, DNT, User-Agent, Keep-Alive, Origin, X-Requested-With, Content-Type, Accept, x-clientid');
|
||||
header('Access-Control-Allow-Methods: PUT, POST, GET, DELETE, OPTIONS');
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
|
||||
function action_login($database, $redis)
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://login.yige.ink/info?token=' . $_ENV['API_TOKEN'] . '&code=' . $_GET['code']);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
$output = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
$output_array = json_decode($output, true);
|
||||
|
||||
$output_array['privilege'] = json_encode($output_array['privilege']);
|
||||
|
||||
$row = $database->select('userinfo', '*', [
|
||||
'openid' => $output_array['openid'],
|
||||
]);
|
||||
|
||||
if (sizeof($row) != 0) {
|
||||
$database->update('userinfo', $output_array, [
|
||||
'openid' => $output_array['openid'],
|
||||
]);
|
||||
|
||||
$output_array['openid'] = null;
|
||||
|
||||
echo json_encode([
|
||||
'status' => 1,
|
||||
'result' => [
|
||||
'id' => $row[0]['id'],
|
||||
'userinfo' => $output_array
|
||||
]
|
||||
]);
|
||||
} else {
|
||||
$database->insert('userinfo', $output_array);
|
||||
|
||||
$output_array['openid'] = null;
|
||||
|
||||
echo json_encode([
|
||||
'status' => 1,
|
||||
'result' => [
|
||||
'id' => $database->id(),
|
||||
'userinfo' => $output_array
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
function action_listUser($database, $redis)
|
||||
{
|
||||
$row = $database->select('userinfo', '*');
|
||||
|
||||
echo json_encode([
|
||||
'status' => 1,
|
||||
'result' => [
|
||||
'list' => $row,
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
function action_getUserInfo($database, $redis)
|
||||
{
|
||||
$row = $database->select('userinfo', '*', [
|
||||
'id' => $_POST['id'],
|
||||
]);
|
||||
|
||||
echo json_encode([
|
||||
'status' => 1,
|
||||
'result' => [
|
||||
'userinfo' => $row[0]
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
function action_setRealName($database, $redis)
|
||||
{
|
||||
$database->update('userinfo', [
|
||||
'realname' => $_POST['realname']
|
||||
], [
|
||||
'id' => $_POST['id'],
|
||||
]);
|
||||
|
||||
echo json_encode([
|
||||
'status' => 1
|
||||
]);
|
||||
}
|
||||
|
||||
function handleRow($row)
|
||||
{
|
||||
foreach ($row as $ro => $val) {
|
||||
if (is_numeric($ro)) {
|
||||
unset($row[$ro]);
|
||||
}
|
||||
}
|
||||
if ($row['isAnswer'] == '1') {
|
||||
$row['isAnswer'] = '有';
|
||||
} else {
|
||||
$row['isAnswer'] = '无';
|
||||
}
|
||||
|
||||
$row['passPercent'] = round((float)$row['passPercent'] * 100, 2) . '%';
|
||||
|
||||
if ($row['difficulty'] == '1') {
|
||||
$row['difficulty'] = '简单';
|
||||
} else if ($row['difficulty'] == '2') {
|
||||
$row['difficulty'] = '中等';
|
||||
} else if ($row['difficulty'] == '3') {
|
||||
$row['difficulty'] = '困难';
|
||||
}
|
||||
|
||||
unset($row['type']);
|
||||
|
||||
return array_values($row);
|
||||
}
|
||||
|
||||
function handleSortRows($rows)
|
||||
{
|
||||
uksort($rows, function ($a, $b) {
|
||||
return (int)$a['no'] - (int)$b['no'];
|
||||
});
|
||||
}
|
||||
|
||||
function action_getProblemsetList($database, $redis)
|
||||
{
|
||||
// $rowAll = $database->debug()->select('problemset', [
|
||||
// "[>]record" => [
|
||||
// "id" => "problemset_id",
|
||||
// $_GET['user_id'] => "user_id"
|
||||
// ],
|
||||
// ], [
|
||||
// 'record.is_pass',
|
||||
// 'problemset.id',
|
||||
// 'problemset.no',
|
||||
// 'problemset.name',
|
||||
// 'problemset.language',
|
||||
// 'problemset.type',
|
||||
// 'problemset.isAnswer',
|
||||
// 'problemset.passPercent',
|
||||
// 'problemset.difficulty',
|
||||
// ], [
|
||||
// "ORDER" => "no"
|
||||
// ]);
|
||||
|
||||
$rowAll = $database->query("SELECT
|
||||
`record`.`is_pass`,
|
||||
`problemset`.`id`,
|
||||
`problemset`.`no`,
|
||||
`problemset`.`name`,
|
||||
`problemset`.`language`,
|
||||
`problemset`.`type`,
|
||||
`problemset`.`isAnswer`,
|
||||
`problemset`.`passPercent`,
|
||||
`problemset`.`difficulty`
|
||||
FROM
|
||||
`problemset`
|
||||
LEFT JOIN `record` ON `problemset`.`id` = `record`.`problemset_id` AND `record`.`user_id` = " . $_GET['user_id'] . " ORDER BY
|
||||
`no`")->fetchAll();
|
||||
|
||||
$rowStage = [];
|
||||
$rowChallenge = [];
|
||||
|
||||
foreach ($rowAll as $row)
|
||||
if ($row['type'] == '1')
|
||||
array_push($rowStage, handleRow($row));
|
||||
else
|
||||
array_push($rowChallenge, handleRow($row));
|
||||
|
||||
|
||||
handleSortRows($rowStage);
|
||||
|
||||
handleSortRows($rowChallenge);
|
||||
|
||||
echo json_encode([
|
||||
'status' => 1,
|
||||
'result' => [
|
||||
'stage' => $rowStage,
|
||||
'challenge' => $rowChallenge,
|
||||
'test' => $database->log()
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
function action_editProblemset($database, $redis)
|
||||
{
|
||||
$datas = $_POST;
|
||||
|
||||
$database->update('problemset', $datas, [
|
||||
'id' => $_GET['id']
|
||||
]);
|
||||
|
||||
echo json_encode([
|
||||
'status' => 1
|
||||
]);
|
||||
}
|
||||
|
||||
function action_addProblemset($database, $redis)
|
||||
{
|
||||
$datas = $_POST;
|
||||
|
||||
$datas['no'] = $redis->incr("ids_" . $datas['type']);
|
||||
|
||||
$database->insert('problemset', $datas);
|
||||
|
||||
echo json_encode([
|
||||
'status' => 1,
|
||||
'result' => [
|
||||
'id' => $database->id(),
|
||||
'no' => $datas['no']
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
function action_getProblemset($database, $redis)
|
||||
{
|
||||
if (isset($_GET['id'])) {
|
||||
$row = $database->select('problemset', '*', [
|
||||
'id' => $_GET['id']
|
||||
]);
|
||||
if (sizeof($row) > 0) {
|
||||
$row = $row[0];
|
||||
echo json_encode([
|
||||
'status' => 1,
|
||||
'result' => $row
|
||||
]);
|
||||
} else {
|
||||
echo json_encode([
|
||||
'status' => 2,
|
||||
'msg' => '没有找到此题目信息'
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
echo json_encode([
|
||||
'status' => 0,
|
||||
'msg' => '缺少必须参数'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
function action_saveTestCode($database, $redis)
|
||||
{
|
||||
$datas = $_POST;
|
||||
|
||||
$redis->set('testCode_' . $datas['user_id'], $datas['code']);
|
||||
|
||||
// if ($database->has("test_record", [
|
||||
// 'user_id' => $datas['user_id']
|
||||
// ])) {
|
||||
// $database->update("test_record", [
|
||||
// 'code' => $datas['code']
|
||||
// ], [
|
||||
// 'user_id' => $datas['user_id']
|
||||
// ]);
|
||||
// } else {
|
||||
// $database->insert('test_record', $datas);
|
||||
// }
|
||||
|
||||
echo json_encode([
|
||||
'status' => 1
|
||||
]);
|
||||
}
|
||||
|
||||
function action_getTestCode($database, $redis)
|
||||
{
|
||||
$datas = $_POST;
|
||||
|
||||
// $row = $database->select("test_record", ["code"], [
|
||||
// 'user_id' => $datas['user_id']
|
||||
// ]);
|
||||
|
||||
$res = $redis->get('testCode_' . $datas['user_id']);
|
||||
|
||||
if ($res == null || $res == "") {
|
||||
echo json_encode([
|
||||
'status' => 1,
|
||||
'code' => '<?php
|
||||
echo "Hello World!";'
|
||||
]);
|
||||
} else {
|
||||
echo json_encode([
|
||||
'status' => 1,
|
||||
'code' => $res
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
function addCredit($database, $problemsetId, $userId)
|
||||
{
|
||||
$problemsetRow = $database->select("problemset", ['id', 'isCredit', 'credit', 'type', 'no'], [
|
||||
'id' => $problemsetId
|
||||
]);
|
||||
|
||||
if ($problemsetRow[0]['isCredit'] == '1') {
|
||||
$userinfoRow = $database->select("userinfo", ['id', "credit"], [
|
||||
'id' => $userId
|
||||
]);
|
||||
|
||||
$oldCredit = $userinfoRow[0]['credit'];
|
||||
|
||||
$addCredit = $problemsetRow[0]['credit'];
|
||||
|
||||
$newCredit = (int)$oldCredit + (int)$addCredit;
|
||||
|
||||
if (!$database->has("credit_flow", [ // 限制一道题只能获得一次积分
|
||||
'problemset_id' => $problemsetId
|
||||
])) {
|
||||
$theType = '闯关模式';
|
||||
if ($problemsetRow[0]['type'] == '2') {
|
||||
$theType = '挑战赛';
|
||||
}
|
||||
|
||||
$log = $theType . '第' . $problemsetRow[0]['no'] . '题得分';
|
||||
|
||||
$database->insert('credit_flow', [ // 写入积分变动日志
|
||||
'log' => $log,
|
||||
'user_id' => $userId,
|
||||
'problemset_id' => $problemsetId,
|
||||
'income' => $addCredit,
|
||||
'credit' => $newCredit
|
||||
]);
|
||||
|
||||
$database->update('userinfo', [
|
||||
'credit' => $newCredit
|
||||
], [
|
||||
'id' => $userId
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function action_addRecord($database, $redis)
|
||||
{
|
||||
$datas = $_POST;
|
||||
|
||||
$row = $database->select("record", ['is_pass'], [
|
||||
'user_id' => $datas['user_id'],
|
||||
'problemset_id' => $datas['problemset_id']
|
||||
]);
|
||||
|
||||
if (sizeof($row) != 0) {
|
||||
if ($datas['is_pass'] == '1' || $row[0]['is_pass'] != '1') {
|
||||
$database->update('record', $datas, [
|
||||
'user_id' => $datas['user_id'],
|
||||
'problemset_id' => $datas['problemset_id']
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
$database->insert('record', $datas);
|
||||
}
|
||||
|
||||
echo json_encode([
|
||||
'status' => 1
|
||||
]);
|
||||
|
||||
fastcgi_finish_request();
|
||||
|
||||
// 异步
|
||||
|
||||
if ($datas['is_pass'] == '1') { // 增加积分
|
||||
addCredit($database, $datas['problemset_id'], $datas['user_id']);
|
||||
}
|
||||
}
|
||||
|
||||
function action_getRecord($database, $redis)
|
||||
{
|
||||
$datas = $_POST;
|
||||
|
||||
$row = $database->select("record", ['code'], [
|
||||
'user_id' => $datas['user_id'],
|
||||
'problemset_id' => $datas['problemset_id']
|
||||
]);
|
||||
|
||||
if (sizeof($row) != 0) {
|
||||
echo json_encode([
|
||||
'status' => 1,
|
||||
'code' => $row[0]['code']
|
||||
]);
|
||||
} else {
|
||||
echo json_encode([
|
||||
'status' => 2
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
function action_getNextNo($database, $redis)
|
||||
{
|
||||
$no = (int)$_GET['no'] + 1;
|
||||
|
||||
$row = $database->select("problemset", ["id"], [
|
||||
'no' => $no,
|
||||
'type' => $_GET['type']
|
||||
]);
|
||||
|
||||
if (sizeof($row) != 0) {
|
||||
echo json_encode([
|
||||
'status' => 1,
|
||||
'id' => $row[0]['id']
|
||||
]);
|
||||
} else {
|
||||
echo json_encode([
|
||||
'status' => 1,
|
||||
'id' => 0
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
function action_getMyRecordCount($database, $redis)
|
||||
{
|
||||
$Allcount = $database->count("problemset", [
|
||||
"type" => "1"
|
||||
]);
|
||||
|
||||
$passCount = $database->count("record", [
|
||||
'user_id' => $_GET['user_id'],
|
||||
'is_pass' => '1'
|
||||
]);
|
||||
|
||||
echo json_encode([
|
||||
'status' => 1,
|
||||
'result' => [
|
||||
'all' => $Allcount,
|
||||
'pass' => $passCount
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
if (isset($_GET['action'])) {
|
||||
$action = "action_" . $_GET['action'];
|
||||
$action($database, $redis);
|
||||
} else {
|
||||
echo json_encode(['err' => '非法访问']);
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
$DBCONFIG = [
|
||||
'database_type' => 'mysql',
|
||||
'database_name' => $_ENV['MYSQL_DBNAME'],
|
||||
'server' => $_ENV['MYSQL_HOST'],
|
||||
'username' => $_ENV['MYSQL_USERNAME'],
|
||||
'password' => $_ENV['MYSQL_PASSWORD'],
|
||||
'charset' => 'utf8mb4',
|
||||
'port' => $_ENV['MYSQL_PORT'],
|
||||
];
|
||||
|
||||
$REDISCONFIG = [
|
||||
'host' => $_ENV['REDIS_HOST'],
|
||||
'port' => $_ENV['REDIS_PORT'],
|
||||
'password' => $_ENV['REDIS_PASSWORD'],
|
||||
'database' => 0
|
||||
];
|
||||
+281
@@ -0,0 +1,281 @@
|
||||
* {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html, body {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: rgb(61, 146, 201);
|
||||
}
|
||||
|
||||
a:hover,
|
||||
a:focus {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#loading {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: 9999999;
|
||||
background: #fff;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#loading img {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 16px;
|
||||
margin-top: -4px;
|
||||
margin-left: -4px;
|
||||
}
|
||||
|
||||
.pure-menu-selected .pure-menu-link, .pure-menu-selected .pure-menu-link:visited {
|
||||
background-color: #373C5A;
|
||||
color: #adbdad;
|
||||
}
|
||||
|
||||
.pure-menu-heading {
|
||||
color: #d7d9dc;
|
||||
}
|
||||
|
||||
.pure-menu-link {
|
||||
color: #adbdad;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-weight: 100;
|
||||
}
|
||||
|
||||
/* LAYOUT CSS */
|
||||
.pure-img-responsive {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
#layout {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.header {
|
||||
top: auto;
|
||||
padding: 0.5em 1em;
|
||||
margin: 0 0;
|
||||
position: relative;
|
||||
text-align: left;
|
||||
background-color: #252A3A;
|
||||
}
|
||||
|
||||
.header .pure-menu {
|
||||
border-bottom-color: black;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.userinfo {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 50px;
|
||||
}
|
||||
|
||||
#leftPane {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#rightPane {
|
||||
padding: 10px;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#avator img {
|
||||
margin-top: 5px;
|
||||
width: 40px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
#logout {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 1em;
|
||||
}
|
||||
|
||||
#avator {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#nickname {
|
||||
color: #888;
|
||||
line-height: 50px;
|
||||
float: right;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
#realname {
|
||||
color: #888;
|
||||
line-height: 50px;
|
||||
float: right;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
#container {
|
||||
width: 100%;
|
||||
min-height: 300px;
|
||||
min-width: 300px;
|
||||
border: 1px solid #eeeeee;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.footer {
|
||||
padding: 1em 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.footer a {
|
||||
color: #ccc;
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
.footer .pure-menu a:hover,
|
||||
.footer .pure-menu a:focus {
|
||||
background: none;
|
||||
}
|
||||
|
||||
#out {
|
||||
margin-top: 0;
|
||||
border: 1px solid #eeeeee;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#run {
|
||||
margin-top: 10px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
#testRun {
|
||||
margin-top: 10px;
|
||||
float: right;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.auto {
|
||||
line-height: 60px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
iframe {
|
||||
border: 0;
|
||||
background: #fff;
|
||||
flex: 1 1 auto;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#rightPane code {
|
||||
color: #888;
|
||||
padding: 0 6px;
|
||||
}
|
||||
|
||||
/* index.php */
|
||||
|
||||
.index-main {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.index-main-table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.horizontal {
|
||||
list-style: none outside none;
|
||||
margin: 15px 0;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.horizontal li {
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.horizontal .active .pure-button {
|
||||
box-shadow: 0 0 0 1px rgba(0, 0, 0, .15) inset, 0 0 6px rgba(0, 0, 0, .2) inset;
|
||||
}
|
||||
|
||||
.admin {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#describeView, #answerView, #resultView {
|
||||
height: 100%;
|
||||
padding-bottom: 110px;
|
||||
}
|
||||
|
||||
#describeView .cont, #answerView .cont {
|
||||
border: 1px solid #eeeeee;
|
||||
height: 100%;
|
||||
padding: 10px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
#resultView .cont {
|
||||
height: 100%;
|
||||
padding: 10px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.testCase {
|
||||
min-height: 50px;
|
||||
}
|
||||
|
||||
.testCaseContent, .expectedResultContent {
|
||||
border: 1px solid #eeeeee;
|
||||
padding: 5px 10px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.expectedResult {
|
||||
min-height: 60px;
|
||||
}
|
||||
|
||||
.resultContent {
|
||||
height: 100%;
|
||||
border: 1px solid #eeeeee;
|
||||
}
|
||||
|
||||
#rightPane .cont pre code {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.dataTable td {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.dataTable .table-pname {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.myCredit {
|
||||
position: absolute;
|
||||
right: 50px;
|
||||
top: 63px;
|
||||
line-height: 38px;
|
||||
}
|
||||
|
||||
.myRecord {
|
||||
position: absolute;
|
||||
right: 150px;
|
||||
top: 63px;
|
||||
line-height: 38px;
|
||||
}
|
||||
|
||||
.dataTable .table-is-pass {
|
||||
text-align: right;
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/*!
|
||||
* StyleSheet for JQuery splitter Plugin version 0.27.1
|
||||
* Copyright (C) 2010-2018 Jakub T. Jankiewicz <https://jcubic.pl/me>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
.splitter_panel {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.splitter_panel .vsplitter {
|
||||
background-color: #f5f5f5;
|
||||
cursor: col-resize;
|
||||
z-index: 900;
|
||||
width: 7px;
|
||||
}
|
||||
|
||||
.splitter_panel .vsplitter:hover {
|
||||
background-color: #dddddd;
|
||||
}
|
||||
|
||||
.splitter_panel .hsplitter {
|
||||
background-color: #5F5F5F;
|
||||
cursor: row-resize;
|
||||
z-index: 800;
|
||||
height: 7px;
|
||||
}
|
||||
|
||||
.splitter_panel .vsplitter.splitter-invisible,
|
||||
.splitter_panel .hsplitter.splitter-invisible {
|
||||
background: none;
|
||||
}
|
||||
|
||||
.splitter_panel .vsplitter, .splitter_panel .left_panel, .splitter_panel .right_panel,
|
||||
.splitter_panel .hsplitter, .splitter_panel .top_panel, .splitter_panel .bottom_panel {
|
||||
position: absolute;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.splitter_panel .vsplitter, .splitter_panel .left_panel, .splitter_panel .right_panel {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.splitter_panel .hsplitter, .splitter_panel .top_panel, .splitter_panel .bottom_panel {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.splitter_panel .top_panel, .splitter_panel .left_panel, .splitter_panel .vsplitter {
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.splitter_panel .top_panel, .splitter_panel .bottom_panel, .splitter_panel .left_panel, .splitter_panel .hsplitter {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.splitter_panel .bottom_panel {
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.splitter_panel .right_panel {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.splitterMask {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 1000;
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
-- 开饭平台用户信息:
|
||||
-- openid 普通用户的标识,对当前开发者帐号唯一
|
||||
-- nickname 普通用户昵称
|
||||
-- sex 普通用户性别,1为男性,2为女性
|
||||
-- province 普通用户个人资料填写的省份
|
||||
-- city 普通用户个人资料填写的城市
|
||||
-- country 国家,如中国为CN
|
||||
-- headimgurl 用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空
|
||||
-- privilege 用户特权信息,json数组,如微信沃卡用户为(chinaunicom)
|
||||
-- unionid 用户统一标识。针对一个微信开放平台帐号下的应用,同一用户的unionid是唯一的。
|
||||
-- 开放平台用户
|
||||
CREATE TABLE `userinfo`(
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`openid` VARCHAR(64) NULL DEFAULT '' COMMENT '微信openid',
|
||||
`nickname` VARCHAR(128) NULL COMMENT '用户昵称',
|
||||
`realname` VARCHAR(20) NULL COMMENT '真实姓名',
|
||||
`sex` TINYINT(1) NULL COMMENT '用户性别,1男性,2女性',
|
||||
`language` VARCHAR(16) NULL COMMENT '语言',
|
||||
`province` VARCHAR(16) NULL COMMENT '用户个人资料填写的省份',
|
||||
`city` VARCHAR(16) NULL COMMENT '普通用户个人资料填写的城市',
|
||||
`country` VARCHAR(32) NULL COMMENT '国家,如中国为CN',
|
||||
`headimgurl` VARCHAR(256) NULL COMMENT '用户头像',
|
||||
`privilege` TEXT NULL COMMENT '用户特权信息,json 数组',
|
||||
`unionid` VARCHAR(128) NULL COMMENT '微信开放平台用户唯一标识',
|
||||
`admin` TINYINT(1) NULL DEFAULT 0 COMMENT '是否是管理员,1是,0不是',
|
||||
`credit` VARCHAR(128) NULL COMMENT '积分',
|
||||
`created_time` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updated_time` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
PRIMARY KEY(`id`)
|
||||
);
|
||||
|
||||
|
||||
-- 题目
|
||||
CREATE TABLE `problemset`(
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`no` BIGINT UNSIGNED NOT NULL,
|
||||
`type` VARCHAR(12) NULL COMMENT '分类',
|
||||
`name` VARCHAR(128) NULL COMMENT '题名',
|
||||
`isAnswer` VARCHAR(12) NULL COMMENT '是否有解答,1有,其余无',
|
||||
`language` VARCHAR(16) NULL COMMENT '编程语言',
|
||||
`passPercent` VARCHAR(16) NULL COMMENT '通过率',
|
||||
`difficulty` VARCHAR(16) NULL COMMENT '难度',
|
||||
`tag` VARCHAR(255) NULL COMMENT '标签',
|
||||
`mark` VARCHAR(256) NULL COMMENT '备注',
|
||||
`describe` LONGTEXT NULL COMMENT '题目描述',
|
||||
`answer` LONGTEXT NULL COMMENT '解答',
|
||||
`phpCode` LONGTEXT NULL COMMENT 'PHP代码',
|
||||
`javascriptCode` LONGTEXT NULL COMMENT 'Javascript代码',
|
||||
`phpUnitCode` LONGTEXT NULL COMMENT 'PHP测试代码',
|
||||
`testCase` LONGTEXT NULL COMMENT '测试用例',
|
||||
`expectedResult` LONGTEXT NULL COMMENT '预期结果',
|
||||
`credit` DECIMAL(8, 2) NULL COMMENT '积分',
|
||||
`isCredit` VARCHAR(5) NULL DEFAULT '0' COMMENT '是否积分,1是,0不是',
|
||||
`created_time` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updated_time` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
PRIMARY KEY(`id`)
|
||||
);
|
||||
|
||||
-- 做题记录
|
||||
CREATE TABLE `record`(
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`user_id` BIGINT UNSIGNED NOT NULL,
|
||||
`problemset_id` BIGINT UNSIGNED NOT NULL,
|
||||
`type` VARCHAR(12) NULL COMMENT '分类',
|
||||
`code` LONGTEXT NULL COMMENT '代码',
|
||||
`is_pass` VARCHAR(5) NULL DEFAULT '0' COMMENT '是否通过测试,1是,0不是',
|
||||
`created_time` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updated_time` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
PRIMARY KEY(`id`)
|
||||
);
|
||||
|
||||
-- -- 在线测试的记录
|
||||
-- CREATE TABLE `test_record`(
|
||||
-- `user_id` BIGINT UNSIGNED NOT NULL,
|
||||
-- `code` LONGTEXT NULL COMMENT '代码',
|
||||
-- `created_time` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
-- `updated_time` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
-- PRIMARY KEY(`user_id`)
|
||||
-- );
|
||||
|
||||
-- 积分变动(流水)
|
||||
CREATE TABLE `credit_flow`(
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`user_id` BIGINT UNSIGNED NOT NULL,
|
||||
`problemset_id` BIGINT UNSIGNED NOT NULL,
|
||||
`log` VARCHAR(256) NULL COMMENT '事由',
|
||||
`income` DECIMAL(8) NOT NULL COMMENT '动账',
|
||||
`credit` DECIMAL(8) NOT NULL COMMENT '当时总积分',
|
||||
`create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
PRIMARY KEY(`id`)
|
||||
);
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
</div>
|
||||
|
||||
<script src="/js/uniter.js"></script>
|
||||
<script crossorigin="anonymous" integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT"
|
||||
src="https://lib.baomitu.com/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script crossorigin="anonymous" integrity="sha384-RnOqe29SFv+Lre8BvIid2hveg/hFrUKA+uLJCbdL0EyEd6DzesjrF3dIhHh2EHsq"
|
||||
src="https://lib.baomitu.com/jquery.tabslet.js/1.7.3/jquery.tabslet.min.js"></script>
|
||||
<script crossorigin="anonymous" integrity="sha384-rgWRqC0OFPisxlUvl332tiM/qmaNxnlY46eksSZD84t+s2vZlqGeHrncwIRX7CGp"
|
||||
src="https://lib.baomitu.com/datatables/1.10.19/js/jquery.dataTables.min.js"></script>
|
||||
<script crossorigin="anonymous" integrity="sha384-83rBTICYr+FwAC+A5t0ZYsWjTcPXibCe/NBSFLAgMPkwHBvIi02EcE9OShMsGCi3"
|
||||
src="https://lib.baomitu.com/simplemde/1.11.2/simplemde.min.js"></script>
|
||||
<script crossorigin="anonymous" integrity="sha384-KpuxVjTC2hfOkg5KV3jSdx1eA6xy0PGS0wNfDrwf4sZBnZdzlIsnkH+LzLkavmH7"
|
||||
src="https://lib.baomitu.com/showdown/1.9.0/showdown.min.js"></script>
|
||||
<script crossorigin="anonymous" integrity="sha384-BlPof9RtjBqeJFskKv3sK3dh4Wk70iKlpIe92FeVN+6qxaGUOUu+mZNpALZ+K7ya"
|
||||
src="https://lib.baomitu.com/highlight.js/9.13.1/highlight.min.js"></script>
|
||||
<script crossorigin="anonymous" integrity="sha384-heo+KfbBN7U3Mb1E3ZDC1aW97zVBWyXmxIr/HQIgGrtBAUaHD1lBFq4Jlfq86SJe"
|
||||
src="https://lib.baomitu.com/monaco-editor/0.15.6/min/vs/loader.js"></script>
|
||||
<script src="/js/jquery.splitter.js"></script>
|
||||
<script src="/js/common.js"></script>
|
||||
<script src="/js<?php
|
||||
if ($nowURL != '/') {
|
||||
echo substr($nowURL, 0, strlen($nowURL) - 4);
|
||||
} else {
|
||||
echo 'index';
|
||||
}
|
||||
?>.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
//获得当前的脚本网址
|
||||
function GetCurUrl()
|
||||
{
|
||||
return $_SERVER["PHP_SELF"];
|
||||
}
|
||||
|
||||
$nowURL = GetCurUrl();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>在线PHP练习</title>
|
||||
<link crossorigin="anonymous" integrity="sha384-9Z9AuAj0Xi0z7WFOSgjjow8EnNY9wPNp925TVLlAyWhvZPsf5Ks23Ex0mxIrWJzJ"
|
||||
href="https://lib.baomitu.com/normalize/8.0.1/normalize.min.css" rel="stylesheet">
|
||||
<link crossorigin="anonymous" integrity="sha384-GQvMoYnQA47ImcAuL/b527e+tU96IK4h/WH1i8Y2oWVSzAne5jXEPr79FFDjbP2O"
|
||||
href="https://lib.baomitu.com/pure/1.0.0/base-min.css" rel="stylesheet">
|
||||
<link crossorigin="anonymous" integrity="sha384-b92sF+wDNTHrfEtRaYo+EpcA8FUyHOSXrdxKc9XB9kaaX1rSQAgMevW6cYeE5Bdv"
|
||||
href="https://lib.baomitu.com/pure/1.0.0/grids-responsive-min.css" rel="stylesheet">
|
||||
<link crossorigin="anonymous" integrity="sha384-T7EqrTLlfKxgBXvvj/5Lz2LDKWPwLFsdS/T4MmXC+EjrRKTH9FWtGOn+JHoKWzSJ"
|
||||
href="https://lib.baomitu.com/pure/1.0.0/menus-min.css" rel="stylesheet">
|
||||
<link crossorigin="anonymous" integrity="sha384-FmOvPjY6YwQXYea5Ja+3CH7+feIm/+HpUXtRUh8g0F7ybli4aDV//h1GzWLDpwHO"
|
||||
href="https://lib.baomitu.com/pure/1.0.0/forms-min.css" rel="stylesheet">
|
||||
<link crossorigin="anonymous" integrity="sha384-fCgQlRnjKz+VWhXVjN344OnXNV9kmKYH2rCqLz4TmMne2vnO1ykQU4Cz1llu+ud8"
|
||||
href="https://lib.baomitu.com/pure/1.0.0/buttons-min.css" rel="stylesheet">
|
||||
<link crossorigin="anonymous" integrity="sha384-MIf4KOt3X2OQ4tRxVM7Ygl5hNkkyYabJ8zm0m+TDRw9NYmAkEXXFpst8PVbF2s/9"
|
||||
href="https://lib.baomitu.com/pure/1.0.0/tables-min.css" rel="stylesheet">
|
||||
<link crossorigin="anonymous" integrity="sha384-rQdIropf4eQBEB9SkNB4xxukYHlkyXJfKYkpVNUQOLizz+d2q0wo7zjVA2XcYSij"
|
||||
href="https://lib.baomitu.com/simplemde/1.11.2/simplemde.min.css" rel="stylesheet">
|
||||
<link crossorigin="anonymous" integrity="sha384-HNGokaYN28H3qifBLVX5/ob64kuuYiIeQfo/b+M/hzijJeueJbsVEAvglj1qvfuY"
|
||||
href="https://lib.baomitu.com/highlight.js/9.13.1/styles/vs.min.css" rel="stylesheet">
|
||||
<link crossorigin="anonymous" integrity="sha384-1UXhfqyOyO+W+XsGhiIFwwD3hsaHRz2XDGMle3b8bXPH5+cMsXVShDoHA3AH/y/p"
|
||||
href="https://lib.baomitu.com/datatables/1.10.19/css/jquery.dataTables.min.css" rel="stylesheet">
|
||||
<link href="/css/jquery.splitter.css" rel="stylesheet">
|
||||
<link href="/css/common.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="loading">
|
||||
<img src="/loading.gif">
|
||||
</div>
|
||||
<div id="layout" class="pure-g">
|
||||
<div class="header">
|
||||
<div class="pure-menu pure-menu-horizontal">
|
||||
<span class="pure-menu-heading">PHP练习</span>
|
||||
<?php include('menu.php'); ?>
|
||||
</div>
|
||||
|
||||
<div class="userinfo">
|
||||
<div id="avator"></div>
|
||||
<div id="nickname"></div>
|
||||
<div id="realname"></div>
|
||||
</div>
|
||||
|
||||
<div id="logout">
|
||||
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" width="25" height="25">
|
||||
<path fill="#d7d9dc"
|
||||
d="M835.669333 554.666667h-473.173333A42.453333 42.453333 0 0 1 320 512a42.666667 42.666667 0 0 1 42.474667-42.666667h473.173333l-161.813333-161.834666a42.666667 42.666667 0 0 1 60.330666-60.330667l234.666667 234.666667a42.666667 42.666667 0 0 1 0 60.330666l-234.666667 234.666667a42.666667 42.666667 0 0 1-60.330666-60.330667L835.669333 554.666667zM554.666667 42.666667a42.666667 42.666667 0 1 1 0 85.333333H149.525333C137.578667 128 128 137.578667 128 149.482667v725.034666C128 886.4 137.6 896 149.525333 896H554.666667a42.666667 42.666667 0 1 1 0 85.333333H149.525333A106.816 106.816 0 0 1 42.666667 874.517333V149.482667A106.773333 106.773333 0 0 1 149.525333 42.666667H554.666667z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php include('header.php'); ?>
|
||||
<div class="myRecord"><button class="pure-button" id="myRecordButton">我的学习统计</button></div>
|
||||
<div class="myCredit"></div>
|
||||
<div class='tabs tabs_default'>
|
||||
<ul class='horizontal'>
|
||||
<li><a class="pure-button" href="#stage">闯关模式</a></li>
|
||||
<li><a class="pure-button" href="#challenge">挑战赛</a></li>
|
||||
<li><a class="pure-button admin" target="_blank" href="/page/user.php">用户管理</a></li>
|
||||
<li><a class="pure-button pure-button-primary admin" target="_blank" href="/page/edit.php">添加新题目</a></li>
|
||||
</ul>
|
||||
<div id='stage'>
|
||||
<div class="index-main">
|
||||
<table id="stage-table" class="stripe">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div id='challenge'>
|
||||
<div class="index-main">
|
||||
<table id="challenge-table" class="stripe">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include('footer.php'); ?>
|
||||
+147
@@ -0,0 +1,147 @@
|
||||
require.config({paths: {'vs': 'https://lib.baomitu.com/monaco-editor/0.15.6/min/vs'}});
|
||||
|
||||
// Before loading vs/editor/editor.main, define a global MonacoEnvironment that overwrites
|
||||
// the default worker url location (used when creating WebWorkers). The problem here is that
|
||||
// HTML5 does not allow cross-domain web workers, so we need to proxy the instantiation of
|
||||
// a web worker through a same-domain script
|
||||
window.MonacoEnvironment = {
|
||||
getWorkerUrl: function (workerId, label) {
|
||||
return '/js/monaco-editor-worker-loader-proxy.js';
|
||||
}
|
||||
};
|
||||
|
||||
window.isAdmin = false;
|
||||
|
||||
function getNowDate() {
|
||||
var date = new Date();
|
||||
var sign1 = "-";
|
||||
var sign2 = ":";
|
||||
var year = date.getFullYear() // 年
|
||||
var month = date.getMonth() + 1; // 月
|
||||
var day = date.getDate(); // 日
|
||||
var hour = date.getHours(); // 时
|
||||
var minutes = date.getMinutes(); // 分
|
||||
var seconds = date.getSeconds() //秒
|
||||
var weekArr = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期天'];
|
||||
var week = weekArr[date.getDay()];
|
||||
// 给一位数数据前面加 “0”
|
||||
if (month >= 1 && month <= 9) {
|
||||
month = "0" + month;
|
||||
}
|
||||
if (day >= 0 && day <= 9) {
|
||||
day = "0" + day;
|
||||
}
|
||||
if (hour >= 0 && hour <= 9) {
|
||||
hour = "0" + hour;
|
||||
}
|
||||
if (minutes >= 0 && minutes <= 9) {
|
||||
minutes = "0" + minutes;
|
||||
}
|
||||
if (seconds >= 0 && seconds <= 9) {
|
||||
seconds = "0" + seconds;
|
||||
}
|
||||
return year + sign1 + month + sign1 + day + " " + hour + sign2 + minutes + sign2 + seconds + " " + week;
|
||||
}
|
||||
|
||||
function GetQueryString(name) {
|
||||
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
|
||||
var r = window.location.search.substr(1).match(reg);
|
||||
if (r!=null) return unescape(r[2]); return '';
|
||||
}
|
||||
|
||||
$(function () {
|
||||
var id = window.localStorage.id;
|
||||
|
||||
if (!id) {
|
||||
window.location.href = '/login.html'
|
||||
}
|
||||
|
||||
var setRealName = function (id, realname) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/api.php?action=setRealName",
|
||||
dataType: "json",
|
||||
cache: !1,
|
||||
timeout: 6e4,
|
||||
data: {
|
||||
id: id,
|
||||
realname: realname
|
||||
},
|
||||
success: function (r) {
|
||||
if (r.status === 1) {
|
||||
console.log('保存真实姓名成功!')
|
||||
} else {
|
||||
alert('很抱歉,保存真实姓名失败,请稍后刷新重试。')
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
alert('很抱歉,出错了,请稍后刷新重试!')
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
function loadImage(url, callback) {
|
||||
var img = new Image(); //创建一个Image对象,实现图片的预下载
|
||||
img.crossOrigin = "Anonymous";
|
||||
img.src = url;
|
||||
img.onload = function () { //图片下载完毕时异步调用callback函数
|
||||
callback.call(img);//将回调函数的this替换为Image对象
|
||||
};
|
||||
}
|
||||
|
||||
var getUserInfo = function (id) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/api.php?action=getUserInfo",
|
||||
dataType: "json",
|
||||
cache: !1,
|
||||
timeout: 6e4,
|
||||
data: {
|
||||
id: id
|
||||
},
|
||||
success: function (r) {
|
||||
if (r.status === 1) {
|
||||
if (!r.result.userinfo) {
|
||||
window.location.href = "login.html"
|
||||
}
|
||||
if (!r.result.userinfo.realname) {
|
||||
var name = prompt("请输入你的真实姓名,方便大家进行沟通", "");
|
||||
if (name != null && name !== "") {
|
||||
r.result.userinfo.realname = name;
|
||||
setRealName(id, name)
|
||||
}
|
||||
}
|
||||
|
||||
window.isAdmin = r.result.userinfo.admin === '1';
|
||||
window.credit = r.result.userinfo.credit;
|
||||
|
||||
if ($('.myCredit')) $('.myCredit').text('经验:' + window.credit);
|
||||
|
||||
loadImage(r.result.userinfo.headimgurl.replace('http://', 'https://'), function () {
|
||||
$('#avator').append(this)
|
||||
});
|
||||
|
||||
$('#realname').text(r.result.userinfo.realname);
|
||||
$('#nickname').text('(' + r.result.userinfo.nickname + ')');
|
||||
|
||||
if (window.isAdmin) {
|
||||
$('.admin').css('display', 'block')
|
||||
}
|
||||
} else {
|
||||
alert('很抱歉,获取用户信息失败,请稍后刷新重试。')
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
alert('很抱歉,出错了,请稍后刷新重试!')
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
$('#logout').click(function () {
|
||||
window.localStorage.removeItem('id');
|
||||
window.location.href = "/login.html"
|
||||
});
|
||||
|
||||
getUserInfo(id);
|
||||
|
||||
});
|
||||
+187
@@ -0,0 +1,187 @@
|
||||
$(function () {
|
||||
var language = {
|
||||
"sProcessing": "处理中...",
|
||||
"sLengthMenu": "显示 _MENU_ 项结果",
|
||||
"sZeroRecords": "没有匹配结果",
|
||||
"sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
|
||||
"sInfoEmpty": "显示第 0 至 0 项结果,共 0 项",
|
||||
"sInfoFiltered": "(由 _MAX_ 项结果过滤)",
|
||||
"sInfoPostFix": "",
|
||||
"sSearch": "搜索:",
|
||||
"sUrl": "",
|
||||
"sEmptyTable": "表中数据为空",
|
||||
"sLoadingRecords": "载入中...",
|
||||
"sInfoThousands": ",",
|
||||
"oPaginate": {
|
||||
"sFirst": "首页",
|
||||
"sPrevious": "上页",
|
||||
"sNext": "下页",
|
||||
"sLast": "末页"
|
||||
},
|
||||
"oAria": {
|
||||
"sSortAscending": ": 以升序排列此列",
|
||||
"sSortDescending": ": 以降序排列此列"
|
||||
}
|
||||
};
|
||||
|
||||
var tableInit = function (r) {
|
||||
$('#stage-table').DataTable({
|
||||
language: language,
|
||||
data: r.result.stage,
|
||||
columns: [
|
||||
{title: ""},
|
||||
{title: "ID"},
|
||||
{title: "No"},
|
||||
{title: "题名"},
|
||||
{title: "编程语言"},
|
||||
{title: "解答"},
|
||||
{title: "通过率"},
|
||||
{title: "难度"},
|
||||
{title: "管理"}
|
||||
],
|
||||
"order": [[2, "asc"]],
|
||||
columnDefs: [
|
||||
{
|
||||
"targets": 0,
|
||||
"orderable": false,
|
||||
"className": "table-is-pass",
|
||||
"render": function (data, type, row) {
|
||||
if (data === '1') {
|
||||
return '<svg viewBox="0 0 1397 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="27" height="20"><path d="M1396.363636 121.018182c0 0-223.418182 74.472727-484.072727 372.363636-242.036364 269.963636-297.890909 381.672727-390.981818 530.618182C512 1014.690909 372.363636 744.727273 0 549.236364l195.490909-186.181818c0 0 176.872727 121.018182 297.890909 344.436364 0 0 307.2-474.763636 902.981818-707.490909L1396.363636 121.018182 1396.363636 121.018182zM1396.363636 121.018182" fill="#1afa29"></path></svg>';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
},
|
||||
{
|
||||
"targets": 1,
|
||||
"data": null,
|
||||
"visible": false,
|
||||
"orderable": false
|
||||
},
|
||||
{
|
||||
"targets": 3,
|
||||
"className": "table-pname",
|
||||
"render": function (data, type, row) {
|
||||
return '<a href="/page/run.php?id=' + row[1] + '" target="_blank">' + data + '</a>';
|
||||
}
|
||||
},
|
||||
{
|
||||
"targets": -1,
|
||||
"data": null,
|
||||
"visible": window.isAdmin,
|
||||
"render": function (data, type, row) {
|
||||
return '<a href="/page/edit.php?id=' + row[1] + '" target="_blank" class="pure-button" style="font-size: 70%;">编辑</a>';
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
$('#challenge-table').DataTable({
|
||||
language: language,
|
||||
data: r.result.challenge,
|
||||
columns: [
|
||||
{title: ""},
|
||||
{title: "ID"},
|
||||
{title: "No"},
|
||||
{title: "题名"},
|
||||
{title: "编程语言"},
|
||||
{title: "解答"},
|
||||
{title: "通过率"},
|
||||
{title: "难度"},
|
||||
{title: "管理"}
|
||||
],
|
||||
"order": [[2, "asc"]],
|
||||
columnDefs: [
|
||||
{
|
||||
"targets": 0,
|
||||
"orderable": false,
|
||||
"render": function (data, type, row) {
|
||||
return data;
|
||||
}
|
||||
},
|
||||
{
|
||||
"targets": 1,
|
||||
"data": null,
|
||||
"visible": false,
|
||||
"orderable": false
|
||||
},
|
||||
{
|
||||
"targets": 3,
|
||||
"className": "table-pname",
|
||||
"render": function (data, type, row) {
|
||||
return '<a href="/page/run.php?id=' + row[1] + '" target="_blank">' + data + '</a>';
|
||||
}
|
||||
},
|
||||
{
|
||||
"targets": -1,
|
||||
"data": null,
|
||||
"visible": window.isAdmin,
|
||||
"render": function (data, type, row) {
|
||||
return '<a href="/page/edit.php?id=' + row[1] + '" target="_blank" class="pure-button" style="font-size: 70%;">编辑</a>';
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
$('.tabs').tabslet({
|
||||
controls: {
|
||||
prev: '.prevTab',
|
||||
next: '.nextTab'
|
||||
}
|
||||
});
|
||||
$('#loading').hide();
|
||||
};
|
||||
|
||||
var checkAdmin = function (r) {
|
||||
if (window.isAdmin !== null) {
|
||||
tableInit(r);
|
||||
} else {
|
||||
setTimeout(function () {
|
||||
checkAdmin(r)
|
||||
}, 50);
|
||||
}
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/api.php?action=getProblemsetList&user_id=" + window.localStorage.id,
|
||||
dataType: "json",
|
||||
cache: !1,
|
||||
timeout: 6e4,
|
||||
success: function (r) {
|
||||
if (r.status === 1) {
|
||||
checkAdmin(r)
|
||||
} else {
|
||||
alert('很抱歉,获取数据失败,请稍后刷新重试。');
|
||||
$('#loading').hide();
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
alert('很抱歉,出错了,请稍后刷新重试!');
|
||||
$('#loading').hide();
|
||||
}
|
||||
});
|
||||
|
||||
$('#myRecordButton').click(function() {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/api.php?action=getMyRecordCount&user_id=" + window.localStorage.id,
|
||||
dataType: "json",
|
||||
cache: !1,
|
||||
timeout: 6e4,
|
||||
success: function (r) {
|
||||
if (r.status === 1) {
|
||||
if (r.result.all === r.result.pass) {
|
||||
alert('恭喜您!已完成全部 ' + r.result.all + ' 道闯关题!');
|
||||
} else {
|
||||
alert('闯关题共有 ' + r.result.all + ' 道,您已经完成 ' + r.result.pass + '道。');
|
||||
}
|
||||
} else {
|
||||
alert('很抱歉,获取数据失败,请稍后刷新重试。');
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
alert('很抱歉,出错了,请稍后刷新重试!');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,351 @@
|
||||
/*!
|
||||
* JQuery Spliter Plugin version 0.27.1
|
||||
* Copyright (C) 2010-2018 Jakub T. Jankiewicz <https://jcubic.pl/me>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
(function($, undefined) {
|
||||
var count = 0;
|
||||
var splitter_id = null;
|
||||
var splitters = [];
|
||||
var current_splitter = null;
|
||||
$.fn.split = function(options) {
|
||||
var data = this.data('splitter');
|
||||
if (data) {
|
||||
return data;
|
||||
}
|
||||
var panel_1;
|
||||
var panel_2;
|
||||
var settings = $.extend({
|
||||
limit: 100,
|
||||
orientation: 'horizontal',
|
||||
position: '50%',
|
||||
invisible: false,
|
||||
onDragStart: $.noop,
|
||||
onDragEnd: $.noop,
|
||||
onDrag: $.noop,
|
||||
percent: false
|
||||
}, options || {});
|
||||
this.settings = settings;
|
||||
var cls;
|
||||
var children = this.children();
|
||||
if (settings.orientation == 'vertical') {
|
||||
panel_1 = children.first().addClass('left_panel');
|
||||
panel_2 = panel_1.next().addClass('right_panel');
|
||||
cls = 'vsplitter';
|
||||
} else if (settings.orientation == 'horizontal') {
|
||||
panel_1 = children.first().addClass('top_panel');
|
||||
panel_2 = panel_1.next().addClass('bottom_panel');
|
||||
cls = 'hsplitter';
|
||||
}
|
||||
if (settings.invisible) {
|
||||
cls += ' splitter-invisible';
|
||||
}
|
||||
var width = this.width();
|
||||
var height = this.height();
|
||||
var id = count++;
|
||||
this.addClass('splitter_panel');
|
||||
var splitter = $('<div/>').addClass(cls).bind('mouseenter touchstart', function() {
|
||||
splitter_id = id;
|
||||
}).bind('mouseleave touchend', function() {
|
||||
splitter_id = null;
|
||||
}).insertAfter(panel_1);
|
||||
var position;
|
||||
|
||||
function get_position(position) {
|
||||
if (typeof position === 'number') {
|
||||
return position;
|
||||
} else if (typeof position === 'string') {
|
||||
var match = position.match(/^([0-9\.]+)(px|%)$/);
|
||||
if (match) {
|
||||
if (match[2] == 'px') {
|
||||
return +match[1];
|
||||
} else {
|
||||
if (settings.orientation == 'vertical') {
|
||||
return (width * +match[1]) / 100;
|
||||
} else if (settings.orientation == 'horizontal') {
|
||||
return (height * +match[1]) / 100;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//throw position + ' is invalid value';
|
||||
}
|
||||
} else {
|
||||
//throw 'position have invalid type';
|
||||
}
|
||||
}
|
||||
|
||||
function set_limit(limit) {
|
||||
if(!isNaN(parseFloat(limit)) && isFinite(limit)){
|
||||
return {
|
||||
leftUpper: limit,
|
||||
rightBottom: limit
|
||||
};
|
||||
}
|
||||
return limit;
|
||||
}
|
||||
|
||||
var self = $.extend(this, {
|
||||
refresh: function() {
|
||||
var new_width = this.width();
|
||||
var new_height = this.height();
|
||||
if (width != new_width || height != new_height) {
|
||||
width = this.width();
|
||||
height = this.height();
|
||||
self.position(position);
|
||||
}
|
||||
},
|
||||
option: function(name, value) {
|
||||
if (name === 'position') {
|
||||
return self.position(value);
|
||||
} else if (typeof value === 'undefined') {
|
||||
return settings[name];
|
||||
} else {
|
||||
settings[name] = value;
|
||||
}
|
||||
return self;
|
||||
},
|
||||
position: (function() {
|
||||
if (settings.orientation == 'vertical') {
|
||||
return function(n, silent) {
|
||||
if (n === undefined) {
|
||||
return position;
|
||||
} else {
|
||||
position = get_position(n);
|
||||
var sw = splitter.width();
|
||||
var sw2 = sw/2, pw;
|
||||
var width = self.width();
|
||||
if (settings.invisible) {
|
||||
pw = panel_1.width(position).outerWidth();
|
||||
panel_2.width(width - pw - 27); // 特殊处理
|
||||
splitter.css('left', pw - sw2);
|
||||
} else {
|
||||
if (settings.percent) {
|
||||
var w1 = (position - sw2) / width * 100;
|
||||
pw = panel_1.css('width', w1 + '%').outerWidth();
|
||||
panel_2.css('width', (width-pw-sw) / width * 100 + '%');
|
||||
splitter.css('left', (pw / width * 100) + '%');
|
||||
} else {
|
||||
pw = panel_1.css('width', position - sw2).outerWidth();
|
||||
panel_2.width(width - pw - sw - 20); // 特殊处理
|
||||
splitter.css('left', pw);
|
||||
}
|
||||
}
|
||||
panel_1.find('.splitter_panel').eq(0).height(self.height());
|
||||
panel_2.find('.splitter_panel').eq(0).height(self.height());
|
||||
}
|
||||
if (!silent) {
|
||||
self.trigger('splitter.resize');
|
||||
self.find('.splitter_panel').trigger('splitter.resize');
|
||||
}
|
||||
return self;
|
||||
};
|
||||
} else if (settings.orientation == 'horizontal') {
|
||||
return function(n, silent) {
|
||||
if (n === undefined) {
|
||||
return position;
|
||||
} else {
|
||||
position = get_position(n);
|
||||
var sw = splitter.height();
|
||||
var sw2 = sw / 2, pw;
|
||||
var height = self.height();
|
||||
if (settings.invisible) {
|
||||
pw = panel_1.height(position).outerHeight();
|
||||
panel_2.height(height - pw);
|
||||
splitter.css('top', pw - sw2);
|
||||
} else if (settings.percent) {
|
||||
var h1 = (position - sw2) / height * 100;
|
||||
pw = panel_1.css('height', h1 + '%').outerHeight();
|
||||
panel_2.css('height', ((height - pw - sw) / height * 100) + '%');
|
||||
splitter.css('top', (pw / height * 100) + '%');
|
||||
} else {
|
||||
pw = panel_1.height(position - sw2).outerHeight();
|
||||
panel_2.height(height - pw - sw);
|
||||
splitter.css('top', pw);
|
||||
}
|
||||
}
|
||||
if (!silent) {
|
||||
self.trigger('splitter.resize');
|
||||
self.find('.splitter_panel').trigger('splitter.resize');
|
||||
}
|
||||
return self;
|
||||
};
|
||||
} else {
|
||||
return $.noop;
|
||||
}
|
||||
})(),
|
||||
orientation: settings.orientation,
|
||||
limit: set_limit(settings.limit),
|
||||
isActive: function() {
|
||||
return splitter_id === id;
|
||||
},
|
||||
destroy: function() {
|
||||
self.removeClass('splitter_panel');
|
||||
splitter.unbind('mouseenter');
|
||||
splitter.unbind('mouseleave');
|
||||
splitter.unbind('touchstart');
|
||||
splitter.unbind('touchmove');
|
||||
splitter.unbind('touchend');
|
||||
splitter.unbind('touchleave');
|
||||
splitter.unbind('touchcancel');
|
||||
if (settings.orientation == 'vertical') {
|
||||
panel_1.removeClass('left_panel');
|
||||
panel_2.removeClass('right_panel');
|
||||
} else if (settings.orientation == 'horizontal') {
|
||||
panel_1.removeClass('top_panel');
|
||||
panel_2.removeClass('bottom_panel');
|
||||
}
|
||||
self.unbind('splitter.resize');
|
||||
self.trigger('splitter.resize');
|
||||
self.find('.splitter_panel').trigger('splitter.resize');
|
||||
splitters[id] = null;
|
||||
count--;
|
||||
splitter.remove();
|
||||
self.removeData('splitter');
|
||||
var not_null = false;
|
||||
for (var i=splitters.length; i--;) {
|
||||
if (splitters[i] !== null) {
|
||||
not_null = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//remove document events when no splitters
|
||||
if (!not_null) {
|
||||
$(document.documentElement).unbind('.splitter');
|
||||
$(window).unbind('resize.splitter');
|
||||
splitters = [];
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
self.bind('splitter.resize', function(e) {
|
||||
var pos = self.position();
|
||||
if (self.orientation == 'vertical' &&
|
||||
pos > self.width()) {
|
||||
pos = self.width() - self.limit.rightBottom-1;
|
||||
} else if (self.orientation == 'horizontal' &&
|
||||
pos > self.height()) {
|
||||
pos = self.height() - self.limit.rightBottom-1;
|
||||
}
|
||||
if (pos < self.limit.leftUpper) {
|
||||
pos = self.limit.leftUpper + 1;
|
||||
}
|
||||
e.stopPropagation();
|
||||
self.position(pos, true);
|
||||
});
|
||||
//inital position of splitter
|
||||
var pos;
|
||||
if (settings.orientation == 'vertical') {
|
||||
if (pos > width-settings.limit.rightBottom) {
|
||||
pos = width-settings.limit.rightBottom;
|
||||
} else {
|
||||
pos = get_position(settings.position);
|
||||
}
|
||||
} else if (settings.orientation == 'horizontal') {
|
||||
//position = height/2;
|
||||
if (pos > height-settings.limit.rightBottom) {
|
||||
pos = height-settings.limit.rightBottom;
|
||||
} else {
|
||||
pos = get_position(settings.position);
|
||||
}
|
||||
}
|
||||
if (pos < settings.limit.leftUpper) {
|
||||
pos = settings.limit.leftUpper;
|
||||
}
|
||||
self.position(pos, true);
|
||||
var parent = this.closest('.splitter_panel');
|
||||
if (parent.length) {
|
||||
this.height(parent.height());
|
||||
}
|
||||
// bind events to document if no splitters
|
||||
if (splitters.filter(Boolean).length === 0) {
|
||||
$(window).bind('resize.splitter', function() {
|
||||
$.each(splitters, function(i, splitter) {
|
||||
if (splitter) {
|
||||
splitter.refresh();
|
||||
}
|
||||
});
|
||||
});
|
||||
$(document.documentElement).on('mousedown.splitter touchstart.splitter', function(e) {
|
||||
if (splitter_id !== null) {
|
||||
e.preventDefault();
|
||||
current_splitter = splitters[splitter_id];
|
||||
setTimeout(function() {
|
||||
$('<div class="splitterMask"></div>').
|
||||
css('cursor', current_splitter.children().eq(1).css('cursor')).
|
||||
insertAfter(current_splitter);
|
||||
});
|
||||
current_splitter.settings.onDragStart(e);
|
||||
}
|
||||
}).bind('mouseup.splitter touchend.splitter touchleave.splitter touchcancel.splitter', function(e) {
|
||||
if (current_splitter) {
|
||||
setTimeout(function() {
|
||||
$('.splitterMask').remove();
|
||||
});
|
||||
current_splitter.settings.onDragEnd(e);
|
||||
current_splitter = null;
|
||||
}
|
||||
}).bind('mousemove.splitter touchmove.splitter', function(e) {
|
||||
if (current_splitter !== null) {
|
||||
var leftUpperLimit = current_splitter.limit.leftUpper;
|
||||
var rightBottomLimit = current_splitter.limit.rightBottom;
|
||||
var offset = current_splitter.offset();
|
||||
if (current_splitter.orientation == 'vertical') {
|
||||
var pageX = e.pageX;
|
||||
if(e.originalEvent && e.originalEvent.changedTouches){
|
||||
pageX = e.originalEvent.changedTouches[0].pageX;
|
||||
}
|
||||
var x = pageX - offset.left;
|
||||
if (x <= current_splitter.limit.leftUpper) {
|
||||
x = current_splitter.limit.leftUpper + 1;
|
||||
} else if (x >= current_splitter.width() - rightBottomLimit) {
|
||||
x = current_splitter.width() - rightBottomLimit - 1;
|
||||
}
|
||||
if (x > current_splitter.limit.leftUpper &&
|
||||
x < current_splitter.width()-rightBottomLimit) {
|
||||
current_splitter.position(x, true);
|
||||
current_splitter.trigger('splitter.resize');
|
||||
current_splitter.find('.splitter_panel').
|
||||
trigger('splitter.resize');
|
||||
//e.preventDefault();
|
||||
}
|
||||
} else if (current_splitter.orientation == 'horizontal') {
|
||||
var pageY = e.pageY;
|
||||
if(e.originalEvent && e.originalEvent.changedTouches){
|
||||
pageY = e.originalEvent.changedTouches[0].pageY;
|
||||
}
|
||||
var y = pageY-offset.top;
|
||||
if (y <= current_splitter.limit.leftUpper) {
|
||||
y = current_splitter.limit.leftUpper + 1;
|
||||
} else if (y >= current_splitter.height() - rightBottomLimit) {
|
||||
y = current_splitter.height() - rightBottomLimit - 1;
|
||||
}
|
||||
if (y > current_splitter.limit.leftUpper &&
|
||||
y < current_splitter.height()-rightBottomLimit) {
|
||||
current_splitter.position(y, true);
|
||||
current_splitter.trigger('splitter.resize');
|
||||
current_splitter.find('.splitter_panel').
|
||||
trigger('splitter.resize');
|
||||
//e.preventDefault();
|
||||
}
|
||||
}
|
||||
current_splitter.settings.onDrag(e);
|
||||
}
|
||||
});//*/
|
||||
}
|
||||
splitters[id] = self;
|
||||
self.data('splitter', self);
|
||||
return self;
|
||||
};
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,4 @@
|
||||
self.MonacoEnvironment = {
|
||||
baseUrl: 'https://lib.baomitu.com/monaco-editor/0.15.6/min/'
|
||||
};
|
||||
importScripts('https://lib.baomitu.com/monaco-editor/0.15.6/min/vs/base/worker/workerMain.js');
|
||||
+329
@@ -0,0 +1,329 @@
|
||||
$(function () {
|
||||
var jsCode = `'use strict';
|
||||
|
||||
var phpEngine = uniter.createEngine('PHP');
|
||||
|
||||
phpEngine.expose({
|
||||
pass: function () {
|
||||
pass();
|
||||
return '测试通过';
|
||||
},
|
||||
}, 'r');
|
||||
|
||||
phpEngine.getStdout().on('data', function (data) {
|
||||
print(data);
|
||||
});
|
||||
|
||||
phpEngine.getStderr().on('data', function (data) {
|
||||
print(data);
|
||||
});
|
||||
|
||||
phpEngine.execute(phpCode).fail(function (error) {
|
||||
// print(error.toString());
|
||||
});
|
||||
`;
|
||||
|
||||
var testCode = `<?php
|
||||
$pass = 1;
|
||||
|
||||
$m =
|
||||
if ($m != ) {
|
||||
$pass = 0;
|
||||
echo "测试用例:<br>";
|
||||
echo "输出结果:" . $m . "<br>";
|
||||
}
|
||||
|
||||
if ($pass) {
|
||||
echo $r->pass();
|
||||
} else {
|
||||
echo "<br>测试不通过";
|
||||
}`;
|
||||
|
||||
require(["vs/editor/editor.main"], function () {
|
||||
window.editor = monaco.editor.create(document.getElementById('phpContainer'), {
|
||||
value: [
|
||||
'<?php',
|
||||
'\tfunction sum($a, $b) {',
|
||||
'\t\treturn $a + $b;',
|
||||
'\t}',
|
||||
'',
|
||||
'// --------- 测试区域',
|
||||
''
|
||||
].join('\n'),
|
||||
language: 'php'
|
||||
});
|
||||
|
||||
window.jsEditor = monaco.editor.create(document.getElementById('jsContainer'), {
|
||||
value: jsCode,
|
||||
language: 'javascript'
|
||||
});
|
||||
|
||||
window.testEditor = monaco.editor.create(document.getElementById('testContainer'), {
|
||||
value: testCode,
|
||||
language: 'php'
|
||||
});
|
||||
|
||||
function execMain() {
|
||||
var javascriptCode = window.jsEditor.getValue(),
|
||||
phpCode = window.editor.getValue(),
|
||||
resultIframe = document.getElementById('result'),
|
||||
resultDocument = resultIframe.contentWindow.document,
|
||||
resultBody;
|
||||
|
||||
function clear() {
|
||||
resultBody.innerHTML = '';
|
||||
}
|
||||
|
||||
function print(html) {
|
||||
resultBody.insertAdjacentHTML('beforeEnd', html);
|
||||
}
|
||||
|
||||
function pass() {
|
||||
console.log('pass')
|
||||
}
|
||||
|
||||
function printText(text) {
|
||||
resultBody.appendChild(document.createTextNode(text));
|
||||
}
|
||||
|
||||
// Ensure the document has a body for IE9
|
||||
resultDocument.write('<body></body>');
|
||||
resultDocument.close();
|
||||
resultBody = resultDocument.body;
|
||||
|
||||
clear();
|
||||
|
||||
try {
|
||||
/*jshint evil: true */
|
||||
new Function('phpCode, print, resultBody, pass', javascriptCode)(phpCode, print, resultBody, pass);
|
||||
} catch (error) {
|
||||
printText('<JavaScript error> ' + error.toString());
|
||||
}
|
||||
}
|
||||
|
||||
function runUnit() {
|
||||
var javascriptCode = window.jsEditor.getValue(),
|
||||
phpCode = window.editor.getValue(),
|
||||
testCode = window.testEditor.getValue(),
|
||||
resultIframe = document.getElementById('result'),
|
||||
resultDocument = resultIframe.contentWindow.document,
|
||||
resultBody;
|
||||
|
||||
if (phpCode.indexOf('// --------- 测试区域') !== -1) {
|
||||
phpCode = phpCode.substring(0, phpCode.lastIndexOf('// --------- 测试区域')) + testCode.replace('<?php', '');
|
||||
} else {
|
||||
phpCode = phpCode + testCode.replace('<?php', '');
|
||||
}
|
||||
|
||||
|
||||
function clear() {
|
||||
resultBody.innerHTML = '';
|
||||
}
|
||||
|
||||
function print(html) {
|
||||
resultBody.insertAdjacentHTML('beforeEnd', html);
|
||||
}
|
||||
|
||||
function pass() {
|
||||
console.log('测试通过')
|
||||
}
|
||||
|
||||
function printText(text) {
|
||||
resultBody.appendChild(document.createTextNode(text));
|
||||
}
|
||||
|
||||
// Ensure the document has a body for IE9
|
||||
resultDocument.write('<body></body>');
|
||||
resultDocument.close();
|
||||
resultBody = resultDocument.body;
|
||||
|
||||
clear();
|
||||
|
||||
try {
|
||||
/*jshint evil: true */
|
||||
new Function('phpCode, print, resultBody, pass', javascriptCode)(phpCode, print, resultBody, pass);
|
||||
} catch (error) {
|
||||
printText('<JavaScript error> ' + error.toString());
|
||||
}
|
||||
}
|
||||
|
||||
$('#runMain').click(function () {
|
||||
execMain()
|
||||
});
|
||||
|
||||
$('#runUnit').click(function () {
|
||||
runUnit()
|
||||
});
|
||||
|
||||
var contentHeight = window.document.body.clientHeight - 50;
|
||||
|
||||
$('#phpContainer').css('height', contentHeight - 70);
|
||||
$('#jsContainer').css('height', contentHeight - 70);
|
||||
$('#testContainer').css('height', contentHeight - 70);
|
||||
|
||||
$('#article').css('height', contentHeight + 30);
|
||||
|
||||
window.editor.layout();
|
||||
window.jsEditor.layout();
|
||||
window.testEditor.layout();
|
||||
|
||||
|
||||
window.onresize = function () {
|
||||
window.editor.layout();
|
||||
window.jsEditor.layout();
|
||||
window.testEditor.layout();
|
||||
};
|
||||
|
||||
var describe = new SimpleMDE({ element: $("#describe")[0] });
|
||||
var answer = new SimpleMDE({ element: $("#answer")[0] });
|
||||
var testCase = new SimpleMDE({ element: $("#testCase")[0] });
|
||||
var expectedResult = new SimpleMDE({ element: $("#expectedResult")[0] });
|
||||
|
||||
$('#submitForm').click(function () {
|
||||
|
||||
// 李永升:你应该适配一下,大于1时直接加百分号,小于1时乘以100再加百分号
|
||||
var passPercent = $('#passPercent').val();
|
||||
if (passPercent > 1) {
|
||||
passPercent = passPercent / 100
|
||||
}
|
||||
$('#passPercent').val(passPercent);
|
||||
|
||||
var postData = $('#edit-form').serializeArray();
|
||||
|
||||
var javascriptCode = window.jsEditor.getValue(),
|
||||
phpUnitCode = window.testEditor.getValue(),
|
||||
phpCode = window.editor.getValue();
|
||||
|
||||
postData.push({
|
||||
name: 'javascriptCode',
|
||||
value: javascriptCode
|
||||
});
|
||||
|
||||
postData.push({
|
||||
name: 'phpUnitCode',
|
||||
value: phpUnitCode
|
||||
});
|
||||
|
||||
postData.push({
|
||||
name: 'phpCode',
|
||||
value: phpCode
|
||||
});
|
||||
|
||||
postData.push({
|
||||
name: 'describe',
|
||||
value: describe.value()
|
||||
});
|
||||
|
||||
postData.push({
|
||||
name: 'answer',
|
||||
value: answer.value()
|
||||
});
|
||||
|
||||
postData.push({
|
||||
name: 'testCase',
|
||||
value: testCase.value()
|
||||
});
|
||||
|
||||
postData.push({
|
||||
name: 'expectedResult',
|
||||
value: expectedResult.value()
|
||||
});
|
||||
|
||||
if (GetQueryString('id')) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/api.php?action=editProblemset&id=" + GetQueryString('id'),
|
||||
dataType: "json",
|
||||
cache: !1,
|
||||
timeout: 6e4,
|
||||
data: postData,
|
||||
success: function (r) {
|
||||
if (r.status === 1) {
|
||||
window.location.href = '/index.php'
|
||||
} else {
|
||||
alert('很抱歉,保存失败,请稍后刷新重试。')
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
alert('很抱歉,出错了,请稍后刷新重试!')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/api.php?action=addProblemset",
|
||||
dataType: "json",
|
||||
cache: !1,
|
||||
timeout: 6e4,
|
||||
data: postData,
|
||||
success: function (r) {
|
||||
if (r.status === 1) {
|
||||
window.location.href = '/index.php'
|
||||
} else {
|
||||
alert('很抱歉,新增题目失败,请稍后刷新重试。')
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
alert('很抱歉,出错了,请稍后刷新重试!')
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
if (GetQueryString('id')) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/api.php?action=getProblemset&id=" + GetQueryString('id'),
|
||||
dataType: "json",
|
||||
cache: !1,
|
||||
timeout: 6e4,
|
||||
success: function (r) {
|
||||
if (r.status === 1) {
|
||||
$('#type').val(r.result.type);
|
||||
$('#name').val(r.result.name);
|
||||
$('#isAnswer').val(r.result.isAnswer);
|
||||
$('#language').val(r.result.language);
|
||||
$('#difficulty').val(r.result.difficulty);
|
||||
$('#isCredit').val(r.result.isCredit);
|
||||
$('#passPercent').val(r.result.passPercent);
|
||||
$('#tag').val(r.result.tag);
|
||||
$('#credit').val(r.result.credit);
|
||||
$('#mark').val(r.result.mark);
|
||||
|
||||
describe.value(r.result.describe);
|
||||
answer.value(r.result.answer);
|
||||
testCase.value(r.result.testCase);
|
||||
expectedResult.value(r.result.expectedResult);
|
||||
|
||||
window.editor.setValue(r.result.phpCode);
|
||||
window.testEditor.setValue(r.result.phpUnitCode);
|
||||
window.jsEditor.setValue(r.result.javascriptCode);
|
||||
|
||||
$('.tabs').tabslet({
|
||||
controls: {
|
||||
prev: '.prevTab',
|
||||
next: '.nextTab'
|
||||
}
|
||||
});
|
||||
} else {
|
||||
alert('很抱歉,获取数据失败,请稍后刷新重试。')
|
||||
}
|
||||
|
||||
$('#loading').hide();
|
||||
},
|
||||
error: function () {
|
||||
alert('很抱歉,出错了,请稍后刷新重试!');
|
||||
$('#loading').hide();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
$('#loading').hide();
|
||||
$('.tabs').tabslet({
|
||||
controls: {
|
||||
prev: '.prevTab',
|
||||
next: '.nextTab'
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
+304
@@ -0,0 +1,304 @@
|
||||
$(function () {
|
||||
var converter = new showdown.Converter();
|
||||
|
||||
var phpUnitCode = "";
|
||||
var javascriptCode = "";
|
||||
var theType = "";
|
||||
var no = "";
|
||||
var isLoading = false;
|
||||
|
||||
require(["vs/editor/editor.main"], function () {
|
||||
window.editor = monaco.editor.create(document.getElementById('container'), {
|
||||
value: [
|
||||
'<?php',
|
||||
'\techo "Hello world!";'
|
||||
].join('\n'),
|
||||
language: 'php'
|
||||
});
|
||||
|
||||
function run (phpCode, oldCode) {
|
||||
var resultIframe = document.getElementById('result');
|
||||
var resultDocument = resultIframe.contentWindow.document;
|
||||
var resultBody = null;
|
||||
|
||||
var clear = function () {
|
||||
resultBody.innerHTML = '';
|
||||
};
|
||||
|
||||
var print = function (html) {
|
||||
// outExeTime();
|
||||
resultBody.insertAdjacentHTML('beforeEnd', html);
|
||||
};
|
||||
|
||||
var pass = function () {
|
||||
console.log('测试通过');
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/api.php?action=addRecord",
|
||||
dataType: "json",
|
||||
cache: !1,
|
||||
timeout: 6e4,
|
||||
data: {
|
||||
user_id: window.localStorage.id,
|
||||
problemset_id: GetQueryString('id'),
|
||||
type: theType,
|
||||
code: oldCode,
|
||||
is_pass: '1'
|
||||
},
|
||||
success: function (r) {
|
||||
if (r.status === 1) {
|
||||
console.log('测试通过的结果保存成功');
|
||||
if (confirm("测试通过,进入下一题?")) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/api.php?action=getNextNo&no=" + no + "&type=" + theType,
|
||||
dataType: "json",
|
||||
cache: !1,
|
||||
timeout: 6e4,
|
||||
success: function (r) {
|
||||
if (r.status === 1) {
|
||||
if (r.id > 0) {
|
||||
window.location.href = '/page/run.php?id=' + r.id;
|
||||
} else if (r.id == 0){
|
||||
alert('恭喜你!已经做完最后一题!');
|
||||
window.location.href = '/index.php';
|
||||
} else {
|
||||
window.location.href = '/index.php';
|
||||
}
|
||||
} else {
|
||||
alert('很抱歉,获取下一题数据失败,请重试。')
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
alert('很抱歉,出错了,请重试!');
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
alert('很抱歉,保存数据失败,请重试。')
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
alert('很抱歉,出错了,请重试!');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
var printText = function (text) {
|
||||
resultBody.appendChild(document.createTextNode(text));
|
||||
};
|
||||
|
||||
// Ensure the document has a body for IE9
|
||||
resultDocument.write('<body></body>');
|
||||
resultDocument.close();
|
||||
resultBody = resultDocument.body;
|
||||
|
||||
clear();
|
||||
|
||||
try {
|
||||
/*jshint evil: true */
|
||||
new Function('phpCode, print, resultBody, pass', javascriptCode)(phpCode, print, resultBody, pass);
|
||||
} catch (error) {
|
||||
printText('<JavaScript error> ' + error.toString());
|
||||
}
|
||||
}
|
||||
|
||||
function exec(test) {
|
||||
// var start = (new Date()).getTime()
|
||||
|
||||
var phpCode = window.editor.getValue();
|
||||
var oldCode = phpCode;
|
||||
|
||||
if (!test) {
|
||||
if (isLoading) return;
|
||||
isLoading = true;
|
||||
if (phpCode.indexOf('// --------- 测试区域') !== -1) {
|
||||
phpCode = phpCode.substring(0, phpCode.lastIndexOf('// --------- 测试区域')) + phpUnitCode.replace('<?php', '');
|
||||
} else {
|
||||
phpCode = phpCode + phpUnitCode.replace('<?php', '');
|
||||
}
|
||||
|
||||
// 每次提交都记录数据, 需要成功返回后再执行,确保数据一致性
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/api.php?action=addRecord",
|
||||
dataType: "json",
|
||||
cache: !1,
|
||||
timeout: 6e4,
|
||||
data: {
|
||||
user_id: window.localStorage.id,
|
||||
problemset_id: GetQueryString('id'),
|
||||
type: theType,
|
||||
code: oldCode,
|
||||
is_pass: '0'
|
||||
},
|
||||
success: function () {
|
||||
run(phpCode, oldCode);
|
||||
isLoading = false;
|
||||
},
|
||||
error: function () {
|
||||
alert('很抱歉,出错了,请重试!');
|
||||
isLoading = false;
|
||||
}
|
||||
})
|
||||
} else {
|
||||
run(phpCode, oldCode)
|
||||
}
|
||||
}
|
||||
|
||||
$('#testRun').click(function () {
|
||||
$('.tabs').trigger('show', '#resultView');
|
||||
exec(true);
|
||||
});
|
||||
|
||||
$('#run').click(function () {
|
||||
$('.tabs').trigger('show', '#resultView');
|
||||
exec(false);
|
||||
});
|
||||
|
||||
var contentHeight = window.document.body.clientHeight - 50;
|
||||
|
||||
$('#container').css('height', contentHeight - 70);
|
||||
|
||||
var splitter = $('#content').height(contentHeight).split({
|
||||
orientation: 'vertical',
|
||||
limit: 10,
|
||||
position: '40%', // if there is no percentage it interpret it as pixels
|
||||
onDrag: function (event) {
|
||||
console.log(splitter.position());
|
||||
window.editor.layout();
|
||||
}
|
||||
});
|
||||
|
||||
if (!localStorage.auto) {
|
||||
localStorage.auto = '1';
|
||||
}
|
||||
|
||||
window.auto = localStorage.auto;
|
||||
|
||||
window.editor.onDidChangeModelContent(function () {
|
||||
if (window.auto === '1') {
|
||||
exec(true)
|
||||
}
|
||||
});
|
||||
|
||||
window.editor.layout();
|
||||
|
||||
if (window.auto === '1') {
|
||||
$("#auto").prop("checked", 'true');
|
||||
exec(true);
|
||||
} else {
|
||||
$("#auto").prop("checked", 'false')
|
||||
}
|
||||
|
||||
$("#auto").click(function () {
|
||||
if ($(this).prop("checked")) {
|
||||
window.auto = '1';
|
||||
localStorage.auto = '1'
|
||||
} else {
|
||||
window.auto = '2';
|
||||
localStorage.auto = '2'
|
||||
}
|
||||
});
|
||||
|
||||
if (GetQueryString('id')) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/api.php?action=getProblemset&id=" + GetQueryString('id'),
|
||||
dataType: "json",
|
||||
cache: !1,
|
||||
timeout: 6e4,
|
||||
success: function (r) {
|
||||
if (r.status === 1) {
|
||||
|
||||
var typeStr = '挑战赛';
|
||||
|
||||
if (r.result.type === '1') {
|
||||
typeStr = '闯关模式'
|
||||
}
|
||||
|
||||
var difficultyStr = '困难';
|
||||
|
||||
if (r.result.difficulty === '1') {
|
||||
difficultyStr = '简单'
|
||||
} else if (r.result.difficulty === '2') {
|
||||
difficultyStr = '中等'
|
||||
}
|
||||
|
||||
$(document).attr('title', r.result.name + ' - ' + typeStr);
|
||||
|
||||
$('#describeView .cont').html('<h3 style="font-weight: 600">' + r.result.name + '(' + difficultyStr + ')' + ' - ' + typeStr + '</h3>' + converter.makeHtml(r.result.describe));
|
||||
$('#answerView .cont').html(converter.makeHtml(r.result.answer));
|
||||
|
||||
if (r.result.isAnswer !== '1') {
|
||||
$('#answerViewButton').hide();
|
||||
}
|
||||
|
||||
window.editor.setValue(r.result.phpCode);
|
||||
|
||||
phpUnitCode = r.result.phpUnitCode;
|
||||
javascriptCode = r.result.javascriptCode;
|
||||
|
||||
var testCase = r.result.testCase;
|
||||
var expectedResult = r.result.expectedResult;
|
||||
|
||||
$('.testCaseContent').html(converter.makeHtml(testCase));
|
||||
$('.expectedResultContent').html(converter.makeHtml(expectedResult));
|
||||
|
||||
$('#rightPane pre code').each(function(i, block) {
|
||||
hljs.highlightBlock(block);
|
||||
});
|
||||
|
||||
theType = r.result.type;
|
||||
no = r.result.no;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/api.php?action=getRecord",
|
||||
dataType: "json",
|
||||
cache: !1,
|
||||
timeout: 6e4,
|
||||
data: {
|
||||
user_id: window.localStorage.id,
|
||||
problemset_id: GetQueryString('id'),
|
||||
},
|
||||
success: function (r) {
|
||||
if (r.status === 1) {
|
||||
window.editor.setValue(r.code);
|
||||
}
|
||||
|
||||
$('.tabs').tabslet({
|
||||
controls: {
|
||||
prev: '.prevTab',
|
||||
next: '.nextTab'
|
||||
}
|
||||
});
|
||||
$('#loading').hide();
|
||||
},
|
||||
error: function () {
|
||||
alert('很抱歉,出错了,请稍后刷新重试!');
|
||||
$('#loading').hide();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
alert('很抱歉,获取数据失败,请稍后刷新重试。')
|
||||
}
|
||||
|
||||
$('#loading').hide();
|
||||
},
|
||||
error: function () {
|
||||
alert('很抱歉,出错了,请稍后刷新重试!');
|
||||
$('#loading').hide();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
$('#loading').hide();
|
||||
$('.tabs').tabslet({
|
||||
controls: {
|
||||
prev: '.prevTab',
|
||||
next: '.nextTab'
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
$(function () {
|
||||
|
||||
var saveTestCode = function (code) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/api.php?action=saveTestCode",
|
||||
dataType: "json",
|
||||
cache: !1,
|
||||
timeout: 6e4,
|
||||
data: {
|
||||
user_id: window.localStorage.id,
|
||||
code: code
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
require(["vs/editor/editor.main"], function () {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/api.php?action=getTestCode",
|
||||
dataType: "json",
|
||||
cache: !1,
|
||||
timeout: 6e4,
|
||||
data: {
|
||||
user_id: window.localStorage.id,
|
||||
},
|
||||
success: function (r) {
|
||||
if (r.status === 1) {
|
||||
window.editor = monaco.editor.create(document.getElementById('container'), {
|
||||
value: r.code,
|
||||
language: 'php'
|
||||
});
|
||||
|
||||
function exec() {
|
||||
// var start = (new Date()).getTime()
|
||||
|
||||
var javascriptCode = `'use strict';
|
||||
|
||||
var phpEngine = uniter.createEngine('PHP');
|
||||
|
||||
phpEngine.getStdout().on('data', function (data) {
|
||||
print(data);
|
||||
});
|
||||
|
||||
phpEngine.getStderr().on('data', function (data) {
|
||||
print(data);
|
||||
});
|
||||
|
||||
phpEngine.execute(phpCode).fail(function (error) {
|
||||
// print(error.toString());
|
||||
});
|
||||
`,
|
||||
phpCode = window.editor.getValue(),
|
||||
resultIframe = document.getElementById('result'),
|
||||
resultDocument = resultIframe.contentWindow.document,
|
||||
resultBody;
|
||||
|
||||
saveTestCode(phpCode);
|
||||
|
||||
function clear() {
|
||||
resultBody.innerHTML = '';
|
||||
}
|
||||
|
||||
function print(html) {
|
||||
// outExeTime();
|
||||
resultBody.insertAdjacentHTML('beforeEnd', html);
|
||||
}
|
||||
|
||||
function printText(text) {
|
||||
resultBody.appendChild(document.createTextNode(text));
|
||||
}
|
||||
|
||||
// function outExeTime () {
|
||||
// // var execTimeString = getNowDate() + '执行结果(' + ((new Date()).getTime() - start) + 'ms)';
|
||||
// // var headerHtml = '<span style="color: #888;font-weight: 300;font-size: 10px;">' + execTimeString + ':</span><br>'
|
||||
// // $('#out').html(headerHtml)
|
||||
// }
|
||||
|
||||
// Ensure the document has a body for IE9
|
||||
resultDocument.write('<body></body>');
|
||||
resultDocument.close();
|
||||
resultBody = resultDocument.body;
|
||||
|
||||
clear();
|
||||
|
||||
try {
|
||||
/*jshint evil: true */
|
||||
new Function('phpCode, print, resultBody', javascriptCode)(phpCode, print, resultBody);
|
||||
} catch (error) {
|
||||
printText('<JavaScript error> ' + error.toString());
|
||||
}
|
||||
}
|
||||
|
||||
$('#run').click(function () {
|
||||
exec()
|
||||
});
|
||||
|
||||
var contentHeight = window.document.body.clientHeight - 50;
|
||||
|
||||
$('#container').css('height', contentHeight - 70);
|
||||
|
||||
var splitter = $('#content').height(contentHeight).split({
|
||||
orientation: 'vertical',
|
||||
limit: 10,
|
||||
position: '40%', // if there is no percentage it interpret it as pixels
|
||||
onDrag: function (event) {
|
||||
console.log(splitter.position());
|
||||
window.editor.layout();
|
||||
}
|
||||
});
|
||||
|
||||
if (!localStorage.auto) {
|
||||
localStorage.auto = '1';
|
||||
}
|
||||
|
||||
window.auto = localStorage.auto;
|
||||
|
||||
window.editor.onDidChangeModelContent(function () {
|
||||
if (window.auto === '1') {
|
||||
exec()
|
||||
}
|
||||
});
|
||||
|
||||
window.editor.layout();
|
||||
|
||||
if (window.auto === '1') {
|
||||
$("#auto").prop("checked", 'true')
|
||||
exec()
|
||||
} else {
|
||||
$("#auto").prop("checked", 'false')
|
||||
}
|
||||
|
||||
$("#auto").click(function () {
|
||||
if ($(this).prop("checked")) {
|
||||
window.auto = '1';
|
||||
localStorage.auto = '1'
|
||||
} else {
|
||||
window.auto = '2';
|
||||
localStorage.auto = '2'
|
||||
}
|
||||
});
|
||||
|
||||
$('#loading').hide();
|
||||
} else {
|
||||
alert('很抱歉,获取已保存的代码失败,请稍后刷新重试。')
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
alert('很抱歉,出错了,请稍后刷新重试!')
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
$(function () {
|
||||
$('#loading').hide();
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
$(function () {
|
||||
$('#loading').hide();
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.uniter=e()}})(function(){var e,t,r;return function e(t,r,n){function i(a,o){if(!r[a]){if(!t[a]){var u=typeof require=="function"&&require;if(!o&&u)return u(a,!0);if(s)return s(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[a]={exports:{}};t[a][0].call(l.exports,function(e){var r=t[a][1][e];return i(r?r:e)},l,l.exports,e,t,r,n)}return r[a].exports}var s=typeof require=="function"&&require;for(var a=0;a<n.length;a++)i(n[a]);return i}({1:[function(e,t,r){(function(r){"use strict";var n=e("phpruntime"),i=e("phptoast"),s=e("phptojs"),a=e("./js/ScriptLoader"),o=e("./js/Uniter"),u,c;c=new o(i,s,n);u=new a(r,'script[type="text/x-uniter-php"]',c);u.loadScripts();t.exports=c}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./js/ScriptLoader":4,"./js/Uniter":6,phpruntime:219,phptoast:238,phptojs:243}],2:[function(e,t,r){"use strict";var n=e("microdash"),i={}.hasOwnProperty,s=e("phpcommon"),a="include",o=s.PHPError,u=e("./Promise");function c(e,t,r,n,i){this.environment=n;this.options=i||{};this.phpParser=e;this.phpRuntime=r;this.phpToJS=t}n.extend(c.prototype,{configure:function(e){n.extend(this.options,e)},execute:function(e,t){var r=this,s,c,l=new u,f,p;function h(e,t){r.phpParser.getState().setPath(t||null);e="return "+r.phpToJS.transpile(r.phpParser.parse(e),{bare:true})+";";p=new Function(e)();return r.phpRuntime.compile(p)}t=t||null;c=n.extend({},r.options,{path:t});if(i.call(c,a)){c[a]=function(e){return function(t,r,i,s){var a={reject:r.reject,resolve:function(e){if(n.isString(e)){r.resolve(h(e,t));return}r.resolve(e)}};e(t,a,i,s)}}(c[a])}try{s=h(e,t)}catch(e){if(t===null&&e instanceof o){r.getStderr().write(e.message)}return l.reject(e)}f=s(c,r.environment);f.execute().then(function(e){l.resolve(e.getNative(),e.getType(),e)},function(e){l.reject(e)});return l},expose:function(e,t){this.environment.expose(e,t)},getStderr:function(){return this.environment.getStderr()},getStdin:function(){return this.environment.getStdin()},getStdout:function(){return this.environment.getStdout()}});t.exports=c},{"./Promise":3,microdash:79,phpcommon:146}],3:[function(e,t,r){"use strict";var n=e("microdash"),i=[].slice,s=e("util"),a=e("./SimplePromise"),o=a.prototype;function u(){a.call(this)}s.inherits(u,a);n.extend(u.prototype,{always:function(e){return this.then(e,e)},done:function(e){return this.then(e)},fail:function(e){return this.then(null,e)},resolve:function(){return o.resolve.call(this,i.call(arguments))},then:function(e,t){return o.then.call(this,e?function(t){e.apply(null,t)}:null,t)}});t.exports=u},{"./SimplePromise":5,microdash:79,util:265}],4:[function(e,t,r){"use strict";var n=e("microdash");function i(e,t,r){this.global=e;this.scriptSelector=t;this.uniter=r}n.extend(i.prototype,{loadScripts:function(){var e=this,t,r;if(!e.global.document){return}r=this.global.document.querySelectorAll(this.scriptSelector);if(r.length===0){return}t=e.uniter.createEngine("PHP");t.expose(e.global.document,"document");t.expose(e.global,"window");t.getStdout().on("data",function(t){if(e.global.console){e.global.console.log(t)}});t.getStderr().on("data",function(t){if(e.global.console){e.global.console.error(t)}});[].forEach.call(r,function(r){var n=r.textContent;t.execute("<?php "+n).fail(function(t){if(e.global.console){e.global.console.error(t.toString());throw t}})})}});t.exports=i},{microdash:79}],5:[function(e,t,r){"use strict";var n=e("microdash"),i=0,s=1,a=2;function o(){this.mode=i;this.thens=[];this.valueArgs=null}n.extend(o.prototype,{reject:function(){var e=[].slice.call(arguments),t=this;if(t.mode===i){t.mode=s;t.valueArgs=e;n.each(t.thens,function(t){if(t.onReject){t.onReject.apply(null,e)}})}return t},resolve:function(){var e=[].slice.call(arguments),t=this;if(t.mode===i){t.mode=a;t.valueArgs=e;n.each(t.thens,function(t){if(t.onResolve){t.onResolve.apply(null,e)}})}return t},then:function(e,t){var r=this;if(r.mode===i){r.thens.push({onReject:t,onResolve:e})}else if(r.mode===s){if(t){t.apply(null,r.valueArgs)}}else if(r.mode===a){if(e){e.apply(null,r.valueArgs)}}return r}});t.exports=o},{microdash:79}],6:[function(e,t,r){"use strict";var n=e("microdash"),i=e("./Engine");function s(e,t,r){this.phpRuntime=r;this.phpToAST=e;this.phpToJS=t}n.extend(s.prototype,{createEngine:function(e,t){var r=this;if(e!=="PHP"){throw new Error('Uniter.createEngine() :: Only language "PHP" is supported')}return new i(r.phpToAST.create(),r.phpToJS,r.phpRuntime,r.phpRuntime.createEnvironment(),t)},createParser:function(){return this.phpToAST.create()}});t.exports=s},{"./Engine":2,microdash:79}],7:[function(t,r,n){(function(i){Line truncated
|
||||
;if(n.isArray(t.onToken)){(function(){var e=t.onToken;t.onToken=function(t){return e.push(t)}})()}if(n.isArray(t.onComment))t.onComment=o(t,t.onComment);return t}function o(e,t){return function(r,n,s,a,o,u){var c={type:r?"Block":"Line",value:n,start:s,end:a};if(e.locations)c.loc=new i.SourceLocation(this,o,u);if(e.ranges)c.range=[s,a];t.push(c)}}},{"./locutil":5,"./util":15}],9:[function(e,t,r){"use strict";var n=e("./tokentype");var i=e("./state");var s=e("./whitespace");var a=i.Parser.prototype;a.isUseStrict=function(e){return this.options.ecmaVersion>=5&&e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&e.expression.raw.slice(1,-1)==="use strict"};a.eat=function(e){if(this.type===e){this.next();return true}else{return false}};a.isContextual=function(e){return this.type===n.types.name&&this.value===e};a.eatContextual=function(e){return this.value===e&&this.eat(n.types.name)};a.expectContextual=function(e){if(!this.eatContextual(e))this.unexpected()};a.canInsertSemicolon=function(){return this.type===n.types.eof||this.type===n.types.braceR||s.lineBreak.test(this.input.slice(this.lastTokEnd,this.start))};a.insertSemicolon=function(){if(this.canInsertSemicolon()){if(this.options.onInsertedSemicolon)this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc);return true}};a.semicolon=function(){if(!this.eat(n.types.semi)&&!this.insertSemicolon())this.unexpected()};a.afterTrailingComma=function(e){if(this.type==e){if(this.options.onTrailingComma)this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc);this.next();return true}};a.expect=function(e){this.eat(e)||this.unexpected()};a.unexpected=function(e){this.raise(e!=null?e:this.start,"Unexpected token")};a.checkPatternErrors=function(e,t){var r=e&&e.trailingComma;if(!t)return!!r;if(r)this.raise(r,"Trailing comma is not permitted in destructuring patterns")};a.checkExpressionErrors=function(e,t){var r=e&&e.shorthandAssign;if(!t)return!!r;if(r)this.raise(r,"Shorthand property assignments are valid only in destructuring patterns")}},{"./state":10,"./tokentype":14,"./whitespace":16}],10:[function(e,t,r){"use strict";r.__esModule=true;function n(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var i=e("./identifier");var s=e("./tokentype");var a=e("./whitespace");var o=e("./options");var u={};r.plugins=u;function c(e){return new RegExp("^("+e.replace(/ /g,"|")+")$")}var l=function(){function e(t,r,u){n(this,e);this.options=t=o.getOptions(t);this.sourceFile=t.sourceFile;this.keywords=c(i.keywords[t.ecmaVersion>=6?6:5]);var l=t.allowReserved?"":i.reservedWords[t.ecmaVersion]+(t.sourceType=="module"?" await":"");this.reservedWords=c(l);var f=(l?l+" ":"")+i.reservedWords.strict;this.reservedWordsStrict=c(f);this.reservedWordsStrictBind=c(f+" "+i.reservedWords.strictBind);this.input=String(r);this.containsEsc=false;this.loadPlugins(t.plugins);if(u){this.pos=u;this.lineStart=Math.max(0,this.input.lastIndexOf("\n",u));this.curLine=this.input.slice(0,this.lineStart).split(a.lineBreak).length}else{this.pos=this.lineStart=0;this.curLine=1}this.type=s.types.eof;this.value=null;this.start=this.end=this.pos;this.startLoc=this.endLoc=this.curPosition();this.lastTokEndLoc=this.lastTokStartLoc=null;this.lastTokStart=this.lastTokEnd=this.pos;this.context=this.initialContext();this.exprAllowed=true;this.strict=this.inModule=t.sourceType==="module";this.potentialArrowAt=-1;this.inFunction=this.inGenerator=false;this.labels=[];if(this.pos===0&&t.allowHashBang&&this.input.slice(0,2)==="#!")this.skipLineComment(2)}e.prototype.isKeyword=function e(t){return this.keywords.test(t)};e.prototype.isReservedWord=function e(t){return this.reservedWords.test(t)};e.prototype.extend=function e(t,r){this[t]=r(this[t])};e.prototype.loadPlugins=function e(t){for(var r in t){var n=u[r];if(!n)throw new Error("Plugin '"+r+"' not found");n(this,t[r])}};e.prototype.parse=function e(){var t=this.options.program||this.startNode();this.nextToken();return this.parseTopLevel(t)};return e}();r.Parser=l},{"./identifier":2,"./options":8,"./tokentype":14,"./whitespace":16}],11:[function(e,t,r){"use strict";var n=e("./tokentype");var i=e("./state");var s=e("./whitespace");var a=i.Parser.prototype;a.parseTopLevel=function(e){var t=true;if(!e.body)e.body=[];while(this.type!==n.types.eof){var r=this.parseStatement(true,true);e.body.push(r);if(t){if(this.isUseStrict(r))this.setStrict(true);t=false}}this.next();if(this.options.ecmaVersion>=6){e.sourceType=this.options.sourceType}return this.finishNode(e,"Program")};var o={kind:"loop"},u={kind:"switch"};a.parseStatement=function(e,t){var r=this.type,i=this.startNode();switch(r){case n.types._break:case n.types._continue:return this.parseBreakContinueStatement(i,r.keyword);case n.types._debugger:return this.parseDebuggerStatement(i);case n.types._do:return this.parseDoStatement(i);case n.types._for:return this.parseForStatement(i);case n.types._function:if(!e&&this.options.ecmaVersion>=6)this.unexpectLine truncated
|
||||
if(this.pos===this.start&&this.type===s.types.template){if(r===36){this.pos+=2;return this.finishToken(s.types.dollarBraceL)}else{++this.pos;return this.finishToken(s.types.backQuote)}}e+=this.input.slice(t,this.pos);return this.finishToken(s.types.template,e)}if(r===92){e+=this.input.slice(t,this.pos);e+=this.readEscapedChar(true);t=this.pos}else if(u.isNewLine(r)){e+=this.input.slice(t,this.pos);++this.pos;switch(r){case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(r);break}if(this.options.locations){++this.curLine;this.lineStart=this.pos}t=this.pos}else{++this.pos}}};l.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);++this.pos;switch(t){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return m(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:if(this.options.locations){this.lineStart=this.pos;++this.curLine}return"";default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0];var n=parseInt(r,8);if(n>255){r=r.slice(0,-1);n=parseInt(r,8)}if(r!=="0"&&(this.strict||e)){this.raise(this.pos-2,"Octal literal in strict mode")}this.pos+=r.length-1;return String.fromCharCode(n)}return String.fromCharCode(t)}};l.readHexChar=function(e){var t=this.pos;var r=this.readInt(16,e);if(r===null)this.raise(t,"Bad character escape sequence");return r};l.readWord1=function(){this.containsEsc=false;var e="",t=true,r=this.pos;var n=this.options.ecmaVersion>=6;while(this.pos<this.input.length){var s=this.fullCharCodeAtPos();if(i.isIdentifierChar(s,n)){this.pos+=s<=65535?1:2}else if(s===92){this.containsEsc=true;e+=this.input.slice(r,this.pos);var a=this.pos;if(this.input.charCodeAt(++this.pos)!=117)this.raise(this.pos,"Expecting Unicode escape sequence \\uXXXX");++this.pos;var o=this.readCodePoint();if(!(t?i.isIdentifierStart:i.isIdentifierChar)(o,n))this.raise(a,"Invalid Unicode escape");e+=m(o);r=this.pos}else{break}t=false}return e+this.input.slice(r,this.pos)};l.readWord=function(){var e=this.readWord1();var t=s.types.name;if((this.options.ecmaVersion>=6||!this.containsEsc)&&this.keywords.test(e))t=s.keywords[e];return this.finishToken(t,e)}},{"./identifier":2,"./locutil":5,"./state":10,"./tokentype":14,"./whitespace":16}],14:[function(e,t,r){"use strict";r.__esModule=true;function n(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var i=function e(t){var r=arguments.length<=1||arguments[1]===undefined?{}:arguments[1];n(this,e);this.label=t;this.keyword=r.keyword;this.beforeExpr=!!r.beforeExpr;this.startsExpr=!!r.startsExpr;this.isLoop=!!r.isLoop;this.isAssign=!!r.isAssign;this.prefix=!!r.prefix;this.postfix=!!r.postfix;this.binop=r.binop||null;this.updateContext=null};r.TokenType=i;function s(e,t){return new i(e,{beforeExpr:true,binop:t})}var a={beforeExpr:true},o={startsExpr:true};var u={num:new i("num",o),regexp:new i("regexp",o),string:new i("string",o),name:new i("name",o),eof:new i("eof"),bracketL:new i("[",{beforeExpr:true,startsExpr:true}),bracketR:new i("]"),braceL:new i("{",{beforeExpr:true,startsExpr:true}),braceR:new i("}"),parenL:new i("(",{beforeExpr:true,startsExpr:true}),parenR:new i(")"),comma:new i(",",a),semi:new i(";",a),colon:new i(":",a),dot:new i("."),question:new i("?",a),arrow:new i("=>",a),template:new i("template"),ellipsis:new i("...",a),backQuote:new i("`",o),dollarBraceL:new i("${",{beforeExpr:true,startsExpr:true}),eq:new i("=",{beforeExpr:true,isAssign:true}),assign:new i("_=",{beforeExpr:true,isAssign:true}),incDec:new i("++/--",{prefix:true,postfix:true,startsExpr:true}),prefix:new i("prefix",{beforeExpr:true,prefix:true,startsExpr:true}),logicalOR:s("||",1),logicalAND:s("&&",2),bitwiseOR:s("|",3),bitwiseXOR:s("^",4),bitwiseAND:s("&",5),equality:s("==/!=",6),relational:s("</>",7),bitShift:s("<</>>",8),plusMin:new i("+/-",{beforeExpr:true,binop:9,prefix:true,startsExpr:true}),modulo:s("%",10),star:s("*",10),slash:s("/",10)};r.types=u;var c={};r.keywords=c;function l(e){var t=arguments.length<=1||arguments[1]===undefined?{}:arguments[1];t.keyword=e;c[e]=u["_"+e]=new i(e,t)}l("break");l("case",a);l("catch");l("continue");l("debugger");l("default",a);l("do",{isLoop:true,beforeExpr:true});l("else",a);l("finally");l("for",{isLoop:true});l("function",o);l("if");l("return",a);l("switch");l("throw",a);l("try");l("var");l("let");l("const");l("while",{isLoop:true});l("with");l("new",{beforeExpr:true,startsExpr:true});l("this",o);l("super",o);l("class");l("extends",a);l("export");l("import");l("yield",{beforeExpr:true,startsExpr:true});l("null",o);l("true",o);l("false",o);l("in",{beforeExpr:true,binop:7});l("instanceof",{beforeExpr:true,binop:7});l("typeof",{beforeExpr:true,prefix:true,startsExpr:true});l("void",{beforeExpr:true,prefix:true,startsExpr:true});l("delete",{beforeExpr:true,prefixLine truncated
|
||||
;var n=e("./valid-callable"),i=e("./valid-value"),s=Function.prototype.bind,a=Function.prototype.call,o=Object.keys,u=Object.prototype.propertyIsEnumerable;t.exports=function(e,t){return function(r,c){var l,f=arguments[2],p=arguments[3];r=Object(i(r));n(c);l=o(r);if(p){l.sort(typeof p==="function"?s.call(p,r):undefined)}if(typeof e!=="function")e=l[e];return a.call(e,l,function(e,n){if(!u.call(r,e))return t;return a.call(c,f,r[e],e,r,n)})}}},{"./valid-callable":42,"./valid-value":44}],25:[function(e,t,r){"use strict";t.exports=e("./is-implemented")()?Object.assign:e("./shim")},{"./is-implemented":26,"./shim":27}],26:[function(e,t,r){"use strict";t.exports=function(){var e=Object.assign,t;if(typeof e!=="function")return false;t={foo:"raz"};e(t,{bar:"dwa"},{trzy:"trzy"});return t.foo+t.bar+t.trzy==="razdwatrzy"}},{}],27:[function(e,t,r){"use strict";var n=e("../keys"),i=e("../valid-value"),s=Math.max;t.exports=function(e,t){var r,a,o=s(arguments.length,2),u;e=Object(i(e));u=function(n){try{e[n]=t[n]}catch(e){if(!r)r=e}};for(a=1;a<o;++a){t=arguments[a];n(t).forEach(u)}if(r!==undefined)throw r;return e}},{"../keys":34,"../valid-value":44}],28:[function(e,t,r){"use strict";var n=e("../array/from"),i=e("./assign"),s=e("./valid-value");t.exports=function(e){var t=Object(s(e)),r=arguments[1],a=Object(arguments[2]);if(t!==e&&!r)return t;var o={};if(r){n(r,function(t){if(a.ensure||t in e)o[t]=e[t]})}else{i(o,e)}return o}},{"../array/from":13,"./assign":25,"./valid-value":44}],29:[function(e,t,r){"use strict";var n=Object.create,i;if(!e("./set-prototype-of/is-implemented")()){i=e("./set-prototype-of/shim")}t.exports=function(){var e,t,r;if(!i)return n;if(i.level!==1)return n;e={};t={};r={configurable:false,enumerable:false,writable:true,value:undefined};Object.getOwnPropertyNames(Object.prototype).forEach(function(e){if(e==="__proto__"){t[e]={configurable:true,enumerable:false,writable:true,value:undefined};return}t[e]=r});Object.defineProperties(e,t);Object.defineProperty(i,"nullPolyfill",{configurable:false,enumerable:false,writable:false,value:e});return function(t,r){return n(t===null?e:t,r)}}()},{"./set-prototype-of/is-implemented":40,"./set-prototype-of/shim":41}],30:[function(e,t,r){"use strict";t.exports=e("./_iterate")("forEach")},{"./_iterate":24}],31:[function(e,t,r){"use strict";t.exports=function(e){return typeof e==="function"}},{}],32:[function(e,t,r){"use strict";var n=e("./is-value");var i={function:true,object:true};t.exports=function(e){return n(e)&&i[typeof e]||false}},{"./is-value":33}],33:[function(e,t,r){"use strict";var n=e("../function/noop")();t.exports=function(e){return e!==n&&e!==null}},{"../function/noop":18}],34:[function(e,t,r){"use strict";t.exports=e("./is-implemented")()?Object.keys:e("./shim")},{"./is-implemented":35,"./shim":36}],35:[function(e,t,r){"use strict";t.exports=function(){try{Object.keys("primitive");return true}catch(e){return false}}},{}],36:[function(e,t,r){"use strict";var n=e("../is-value");var i=Object.keys;t.exports=function(e){return i(n(e)?Object(e):e)}},{"../is-value":33}],37:[function(e,t,r){"use strict";var n=e("./valid-callable"),i=e("./for-each"),s=Function.prototype.call;t.exports=function(e,t){var r={},a=arguments[2];n(t);i(e,function(e,n,i,o){r[n]=s.call(t,a,e,n,i,o)});return r}},{"./for-each":30,"./valid-callable":42}],38:[function(e,t,r){"use strict";var n=e("./is-value");var i=Array.prototype.forEach,s=Object.create;var a=function(e,t){var r;for(r in e)t[r]=e[r]};t.exports=function(e){var t=s(null);i.call(arguments,function(e){if(!n(e))return;a(Object(e),t)});return t}},{"./is-value":33}],39:[function(e,t,r){"use strict";t.exports=e("./is-implemented")()?Object.setPrototypeOf:e("./shim")},{"./is-implemented":40,"./shim":41}],40:[function(e,t,r){"use strict";var n=Object.create,i=Object.getPrototypeOf,s={};t.exports=function(){var e=Object.setPrototypeOf,t=arguments[0]||n;if(typeof e!=="function")return false;return i(e(t(null),s))===s}},{}],41:[function(e,t,r){"use strict";var n=e("../is-object"),i=e("../valid-value"),s=Object.prototype.isPrototypeOf,a=Object.defineProperty,o={configurable:true,enumerable:false,writable:true,value:undefined},u;u=function(e,t){i(e);if(t===null||n(t))return e;throw new TypeError("Prototype must be null or an object")};t.exports=function(e){var t,r;if(!e)return null;if(e.level===2){if(e.set){r=e.set;t=function(e,t){r.call(u(e,t),t);return e}}else{t=function(e,t){u(e,t).__proto__=t;return e}}}else{t=function e(t,r){var n;u(t,r);n=s.call(e.nullPolyfill,t);if(n)delete e.nullPolyfill.__proto__;if(r===null)r=e.nullPolyfill;t.__proto__=r;if(n)a(e.nullPolyfill,"__proto__",o);return t}}return Object.defineProperty(t,"level",{configurable:false,enumerable:false,writable:false,value:e.level})}(function(){var e=Object.create(null),t={},r,n=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__");if(n){try{r=n.set;r.call(e,t)}catch(e){}if(Object.getPrototypeOf(e)===t)return{set:r,level:2}}e.__proto__=t;if(Object.getPrototypeOfLine truncated
|
||||
if(e.slice(r,r+8)!=="function"){return false}t=e.charCodeAt(r+8);return t===40||u.code.isWhiteSpace(t)||t===42||u.code.isLineTerminator(t)}r=[this.generateExpression(e.expression,i.Sequence,j)];s=ce(r).toString();if(s.charCodeAt(0)===123||a(s)||o(s)||c(s)||A&&t&L&&e.expression.type===n.Literal&&typeof e.expression.value==="string"){r=["(",r,")"+this.semicolon(t)]}else{r.push(this.semicolon(t))}return r},ImportDeclaration:function(e,t){var r,s,a=this;if(e.specifiers.length===0){return["import",y,this.generateExpression(e.source,i.Sequence,j),this.semicolon(t)]}r=["import"];s=0;if(e.specifiers[s].type===n.ImportDefaultSpecifier){r=fe(r,[this.generateExpression(e.specifiers[s],i.Sequence,j)]);++s}if(e.specifiers[s]){if(s!==0){r.push(",")}if(e.specifiers[s].type===n.ImportNamespaceSpecifier){r=fe(r,[y,this.generateExpression(e.specifiers[s],i.Sequence,j)])}else{r.push(y+"{");if(e.specifiers.length-s===1){r.push(y);r.push(this.generateExpression(e.specifiers[s],i.Sequence,j));r.push(y+"}"+y)}else{he(function(t){var n,o;r.push(g);for(n=s,o=e.specifiers.length;n<o;++n){r.push(t);r.push(a.generateExpression(e.specifiers[n],i.Sequence,j));if(n+1<o){r.push(","+g)}}});if(!Q(ce(r).toString())){r.push(g)}r.push(l+"}"+y)}}}r=fe(r,["from"+y,this.generateExpression(e.source,i.Sequence,j),this.semicolon(t)]);return r},VariableDeclarator:function(e,t){var r=t&w?j:k;if(e.init){return[this.generateExpression(e.id,i.Assignment,r),y,"=",y,this.generateExpression(e.init,i.Assignment,r)]}return this.generatePattern(e.id,i.Assignment,r)},VariableDeclaration:function(e,t){var r,n,i,s,a,o=this;r=[e.kind];a=t&w?q:Y;function u(){s=e.declarations[0];if(S.comment&&s.leadingComments){r.push("\n");r.push(pe(o.generateStatement(s,a)))}else{r.push(le());r.push(o.generateStatement(s,a))}for(n=1,i=e.declarations.length;n<i;++n){s=e.declarations[n];if(S.comment&&s.leadingComments){r.push(","+g);r.push(pe(o.generateStatement(s,a)))}else{r.push(","+y);r.push(o.generateStatement(s,a))}}}if(e.declarations.length>1){he(u)}else{u()}r.push(this.semicolon(t));return r},ThrowStatement:function(e,t){return[fe("throw",this.generateExpression(e.argument,i.Sequence,j)),this.semicolon(t)]},TryStatement:function(e,t){var r,n,i,s;r=["try",this.maybeBlock(e.block,q)];r=this.maybeBlockSuffix(e.block,r);if(e.handlers){for(n=0,i=e.handlers.length;n<i;++n){r=fe(r,this.generateStatement(e.handlers[n],q));if(e.finalizer||n+1!==i){r=this.maybeBlockSuffix(e.handlers[n].body,r)}}}else{s=e.guardedHandlers||[];for(n=0,i=s.length;n<i;++n){r=fe(r,this.generateStatement(s[n],q));if(e.finalizer||n+1!==i){r=this.maybeBlockSuffix(s[n].body,r)}}if(e.handler){if(c(e.handler)){for(n=0,i=e.handler.length;n<i;++n){r=fe(r,this.generateStatement(e.handler[n],q));if(e.finalizer||n+1!==i){r=this.maybeBlockSuffix(e.handler[n].body,r)}}}else{r=fe(r,this.generateStatement(e.handler,q));if(e.finalizer){r=this.maybeBlockSuffix(e.handler.body,r)}}}}if(e.finalizer){r=fe(r,["finally",this.maybeBlock(e.finalizer,q)])}return r},SwitchStatement:function(e,t){var r,n,s,a,o,u=this;he(function(){r=["switch"+y+"(",u.generateExpression(e.discriminant,i.Sequence,j),")"+y+"{"+g]});if(e.cases){o=q;for(s=0,a=e.cases.length;s<a;++s){if(s===a-1){o|=M}n=pe(this.generateStatement(e.cases[s],o));r.push(n);if(!Q(ce(n).toString())){r.push(g)}}}r.push(pe("}"));return r},SwitchCase:function(e,t){var r,s,a,o,u,c=this;he(function(){if(e.test){r=[fe("case",c.generateExpression(e.test,i.Sequence,j)),":"]}else{r=["default:"]}a=0;o=e.consequent.length;if(o&&e.consequent[0].type===n.BlockStatement){s=c.maybeBlock(e.consequent[0],q);r.push(s);a=1}if(a!==o&&!Q(ce(r).toString())){r.push(g)}u=q;for(;a<o;++a){if(a===o-1&&t&M){u|=M}s=pe(c.generateStatement(e.consequent[a],u));r.push(s);if(a+1!==o&&!Q(ce(s).toString())){r.push(g)}}});return r},IfStatement:function(e,t){var r,s,a,o=this;he(function(){r=["if"+y+"(",o.generateExpression(e.test,i.Sequence,j),")"]});a=t&M;s=q;if(a){s|=M}if(e.alternate){r.push(this.maybeBlock(e.consequent,q));r=this.maybeBlockSuffix(e.consequent,r);if(e.alternate.type===n.IfStatement){r=fe(r,["else ",this.generateStatement(e.alternate,s)])}else{r=fe(r,fe("else",this.maybeBlock(e.alternate,s)))}}else{r.push(this.maybeBlock(e.consequent,s))}return r},ForStatement:function(e,t){var r,s=this;he(function(){r=["for"+y+"("];if(e.init){if(e.init.type===n.VariableDeclaration){r.push(s.generateStatement(e.init,Y))}else{r.push(s.generateExpression(e.init,i.Sequence,k));r.push(";")}}else{r.push(";")}if(e.test){r.push(y);r.push(s.generateExpression(e.test,i.Sequence,j));r.push(";")}else{r.push(";")}if(e.update){r.push(y);r.push(s.generateExpression(e.update,i.Sequence,j));r.push(")")}else{r.push(")")}});r.push(this.maybeBlock(e.body,t&M?H:q));return r},ForInStatement:function(e,t){return this.generateIterationForStatement("in",e,t&M?H:q)},ForOfStatement:function(e,t){return this.generateIterationForStatement("of",e,t&M?H:q)},LabeledStatement:function(e,t){return[e.label.name+":",this.maybeBlock(e.body,t&M?H:q)]},Line truncated
|
||||
"unit-test":"mocha --compilers js:babel-register"},version:"4.2.0"}},{}],70:[function(e,t,r){(function(){"use strict";function e(e){if(e==null){return false}switch(e.type){case"ArrayExpression":case"AssignmentExpression":case"BinaryExpression":case"CallExpression":case"ConditionalExpression":case"FunctionExpression":case"Identifier":case"Literal":case"LogicalExpression":case"MemberExpression":case"NewExpression":case"ObjectExpression":case"SequenceExpression":case"ThisExpression":case"UnaryExpression":case"UpdateExpression":return true}return false}function r(e){if(e==null){return false}switch(e.type){case"DoWhileStatement":case"ForInStatement":case"ForStatement":case"WhileStatement":return true}return false}function n(e){if(e==null){return false}switch(e.type){case"BlockStatement":case"BreakStatement":case"ContinueStatement":case"DebuggerStatement":case"DoWhileStatement":case"EmptyStatement":case"ExpressionStatement":case"ForInStatement":case"ForStatement":case"IfStatement":case"LabeledStatement":case"ReturnStatement":case"SwitchStatement":case"ThrowStatement":case"TryStatement":case"VariableDeclaration":case"WhileStatement":case"WithStatement":return true}return false}function i(e){return n(e)||e!=null&&e.type==="FunctionDeclaration"}function s(e){switch(e.type){case"IfStatement":if(e.alternate!=null){return e.alternate}return e.consequent;case"LabeledStatement":case"ForStatement":case"ForInStatement":case"WhileStatement":case"WithStatement":return e.body}return null}function a(e){var t;if(e.type!=="IfStatement"){return false}if(e.alternate==null){return false}t=e.consequent;do{if(t.type==="IfStatement"){if(t.alternate==null){return true}}t=s(t)}while(t);return false}t.exports={isExpression:e,isStatement:n,isIterationStatement:r,isSourceElement:i,isProblematicIfStatement:a,trailingStatement:s}})()},{}],71:[function(e,t,r){(function(){"use strict";var e,r,n,i,s,a;r={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8Line truncated
|
||||
;if(!this._events||!this._events[e])t=[];else if(i(this._events[e]))t=[this._events[e]];else t=this._events[e].slice();return t};n.listenerCount=function(e,t){var r;if(!e._events||!e._events[t])r=0;else if(i(e._events[t]))r=1;else r=e._events[t].length;return r};function i(e){return typeof e==="function"}function s(e){return typeof e==="number"}function a(e){return typeof e==="object"&&e!==null}function o(e){return e===void 0}},{}],75:[function(e,t,r){r.read=function(e,t,r,n,i){var s,a;var o=i*8-n-1;var u=(1<<o)-1;var c=u>>1;var l=-7;var f=r?i-1:0;var p=r?-1:1;var h=e[t+f];f+=p;s=h&(1<<-l)-1;h>>=-l;l+=o;for(;l>0;s=s*256+e[t+f],f+=p,l-=8){}a=s&(1<<-l)-1;s>>=-l;l+=n;for(;l>0;a=a*256+e[t+f],f+=p,l-=8){}if(s===0){s=1-c}else if(s===u){return a?NaN:(h?-1:1)*Infinity}else{a=a+Math.pow(2,n);s=s-c}return(h?-1:1)*a*Math.pow(2,s-n)};r.write=function(e,t,r,n,i,s){var a,o,u;var c=s*8-i-1;var l=(1<<c)-1;var f=l>>1;var p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0;var h=n?0:s-1;var m=n?1:-1;var d=t<0||t===0&&1/t<0?1:0;t=Math.abs(t);if(isNaN(t)||t===Infinity){o=isNaN(t)?1:0;a=l}else{a=Math.floor(Math.log(t)/Math.LN2);if(t*(u=Math.pow(2,-a))<1){a--;u*=2}if(a+f>=1){t+=p/u}else{t+=p*Math.pow(2,1-f)}if(t*u>=2){a++;u/=2}if(a+f>=l){o=0;a=l}else if(a+f>=1){o=(t*u-1)*Math.pow(2,i);a=a+f}else{o=t*Math.pow(2,f-1)*Math.pow(2,i);a=0}}for(;i>=8;e[r+h]=o&255,h+=m,o/=256,i-=8){}a=a<<i|o;c+=i;for(;c>0;e[r+h]=a&255,h+=m,a/=256,c-=8){}e[r+h-m]|=d*128}},{}],76:[function(e,t,r){(function(e){"use strict";var r=e.MutationObserver||e.WebKitMutationObserver;var n;{if(r){var i=0;var s=new r(l);var a=e.document.createTextNode("");s.observe(a,{characterData:true});n=function(){a.data=i=++i%2}}else if(!e.setImmediate&&typeof e.MessageChannel!=="undefined"){var o=new e.MessageChannel;o.port1.onmessage=l;n=function(){o.port2.postMessage(0)}}else if("document"in e&&"onreadystatechange"in e.document.createElement("script")){n=function(){var t=e.document.createElement("script");t.onreadystatechange=function(){l();t.onreadystatechange=null;t.parentNode.removeChild(t);t=null};e.document.documentElement.appendChild(t)}}else{n=function(){setTimeout(l,0)}}}var u;var c=[];function l(){u=true;var e,t;var r=c.length;while(r){t=c;c=[];e=-1;while(++e<r){t[e]()}r=c.length}u=false}t.exports=f;function f(e){if(c.push(e)===1&&!u){n()}}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],77:[function(e,t,r){var n={}.toString;t.exports=Array.isArray||function(e){return n.call(e)=="[object Array]"}},{}],78:[function(e,t,r){"use strict";var n=e("immediate");function i(){}var s={};var a=["REJECTED"];var o=["FULFILLED"];var u=["PENDING"];t.exports=c;function c(e){if(typeof e!=="function"){throw new TypeError("resolver must be a function")}this.state=u;this.queue=[];this.outcome=void 0;if(e!==i){h(this,e)}}c.prototype["catch"]=function(e){return this.then(null,e)};c.prototype.then=function(e,t){if(typeof e!=="function"&&this.state===o||typeof t!=="function"&&this.state===a){return this}var r=new this.constructor(i);if(this.state!==u){var n=this.state===o?e:t;f(r,n,this.outcome)}else{this.queue.push(new l(r,e,t))}return r};function l(e,t,r){this.promise=e;if(typeof t==="function"){this.onFulfilled=t;this.callFulfilled=this.otherCallFulfilled}if(typeof r==="function"){this.onRejected=r;this.callRejected=this.otherCallRejected}}l.prototype.callFulfilled=function(e){s.resolve(this.promise,e)};l.prototype.otherCallFulfilled=function(e){f(this.promise,this.onFulfilled,e)};l.prototype.callRejected=function(e){s.reject(this.promise,e)};l.prototype.otherCallRejected=function(e){f(this.promise,this.onRejected,e)};function f(e,t,r){n(function(){var n;try{n=t(r)}catch(t){return s.reject(e,t)}if(n===e){s.reject(e,new TypeError("Cannot resolve promise with itself"))}else{s.resolve(e,n)}})}s.resolve=function(e,t){var r=m(p,t);if(r.status==="error"){return s.reject(e,r.value)}var n=r.value;if(n){h(e,n)}else{e.state=o;e.outcome=t;var i=-1;var a=e.queue.length;while(++i<a){e.queue[i].callFulfilled(t)}}return e};s.reject=function(e,t){e.state=a;e.outcome=t;var r=-1;var n=e.queue.length;while(++r<n){e.queue[r].callRejected(t)}return e};function p(e){var t=e&&e.then;if(e&&(typeof e==="object"||typeof e==="function")&&typeof t==="function"){return function r(){t.apply(e,arguments)}}}function h(e,t){var r=false;function n(t){if(r){return}r=true;s.reject(e,t)}function i(t){if(r){return}r=true;s.resolve(e,t)}function a(){t(i,n)}var o=m(a);if(o.status==="error"){n(o.value)}}function m(e,t){var r={};try{r.value=e(t);r.status="success"}catch(e){r.status="error";r.value=e}return r}c.resolve=d;function d(e){if(e instanceof this){return e}return s.resolve(new this(i),e)}c.reject=E;function E(e){var t=new this(i);return s.reject(t,e)}c.all=g;function g(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]"){return this.reject(new TypeError("must be an array"))}var r=e.length;var n=false;if(!r){return this.resolve([])}var a=neLine truncated
|
||||
var t=[],r,s=i.parse("var statementIndex = 0;").body[0],a=this,u=[],c,l=[],p=[],h=i.parse("if (Resumable._resumeState_) { statementIndex = Resumable._resumeState_.statementIndex; }").body[0];n.each(a.variables,function(e){s[o].push({type:f.VariableDeclarator,id:{type:f.Identifier,name:e},init:null})});if(a.catches.length>0){r=[];n.each(a.catches,function(e){r.push({type:f.Property,kind:"init",key:{type:f.Identifier,name:e.catchStatementIndex},value:{type:f.ObjectExpression,properties:[{type:f.Property,kind:"init",key:{type:f.Identifier,name:"from"},value:{type:f.Literal,value:e.tryStartIndex}},{type:f.Property,kind:"init",key:{type:f.Identifier,name:"to"},value:{type:f.Literal,value:e.tryEndIndex}},{type:f.Property,kind:"init",key:{type:f.Identifier,name:"param"},value:{type:f.Literal,value:e.catchParameter}}]}})});p.push({type:f.Property,kind:"init",key:{type:f.Identifier,name:"catches"},value:{type:f.ObjectExpression,properties:r}})}if(a.hasFinally){u.push({type:f.VariableDeclaration,declarations:[{type:f.VariableDeclarator,id:{type:f.Identifier,name:"resumablePause"},init:{type:f.Literal,value:null}}],kind:"var"})}for(c=0;c<a.nextTempIndex;c++){p.push({type:f.Property,kind:"init",key:{type:f.Identifier,name:"temp"+c},value:{type:f.Identifier,name:"temp"+c}});s.declarations.push({type:f.VariableDeclarator,id:{type:f.Identifier,name:"temp"+c},init:null});h.consequent.body.push({type:f.ExpressionStatement,expression:{type:f.AssignmentExpression,operator:"=",left:{type:f.Identifier,name:"temp"+c},right:i.parse("Resumable._resumeState_.temp"+c).body[0].expression}})}h.consequent.body.push(i.parse("Resumable._resumeState_ = null;").body[0]);n.forOwn(a.assignmentVariables,function(e,r){t.push({type:f.Property,kind:"init",key:{type:f.Literal,value:r},value:{type:f.Literal,value:e}})});l.push(s);[].push.apply(l,a.functionDeclarations);l.push({type:f.ReturnStatement,argument:{type:f.CallExpression,arguments:[{type:f.ThisExpression},{type:f.Identifier,name:"arguments"}],callee:{type:f.MemberExpression,object:{type:f.FunctionExpression,id:{type:f.Identifier,name:"resumableScope"},params:[],body:{type:f.BlockStatement,body:u.concat([h,{type:f.TryStatement,block:{type:f.BlockStatement,body:[e]},handler:{type:f.CatchClause,param:{type:f.Identifier,name:"e"},body:{type:f.BlockStatement,body:[{type:f.IfStatement,test:i.parse("e instanceof Resumable.PauseException").body[0].expression,consequent:{type:f.BlockStatement,body:[{type:f.ExpressionStatement,expression:{type:f.CallExpression,callee:{type:f.MemberExpression,object:{type:f.Identifier,name:"e"},property:{type:f.Identifier,name:"add"},computed:false},arguments:[{type:f.ObjectExpression,properties:[{type:f.Property,kind:"init",key:{type:f.Identifier,name:"func"},value:{type:f.Identifier,name:"resumableScope"}},{type:f.Property,kind:"init",key:{type:f.Identifier,name:"statementIndex"},value:{type:f.BinaryExpression,operator:"+",left:{type:f.Identifier,name:"statementIndex"},right:{type:f.Literal,value:1}}},{type:f.Property,kind:"init",key:{type:f.Identifier,name:"assignments"},value:{type:f.ObjectExpression,properties:t}}].concat(p)}]}}]}},{type:f.ThrowStatement,argument:{type:f.Identifier,name:"e"}}]}}}])}},property:{type:f.Identifier,name:"apply"}}}});return l},getTempName:function(){return"temp"+this.nextTempIndex++},getTempNameForVariable:function(e,t){var r=this,n;n=r.getTempName();r.lastTempNames[e]=n;t.addAssignment(n).assign({type:f.Identifier,name:e});return n},getLastTempName:function(){return"temp"+(this.nextTempIndex-1)},getLastTempNameForVariable:function(e){var t=this;if(!a.call(t.lastTempNames,e)){return e}return t.lastTempNames[e]},hasVariableDefined:function(e){var t=false;n.each(this.functionDeclarations,function(r){if(r[u]&&r[u][c]===e){t=true;return false}});n.each(this.variables,function(r){if(r===e){t=true}});return t},popLabelableContext:function(){var e=this;e.labelableContext=e.labelableContextStack.pop()},pushLabelableContext:function(e){var t=this,r=t.labelableContextStack.length,n=new l(e,r);t.labelableContextStack.push(t.labelableContext);t.labelableContext=n;return n}});t.exports=p},{"./LabelableContext":120,acorn:7,estraverse:68,microdash:79}],119:[function(e,t,r){"use strict";var n=e("microdash"),i=e("estraverse"),s=e("./BlockContext"),a=e("./FunctionContext"),o="body",u="id",c="name",l="params",f="type",p=i.Syntax;function h(e){this.statementTranspiler=e}n.extend(h.prototype,{transpile:function(e){var t,r=this,i=new a,h=new s(i),m=[];n.each(e[l],function(e){i.addParameter(e[c])});if(e[o][o].length>0){r.statementTranspiler.transpileArray(e[o][o],e,i,h);m=i.getStatements(h.getSwitchStatement())}t={type:e[f],id:e[u],params:e[l],body:{type:p.BlockStatement,body:m}};return t}});t.exports=h},{"./BlockContext":104,"./FunctionContext":118,estraverse:68,microdash:79}],120:[function(e,t,r){"use strict";var n=e("microdash"),i=e("estraverse"),s=i.Syntax;function a(e,t){this.continueStatements=[];this.index=t;this.label=e;this.labelAssigned=e||nulLine truncated
|
||||
INSTANCEOF_EXPECTS_OBJECT:20,CANNOT_USE_WRONG_TYPE_AS:21,USED_THIS_OUTSIDE_OBJECT_CONTEXT:22,OPERATOR_REQUIRES_POSITIVE_NUMBER:23,CANNOT_BREAK_OR_CONTINUE:24,ONLY_VARIABLES_BY_REFERENCE:25,CANNOT_UNSET_STATIC_PROPERTY:26,NO_PARENT_CLASS:27});t.exports=u},{"./PHPError":148,microdash:79,"template-string":259,util:265}],150:[function(e,t,r){"use strict";var n=e("microdash"),i=e("template-string"),s=e("util"),a=e("./PHPError"),o={1:"syntax error, unexpected ${what} in ${file} on line ${line}"};function u(e,t){a.call(this,a.E_PARSE,i(o[e],t))}s.inherits(u,a);n.extend(u,{SYNTAX_UNEXPECTED:1});t.exports=u},{"./PHPError":148,microdash:79,"template-string":259,util:265}],151:[function(e,t,r){(function(r){"use strict";var n=e("pausable"),i=e("phpcommon"),s=e("./src/Debug/DebugFactory"),a=e("./src/Debug/DebugFormatter"),o=e("./src/Debug/DebugFormatterInstaller"),u=e("./src/Debug/DebugValue"),c=e("./src/Engine"),l=e("./src/Environment"),f=e("./src/OptionSet"),p=e("./src/PHPState").async(n),h=e("./src/Runtime").async(n),m=e("./src/Debug/ValueFormatter"),d=new h(l,c,f,p,i,n),E=new s(a,u,m);new o(r,E).install();t.exports=d}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./src/Debug/DebugFactory":159,"./src/Debug/DebugFormatter":160,"./src/Debug/DebugFormatterInstaller":161,"./src/Debug/DebugValue":162,"./src/Debug/ValueFormatter":164,"./src/Engine":165,"./src/Environment":166,"./src/OptionSet":178,"./src/PHPState":180,"./src/Runtime":191,pausable:103,phpcommon:146}],152:[function(e,t,r){"use strict";var n=e("microdash");function i(e,t,r,n){this.args=r;this.finder=null;this.namespaceScope=t;this.newStaticClass=n;this.scope=e}n.extend(i.prototype,{getFilePath:function(){return this.namespaceScope.getFilePath()},getFunctionArgs:function(){return this.args},getFunctionName:function(){return this.scope.getFunctionName().getNative()},getLastLine:function(){var e=this;if(!e.finder){return null}return e.finder()},getScope:function(){return this.scope},getStaticClass:function(){var e=this,t=e.scope.getThisObject();if(t&&t.getType()!=="null"){return t.getClass()}return e.newStaticClass},instrument:function(e){this.finder=e}});t.exports=i},{microdash:79}],153:[function(e,t,r){"use strict";var n=e("microdash");function i(e){this.Call=e}n.extend(i.prototype,{create:function(e,t,r,n){var i=this;return new i.Call(e,t,r||[],n||null)}});t.exports=i},{microdash:79}],154:[function(e,t,r){"use strict";var n=e("microdash"),i=e("phpcommon"),s=i.PHPError;function a(e){this.calls=[];this.stderr=e}n.extend(a.prototype,{getCallerScope:function(){var e=this,t=e.calls[e.calls.length-2]||null;return t?t.getScope():null},getCurrent:function(){var e=this;return e.calls[e.calls.length-1]||null},getLastFilePath:function(){return this.getCurrent().getFilePath()},getLastLine:function(){return this.getCurrent().getLastLine()},getStaticClass:function(){var e,t=this,r,n,i=null;for(r=t.calls.length-1;r>=0;r--){e=t.calls[r];n=e.getStaticClass();if(n){i=n;break}}return i},getThisObject:function(){var e=this.getCurrent();if(!e){return null}return e.getScope().getThisObject()},getTrace:function(){var e=this,t=[],r=e.calls.length-1;n.each(e.calls,function(n,i){t.unshift({index:r--,file:n.getFilePath(),line:i>0?e.calls[i-1].getLastLine():null,func:n.getFunctionName(),args:n.getFunctionArgs()})});return t},instrumentCurrent:function(e){this.getCurrent().instrument(e)},pop:function(){this.calls.pop()},push:function(e){this.calls.push(e)},raiseError:function(e,t){var r,n=this,i=n.calls,a,o;if(n.getCurrent().getScope().suppressesOwnErrors()){return}for(o=i.length-1;o>=0;--o){r=i[o];if(r.getScope().suppressesErrors()){return}}a=new s(e,t);n.stderr.write(a.message+"\n")}});t.exports=a},{microdash:79,phpcommon:146}],155:[function(e,t,r){"use strict";t.exports=e("pauser")([e("microdash"),e("phpcommon"),e("./Reference/StaticProperty"),e("./Reference/UndeclaredStaticProperty")],function(e,t,r,n){var i="isStatic",s="__call",a="__callStatic",o="value",u="visibility",c={}.hasOwnProperty,l=t.PHPError,f=t.PHPFatalError,p=function(t){var r;function n(e){this.phpObject=e}n.prototype=Object.create(t.InternalClass.prototype);function i(e){n.prototype[e]=function(){var t=[e].concat([].slice.call(arguments));return this.phpObject.callMethod.apply(this.phpObject,t)}}r=t;while(r){e.forOwn(r.InternalClass.prototype,function(e,t){i(t)});r=r.superClass}t.UnwrappedClass=n},h=function(t,r){if(r.autoCoercionEnabled){return e.map(t,function(e){return e.getNative()})}return t},m=function(t,r){var n=null;e.forOwn(t,function(t,i){if(i.toLowerCase()===r.toLowerCase()&&e.isFunction(t)){n=t;return false}});return n};function d(t,n,i,s,a,c,l,f,p,h,m){var d=this,E={};this.autoCoercionEnabled=false;this.callStack=i;this.constants=f;this.constructorName=a;this.functionFactory=n;this.interfaceNames=h||[];this.InternalClass=c;this.name=s;this.namespaceScope=m;this.staticProperties=E;this.superClass=p;this.unwrapper=null;this.valueFactoLine truncated
|
||||
;t.exports=e("pauser")([e("microdash"),e("./builtin/builtins"),e("util"),e("./Reference/AccessorReference"),e("./Call"),e("./CallFactory"),e("./CallStack"),e("./ClassAutoloader"),e("./Closure"),e("./ClosureFactory"),e("./FunctionFactory"),e("./INIState"),e("./MethodSpec"),e("./Module"),e("./ModuleFactory"),e("./Namespace"),e("./NamespaceFactory"),e("./NamespaceScope"),e("./Reference/Null"),e("./ReferenceFactory"),e("./Scope"),e("./ScopeFactory"),e("./SuperGlobalScope"),e("./Value"),e("./ValueFactory"),e("./Variable"),e("./VariableFactory"),e("./Reference/Variable")],function(e,t,r,n,i,s,a,o,u,c,l,f,p,h,m,d,E,g,y,_,v,N,A,S,T,C,b,D){var x="Exception",F=function(r,n){var i=r.globalNamespace;function s(t){var n=t(r.internals);e.each(n,function(e,t){i.defineFunction(t,e)})}function a(e,t){r.defineClass(t,e)}function o(t){var n=t(r.internals);e.each(n,function(e,t){i.defineConstant(t,r.valueFactory.coerce(e))})}e.each(t.functionGroups,s);e.forOwn(t.classes,a);e.each(t.constantGroups,o);e.each(n.functionGroups,s);e.forOwn(n.classes,a);e.each(n.constantGroups,o)};function I(e,t,r,S,x,I){var O=new a(S),w=new s(i),B=new m(h),R=new T(x,O),P=new _(n,y,D,R),L=new o(R),M=new A(O,R),k=new b(C,O,R),V=new N(v,O,M,R,k,P),j=new l(p,V,w,R,O),U=new c(j,R,O,u),G=new E(d,O,j,R,L),X=G.create(),q=B.create(null),H=new g(X,R,q,X),Y,W=M.defineVariable("GLOBALS");V.setClosureFactory(U);Y=V.create(H);V.setGlobalScope(Y);L.setGlobalNamespace(X);R.setGlobalNamespace(X);W.setReference(P.createAccessor(function(){var e=Y.exportVariables(),t=R.coerce(e);t.getElementByKey(R.createString("GLOBALS")).setValue(t);return t},function(e){W.unset();W.setValue(R.coerce(e))}));this.callFactory=w;this.callStack=O;this.globalNamespace=X;this.globalNamespaceScope=H;this.globalScope=Y;this.iniState=new f;this.internals={callStack:O,classAutoloader:L,globalNamespace:X,iniState:this.iniState,optionSet:I,pausable:x,stdout:r,valueFactory:R};this.moduleFactory=B;this.optionSet=I;this.referenceFactory=P;this.callStack=O;this.classAutoloader=L;this.pausable=x;this.stderr=S;this.stdin=t;this.stdout=r;this.superGlobalScope=M;this.valueFactory=R;this.PHPException=null;F(this,e)}e.extend(I.prototype,{defineClass:function(t,r){var n=this,i=null,s=true,a=r(e.extend({},n.internals,{defineUnwrapper:function(e){i=e},disableAutoCoercion:function(){s=false}})),o,u=n.globalNamespace,c=n.globalNamespace.parseClassName(t);if(t===x){if(n.PHPException){throw new Error("PHPState.defineClass(...) :: Exception class is already defined")}n.PHPException=a}if(c){u=c.namespace;t=c.name}o=u.defineClass(t,a,n.globalNamespaceScope);if(i){o.defineUnwrapper(i)}if(s){o.enableAutoCoercion()}return o},defineSuperGlobal:function(e,t){this.superGlobalScope.defineVariable(e).setValue(t)},defineSuperGlobalAccessor:function(e,t,r){var i=this,s=new n(i.valueFactory,t,r);i.superGlobalScope.defineVariable(e).setReference(s)},getCallFactory:function(){return this.callFactory},getCallStack:function(){return this.callStack},getConstant:function(e){var t;try{t=this.globalNamespace.getConstant(e,true)}catch(e){return null}return t.getNative()},getGlobalNamespace:function(){return this.globalNamespace},getGlobalScope:function(){return this.globalScope},getModuleFactory:function(){return this.moduleFactory},getOptions:function(){return this.optionSet.getOptions()},getPHPExceptionClass:function(){return this.PHPException},getReferenceFactory:function(){return this.referenceFactory},getStderr:function(){return this.stderr},getStdin:function(){return this.stdin},getStdout:function(){return this.stdout},getSuperGlobalScope:function(){return this.superGlobalScope},getValueFactory:function(){return this.valueFactory}});return I},{strict:true})},{"./Call":152,"./CallFactory":153,"./CallStack":154,"./ClassAutoloader":156,"./Closure":157,"./ClosureFactory":158,"./FunctionFactory":167,"./INIState":168,"./MethodSpec":172,"./Module":173,"./ModuleFactory":174,"./Namespace":175,"./NamespaceFactory":176,"./NamespaceScope":177,"./Reference/AccessorReference":181,"./Reference/Null":183,"./Reference/Variable":189,"./ReferenceFactory":190,"./Scope":192,"./ScopeFactory":193,"./SuperGlobalScope":195,"./Value":196,"./ValueFactory":206,"./Variable":207,"./VariableFactory":208,"./builtin/builtins":209,microdash:79,pauser:144,util:265}],181:[function(e,t,r){"use strict";var n=e("microdash"),i=e("util"),s=e("./Reference");function a(e,t,r){this.valueFactory=e;this.valueGetter=t;this.valueSetter=r}i.inherits(a,s);n.extend(a.prototype,{getReference:function(){return this},getValue:function(){var e=this;return e.valueFactory.coerce(e.valueGetter())},setValue:function(e){this.valueSetter(e.getNative());return e}});t.exports=a},{"./Reference":186,microdash:79,util:265}],182:[function(e,t,r){"use strict";var n=e("microdash"),i=e("phpcommon"),s=e("util"),a=e("../KeyReferencePair"),o=e("../KeyValuePair"),u=i.PHPError,c=e("./Reference");function l(e,t,r,n,i,s){if(i&&s){throw new Error("Array elements can only have a value or be a reference,Line truncated
|
||||
reset:function(){var e=this;e.pointer=0;return e},setPointer:function(e){this.pointer=e},shift:function(){var t=this,r=t.value,i=[],s={},a=0;if(r.length===0){return t.factory.createNull()}e.each(r.slice(1),function(e){var r=e.getKey(),o=r.getNative();if(isFinite(o)){o=a++;r=t.factory.createInteger(o)}e=new n(t.factory,t.callStack,t,r,e.getValue());s[o]=e;i.push(e)});t.pointer=0;t.keysToElements=s;t.value=i;return r[0].getValue()},shiftLeftBy:function(e){return this.coerceToInteger().shiftLeftBy(e)},shiftRightBy:function(e){return this.coerceToInteger().shiftRightBy(e)},sort:function(e){this.value.sort(e)}});return h},{strict:true})},{"../KeyReferencePair":169,"../KeyValuePair":170,"../Reference/Element":182,"../Reference/Null":183,"../Reference/Reference":186,"../Value":196,"../Variable":207,microdash:79,pauser:144,phpcommon:146,util:265}],198:[function(e,t,r){"use strict";t.exports=e("pauser")([e("microdash"),e("util"),e("./String")],function(e,t,r){function n(e,t,n){r.call(this,e,t,n)}t.inherits(n,r);e.extend(n.prototype,{call:function(e,t){return t.getFunction(this.value).apply(null,e)},callStaticMethod:function(e,t,r,n){var i=this,s=r.getClass(i.value);return s.callMethod(e.getNative(),t,null,null,null,n)},getCallableName:function(e){var t=this,r=e.resolveClass(t.value);return r.namespace.getPrefix()+r.name},getConstantByName:function(e,t){var r=this,n=t.getClass(r.value);return n.getConstantByName(e)},getStaticPropertyByName:function(e,t){var r=this,n=t.getClass(r.value);return n.getStaticPropertyByName(e.getNative())},instantiate:function(e,t){var r=this,n=t.getClass(r.value);return n.instantiate(e)},isTheClassOfObject:function(e,t){var r=this,n=r.getCallableName(t);return r.factory.createBoolean(e.classIs(n))}});return n},{strict:true})},{"./String":205,microdash:79,pauser:144,util:265}],199:[function(e,t,r){"use strict";t.exports=e("pauser")([e("microdash"),e("phpcommon"),e("util"),e("../Value")],function(e,t,r,n){var i=t.PHPError,s=t.PHPFatalError;function a(e,t,r){n.call(this,e,t,"boolean",!!r)}r.inherits(a,n);e.extend(a.prototype,{add:function(e){return e.addToBoolean(this)},addToBoolean:function(e){var t=this;return t.factory.createInteger(t.value+e.value)},addToInteger:function(e){return e.addToBoolean(this)},addToNull:function(){return this.coerceToInteger()},addToObject:function(e){return e.addToBoolean(this)},coerceToBoolean:function(){return this},coerceToInteger:function(){var e=this;return e.factory.createInteger(e.value?1:0)},coerceToKey:function(){return this.coerceToInteger()},coerceToNumber:function(){return this.coerceToInteger()},coerceToString:function(){var e=this;return e.factory.createString(e.value?"1":"")},divide:function(e){return e.divideByBoolean(this)},divideByNonArray:function(e){var t,r=this,n=r.getNative(),s;if(n===false){r.callStack.raiseError(i.E_WARNING,"Division by zero");return r.factory.createBoolean(false)}t=e.coerceToNumber();s=t.getNative()/n;return t.getType()==="float"?r.factory.createFloat(s):r.factory.createInteger(s)},formatAsString:function(){return this.value?"true":"false"},getElement:function(){return this.factory.createNull()},isAnInstanceOf:function(e){return e.isTheClassOfBoolean(this)},isEmpty:function(){return this.value===false},isEqualTo:function(e){var t=this,r=t.factory;return r.createBoolean(e.coerceToBoolean().value===t.value)},isEqualToObject:function(){return this},isEqualToString:function(e){var t=this;return e.factory.createBoolean(e.coerceToBoolean().getNative()===t.getNative())},isNumeric:function(){return false},multiply:function(e){return e.multiplyByBoolean(this)},multiplyByNonArray:function(e){var t=e.coerceToNumber(),r=this,n=r.getNative(),i=t.getNative()*n;return t.getType()==="float"?r.factory.createFloat(i):r.factory.createInteger(i)},onesComplement:function(){throw new s(s.UNSUPPORTED_OPERAND_TYPES)},shiftLeftBy:function(e){return this.coerceToInteger().shiftLeftBy(e)},shiftRightBy:function(e){return this.coerceToInteger().shiftRightBy(e)}});return a},{strict:true})},{"../Value":196,microdash:79,pauser:144,phpcommon:146,util:265}],200:[function(e,t,r){"use strict";t.exports=e("pauser")([e("microdash"),e("util"),e("../Value")],function(e,t,r){function n(e,t,n){r.call(this,e,t,"exit",null);this.statusValue=n}t.inherits(n,r);e.extend(n.prototype,{getStatus:function(){var e=this;return e.statusValue?e.statusValue.getNative():0}});return n},{strict:true})},{"../Value":196,microdash:79,pauser:144,util:265}],201:[function(e,t,r){"use strict";t.exports=e("pauser")([e("microdash"),e("phpcommon"),e("util"),e("../Value")],function(e,t,r,n){var i=t.PHPError;function s(e,t,r){n.call(this,e,t,"float",r)}r.inherits(s,n);e.extend(s.prototype,{add:function(e){return e.addToFloat(this)},addToBoolean:function(e){var t=this;return t.factory.createFloat(t.value+Number(e.value))},addToInteger:function(e){var t=this;return t.factory.createFloat(t.value+e.value)},addToObject:function(e){return e.addToFloat(this)},addToNull:function(){return this.coeLine truncated
|
||||
}else{f=u.coerceToString().getNative()}}else{f=null}if(f&&f!=="static"){l=a.getClass(f)}else if(c.getType()!=="null"){l=c.getClass()}else{l=null}return o.createObject(s.bindClosure(c,l),a.getClass("Closure"))}),bindTo:function(e,r){var n=this,s,u,c,l;if(!e){t.raiseError(i.E_WARNING,"Closure::bindTo() expects at least 1 parameter, 0 given");return o.createNull()}u=e.getValue();if(u.getType()!=="object"&&u.getType()!=="null"){t.raiseError(i.E_WARNING,"Closure::bindTo() expects parameter 1 to be object, "+u.getType()+" given");return o.createNull()}s=r?r.getValue():null;if(s){if(s.getType()==="object"){l=s.getClassName()}else{l=s.coerceToString().getNative()}}else{l=null}if(l&&l!=="static"){c=a.getClass(l)}else if(u.getType()!=="null"){c=u.getClass()}else{c=null}return o.createObject(n.bindClosure(u,c),a.getClass("Closure"))},__invoke:function(){return this.invokeClosure([].slice.call(arguments))}});e.disableAutoCoercion();e.defineUnwrapper(function(){var t=this;return function(){var r=o.coerceObject(this),i=[];n.each(arguments,function(e){i.push(o.coerce(e))});if(e.pausable){return new s(function(n,s){e.pausable.call(t.getObject().invoke,[i,r],t.getObject()).then(function(e){n(e.getNative())},function(e){if(o.isValue(e)&&e.getType()==="object"){s(e.coerceToNativeError());return}s(e)})})}try{return t.getObject().invoke(i,r).getNative()}catch(e){if(o.isValue(e)&&e.getType()==="object"){throw e.coerceToNativeError()}throw e}}});return u}},{lie:78,microdash:79,phpcommon:146}],211:[function(e,t,r){"use strict";var n=e("microdash"),i=e("phpcommon"),s=e("util"),a=i.PHPError;t.exports=function(e){var t=e.callStack,r=e.valueFactory;function i(e){this.setInternalProperty("messageValue",e||r.createString(""))}i.shadowConstructor=function(){this.setInternalProperty("file",t.getLastFilePath());this.setInternalProperty("line",t.getLastLine());this.setInternalProperty("messageValue",r.createString(""));this.setInternalProperty("trace",t.getTrace())};s.inherits(i,a);n.extend(i.prototype,{getFile:function(){return r.createString(this.getInternalProperty("file"))},getLine:function(){return r.createInteger(this.getInternalProperty("line"))},getMessage:function(){return this.getInternalProperty("messageValue")},getTraceAsString:function(){var e=this.getInternalProperty("trace"),t=[];e.pop();n.each(e,function(e){var r=n.map(e.args,function(e){return e.formatAsString()});t.push("#"+e.index+" "+e.file+"("+e.line+"): "+e.func+"("+r.join(", ")+")")});t.push("#"+e.length+" {main}");return r.createString(t.join("\n"))}});e.disableAutoCoercion();return i}},{microdash:79,phpcommon:146,util:265}],212:[function(e,t,r){"use strict";var n=e("microdash"),i=e("phpcommon").PHPFatalError,s=e("lie");t.exports=function(e){var t=e.pausable,r=function(e){var r;if(!(e instanceof s)){return}if(!t){throw new Error("Cannot wait for promise returned from JS-land to resolve - async mode is not available")}r=t.createPause();e.then(function(e){r.resume(e)},function(e){r.throw(e)});r.now()};function a(){}n.extend(a.prototype,{__call:function(e,t){var s=this,a;if(!n.isFunction(s[e])){throw new i(i.UNDEFINED_METHOD,{className:"JSObject",methodName:e})}a=s[e].apply(s,t);r(a);return a},__invoke:function(){var e=this,t;if(!n.isFunction(e)){throw new Error("Attempted to invoke a non-function JS object")}t=e.apply(null,arguments);r(t);return t}});return a}},{lie:78,microdash:79,phpcommon:146}],213:[function(e,t,r){"use strict";t.exports=function(e){function t(){}e.disableAutoCoercion();return t}},{}],214:[function(e,t,r){"use strict";t.exports=function(){return{PHP_EOL:"\n"}}},{}],215:[function(e,t,r){"use strict";t.exports=e("pauser")([e("../../Variable")],function(e){return function(t){var r=t.classAutoloader,n=t.valueFactory;return{spl_autoload_register:function(t){var n=t instanceof e,i=n?t.getValue():t;r.appendAutoloadCallable(i)},spl_autoload_unregister:function(t){var i=t instanceof e,s=i?t.getValue():t;return n.createBoolean(r.removeAutoloadCallable(s))}}}},{strict:true})},{"../../Variable":207,pauser:144}],216:[function(e,t,r){"use strict";t.exports=function(){function e(){}return e}},{}],217:[function(e,t,r){"use strict";var n=e("./src/builtin/builtins"),i=e("phpcore/async");i.install(n);t.exports=i},{"./src/builtin/builtins":220,"phpcore/async":151}],218:[function(e,t,r){"use strict";t.exports={sapi:"cli",operatingSystem:{name:"Uniter",hostName:"localhost",releaseName:"1.0.0",versionInfo:"(Generic)",machineType:"JavaScript"},phpVersion:{major:5,minor:4,release:0},zendVersion:{major:2,minor:5,release:0}}},{}],219:[function(e,t,r){"use strict";t.exports=e("./async")},{"./async":217}],220:[function(e,t,r){"use strict";var n=e("./constants/array"),i=e("./functions/array"),s=e("./functions/math/baseConversion"),a=e("./functions/class"),o=e("./functions/misc/constant"),u=e("./interfaces/Countable"),c=e("./constants/filesystem"),l=e("./functions/filesystem"),f=e("./functions/functionHandling"),p=e("./classes/InvalidArgumentException"),h=e("./constants/pcre"),mLine truncated
|
||||
component:"constant",capture:"next"}},N_CLASS_CONSTANT:"N_EXPRESSION_LEVEL_2_A",N_EMPTY_ARRAY_INDEX:{captureAs:"N_ARRAY_INDEX",components:{name:"indices",what:[/\[/,/\]/]},options:{indices:true}},N_EXPRESSION_LEVEL_2_B:{components:[{name:"expression",oneOf:["N_EXPRESSION_LEVEL_2_A","N_NAMESPACED_REFERENCE"]},{name:"member",zeroOrMoreOf:{oneOf:[{name:"array_index",oneOf:["N_EMPTY_ARRAY_INDEX",{name:"indices",oneOrMoreOf:[/\[/,{name:"index",what:"N_EXPRESSION"},/\]/]}]},{name:"method_call",what:{name:"calls",oneOrMoreOf:["T_OBJECT_OPERATOR",{name:"func",what:"N_INSTANCE_MEMBER"},/\(/,{name:"args",zeroOrMoreOf:["N_EXPRESSION",{what:/(,|(?=\)))()/,captureIndex:2}]},/\)/]}},{name:"object_property",what:{name:"properties",oneOrMoreOf:["T_OBJECT_OPERATOR",{name:"property",what:"N_INSTANCE_MEMBER"},/(?!\()/]}},{name:"static_method_call",what:["T_DOUBLE_COLON",{name:"method",oneOf:["N_STRING","N_VARIABLE","N_VARIABLE_EXPRESSION"]},/\(/,{name:"args",zeroOrMoreOf:["N_EXPRESSION",{what:/(,|(?=\)))()/,captureIndex:2}]},/\)/]},{name:"static_property",what:["T_DOUBLE_COLON",{name:"property",what:"N_STATIC_MEMBER"}]},{name:"callable",what:[/\(/,{name:"args",zeroOrMoreOf:["N_EXPRESSION",{what:/(,|(?=\)))()/,captureIndex:2}]},/\)/]}]}}],processor:function(e){var t;if(!e||!e.expression){return e}t=e.expression;n.each(e.member,function(e){if(e.array_index){t={name:"N_ARRAY_INDEX",array:t,indices:e.array_index.indices}}else if(e.method_call){t={name:"N_METHOD_CALL",object:t,calls:e.method_call.calls}}else if(e.object_property){t={name:"N_OBJECT_PROPERTY",object:t,properties:e.object_property.properties}}else if(e.static_method_call){t={name:"N_STATIC_METHOD_CALL",className:t,method:e.static_method_call.method,args:e.static_method_call.args}}else if(e.static_property){t={name:"N_STATIC_PROPERTY",className:t,property:e.static_property.property}}else if(e.callable){t={name:"N_FUNCTION_CALL",func:t,args:e.callable.args}}if(e.offset){t.offset=e.offset}});return t}},N_EXPRESSION_LEVEL_2_C:{components:{oneOf:["N_REFERENCE","N_EXPRESSION_LEVEL_2_B"]}},N_REFERENCE:{components:[/&/,{name:"operand",what:"N_EXPRESSION_LEVEL_2_B"}]},N_EXPRESSION_LEVEL_3_A:{oneOf:["N_UNARY_PREFIX_EXPRESSION","N_UNARY_SUFFIX_EXPRESSION","N_EXPRESSION_LEVEL_2_C"]},N_EXPRESSION_LEVEL_3_B:{oneOf:["N_ARRAY_CAST","N_BINARY_CAST","N_BOOLEAN_CAST","N_DOUBLE_CAST","N_INTEGER_CAST","N_OBJECT_CAST","N_STRING_CAST","N_UNSET_CAST","N_SUPPRESSED_EXPRESSION","N_EXPRESSION_LEVEL_3_A"]},N_ARRAY_CAST:{components:["T_ARRAY_CAST",{name:"value",rule:"N_EXPRESSION_LEVEL_3_B"}]},N_BINARY_CAST:{components:["T_BINARY_CAST",{name:"value",rule:"N_EXPRESSION_LEVEL_3_B"}]},N_BOOLEAN_CAST:{components:["T_BOOL_CAST",{name:"value",rule:"N_EXPRESSION_LEVEL_3_B"}]},N_DOUBLE_CAST:{components:["T_DOUBLE_CAST",{name:"value",rule:"N_EXPRESSION_LEVEL_3_B"}]},N_INTEGER_CAST:{components:["T_INT_CAST",{name:"value",rule:"N_EXPRESSION_LEVEL_3_B"}]},N_OBJECT_CAST:{components:["T_OBJECT_CAST",{name:"value",rule:"N_EXPRESSION_LEVEL_3_B"}]},N_STRING_CAST:{components:["T_STRING_CAST",{name:"value",rule:"N_EXPRESSION_LEVEL_3_B"}]},N_UNSET_CAST:{components:["T_UNSET_CAST",{name:"value",rule:"N_EXPRESSION_LEVEL_3_B"}]},N_SUPPRESSED_EXPRESSION:{components:[/@/,{name:"expression",oneOf:["N_ASSIGNMENT_EXPRESSION","N_EXPRESSION_LEVEL_3_B"]}]},N_UNARY_PREFIX_EXPRESSION:{captureAs:"N_UNARY_EXPRESSION",components:[{name:"operator",oneOf:["T_INC","T_DEC",/~/]},{name:"operand",what:"N_EXPRESSION_LEVEL_2_C"}],ifNoMatch:{component:"operator",capture:"operand"},options:{prefix:true}},N_UNARY_SUFFIX_EXPRESSION:{captureAs:"N_UNARY_EXPRESSION",components:[{name:"operand",what:"N_EXPRESSION_LEVEL_2_C"},{name:"operator",oneOf:["T_INC","T_DEC"]}],ifNoMatch:{component:"operator",capture:"operand"},options:{prefix:false}},N_EMPTY:{components:["T_EMPTY",/\(/,{name:"variable",rule:"N_EXPRESSION"},/\)/]},N_EXPRESSION_LEVEL_4:{captureAs:"N_EXPRESSION",components:[{name:"left",what:"N_EXPRESSION_LEVEL_3_B"},{name:"right",zeroOrMoreOf:[{name:"operator",what:"T_INSTANCEOF"},{name:"operand",what:"N_EXPRESSION_LEVEL_3_B"}]}],processor:function(e){if(e.right.length===0){return e.left}return u(e.left,e.right,function(e,t){return{name:"N_INSTANCE_OF",object:e,class:t.operand}})}},N_EXPRESSION_LEVEL_5:{captureAs:"N_UNARY_EXPRESSION",components:[{name:"operator",optionally:/!/},{name:"operand",oneOf:["N_ASSIGNMENT_EXPRESSION","N_EXPRESSION_LEVEL_4"]}],ifNoMatch:{component:"operator",capture:"operand"},options:{prefix:true}},N_EXPRESSION_LEVEL_6:{captureAs:"N_EXPRESSION",components:[{name:"left",what:"N_EXPRESSION_LEVEL_5"},{name:"right",zeroOrMoreOf:[{name:"operator",oneOf:[/\*/,/\//,/%/]},{name:"operand",oneOf:["N_ASSIGNMENT_EXPRESSION","N_EXPRESSION_LEVEL_5"]}]}],processor:function(e){if(e.right.length===0){return e.left}return c(e.left,e.right)}},N_EXPRESSION_LEVEL_7_A:{captureAs:"N_UNARY_EXPRESSION",components:[{name:"operator",optionally:/([+-])(?!\1)/},{name:"operand",what:"N_EXPRESSION_LEVEL_6"}],ifNoMatch:{component:"operator",captuLine truncated
|
||||
i.push("stdout.write(",t(e),".coerceToString().getNative());")});return r.createStatementSourceNode(i,e)},N_EMPTY:function(e,t,r){return r.createExpressionSourceNode(["(function (scope) {scope.suppressOwnErrors();"+"var result = tools.valueFactory.createBoolean("].concat(t(e.variable,{getValue:false}),".isEmpty());"+"scope.unsuppressOwnErrors(); return result;}(scope))"),e)},N_EXIT:function(e,t,r){if(h.call(e,"status")){return r.createExpressionSourceNode(["tools.exit("].concat(t(e.status),")"),e)}if(h.call(e,"message")){return r.createExpressionSourceNode(["(stdout.write("].concat(t(e.message),".getNative()), tools.exit())"),e)}return r.createStatementSourceNode(["tools.exit()"],e)},N_EXPRESSION:function(e,t,r){var i=/^(?:[-+*\/.%&|^]|<<|>>)?=$/.test(e.right[0].operator),s=[],a=t(e.left,{assignment:i,getValue:!i});n.each(e.right,function(o,u){var c,l=o.operand.name==="N_REFERENCE",f,h=l?o.operand.operand:o.operand,m,d=l?".getReference()":"";c=(!i||u===e.right.length-1)&&!l;m=t(h,{getValue:c});if(o.operator==="&&"||o.operator==="and"){a=["tools.valueFactory.createBoolean("].concat(a,".coerceToBoolean().getNative() && (",m,d+".coerceToBoolean().getNative()");s.push("))")}else if(o.operator==="||"||o.operator==="or"){a=["tools.valueFactory.createBoolean("].concat(a,".coerceToBoolean().getNative() || (",m,d+".coerceToBoolean().getNative()");s.push("))")}else if(o.operator==="xor"){a=["tools.valueFactory.createBoolean("].concat(a,".coerceToBoolean().getNative() !== (",m,d+".coerceToBoolean().getNative()");s.push("))")}else{f=p[o.operator];if(!f){throw new Error('Unsupported binary operator "'+o.operator+'"')}if(n.isPlainObject(f)){f=f[l]}a.push("."+f+"(",m,d);s.push(")")}if(l&&r.getValue){s.push(".getValue()")}});return r.createExpressionSourceNode(a.concat(s),e)},N_EXPRESSION_STATEMENT:function(e,t,r){return r.createStatementSourceNode(t(e.expression).concat(";"),e)},N_FLOAT:function(e,t,r){return r.createExpressionSourceNode(["tools.valueFactory.createFloat("+e.number+")"],e)},N_FOR_STATEMENT:function(e,t,r){var n=r.blockContexts.concat(["for"]),i={blockContexts:n},s=t(e.body,i),a=t(e.condition,i),o=t(e.initializer,i),u=t(e.update,i);if(a.length>0){a.push(".coerceToBoolean().getNative()")}return r.createStatementSourceNode(["block_"+n.length+": for ("].concat(o,";",a||[],";",u,") {",s,"}"),e)},N_FOREACH_STATEMENT:function(e,t,r){var n=t(e.array),i,s=[],a=e.key?t(e.key,{getValue:false}):null,o,u,c=r.blockContexts.concat(["foreach"]),l={blockContexts:c},f=e.value.name==="N_REFERENCE",p=f?e.value.operand:e.value,h=t(p,{getValue:false});i="array_"+c.length;s.push("var "+i+" = ",n,".reset();");o="length_"+c.length;s.push("var "+o+" = "+i+".getLength();");u="pointer_"+c.length;s.push("var "+u+" = 0;");s.push("block_"+c.length+": ");s.push("while ("+u+" < "+o+") {");if(a){s.push(a,".setValue("+i+".getKeyByIndex("+u+"));")}s.push(h,".set"+(f?"Reference":"Value")+"("+i+".getElementByIndex("+u+")"+(f?".getReference()":".getValue()")+");");s.push(u+"++;");s=s.concat(t(e.body,l));s.push("}");return r.createStatementSourceNode(s,e)},N_FUNCTION_STATEMENT:function(e,t,r){var n;n=N(e.func,e.args,null,e.body,t,r);return r.createStatementSourceNode(["namespace.defineFunction("+JSON.stringify(e.func.string)+", "].concat(n,", namespaceScope);"),e)},N_FUNCTION_CALL:function(e,t,r){var i=[];n.each(e.args,function(e,r){if(r>0){i.push(", ")}i.push(t(e,{getValue:false}))});return r.createExpressionSourceNode(["("].concat(t(e.func,{getValue:true,allowBareword:true}),".call([",i,"], namespaceScope) || tools.valueFactory.createNull())"),e)},N_GLOBAL_STATEMENT:function(e,t,r){var i="";n.each(e.variables,function(e){i+="scope.importGlobal("+JSON.stringify(e.variable)+");"});return r.createStatementSourceNode([i],e)},N_GOTO_STATEMENT:function(e,t,r){var n="",i=e.label;r.labelRepository.addPending(i);n+="goingToLabel_"+i+" = true;";if(r.labelRepository.hasBeenFound(i)){n+=" continue continue_"+i+";"}else{n+=" break "+i+";"}return r.createStatementSourceNode([n],e)},N_HEREDOC:function(e,t,r){var i=[];n.each(e.parts,function(e,r){if(r>0){i.push(" + ")}i.push(t(e),".coerceToString().getNative()")});return r.createExpressionSourceNode(["tools.valueFactory.createString("].concat(i,")"),e)},N_IF_STATEMENT:function(e,t,r){var i,s,a=t(e.condition).concat(".coerceToBoolean().getNative()"),o,u={},c=r.labelRepository;function l(e){delete u[e]}function f(e){u[e]=true}c.on("pending label",l);c.on("found label",f);o=t(e.consequentStatement);c.off("pending label",l);c.off("found label",f);n.each(Object.keys(u),function(e){a=["goingToLabel_"+e+" || ("].concat(a,")")});o=["{"].concat(o,"}");i=e.alternateStatement?[" else {"].concat(t(e.alternateStatement),"}"):[];s=["if ("].concat(a,") ",o,i);return r.createStatementSourceNode(s,e)},N_INCLUDE_EXPRESSION:function(e,t,r){return r.createExpressionSourceNode(["tools.include("].concat(t(e.path),".getNative(), scope)"),e)},N_INCLUDE_ONCE_EXPRESSION:function(e,t,r){return r.createExpressionSourceNode(["tools.inclLine truncated
|
||||
throw new Error('"'+t+'" is not in the SourceMap.')}};c.prototype.generatedPositionFor=function e(t){var r=n.getArg(t,"source");if(this.sourceRoot!=null){r=n.relative(this.sourceRoot,r)}if(!this._sources.has(r)){return{line:null,column:null,lastColumn:null}}r=this._sources.indexOf(r);var i={source:r,originalLine:n.getArg(t,"line"),originalColumn:n.getArg(t,"column")};var s=this._findMapping(i,this._originalMappings,"originalLine","originalColumn",n.compareByOriginalPositions,n.getArg(t,"bias",u.GREATEST_LOWER_BOUND));if(s>=0){var a=this._originalMappings[s];if(a.source===i.source){return{line:n.getArg(a,"generatedLine",null),column:n.getArg(a,"generatedColumn",null),lastColumn:n.getArg(a,"lastGeneratedColumn",null)}}}return{line:null,column:null,lastColumn:null}};r.BasicSourceMapConsumer=c;function f(e){var t=e;if(typeof e==="string"){t=JSON.parse(e.replace(/^\)\]\}'/,""))}var r=n.getArg(t,"version");var i=n.getArg(t,"sections");if(r!=this._version){throw new Error("Unsupported version: "+r)}this._sources=new s;this._names=new s;var a={line:-1,column:0};this._sections=i.map(function(e){if(e.url){throw new Error("Support for url field in sections not implemented.")}var t=n.getArg(e,"offset");var r=n.getArg(t,"line");var i=n.getArg(t,"column");if(r<a.line||r===a.line&&i<a.column){throw new Error("Section offsets must be ordered and non-overlapping.")}a=t;return{generatedOffset:{generatedLine:r+1,generatedColumn:i+1},consumer:new u(n.getArg(e,"map"))}})}f.prototype=Object.create(u.prototype);f.prototype.constructor=u;f.prototype._version=3;Object.defineProperty(f.prototype,"sources",{get:function(){var e=[];for(var t=0;t<this._sections.length;t++){for(var r=0;r<this._sections[t].consumer.sources.length;r++){e.push(this._sections[t].consumer.sources[r])}}return e}});f.prototype.originalPositionFor=function e(t){var r={generatedLine:n.getArg(t,"line"),generatedColumn:n.getArg(t,"column")};var s=i.search(r,this._sections,function(e,t){var r=e.generatedLine-t.generatedOffset.generatedLine;if(r){return r}return e.generatedColumn-t.generatedOffset.generatedColumn});var a=this._sections[s];if(!a){return{source:null,line:null,column:null,name:null}}return a.consumer.originalPositionFor({line:r.generatedLine-(a.generatedOffset.generatedLine-1),column:r.generatedColumn-(a.generatedOffset.generatedLine===r.generatedLine?a.generatedOffset.generatedColumn-1:0),bias:t.bias})};f.prototype.hasContentsOfAllSources=function e(){return this._sections.every(function(e){return e.consumer.hasContentsOfAllSources()})};f.prototype.sourceContentFor=function e(t,r){for(var n=0;n<this._sections.length;n++){var i=this._sections[n];var s=i.consumer.sourceContentFor(t,true);if(s){return s}}if(r){return null}else{throw new Error('"'+t+'" is not in the SourceMap.')}};f.prototype.generatedPositionFor=function e(t){for(var r=0;r<this._sections.length;r++){var i=this._sections[r];if(i.consumer.sources.indexOf(n.getArg(t,"source"))===-1){continue}var s=i.consumer.generatedPositionFor(t);if(s){var a={line:s.line+(i.generatedOffset.generatedLine-1),column:s.column+(i.generatedOffset.generatedLine===s.line?i.generatedOffset.generatedColumn-1:0)};return a}}return{line:null,column:null}};f.prototype._parseMappings=function e(t,r){this.__generatedMappings=[];this.__originalMappings=[];for(var i=0;i<this._sections.length;i++){var s=this._sections[i];var a=s.consumer._generatedMappings;for(var u=0;u<a.length;u++){var c=a[u];var l=s.consumer._sources.at(c.source);if(s.consumer.sourceRoot!==null){l=n.join(s.consumer.sourceRoot,l)}this._sources.add(l);l=this._sources.indexOf(l);var f=s.consumer._names.at(c.name);this._names.add(f);f=this._names.indexOf(f);var p={source:l,generatedLine:c.generatedLine+(s.generatedOffset.generatedLine-1),generatedColumn:c.generatedColumn+(s.generatedOffset.generatedLine===c.generatedLine?s.generatedOffset.generatedColumn-1:0),originalLine:c.originalLine,originalColumn:c.originalColumn,name:f};this.__generatedMappings.push(p);if(typeof p.originalLine==="number"){this.__originalMappings.push(p)}}}o(this.__generatedMappings,n.compareByGeneratedPositionsDeflated);o(this.__originalMappings,n.compareByOriginalPositions)};r.IndexedSourceMapConsumer=f},{"./array-set":248,"./base64-vlq":249,"./binary-search":251,"./quick-sort":253,"./util":257}],255:[function(e,t,r){var n=e("./base64-vlq");var i=e("./util");var s=e("./array-set").ArraySet;var a=e("./mapping-list").MappingList;function o(e){if(!e){e={}}this._file=i.getArg(e,"file",null);this._sourceRoot=i.getArg(e,"sourceRoot",null);this._skipValidation=i.getArg(e,"skipValidation",false);this._sources=new s;this._names=new s;this._mappings=new a;this._sourcesContents=null}o.prototype._version=3;o.fromSourceMap=function e(t){var r=t.sourceRoot;var n=new o({file:t.file,sourceRoot:r});t.eachMapping(function(e){var t={generated:{line:e.generatedLine,column:e.generatedColumn}};if(e.source!=null){t.source=e.source;if(r!=null){t.source=i.relative(r,t.source)}t.original={line:e.originalLine,Line truncated
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
+230
@@ -0,0 +1,230 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>微信扫码登陆</title>
|
||||
<style>
|
||||
* {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-ms-box-sizing: border-box;
|
||||
-o-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
background: #092756;
|
||||
background: -moz-radial-gradient(0% 100%, ellipse cover, rgba(104, 128, 138, .4) 10%, rgba(138, 114, 76, 0) 40%), -moz-linear-gradient(top, rgba(57, 173, 219, .25) 0%, rgba(42, 60, 87, .4) 100%), -moz-linear-gradient(-45deg, #670d10 0%, #092756 100%);
|
||||
background: -webkit-radial-gradient(0% 100%, ellipse cover, rgba(104, 128, 138, .4) 10%, rgba(138, 114, 76, 0) 40%), -webkit-linear-gradient(top, rgba(57, 173, 219, .25) 0%, rgba(42, 60, 87, .4) 100%), -webkit-linear-gradient(-45deg, #670d10 0%, #092756 100%);
|
||||
background: -o-radial-gradient(0% 100%, ellipse cover, rgba(104, 128, 138, .4) 10%, rgba(138, 114, 76, 0) 40%), -o-linear-gradient(top, rgba(57, 173, 219, .25) 0%, rgba(42, 60, 87, .4) 100%), -o-linear-gradient(-45deg, #670d10 0%, #092756 100%);
|
||||
background: -ms-radial-gradient(0% 100%, ellipse cover, rgba(104, 128, 138, .4) 10%, rgba(138, 114, 76, 0) 40%), -ms-linear-gradient(top, rgba(57, 173, 219, .25) 0%, rgba(42, 60, 87, .4) 100%), -ms-linear-gradient(-45deg, #670d10 0%, #092756 100%);
|
||||
background: -webkit-radial-gradient(0% 100%, ellipse cover, rgba(104, 128, 138, .4) 10%, rgba(138, 114, 76, 0) 40%), linear-gradient(to bottom, rgba(57, 173, 219, .25) 0%, rgba(42, 60, 87, .4) 100%), linear-gradient(135deg, #670d10 0%, #092756 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#3E1D6D', endColorstr='#092756', GradientType=1);
|
||||
}
|
||||
|
||||
.login {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin: -150px 0 0 -150px;
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
#qrcode {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
display: none;
|
||||
box-shadow: 0 0 22px rgba(81, 81, 81, 0.8);
|
||||
}
|
||||
|
||||
.loading {
|
||||
width: 150px;
|
||||
height: 15px;
|
||||
margin: 0 auto;
|
||||
margin-top: 100px;
|
||||
}
|
||||
|
||||
.loading span {
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
height: 100%;
|
||||
margin-right: 5px;
|
||||
background: lightgreen;
|
||||
-webkit-transform-origin: right bottom;
|
||||
-webkit-animation: load 1s ease infinite;
|
||||
}
|
||||
|
||||
.loading span:last-child {
|
||||
margin-right: 0px;
|
||||
}
|
||||
|
||||
@-webkit-keyframes load {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0;
|
||||
-webkit-transform: rotate(90deg);
|
||||
}
|
||||
}
|
||||
|
||||
.loading span:nth-child(1) {
|
||||
-webkit-animation-delay: 0.13s;
|
||||
}
|
||||
|
||||
.loading span:nth-child(2) {
|
||||
-webkit-animation-delay: 0.26s;
|
||||
}
|
||||
|
||||
.loading span:nth-child(3) {
|
||||
-webkit-animation-delay: 0.39s;
|
||||
}
|
||||
|
||||
.loading span:nth-child(4) {
|
||||
-webkit-animation-delay: 0.52s;
|
||||
}
|
||||
|
||||
.loading span:nth-child(5) {
|
||||
-webkit-animation-delay: 0.65s;
|
||||
}
|
||||
|
||||
#code {
|
||||
color: #fff;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="login">
|
||||
<div class="loading">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h1 id="code"></h1>
|
||||
<script crossorigin="anonymous" integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT"
|
||||
src="https://lib.baomitu.com/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script>
|
||||
$(function () {
|
||||
var login = function (code) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/api.php?action=login&code=" + code,
|
||||
dataType: "json",
|
||||
cache: !1,
|
||||
timeout: 6e4,
|
||||
success: function (r) {
|
||||
if (r.status === 1) {
|
||||
window.localStorage.id = r.result.id
|
||||
window.localStorage.userinfo = JSON.stringify(r.result.userinfo)
|
||||
$('#code').text('登陆成功')
|
||||
window.location.href = "/index.php"
|
||||
} else {
|
||||
alert('很抱歉,登陆失败,请稍后刷新重试。')
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
alert('很抱歉,出错了,请稍后刷新重试!')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
var getCode = function (uuid, last) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "https://apio.xyz/weixin-login-php/weixin.php?uuid=" + uuid + (last ? '&last=' + last : ''),
|
||||
dataType: "json",
|
||||
cache: !1,
|
||||
timeout: 6e4,
|
||||
success: function (data) {
|
||||
if (data.status === 405) {
|
||||
$('#code').text('扫码成功,正在登陆...')
|
||||
login(data.result.code)
|
||||
} else if (data.status === 404) {
|
||||
$('#code').text(data.msg.title + ', ' + data.msg.content)
|
||||
getCode(uuid, data.result.wxErrCode)
|
||||
} else if (data.status === 403) {
|
||||
$('#code').text(data.msg.title + ', ' + data.msg.content)
|
||||
getCode(uuid, data.result.wxErrCode)
|
||||
} else if (data.status === 500) {
|
||||
getUUID()
|
||||
} else {
|
||||
setTimeout(function () {
|
||||
getCode(uuid)
|
||||
}, 2000)
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
setTimeout(function () {
|
||||
getCode(uuid)
|
||||
}, 2000)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function loadImage(url, callback) {
|
||||
var img = new Image(); //创建一个Image对象,实现图片的预下载
|
||||
img.src = url;
|
||||
img.onload = function () { //图片下载完毕时异步调用callback函数
|
||||
callback.call(img); //将回调函数的this替换为Image对象
|
||||
};
|
||||
};
|
||||
|
||||
var getUUID = function (uuid) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "https://apio.xyz/weixin-login-php/weixin.php?appid=wx2d1d6aa2f86768d7&redirect_uri=https://wyr.me/login",
|
||||
dataType: "json",
|
||||
cache: !1,
|
||||
timeout: 6e4,
|
||||
success: function (data) {
|
||||
if (data.status === 1) {
|
||||
var uuid = data.result.wxUUID
|
||||
loadImage(data.result.imgData, function () {
|
||||
$('.loading').hide()
|
||||
this.id = 'qrcode'
|
||||
$('.login').append(this)
|
||||
$('#qrcode').show()
|
||||
})
|
||||
getCode(uuid)
|
||||
} else {
|
||||
setTimeout(function () {
|
||||
window.location.reload();
|
||||
}, 2000)
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
setTimeout(function () {
|
||||
window.location.reload();
|
||||
}, 2000)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
getUUID()
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,7 @@
|
||||
<ul class="pure-menu-list">
|
||||
<li class="pure-menu-item <?php if ($nowURL == '/' || $nowURL == '/index.php') echo 'pure-menu-selected'; ?>"><a href="/" class="pure-menu-link">题库</a></li>
|
||||
<li class="pure-menu-item <?php if ($nowURL == '/page/test.php') echo 'pure-menu-selected'; ?>"><a href="/page/test.php" class="pure-menu-link">在线测试</a></li>
|
||||
<li class="pure-menu-item"><a href="http://php.net/manual/zh/" class="pure-menu-link" target="_blank">PHP官方文档</a></li>
|
||||
<li class="pure-menu-item"><a href="http://www.w3school.com.cn/php/index.asp" class="pure-menu-link" target="_blank">w3school</a></li>
|
||||
<li class="pure-menu-item"><a href="http://www.runoob.com/php/php-tutorial.html" class="pure-menu-link" target="_blank">PHP教程</a></li>
|
||||
</ul>
|
||||
+214
@@ -0,0 +1,214 @@
|
||||
<?php include('../header.php'); ?>
|
||||
<div class='edit-main'>
|
||||
<style type="text/css">
|
||||
.edit-main {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
article {
|
||||
margin: 0 auto;
|
||||
width: 60%;
|
||||
}
|
||||
|
||||
article > heading {
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
|
||||
margin: 1.5em 0;
|
||||
padding-bottom: 1.5em;
|
||||
|
||||
display: block;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
article > heading h1 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.contain-floats::after {
|
||||
display: block;
|
||||
content: " ";
|
||||
clear: left;
|
||||
}
|
||||
|
||||
.panes {
|
||||
margin-left: -30%;
|
||||
margin-right: -30%;
|
||||
}
|
||||
|
||||
.panes section {
|
||||
float: left;
|
||||
width: 33.33%;
|
||||
height: 30em;
|
||||
}
|
||||
|
||||
.result {
|
||||
display: block;
|
||||
margin-right: 1em;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.result {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#jsContainer, #phpContainer, #testContainer {
|
||||
margin: 5px;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid #eeeeee;
|
||||
}
|
||||
|
||||
#phpContainer {
|
||||
margin: 5px 4px 5px 4px;
|
||||
}
|
||||
|
||||
.edit-form label {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.button-control {
|
||||
height: 50px;
|
||||
}
|
||||
</style>
|
||||
<form class="pure-form pure-form-stacked edit-form" id="edit-form">
|
||||
<fieldset>
|
||||
<legend><h1><?php if (isset($_GET['id'])) {
|
||||
echo '编辑';
|
||||
} else {
|
||||
echo '添加';
|
||||
} ?>题目</h1></legend>
|
||||
|
||||
<div class="pure-g">
|
||||
<div class="pure-u-lg-1-6">
|
||||
<label for="type">分类</label>
|
||||
<select id="type" name="type">
|
||||
<option value="1">闯关模式</option>
|
||||
<option value="2">挑战赛</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="pure-u-lg-1-6">
|
||||
<label for="isAnswer" class="pure-checkbox">
|
||||
是否有解答
|
||||
</label>
|
||||
<select id="isAnswer" name="isAnswer">
|
||||
<option value="1">是</option>
|
||||
<option value="0">否</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="pure-u-lg-1-6">
|
||||
<label for="difficulty">难度</label>
|
||||
<select id="difficulty" name="difficulty">
|
||||
<option value="1">简单</option>
|
||||
<option value="2">中等</option>
|
||||
<option value="3">困难</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="pure-u-lg-1-6">
|
||||
<label for="isCredit">是否有积分</label>
|
||||
<select id="isCredit" name="isCredit">
|
||||
<option value="1">有</option>
|
||||
<option value="0">没有</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="pure-u-lg-1-6">
|
||||
<label for="language">编程语言</label>
|
||||
<select id="language" name="language">
|
||||
<option value="PHP">PHP</option>
|
||||
<option value="HTML">HTML</option>
|
||||
<option value="JAVA">JAVA</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<label for="name">名称</label>
|
||||
<input id="name" name="name" class="pure-input-3-4" type="text">
|
||||
|
||||
<div class="pure-g">
|
||||
<div class="pure-u-lg-1-4">
|
||||
<label for="passPercent">通过率</label>
|
||||
<input id="passPercent" name="passPercent" class="pure-input-1" type="text">
|
||||
</div>
|
||||
|
||||
<div class="pure-u-lg-1-4">
|
||||
<label for="tag">标签</label>
|
||||
<input id="tag" name="tag" class="pure-input-1" type="text">
|
||||
</div>
|
||||
|
||||
<div class="pure-u-lg-1-4">
|
||||
<label for="credit">积分</label>
|
||||
<input id="credit" name="credit" type="text" value="0" class="pure-input-1">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label for="mark">备注</label>
|
||||
<textarea id="mark" name="mark" class="pure-input-1"></textarea>
|
||||
|
||||
<div class='tabs tabs_default'>
|
||||
<ul class='horizontal' style="margin-top: 10px;margin-bottom: 20px">
|
||||
<li><a class="pure-button" href="#describeEdit">题目描述</a></li>
|
||||
<li><a class="pure-button" href="#answerEdit">解答</a></li>
|
||||
<li><a class="pure-button admin" href="#testCaseEdit">测试用例</a></li>
|
||||
<li><a class="pure-button admin" href="#expectedResultEdit">预期结果</a></li>
|
||||
</ul>
|
||||
<div id='describeEdit'>
|
||||
<textarea id='describe' class="pure-input-1"></textarea>
|
||||
</div>
|
||||
<div id='answerEdit'>
|
||||
<textarea id='answer' class="pure-input-1"></textarea>
|
||||
</div>
|
||||
|
||||
<div id='testCaseEdit'>
|
||||
<textarea id="testCase" class="pure-input-1"></textarea>
|
||||
</div>
|
||||
|
||||
<div id="expectedResultEdit">
|
||||
<textarea id="expectedResult" class="pure-input-1"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<article id="article">
|
||||
<div class="panes contain-floats">
|
||||
<section>
|
||||
<heading>
|
||||
<h1>JavaScript</h1>
|
||||
</heading>
|
||||
|
||||
<div id="jsContainer"></div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<heading>
|
||||
<h1>PHP 主程序</h1>
|
||||
</heading>
|
||||
|
||||
<div id="phpContainer"></div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<heading>
|
||||
<h1>PHP 测试用例</h1>
|
||||
</heading>
|
||||
|
||||
<div id="testContainer"></div>
|
||||
</section>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<div class="button-control">
|
||||
<div class="pure-button" id="runMain">运行主程序</div>
|
||||
<div class="pure-button" id="runUnit">运行测试用例</div>
|
||||
</div>
|
||||
<div id="out">
|
||||
<iframe class="result" id="result"></iframe>
|
||||
</div>
|
||||
|
||||
<button type="button" id="submitForm" style="margin-top: 20px" class="pure-button pure-button-primary">保存</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<?php include('../footer.php'); ?>
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php include('../header.php'); ?>
|
||||
<div class="content" id="content">
|
||||
<div id="leftPane">
|
||||
<div id="container"></div>
|
||||
<div class="control">
|
||||
<div class="pure-button pure-button-primary" id="run">提交</div>
|
||||
<div class="pure-button" id="testRun">执行代码</div>
|
||||
<label for="auto" class="pure-checkbox auto">
|
||||
<input id="auto" type="checkbox"> 自动执行代码
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div id="rightPane">
|
||||
<div class='tabs tabs_default' style="height: 100%">
|
||||
<ul class='horizontal' style="margin-top: 10px;margin-bottom: 20px">
|
||||
<li><a class="pure-button" href="#describeView">题目描述</a></li>
|
||||
<li><a class="pure-button" href="#answerView" id="answerViewButton">解答</a></li>
|
||||
<li><a class="pure-button" href="#resultView">运行结果</a></li>
|
||||
</ul>
|
||||
<div id='describeView'>
|
||||
<div class="cont"></div>
|
||||
</div>
|
||||
<div id='answerView'>
|
||||
<div class="cont"></div>
|
||||
</div>
|
||||
|
||||
<div id='resultView'>
|
||||
<div class="cont">
|
||||
<div class="testCase">
|
||||
<h4 style="font-weight: 500;margin: 4px 0;">输入:</h4>
|
||||
<div class="testCaseContent"></div>
|
||||
</div>
|
||||
<div class="expectedResult" style="margin-top: 10px;">
|
||||
<h4 style="font-weight: 500;margin: 4px 0;">预期结果:</h4>
|
||||
<div class="expectedResultContent"></div>
|
||||
</div>
|
||||
<div class="resultArea" style="margin-top: 10px;">
|
||||
<h4 style="font-weight: 500;margin: 4px 0;">输出:</h4>
|
||||
<div class="resultContent">
|
||||
<iframe class="result" id="result"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include('../footer.php'); ?>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php include('../header.php'); ?>
|
||||
<div class="content" id="content">
|
||||
<div id="leftPane">
|
||||
<div id="container"></div>
|
||||
<div class="control">
|
||||
<div class="pure-button pure-button-primary" id="run">执行代码</div>
|
||||
<label for="auto" class="pure-checkbox auto">
|
||||
<input id="auto" type="checkbox"> 自动
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div id="rightPane">
|
||||
<div id="out">
|
||||
<iframe class="result" id="result"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include('../footer.php'); ?>
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php include('../header.php'); ?>
|
||||
<?php
|
||||
//error_reporting(0);
|
||||
require_once '../config.php';
|
||||
require_once '../medoo.php';
|
||||
|
||||
use Medoo\Medoo;
|
||||
|
||||
$database = new Medoo($DBCONFIG);
|
||||
|
||||
$Allcount = $database->count("problemset", [
|
||||
"type" => "1"
|
||||
]);
|
||||
|
||||
$rows = $database->select('userinfo', '*', [
|
||||
"ORDER" => [
|
||||
"id" => "DESC"
|
||||
]
|
||||
]);
|
||||
?>
|
||||
<div class="user" style="padding: 10px">
|
||||
<table class="pure-table" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>头像</th>
|
||||
<th>用户昵称</th>
|
||||
<th>真实姓名</th>
|
||||
<th>用户性别</th>
|
||||
<th>进度</th>
|
||||
<th>管理</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php foreach ($rows as $inx => $row) { ?>
|
||||
<tr class="<?php if ($inx % 2) echo 'pure-table-odd'; ?>">
|
||||
<td><?php echo $row['id'] ?></td>
|
||||
<td><img src="<?php echo $row['headimgurl']; ?>" width="50"/></td>
|
||||
<td><?php echo $row['nickname']; ?></td>
|
||||
<td><?php echo $row['realname']; ?></td>
|
||||
<td><?php if ($row['sex'] == '1') {
|
||||
echo '男';
|
||||
} else {
|
||||
echo '女';
|
||||
} ?></td>
|
||||
<td><?php
|
||||
$passCount = $database->count("record", [
|
||||
'user_id' => $row['id'],
|
||||
'is_pass' => '1'
|
||||
]);
|
||||
|
||||
echo $passCount . '/' . $Allcount;
|
||||
?></td>
|
||||
<td><a href="/page/userinfo.php?id=<?php echo $row['id']; ?>" target="_blank">查看详情</a></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php include('../footer.php'); ?>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php include('../header.php'); ?>
|
||||
<?php
|
||||
//error_reporting(0);
|
||||
require_once '../config.php';
|
||||
require_once '../medoo.php';
|
||||
|
||||
use Medoo\Medoo;
|
||||
|
||||
$database = new Medoo($DBCONFIG);
|
||||
|
||||
$rows = $database->query("SELECT
|
||||
`record`.`is_pass`,
|
||||
`problemset`.`id`,
|
||||
`problemset`.`no`,
|
||||
`problemset`.`name`,
|
||||
`problemset`.`language`,
|
||||
`problemset`.`type`,
|
||||
`problemset`.`isAnswer`,
|
||||
`problemset`.`passPercent`,
|
||||
`problemset`.`difficulty`
|
||||
FROM
|
||||
`problemset`
|
||||
LEFT JOIN `record` ON `problemset`.`id` = `record`.`problemset_id` AND `record`.`user_id` = " . $_GET['id'] . " WHERE `problemset`.`type` = '1' ORDER BY
|
||||
`no`")->fetchAll();
|
||||
?>
|
||||
<div class="user" style="padding: 10px">
|
||||
<table class="pure-table" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>题目</th>
|
||||
<th>做题状态</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php foreach ($rows as $inx => $row) { ?>
|
||||
<tr class="<?php if ($inx % 2) echo 'pure-table-odd'; ?>">
|
||||
<td><?php echo $row['no'] ?></td>
|
||||
<td><?php echo $row['name']; ?></td>
|
||||
<td><?php if ($row['is_pass'] == '1') {
|
||||
echo '<svg viewBox="0 0 1397 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="27" height="20"><path d="M1396.363636 121.018182c0 0-223.418182 74.472727-484.072727 372.363636-242.036364 269.963636-297.890909 381.672727-390.981818 530.618182C512 1014.690909 372.363636 744.727273 0 549.236364l195.490909-186.181818c0 0 176.872727 121.018182 297.890909 344.436364 0 0 307.2-474.763636 902.981818-707.490909L1396.363636 121.018182 1396.363636 121.018182zM1396.363636 121.018182" fill="#1afa29"></path></svg>';
|
||||
} ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php include('../footer.php'); ?>
|
||||
Whitespace-only changes.
Reference in new issue
Block a user