1.1.0.0
60
root/initPads.sh
Executable file
|
|
@ -0,0 +1,60 @@
|
|||
#!/bin/bash
|
||||
# Init joypads, if present
|
||||
# 23/01/2017
|
||||
# Daniele Callari
|
||||
# www.daxtech.net
|
||||
|
||||
|
||||
xboxdrv --quiet --silent --detach-kernel-driver &
|
||||
sleep 1
|
||||
|
||||
killall xboxdrv
|
||||
sleep 1
|
||||
|
||||
LED=1
|
||||
xboxdrv -L | grep "0x" | while read -r line ; do
|
||||
|
||||
if [[ $line == *"PLAYSTATION"* ]]; then
|
||||
|
||||
ID=$(echo $line | grep -o -E '[0-9]+' | head -1 | sed -e 's/^\+//')
|
||||
LED=`expr $LED + 1`
|
||||
|
||||
xboxdrv \
|
||||
--id $ID \
|
||||
--led $LED \
|
||||
--mimic-xpad \
|
||||
--dbus disabled \
|
||||
--dpad-rotation 90 \
|
||||
--axismap -DPAD_X=DPAD_X \
|
||||
--buttonmap Y=X \
|
||||
--buttonmap X=Y \
|
||||
--silent \
|
||||
--quiet &
|
||||
|
||||
printf "\e[92mPlayStation pad $ID $LED has been initialized\e[39m\n"
|
||||
|
||||
elif [[ $line == *"Xbox 360"* ]]; then
|
||||
|
||||
ID=$(echo $line | grep -o -E '[0-9]+' | head -1 | sed -e 's/^\+//')
|
||||
LED=`expr $LED + 1`
|
||||
|
||||
xboxdrv \
|
||||
--id $ID \
|
||||
--trigger-as-button \
|
||||
--led $LED \
|
||||
--deadzone 4000 \
|
||||
--dpad-rotation 90 \
|
||||
--axismap -DPAD_X=DPAD_X \
|
||||
--buttonmap Y=X \
|
||||
--buttonmap X=Y \
|
||||
--silent \
|
||||
--quiet \
|
||||
--mimic-xpad \
|
||||
--dbus disabled &
|
||||
|
||||
printf "\e[92mxBox pad $ID $LED has been initialized\e[39m\n"
|
||||
|
||||
fi
|
||||
|
||||
sleep 2
|
||||
done
|
||||
1
root/raspi-version
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
/var/www/raspi-version
|
||||
BIN
root/splash-screen.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
20
var/www/.bash_history
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
cd
|
||||
ls
|
||||
cd /root/
|
||||
cd
|
||||
ls
|
||||
sudo sh /var/www/initPads.sh
|
||||
sh /var/www/initPads.sh
|
||||
cd
|
||||
ls
|
||||
ls -l
|
||||
nano initPads.sh
|
||||
./initPads.sh
|
||||
nano initPads.sh
|
||||
./initPads.sh
|
||||
nano initPads.sh
|
||||
./initPads.sh
|
||||
cd
|
||||
ls
|
||||
./initPads.sh
|
||||
sh initPads.sh
|
||||
31
var/www/api/cpuload.api.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
include('../includes/common.inc.php');
|
||||
checkReferrer() or die();
|
||||
|
||||
// this code is part of servermonitor project engine - https://www.phpservermonitor.org/
|
||||
if (!($load_tmp = shell_exec('cat /proc/loadavg | awk \'{print $1","$2","$3}\''))) {
|
||||
$load = array(0, 0, 0);
|
||||
}else{
|
||||
if (!($num_cores = shell_exec('/bin/grep -c ^processor /proc/cpuinfo'))){
|
||||
if (!($num_cores = trim(shell_exec('/usr/bin/nproc')))) {
|
||||
$num_cores = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ((int)$num_cores <= 0) $num_cores = 1;
|
||||
$cores = (int)$num_cores;
|
||||
$load_exp = explode(',', $load_tmp);
|
||||
$load = array_map(
|
||||
function ($value, $cores) {
|
||||
$v = (int)($value * 100 / $cores);
|
||||
if ($v > 100)
|
||||
$v = 100;
|
||||
return $v;
|
||||
},
|
||||
$load_exp,
|
||||
array_fill(0, 3, $cores)
|
||||
);
|
||||
}
|
||||
$datas = $load;
|
||||
echo json_encode($datas);
|
||||
?>
|
||||
19
var/www/api/getGames.api.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
include('../includes/common.inc.php');
|
||||
checkReferrer() or die();
|
||||
$toReturn = array();
|
||||
|
||||
exec("sudo timeout 6 moonlight list", $cmd);
|
||||
$i=0;
|
||||
foreach( $cmd as $item ){
|
||||
if( is_numeric(substr($item,0,1)) ){
|
||||
$i++;
|
||||
$game = substr( $item, 3, strlen($item) );
|
||||
$toReturn[] = array(
|
||||
'id' => $i,
|
||||
'name' => $game
|
||||
);
|
||||
}
|
||||
}
|
||||
die(json_encode($toReturn));
|
||||
?>
|
||||
5
var/www/api/initPads.api.php
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
include('../includes/common.inc.php');
|
||||
checkReferrer() or die();
|
||||
exec("sudo bash /root/initPads.sh", $cmd);
|
||||
?>
|
||||
8
var/www/api/pair.api.php
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
include('../includes/common.inc.php');
|
||||
checkReferrer() or die();
|
||||
$cmd = 'sudo ./pair.exp';
|
||||
exec($cmd, $out);
|
||||
unset($out[0]);
|
||||
echo implode('<br />', $out);
|
||||
?>
|
||||
4
var/www/api/pair.exp
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/expect
|
||||
set timeout 4
|
||||
spawn sudo moonlight pair
|
||||
expect "% " { send "\n" }
|
||||
11
var/www/api/ram-alloc.api.php
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
include('../includes/common.inc.php');
|
||||
checkReferrer() or die();
|
||||
|
||||
$data = shell_exec("free -m | awk 'NR==2{printf \"%s/%sMB %.2f%\", \$3,\$2,\$3*100/\$2 }'");
|
||||
$s = explode(' ', $data);
|
||||
echo json_encode(array(
|
||||
'mb' => $s[0],
|
||||
'pc' => $s[1]
|
||||
));
|
||||
?>
|
||||
4
var/www/api/reboot.api.php
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
include('../includes/common.inc.php');
|
||||
checkReferrer() or die();
|
||||
exec("sudo reboot", $cmd); ?>
|
||||
5
var/www/api/shutdown.api.php
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
include('../includes/common.inc.php');
|
||||
checkReferrer() or die();
|
||||
exec("sudo halt", $cmd);
|
||||
?>
|
||||
44
var/www/api/startgame.api.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
include('../includes/common.inc.php');
|
||||
checkReferrer() or die();
|
||||
$_POST['game'] = str_replace('../', '', $_POST['game']);
|
||||
$_POST['game'] = str_replace('&', '', $_POST['game']);
|
||||
$_POST['game'] = str_replace(';', '', $_POST['game']);
|
||||
|
||||
/*
|
||||
data :{
|
||||
game : game,
|
||||
resolution : Settings.resolution,
|
||||
fps : Settings.fps,
|
||||
forcehevc : Settings.forcehevc,
|
||||
localaudio : Settings.localaudio
|
||||
}
|
||||
-720 Use 1280x720 resolution [default]
|
||||
-1080 Use 1920x1080 resolution
|
||||
-width <width> Horizontal resolution (default 1280)
|
||||
-height <height> Vertical resolution (default 720)
|
||||
-30fps Use 30fps
|
||||
-60fps Use 60fps [default]
|
||||
-bitrate <bitrate> Specify the bitrate in Kbps
|
||||
-packetsize <size> Specify the maximum packetsize in bytes
|
||||
-forcehevc Use high efficiency video decoding (HEVC)
|
||||
-remote Enable remote optimizations
|
||||
-app <app> Name of app to stream
|
||||
-nosops Don't allow GFE to modify game settings
|
||||
-localaudio Play audio locally
|
||||
-surround Stream 5.1 surround sound (requires GFE 2.7)
|
||||
-keydir <directory> Load encryption keys from directory
|
||||
*/
|
||||
|
||||
$cmd = 'sudo moonlight stream -app "'.$_POST['game'].'"';
|
||||
|
||||
if( $_POST['resolution'] == '1920x1080') $cmd .= ' -1080';
|
||||
if( $_POST['fps'] == '30') $cmd .= ' -30fps';
|
||||
if( $_POST['forcehevc'] == 'true') $cmd .= ' -forcehevc';
|
||||
if( $_POST['localaudio'] == 'true') $cmd .= ' -localaudio';
|
||||
if( $_POST['remote'] == 'true') $cmd .= ' -remote';
|
||||
|
||||
exec("$cmd &", $out);
|
||||
print_r($out);
|
||||
|
||||
?>
|
||||
6
var/www/api/stopStream.api.php
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
include('../includes/common.inc.php');
|
||||
checkReferrer() or die();
|
||||
exec('sudo moonlight quit', $out);
|
||||
print_r($out);
|
||||
?>
|
||||
7
var/www/api/unpair.api.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
include('../includes/common.inc.php');
|
||||
checkReferrer() or die();
|
||||
$cmd = 'sudo moonlight unpair';
|
||||
exec($cmd, $out);
|
||||
echo implode('<br />', $out);
|
||||
?>
|
||||
8544
var/www/css/materialize.css
vendored
Executable file
16
var/www/css/materialize.min.css
vendored
Executable file
23
var/www/css/my.css
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
.collection .collection-item.avatar {
|
||||
min-height: 64px;
|
||||
padding-left: 72px;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
#cpuValues td, #cpuValues th, #ramValue td, #ramValue th {
|
||||
padding: 0;
|
||||
border: 10px solid white;
|
||||
}
|
||||
#cpuValues td:last-child, #ramValue td:last-child {
|
||||
background: #96e0a0;
|
||||
text-align: center;
|
||||
color: white;
|
||||
}
|
||||
.tabs .tab a, .tabs .tab a.active, .card a { color: #4CAF50!important; }
|
||||
.tabs .tab a:hover { color: #62e467; }
|
||||
.tabs .indicator { background-color: #4CAF50; }
|
||||
.sameWidth { min-width: 70%; }
|
||||
#credits .card { background-color: #efefef; }
|
||||
body { font-family: 'Titillium Web', sans-serif; }
|
||||
|
||||
#config .input-field { padding: 10px; margin-bottom: 20px; }
|
||||
BIN
var/www/fav/android-chrome-192x192.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
var/www/fav/android-chrome-256x256.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
var/www/fav/apple-touch-icon.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
9
var/www/fav/browserconfig.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square150x150logo src="/mstile-150x150.png"/>
|
||||
<TileColor>#da532c</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
</browserconfig>
|
||||
BIN
var/www/fav/favicon-16x16.png
Normal file
|
After Width: | Height: | Size: 632 B |
BIN
var/www/fav/favicon-32x32.png
Normal file
|
After Width: | Height: | Size: 882 B |
BIN
var/www/fav/favicon.ico
Normal file
|
After Width: | Height: | Size: 15 KiB |
17
var/www/fav/manifest.json
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"name": "RaspiStream",
|
||||
"icons": [
|
||||
{
|
||||
"src": "fav\/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image\/png"
|
||||
},
|
||||
{
|
||||
"src": "fav\/android-chrome-256x256.png",
|
||||
"sizes": "256x256",
|
||||
"type": "image\/png"
|
||||
}
|
||||
],
|
||||
|
||||
"display": "standalone"
|
||||
}
|
||||
BIN
var/www/fav/mstile-150x150.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
19
var/www/fav/safari-pinned-tab.svg
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
||||
width="256.000000pt" height="256.000000pt" viewBox="0 0 256.000000 256.000000"
|
||||
preserveAspectRatio="xMidYMid meet">
|
||||
<metadata>
|
||||
Created by potrace 1.11, written by Peter Selinger 2001-2013
|
||||
</metadata>
|
||||
<g transform="translate(0.000000,256.000000) scale(0.100000,-0.100000)"
|
||||
fill="#000000" stroke="none">
|
||||
<path d="M1109 2549 c-557 -81 -997 -510 -1093 -1064 -20 -114 -14 -344 12
|
||||
-465 108 -505 501 -893 1012 -997 86 -17 333 -25 400 -13 25 4 59 10 75 13 51
|
||||
8 87 18 179 48 186 62 342 161 491 313 201 203 300 395 361 701 3 17 7 93 9
|
||||
170 9 365 -129 696 -398 952 -178 169 -394 281 -635 330 -87 17 -329 25 -413
|
||||
12z m305 -984 c206 -154 375 -282 375 -285 0 -5 -744 -563 -757 -568 -4 -1 -8
|
||||
254 -8 568 0 314 4 569 8 568 4 -2 176 -129 382 -283z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 951 B |
BIN
var/www/fonts/roboto/Roboto-Bold.eot
Executable file
BIN
var/www/fonts/roboto/Roboto-Bold.ttf
Executable file
BIN
var/www/fonts/roboto/Roboto-Bold.woff
Executable file
BIN
var/www/fonts/roboto/Roboto-Bold.woff2
Executable file
BIN
var/www/fonts/roboto/Roboto-Light.eot
Executable file
BIN
var/www/fonts/roboto/Roboto-Light.ttf
Executable file
BIN
var/www/fonts/roboto/Roboto-Light.woff
Executable file
BIN
var/www/fonts/roboto/Roboto-Light.woff2
Executable file
BIN
var/www/fonts/roboto/Roboto-Medium.eot
Executable file
BIN
var/www/fonts/roboto/Roboto-Medium.ttf
Executable file
BIN
var/www/fonts/roboto/Roboto-Medium.woff
Executable file
BIN
var/www/fonts/roboto/Roboto-Medium.woff2
Executable file
BIN
var/www/fonts/roboto/Roboto-Regular.eot
Executable file
BIN
var/www/fonts/roboto/Roboto-Regular.ttf
Executable file
BIN
var/www/fonts/roboto/Roboto-Regular.woff
Executable file
BIN
var/www/fonts/roboto/Roboto-Regular.woff2
Executable file
BIN
var/www/fonts/roboto/Roboto-Thin.eot
Executable file
BIN
var/www/fonts/roboto/Roboto-Thin.ttf
Executable file
BIN
var/www/fonts/roboto/Roboto-Thin.woff
Executable file
BIN
var/www/fonts/roboto/Roboto-Thin.woff2
Executable file
14
var/www/ide/AUTHORS.txt
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
Authors Ordered By First Contribution
|
||||
--------------------------------------------------
|
||||
|
||||
Kent Safranski - @fluidbyte <kent@fluidbyte.net>
|
||||
Tim Holum - @tholum
|
||||
Gaurab Paul - @lorefnon
|
||||
Shawn A - @tablatronix
|
||||
Florent Galland - @Flolagale
|
||||
Luc Verdier - @Verdier
|
||||
Danny Morabito - @newsocialifecom <staff@newsocialife.com>
|
||||
Alexander D - @daeks
|
||||
Jean-Philippe Zolesio - @holblin
|
||||
|
||||
and all the other contributors - Thanks!
|
||||
25
var/www/ide/CONTRIBUTING.md
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
# How to Contribute
|
||||
|
||||
Your contributions are welcome and we're very open about how contributions are made, however, to keep order to things please take the following into consideration:
|
||||
|
||||
* Check the issues to ensure that someone else isn't already working on the bug or feature
|
||||
* Submit an issue for bugs and feature additions before you start with it
|
||||
* Familiarize yourself with the documentation in the [Wiki](https://github.com/Codiad/Codiad/wiki)
|
||||
|
||||
There is an established format for `components` which utilizes one JS (`init.js`) and one CSS (`screen.css`) which is handled by the loader file. Any other resources used should be loaded or accessed from one of these.
|
||||
|
||||
**Don't Reinvent the Wheel!** There's an API and defined, easy-to-understand set of methods for a reason - use them.
|
||||
|
||||
Stick to the conventions defined in other components as closely as possible.
|
||||
|
||||
* Utilize the same commenting structure
|
||||
* Use underscores in namespaces instead of interCaps
|
||||
* Use intend with 4 spaces in your code
|
||||
* Use single quotes for parameternames and double quotes for strings
|
||||
* When working with the editor utilize the `active` object whenever possible instead of going direct to the `editor`
|
||||
|
||||
**Javascript Formatting**
|
||||
|
||||
In order to maintain a consistant code structure to the code across the application please run any changes through JSBeautifier (http://jsbeautifier.org/) with the default settings.
|
||||
|
||||
If you have questions, please ask. Submit an issue or [contact us directly](mailto:dev@codiad.com).
|
||||
21
var/www/ide/INSTALL.txt
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
CODIAD INSTALLATION
|
||||
----------------------------------------------------------------------
|
||||
|
||||
To install simply place the contents of the system in a web accessible
|
||||
folder.
|
||||
|
||||
Ensure that the following have write capabilities:
|
||||
|
||||
/config.php
|
||||
/data
|
||||
/workspace
|
||||
|
||||
Navigate in your browser to the URL where the system is placed and the
|
||||
installer screen will appear. If any dependencies have not been met the
|
||||
system will alert you.
|
||||
|
||||
Enter the requested information to create a user account, project, and
|
||||
set your timezone and submit the form. If everything goes as planned
|
||||
you will be greeted with a login screen.
|
||||
|
||||
Happy coding!
|
||||
20
var/www/ide/LICENSE.txt
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
* Copyright (c) Codiad & Kent Safranski (codiad.com)
|
||||
*
|
||||
* 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.
|
||||
11
var/www/ide/README.md
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
# Codiad Web IDE
|
||||
|
||||
Codiad is a web-based IDE framework with a small footprint and minimal requirements.
|
||||
|
||||
Codiad was built with simplicity in mind, allowing for fast, interactive development without the massive overhead of some of the larger desktop editors. That being said even users of IDE's such as Eclipse, NetBeans and Aptana are finding Codiad's simplicity to be a huge benefit. While simplicity was key, we didn't skimp on features and have a team of dedicated developer actively adding more.
|
||||
|
||||
Keep up to date with the latest changes and news on **[Twitter](http://twitter.com/codiadide)** or **[Facebook](http://www.facebook.com/Codiad)**
|
||||
|
||||
For more information on the project please check out the **[check out the Wiki](https://github.com/Codiad/Codiad/wiki)** or **[the Codiad Website](http://www.codiad.com)**
|
||||
|
||||
Distributed under the MIT-Style License. See `LICENSE.txt` file for more information.
|
||||
19
var/www/ide/build.xml
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<project name="Codiad" basedir="." default="phpcs">
|
||||
|
||||
<fileset id="components" dir="./components">
|
||||
<include name="**/*.php" />
|
||||
</fileset>
|
||||
|
||||
<target name="phpcs">
|
||||
<phpcodesniffer
|
||||
standard="PSR2"
|
||||
showSniffs="false"
|
||||
showWarnings="true"
|
||||
haltonerror="${build.haltonanalysiserror}">
|
||||
<fileset refid="components" />
|
||||
<formatter type="full" usefile="false" />
|
||||
</phpcodesniffer>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
314
var/www/ide/common.php
Executable file
|
|
@ -0,0 +1,314 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright (c) Codiad & Kent Safranski (codiad.com), distributed
|
||||
* as-is and without warranty under the MIT License. See
|
||||
* [root]/license.txt for more. This information must remain intact.
|
||||
*/
|
||||
|
||||
Common::startSession();
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Common Class
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
class Common {
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// PROPERTIES
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public static $debugMessageStack = array();
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// METHODS
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------||----------------------------- //
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Construct
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public static function construct(){
|
||||
global $cookie_lifetime;
|
||||
$path = str_replace("index.php", "", $_SERVER['SCRIPT_FILENAME']);
|
||||
foreach (array("components","plugins") as $folder) {
|
||||
if(strpos($_SERVER['SCRIPT_FILENAME'], $folder)) {
|
||||
$path = substr($_SERVER['SCRIPT_FILENAME'],0, strpos($_SERVER['SCRIPT_FILENAME'], $folder));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(file_exists($path.'config.php')){ require_once($path.'config.php'); }
|
||||
|
||||
if(!defined('BASE_PATH')) {
|
||||
define('BASE_PATH', rtrim(str_replace("index.php", "", $_SERVER['SCRIPT_FILENAME']),"/"));
|
||||
}
|
||||
|
||||
if(!defined('COMPONENTS')) {
|
||||
define('COMPONENTS', BASE_PATH . '/components');
|
||||
}
|
||||
|
||||
if(!defined('PLUGINS')) {
|
||||
define('PLUGINS', BASE_PATH . '/plugins');
|
||||
}
|
||||
|
||||
if(!defined('DATA')) {
|
||||
define('DATA', BASE_PATH . '/data');
|
||||
}
|
||||
|
||||
if(!defined('THEMES')){
|
||||
define("THEMES", BASE_PATH . "/themes");
|
||||
}
|
||||
|
||||
if(!defined('THEME')){
|
||||
define("THEME", "default");
|
||||
}
|
||||
|
||||
if(!defined('LANGUAGE')){
|
||||
define("LANGUAGE", "en");
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// SESSIONS
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public static function startSession() {
|
||||
Common::construct();
|
||||
|
||||
global $cookie_lifetime;
|
||||
if(isset($cookie_lifetime) && $cookie_lifetime != "") {
|
||||
ini_set("session.cookie_lifetime", $cookie_lifetime);
|
||||
}
|
||||
|
||||
//Set a Session Name
|
||||
session_name(md5(BASE_PATH));
|
||||
|
||||
session_start();
|
||||
|
||||
//Check for external authentification
|
||||
if(defined('AUTH_PATH')){
|
||||
require_once(AUTH_PATH);
|
||||
}
|
||||
|
||||
global $lang;
|
||||
if (isset($_SESSION['lang'])) {
|
||||
include BASE_PATH."/languages/{$_SESSION['lang']}.php";
|
||||
} else {
|
||||
include BASE_PATH."/languages/".LANGUAGE.".php";
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Read Content of directory
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public static function readDirectory($foldername) {
|
||||
$tmp = array();
|
||||
$allFiles = scandir($foldername);
|
||||
foreach ($allFiles as $fname){
|
||||
if($fname == '.' || $fname == '..' ){
|
||||
continue;
|
||||
}
|
||||
if(is_dir($foldername.'/'.$fname)){
|
||||
$tmp[] = $fname;
|
||||
}
|
||||
}
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Log debug message
|
||||
// Messages will be displayed in the console when the response is
|
||||
// made with the formatJSEND function.
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public static function debug($message) {
|
||||
Common::$debugMessageStack[] = $message;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// URLs
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public static function getConstant($key, $default = null) {
|
||||
return defined($key) ? constant($key) : $default;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Localization
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public static function i18n($key, $args = array()) {
|
||||
echo Common::get_i18n($key, $args);
|
||||
}
|
||||
|
||||
public static function get_i18n($key, $args = array()) {
|
||||
global $lang;
|
||||
$key = ucwords(strtolower($key)); //Test, test TeSt and tESt are exacly the same
|
||||
$return = isset($lang[$key]) ? $lang[$key] : $key;
|
||||
foreach($args as $k => $v)
|
||||
$return = str_replace("%{".$k."}%", $v, $return);
|
||||
return $return;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Check Session / Key
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public static function checkSession(){
|
||||
// Set any API keys
|
||||
$api_keys = array();
|
||||
// Check API Key or Session Authentication
|
||||
$key = "";
|
||||
if(isset($_GET['key'])){ $key = $_GET['key']; }
|
||||
if(!isset($_SESSION['user']) && !in_array($key,$api_keys)){
|
||||
exit('{"status":"error","message":"Authentication Error"}');
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Get JSON
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public static function getJSON($file,$namespace=""){
|
||||
$path = DATA . "/";
|
||||
if($namespace != ""){
|
||||
$path = $path . $namespace . "/";
|
||||
$path = preg_replace('#/+#','/',$path);
|
||||
}
|
||||
|
||||
$json = file_get_contents($path . $file);
|
||||
$json = str_replace("|*/?>","",str_replace("<?php/*|","",$json));
|
||||
$json = json_decode($json,true);
|
||||
return $json;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Save JSON
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public static function saveJSON($file,$data,$namespace=""){
|
||||
$path = DATA . "/";
|
||||
if($namespace != ""){
|
||||
$path = $path . $namespace . "/";
|
||||
$path = preg_replace('#/+#','/',$path);
|
||||
if(!is_dir($path)) mkdir($path);
|
||||
}
|
||||
|
||||
$data = "<?php/*|" . json_encode($data) . "|*/?>";
|
||||
$write = fopen($path . $file, 'w') or die("can't open file ".$path.$file);
|
||||
fwrite($write, $data);
|
||||
fclose($write);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Format JSEND Response
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public static function formatJSEND($status,$data=false){
|
||||
|
||||
/// Debug /////////////////////////////////////////////////
|
||||
$debug = "";
|
||||
if(count(Common::$debugMessageStack) > 0) {
|
||||
$debug .= ',"debug":';
|
||||
$debug .= json_encode(Common::$debugMessageStack);
|
||||
}
|
||||
|
||||
// Success ///////////////////////////////////////////////
|
||||
if($status=="success"){
|
||||
if($data){
|
||||
$jsend = '{"status":"success","data":'.json_encode($data).$debug.'}';
|
||||
}else{
|
||||
$jsend = '{"status":"success","data":null'.$debug.'}';
|
||||
}
|
||||
|
||||
// Error /////////////////////////////////////////////////
|
||||
}else{
|
||||
$jsend = '{"status":"error","message":"'.$data.'"'.$debug.'}';
|
||||
}
|
||||
|
||||
// Return ////////////////////////////////////////////////
|
||||
return $jsend;
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Check Function Availability
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public static function checkAccess() {
|
||||
return !file_exists(DATA . "/" . $_SESSION['user'] . '_acl.php');
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Check Path
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public static function checkPath($path) {
|
||||
if(file_exists(DATA . "/" . $_SESSION['user'] . '_acl.php')){
|
||||
foreach (getJSON($_SESSION['user'] . '_acl.php') as $projects=>$data) {
|
||||
if (strpos($path, $data) === 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach(getJSON('projects.php') as $project=>$data){
|
||||
if (strpos($path, $data['path']) === 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Check Function Availability
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public static function isAvailable($func) {
|
||||
if (ini_get('safe_mode')) return false;
|
||||
$disabled = ini_get('disable_functions');
|
||||
if ($disabled) {
|
||||
$disabled = explode(',', $disabled);
|
||||
$disabled = array_map('trim', $disabled);
|
||||
return !in_array($func, $disabled);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Check If Path is absolute
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public static function isAbsPath( $path ) {
|
||||
return ($path[0] === '/' || $path[1] === ':')?true:false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Check If WIN based system
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public static function isWINOS( ) {
|
||||
return (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Wrapper for old method names
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
function debug($message) { Common::debug($message); }
|
||||
function i18n($key, $args = array()) { echo Common::i18n($key, $args); }
|
||||
function get_i18n($key, $args = array()) { return Common::get_i18n($key, $args); }
|
||||
function checkSession(){ Common::checkSession(); }
|
||||
function getJSON($file,$namespace=""){ return Common::getJSON($file,$namespace); }
|
||||
function saveJSON($file,$data,$namespace=""){ Common::saveJSON($file,$data,$namespace); }
|
||||
function formatJSEND($status,$data=false){ return Common::formatJSEND($status,$data); }
|
||||
function checkAccess() { return Common::checkAccess(); }
|
||||
function checkPath($path) { return Common::checkPath($path); }
|
||||
function isAvailable($func) { return Common::isAvailable($func); }
|
||||
?>
|
||||
165
var/www/ide/components/active/class.active.php
Executable file
|
|
@ -0,0 +1,165 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (c) Codiad & Kent Safranski (codiad.com), distributed
|
||||
* as-is and without warranty under the MIT License. See
|
||||
* [root]/license.txt for more. This information must remain intact.
|
||||
*/
|
||||
|
||||
require_once('../../common.php');
|
||||
|
||||
class Active extends Common {
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// PROPERTIES
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public $username = "";
|
||||
public $path = "";
|
||||
public $new_path = "";
|
||||
public $actives = "";
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// METHODS
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------||----------------------------- //
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Construct
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public function __construct(){
|
||||
$this->actives = getJSON('active.php');
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// List User's Active Files
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public function ListActive(){
|
||||
$active_list = array();
|
||||
$tainted = FALSE;
|
||||
$root = WORKSPACE;
|
||||
if($this->actives){
|
||||
foreach($this->actives as $active=>$data){
|
||||
if(is_array($data) && isset($data['username']) && $data['username']==$this->username){
|
||||
if($this->isAbsPath($data['path'])) {
|
||||
$root = "";
|
||||
} else {
|
||||
$root = $root.'/';
|
||||
}
|
||||
if (file_exists($root.$data['path'])) {
|
||||
$focused = isset($data['focused']) ? $data['focused'] : false;
|
||||
$active_list[] = array('path'=>$data['path'], 'focused'=>$focused);
|
||||
} else {
|
||||
unset($this->actives[$active]);
|
||||
$tainted = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($tainted){
|
||||
saveJSON('active.php',$this->actives);
|
||||
}
|
||||
echo formatJSEND("success",$active_list);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Check File
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public function Check(){
|
||||
$cur_users = array();
|
||||
foreach($this->actives as $active=>$data){
|
||||
if(is_array($data) && isset($data['username']) && $data['username']!=$this->username && $data['path']==$this->path){
|
||||
$cur_users[] = $data['username'];
|
||||
}
|
||||
}
|
||||
if(count($cur_users)!=0){
|
||||
echo formatJSEND("error","Warning: File ".substr($this->path,strrpos($this->path,"/")+1)." Currently Opened By: " . implode(", ",$cur_users));
|
||||
}else{
|
||||
echo formatJSEND("success");
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Add File
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public function Add(){
|
||||
$process_add = true;
|
||||
foreach($this->actives as $active=>$data){
|
||||
if(is_array($data) && isset($data['username']) && $data['username']==$this->username && $data['path']==$this->path){
|
||||
$process_add = false;
|
||||
}
|
||||
}
|
||||
if($process_add){
|
||||
$this->actives[] = array("username"=>$this->username,"path"=>$this->path);
|
||||
saveJSON('active.php',$this->actives);
|
||||
echo formatJSEND("success");
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Rename File
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public function Rename(){
|
||||
$revised_actives = array();
|
||||
foreach($this->actives as $active=>$data){
|
||||
if(is_array($data) && isset($data['username'])){
|
||||
$revised_actives[] = array("username"=>$data['username'],"path"=>str_replace($this->path,$this->new_path,$data['path']));
|
||||
}
|
||||
}
|
||||
saveJSON('active.php',$revised_actives);
|
||||
echo formatJSEND("success");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Remove File
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public function Remove(){
|
||||
foreach($this->actives as $active=>$data){
|
||||
if(is_array($data) && isset($data['username']) && $this->username==$data['username'] && $this->path==$data['path']){
|
||||
unset($this->actives[$active]);
|
||||
}
|
||||
}
|
||||
saveJSON('active.php',$this->actives);
|
||||
echo formatJSEND("success");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Remove All Files
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public function RemoveAll(){
|
||||
foreach($this->actives as $active=>$data){
|
||||
if(is_array($data) && isset($data['username']) && $this->username==$data['username']){
|
||||
unset($this->actives[$active]);
|
||||
}
|
||||
}
|
||||
saveJSON('active.php',$this->actives);
|
||||
echo formatJSEND("success");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Mark File As Focused
|
||||
// All other files will be marked as non-focused.
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public function MarkFileAsFocused(){
|
||||
foreach($this->actives as $active=>$data){
|
||||
if(is_array($data) && isset($data['username']) && $this->username==$data['username']){
|
||||
$this->actives[$active]['focused']=false;
|
||||
if($this->path==$data['path']){
|
||||
$this->actives[$active]['focused']=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
saveJSON('active.php',$this->actives);
|
||||
echo formatJSEND("success");
|
||||
}
|
||||
|
||||
}
|
||||
89
var/www/ide/components/active/controller.php
Executable file
|
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (c) Codiad & Kent Safranski (codiad.com), distributed
|
||||
* as-is and without warranty under the MIT License. See
|
||||
* [root]/license.txt for more. This information must remain intact.
|
||||
*/
|
||||
|
||||
require_once('../../common.php');
|
||||
require_once('class.active.php');
|
||||
|
||||
$Active = new Active();
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Verify Session or Key
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
checkSession();
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Get user's active files
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
if($_GET['action']=='list'){
|
||||
$Active->username = $_SESSION['user'];
|
||||
$Active->ListActive();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Add active record
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
if($_GET['action']=='add'){
|
||||
$Active->username = $_SESSION['user'];
|
||||
$Active->path = $_GET['path'];
|
||||
$Active->Add();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Rename
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
if($_GET['action']=='rename'){
|
||||
$Active->username = $_SESSION['user'];
|
||||
$Active->path = $_GET['old_path'];
|
||||
$Active->new_path = $_GET['new_path'];
|
||||
$Active->Rename();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Check if file is active
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
if($_GET['action']=='check'){
|
||||
$Active->username = $_SESSION['user'];
|
||||
$Active->path = $_GET['path'];
|
||||
$Active->Check();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Remove active record
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
if($_GET['action']=='remove'){
|
||||
$Active->username = $_SESSION['user'];
|
||||
$Active->path = $_GET['path'];
|
||||
$Active->Remove();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Remove all active record
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
if($_GET['action']=='removeall'){
|
||||
$Active->username = $_SESSION['user'];
|
||||
$Active->RemoveAll();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Mark file as focused
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
if($_GET['action']=='focused'){
|
||||
$Active->username = $_SESSION['user'];
|
||||
$Active->path = $_GET['path'];
|
||||
$Active->MarkFileAsFocused();
|
||||
}
|
||||
|
||||
?>
|
||||
84
var/www/ide/components/active/dialog.php
Executable file
|
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (c) Codiad & Kent Safranski (codiad.com), distributed
|
||||
* as-is and without warranty under the MIT License. See
|
||||
* [root]/license.txt for more. This information must remain intact.
|
||||
*/
|
||||
|
||||
require_once('../../common.php');
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Verify Session or Key
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
checkSession();
|
||||
|
||||
?>
|
||||
<form onsubmit="return false;">
|
||||
<?php
|
||||
|
||||
switch($_GET['action']){
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Confirm Close Unsaved File
|
||||
//////////////////////////////////////////////////////////////////
|
||||
case 'confirm':
|
||||
$path = $_GET['path'];
|
||||
?>
|
||||
<label><?php i18n("Close Unsaved File?"); ?></label>
|
||||
|
||||
<pre><?php echo($path); ?></pre>
|
||||
|
||||
<button class="btn-left" onclick="save_and_close('<?php echo($path); ?>'); return false;"><?php i18n("Save & Close"); ?></button>
|
||||
<button class="btn-mid" onclick="close_without_save('<?php echo($path); ?>'); return false;"><?php i18n("Discard Changes"); ?></button>
|
||||
<button class="btn-right" onclick="codiad.modal.unload(); return false;"><?php i18n("Cancel"); ?></button>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'confirmAll':
|
||||
?>
|
||||
<label><?php i18n("Close Unsaved Files?"); ?></label>
|
||||
|
||||
<button class="btn-left" onclick="save_and_close_all(); return false;"><?php i18n("Save & Close"); ?></button>
|
||||
<button class="btn-mid" onclick="close_without_save_all(); return false;"><?php i18n("Discard Changes"); ?></button>
|
||||
<button class="btn-right" onclick="codiad.modal.unload(); return false;"><?php i18n("Cancel"); ?></button>
|
||||
<?php
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
</form>
|
||||
<script>
|
||||
|
||||
function save_and_close(path){
|
||||
/*var id = codiad.editor.getId(path);
|
||||
var content = codiad.editor.getContent(id);
|
||||
codiad.filemanager.saveFile(path,content, {
|
||||
success: function(){
|
||||
$('#active-files a[data-path="'+path+'"]').removeClass('changed');
|
||||
codiad.active.removeDraft(path);
|
||||
}
|
||||
});*/
|
||||
codiad.active.save(path);
|
||||
codiad.active.close(path);
|
||||
codiad.modal.unload();
|
||||
}
|
||||
|
||||
function close_without_save(path){
|
||||
codiad.active.close(path);
|
||||
codiad.modal.unload();
|
||||
}
|
||||
|
||||
function save_and_close_all(){
|
||||
codiad.active.saveAll();
|
||||
codiad.active.removeAll(true);
|
||||
codiad.modal.unload();
|
||||
}
|
||||
|
||||
function close_without_save_all(){
|
||||
codiad.active.removeAll(true);
|
||||
codiad.modal.unload();
|
||||
}
|
||||
</script>
|
||||
1004
var/www/ide/components/active/init.js
Executable file
679
var/www/ide/components/autocomplete/init.js
Executable file
|
|
@ -0,0 +1,679 @@
|
|||
/*
|
||||
* Copyright (c) Codiad & Kent Safranski (codiad.com), distributed
|
||||
* as-is and without warranty under the MIT License. See
|
||||
* [root]/license.txt for more. This information must remain intact.
|
||||
*/
|
||||
|
||||
(function (global, $) {
|
||||
|
||||
var EventEmitter = ace.require('ace/lib/event_emitter').EventEmitter;
|
||||
var Range = ace.require('ace/range').Range;
|
||||
|
||||
|
||||
var codiad = global.codiad;
|
||||
|
||||
$(function () {
|
||||
codiad.autocomplete.init();
|
||||
});
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Autocomplete Component for Codiad
|
||||
// ---------------------------------
|
||||
// Show a popup with word completion suggestions.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
codiad.autocomplete = {
|
||||
|
||||
wordRegex: /[^a-zA-Z_0-9\$]+/,
|
||||
|
||||
isVisible: false,
|
||||
|
||||
standardGoLineDownExec: null,
|
||||
|
||||
standardGoLineUpExec: null,
|
||||
|
||||
_suggestionCache: null,
|
||||
|
||||
standardGoToRightExec: null,
|
||||
|
||||
standardGoToLeftExec: null,
|
||||
|
||||
standardIndentExec: null,
|
||||
|
||||
init: function () {
|
||||
var _this = this;
|
||||
|
||||
this.$onDocumentChange = this.onDocumentChange.bind(this);
|
||||
this.$selectNextSuggestion = this.selectNextSuggestion.bind(this);
|
||||
this.$selectPreviousSuggestion = this.selectPreviousSuggestion.bind(this);
|
||||
this.$complete = this.complete.bind(this);
|
||||
this.$hide = this.hide.bind(this);
|
||||
|
||||
/* Catch click on suggestion */
|
||||
$('#autocomplete li').live('click', function () {
|
||||
$('#autocomplete li.active-suggestion').removeClass('active-suggestion');
|
||||
$(this).addClass('active-suggestion');
|
||||
_this.complete();
|
||||
});
|
||||
|
||||
/* In debug mode, run some tests here. */
|
||||
// this._testSimpleMatchScorer();
|
||||
// this._testFuzzyMatcher();
|
||||
},
|
||||
|
||||
suggest: function () {
|
||||
var _this = this;
|
||||
|
||||
var cursorPosition = this._getEditor().getCursorPosition();
|
||||
var foundSuggestions = this.updateSuggestions(cursorPosition);
|
||||
if (foundSuggestions) {
|
||||
this.addListenerToOnDocumentChange();
|
||||
|
||||
// Show the completion popup.
|
||||
this.show();
|
||||
|
||||
// handle click-out autoclosing.
|
||||
var fn = function () {
|
||||
_this.hide();
|
||||
$(window).off('click', fn);
|
||||
};
|
||||
$(window).on('click', fn);
|
||||
} else {
|
||||
this.clearSuggestionCache();
|
||||
}
|
||||
},
|
||||
|
||||
/* Update the suggestions for the word at the given position. Return true if
|
||||
* some suitable suggestions could be found, false if not. */
|
||||
updateSuggestions: function (position) {
|
||||
var _this = this;
|
||||
|
||||
var session = this._getEditSession();
|
||||
|
||||
/* Extract the word being typed. Keep only the part of the word
|
||||
* which is before the given position. It is somehow the prefix of
|
||||
* the wanted full word. Make sure we only keep one word. */
|
||||
var token = session.getTokenAt(position.row, position.column);
|
||||
if (!token) {
|
||||
/* No word at the given position. */
|
||||
this.removeSuggestions();
|
||||
return false;
|
||||
}
|
||||
|
||||
var prefix = token.value.substr(0, position.column - token.start);
|
||||
prefix = prefix.split(this.wordRegex).slice(-1)[0];
|
||||
if (prefix === '') {
|
||||
/* No word at the given position. */
|
||||
this.removeSuggestions();
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Build and order the suggestions themselves. */
|
||||
// TODO cache suggestions and augment them incrementally.
|
||||
var suggestionsAndDistance = this.getSuggestions(position);
|
||||
var suggestions = this.rankSuggestions(prefix, suggestionsAndDistance);
|
||||
if (suggestions.length < 1) {
|
||||
/* No suitable suggestions found. */
|
||||
this.removeSuggestions();
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Remove the existing suggestions and populate the popup with the
|
||||
* updated ones. */
|
||||
this.removeSuggestions();
|
||||
var popupContent = $('#autocomplete #suggestions');
|
||||
$.each(suggestions, function (index, suggestion) {
|
||||
/* First get rid of the suggestion suffix. */
|
||||
suggestion = suggestion.slice(0, -1);
|
||||
|
||||
var indexes = _this.getMatchIndexes(prefix, suggestion);
|
||||
$.each(indexes.reverse(), function (index, matchIndex) {
|
||||
suggestion = suggestion.substr(0, matchIndex) +
|
||||
'<span class="matched">' +
|
||||
suggestion.substr(matchIndex, 1) +
|
||||
'</span>' +
|
||||
suggestion.substr(matchIndex + 1);
|
||||
});
|
||||
popupContent.append('<li class="suggestion">' + suggestion + '</li>');
|
||||
});
|
||||
|
||||
this.selectFirstSuggestion();
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
show: function () {
|
||||
this.isVisible = true;
|
||||
|
||||
var popup = $('#autocomplete');
|
||||
popup.css({
|
||||
'top': this._computeTopOffset(),
|
||||
'left': this._computeLeftOffset(),
|
||||
'font-family': $('.ace_editor').css('font-family'),
|
||||
'font-size': $('.ace_editor').css('font-size')
|
||||
});
|
||||
popup.slideToggle('fast', function(){
|
||||
$(this).css('overflow', '');
|
||||
});
|
||||
|
||||
this.addKeyboardCommands();
|
||||
},
|
||||
|
||||
hide: function () {
|
||||
this.isVisible = false;
|
||||
|
||||
$('#autocomplete').hide();
|
||||
this.removeSuggestions();
|
||||
this.clearSuggestionCache();
|
||||
|
||||
this.removeListenerToOnDocumentChange();
|
||||
this.removeKeyboardCommands();
|
||||
},
|
||||
|
||||
/* Return a jQuery object containing the currently selected suggestion. */
|
||||
getSelectedSuggestion: function () {
|
||||
var selectedSuggestion = $('#autocomplete li.suggestion.active-suggestion');
|
||||
|
||||
if (selectedSuggestion.length < 1) {
|
||||
alert(i18n('No suggestion selected. Might be a bug.'));
|
||||
} else if (selectedSuggestion.length > 1) {
|
||||
alert(i18n('More than one suggestions selected. Might be a bug.'));
|
||||
}
|
||||
|
||||
return selectedSuggestion;
|
||||
},
|
||||
|
||||
selectFirstSuggestion: function () {
|
||||
var firstChild = $('li.suggestion:first-child');
|
||||
firstChild.addClass('active-suggestion');
|
||||
this._ensureVisible(firstChild, $('#autocomplete'));
|
||||
},
|
||||
|
||||
selectLastSuggestion: function () {
|
||||
var lastChild = $('li.suggestion:last-child');
|
||||
lastChild.addClass('active-suggestion');
|
||||
this._ensureVisible(lastChild, $('#autocomplete'));
|
||||
},
|
||||
|
||||
selectNextSuggestion: function () {
|
||||
var selectedSuggestion = this.getSelectedSuggestion();
|
||||
selectedSuggestion.removeClass('active-suggestion');
|
||||
var nextSuggestion = selectedSuggestion.next();
|
||||
if (nextSuggestion.length > 0) {
|
||||
nextSuggestion.addClass('active-suggestion');
|
||||
this._ensureVisible(nextSuggestion, $('#autocomplete'));
|
||||
} else {
|
||||
/* The currently selected suggestion is the last one.
|
||||
* Go back to first one. */
|
||||
this.selectFirstSuggestion();
|
||||
}
|
||||
},
|
||||
|
||||
selectPreviousSuggestion: function () {
|
||||
var selectedSuggestion = this.getSelectedSuggestion();
|
||||
selectedSuggestion.removeClass('active-suggestion');
|
||||
var previousSuggestion = selectedSuggestion.prev();
|
||||
if (previousSuggestion.length > 0) {
|
||||
previousSuggestion.addClass('active-suggestion');
|
||||
this._ensureVisible(previousSuggestion, $('#autocomplete'));
|
||||
} else {
|
||||
/* The currently selected suggestion is the first one.
|
||||
* Go back to last one. */
|
||||
this.selectLastSuggestion();
|
||||
}
|
||||
},
|
||||
|
||||
addListenerToOnDocumentChange: function () {
|
||||
var session = this._getEditSession();
|
||||
session.addEventListener('change', this.$onDocumentChange);
|
||||
},
|
||||
|
||||
removeListenerToOnDocumentChange: function () {
|
||||
var session = this._getEditSession();
|
||||
session.removeEventListener('change', this.$onDocumentChange);
|
||||
},
|
||||
|
||||
onDocumentChange: function (e) {
|
||||
if (e.data.text.search(/^\s+$/) !== -1) {
|
||||
this.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
var position = null;
|
||||
if (e.data.action === 'insertText') {
|
||||
position = e.data.range.end;
|
||||
} else if (e.data.action === 'removeText') {
|
||||
position = e.data.range.start;
|
||||
} else {
|
||||
alert('Unkown document change action.');
|
||||
}
|
||||
|
||||
var foundSuggestions = this.updateSuggestions(position);
|
||||
if (!foundSuggestions) {
|
||||
this.hide();
|
||||
}
|
||||
},
|
||||
|
||||
addKeyboardCommands: function () {
|
||||
var _this = this;
|
||||
var commandManager = this._getEditor().commands;
|
||||
|
||||
/* Save the standard commands that will be overwritten. */
|
||||
this.standardGoLineDownExec = commandManager.commands.golinedown.exec;
|
||||
this.standardGoLineUpExec = commandManager.commands.golineup.exec;
|
||||
|
||||
this.standardGoToRightExec = commandManager.commands.gotoright.exec;
|
||||
this.standardGoToLeftExec = commandManager.commands.gotoleft.exec;
|
||||
this.standardIndentExec = commandManager.commands.indent.exec;
|
||||
|
||||
/* Overwrite with the completion specific implementations. */
|
||||
commandManager.commands.golinedown.exec = this.$selectNextSuggestion;
|
||||
commandManager.commands.golineup.exec = this.$selectPreviousSuggestion;
|
||||
|
||||
commandManager.commands.gotoright.exec = this.$complete;
|
||||
commandManager.commands.gotoleft.exec = this.$hide;
|
||||
commandManager.commands.indent.exec = this.$complete;
|
||||
|
||||
commandManager.addCommand({
|
||||
name: 'hideautocomplete',
|
||||
bindKey: 'Esc',
|
||||
exec: function () {
|
||||
_this.hide();
|
||||
}
|
||||
});
|
||||
|
||||
commandManager.addCommand({
|
||||
name: 'autocomplete',
|
||||
bindKey: 'Return',
|
||||
exec: this.$complete
|
||||
});
|
||||
},
|
||||
|
||||
removeKeyboardCommands: function () {
|
||||
var commandManager = this._getEditor().commands;
|
||||
|
||||
/* Make sure the standard exec have been initialized. */
|
||||
if (this.standardGoLineDownExec !== null) {
|
||||
commandManager.commands.golinedown.exec = this.standardGoLineDownExec;
|
||||
}
|
||||
|
||||
if (this.standardGoLineUpExec !== null) {
|
||||
commandManager.commands.golineup.exec = this.standardGoLineUpExec;
|
||||
}
|
||||
|
||||
if (this.standardGoToRightExec !== null) {
|
||||
commandManager.commands.gotoright.exec = this.standardGoToRightExec;
|
||||
}
|
||||
|
||||
if (this.standardGoToLeftExec !== null) {
|
||||
commandManager.commands.gotoleft.exec = this.standardGoToLeftExec;
|
||||
}
|
||||
|
||||
if (this.standardIndentExec !== null) {
|
||||
commandManager.commands.indent.exec = this.standardIndentExec;
|
||||
}
|
||||
|
||||
commandManager.removeCommand('hideautocomplete');
|
||||
commandManager.removeCommand('autocomplete');
|
||||
},
|
||||
|
||||
/* Complete the word at the given position with the currently selected
|
||||
* suggestion. Only the part of the word before the position is
|
||||
* replaced. */
|
||||
complete: function (position) {
|
||||
var editor = this._getEditor();
|
||||
var session = this._getEditSession();
|
||||
|
||||
var position = editor.getCursorPosition();
|
||||
|
||||
/* Get the length of the word being typed. */
|
||||
var token = session.getTokenAt(position.row, position.column);
|
||||
if (!token) {
|
||||
/* No token at the given position. */
|
||||
this.clearSuggestionCache();
|
||||
this.hide();
|
||||
editor.focus();
|
||||
}
|
||||
|
||||
var prefix = token.value.substr(0, position.column - token.start);
|
||||
var prefixLength = prefix.split(this.wordRegex).slice(-1)[0].length;
|
||||
|
||||
var range = new Range(position.row,
|
||||
position.column - prefixLength,
|
||||
position.row,
|
||||
position.column);
|
||||
|
||||
var suggestion = this.getSelectedSuggestion().text();
|
||||
session.replace(range, suggestion);
|
||||
|
||||
this.hide();
|
||||
editor.focus();
|
||||
},
|
||||
|
||||
/* Remove the suggestions from the Dom. */
|
||||
removeSuggestions: function () {
|
||||
$('.suggestion').remove();
|
||||
},
|
||||
|
||||
/* Get suggestions of completion for the current position in the
|
||||
* document. */
|
||||
getSuggestions: function (position) {
|
||||
|
||||
/* If suggestions are cached,
|
||||
* return them directely */
|
||||
if (this._suggestionCache) {
|
||||
return this._suggestionCache;
|
||||
}
|
||||
|
||||
var doc = this._getDocument();
|
||||
|
||||
/* FIXME For now, make suggestions on the whole file content except
|
||||
* the current token. Might be a little bit smarter, e.g., remove
|
||||
* all the keywords associated with the current language. */
|
||||
|
||||
/* Get all the text, put a marker at the cursor position. The
|
||||
* marker uses word character so that it won't be discarded by a
|
||||
* word split. */
|
||||
var markerString = '__autocomplete_marker__';
|
||||
var text = doc.getLines(0, position.row - 1).join("\n") + "\n";
|
||||
var currentLine = doc.getLine(position.row);
|
||||
text += currentLine.substr(0, position.column);
|
||||
text += markerString;
|
||||
if (position.column === currentLine.length) {
|
||||
// position is at end of line, add a break line.
|
||||
text += "\n";
|
||||
}
|
||||
text += currentLine.substr(position.column + 1);
|
||||
text += doc.getLines(position.row + 1, doc.getLength()).join("\n") + "\n";
|
||||
|
||||
/* Split the text into words. */
|
||||
var suggestions = text.split(this.wordRegex);
|
||||
|
||||
/* Get the index of the word at the cursor position. */
|
||||
var markerIndex = 0;
|
||||
var markedWord = '';
|
||||
$.each(suggestions, function (index, value) {
|
||||
if (value.search(markerString) !== -1) {
|
||||
markerIndex = index;
|
||||
markedWord = value;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
/* Build an object associating the suggestions with their distance
|
||||
* to the word at cursor position. To make sure that no suggestion
|
||||
* string overrides a built-in method of the suggestionsAndDistance
|
||||
* object, suffix all the suggestions with '-'. Afterward, make
|
||||
* sure of removing that suffix before using the stored
|
||||
* suggestions! */
|
||||
var suggestionsAndDistance = {};
|
||||
$.each(suggestions, function (index, suggestion) {
|
||||
var distance = Math.abs(index - markerIndex);
|
||||
if (!suggestionsAndDistance[suggestion + '-'] ||
|
||||
distance < suggestionsAndDistance[suggestion]) {
|
||||
suggestionsAndDistance[suggestion + '-'] = distance;
|
||||
}
|
||||
});
|
||||
|
||||
/* Remove from the suggestions the word under the cursor. */
|
||||
delete suggestionsAndDistance[markedWord + '-'];
|
||||
|
||||
/* Fill the cache */
|
||||
this._suggestionCache = suggestionsAndDistance;
|
||||
|
||||
return suggestionsAndDistance;
|
||||
},
|
||||
|
||||
/* Clear the suggestion cache */
|
||||
clearSuggestionCache: function () {
|
||||
this._suggestionCache = null;
|
||||
},
|
||||
|
||||
/* Given an object associating suggestions and their distances to the
|
||||
* word under the cursor (the prefix), return a ranked array of
|
||||
* suggestions with the best match first. The suggestions are ranked
|
||||
* based on if they match the prefix fuzzily, how much they match the
|
||||
* given prefix in the computeSimpleMatchScore sense and on their
|
||||
* distances to the prefix. */
|
||||
rankSuggestions: function (prefix, suggestionsAndDistance) {
|
||||
/* Initialize maxScore to one to ensure removing the non matching
|
||||
* suggestions (those with a zero score). */
|
||||
var maxScore = 1;
|
||||
var suggestionsAndMatchScore = {};
|
||||
for (var suggestion in suggestionsAndDistance) {
|
||||
if (Object.prototype.hasOwnProperty.call(suggestionsAndDistance, suggestion)) {
|
||||
var score = this.computeSimpleMatchScore(prefix, suggestion);
|
||||
if (score > maxScore) {
|
||||
maxScore = score;
|
||||
}
|
||||
suggestionsAndMatchScore[suggestion] = score;
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove the suggestions that do not match the prefix fuzzily. */
|
||||
for (suggestion in suggestionsAndMatchScore) {
|
||||
if (Object.prototype.hasOwnProperty.call(suggestionsAndMatchScore, suggestion)) {
|
||||
if (!this.isMatchingFuzzily(prefix, suggestion)) {
|
||||
delete suggestionsAndMatchScore[suggestion];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Now for each suggestion we have its matching score and its
|
||||
* distance to the word under the cursor. So compute its final
|
||||
* score as a combination of both. */
|
||||
var suggestionsAndFinalScore = {};
|
||||
for (suggestion in suggestionsAndMatchScore) {
|
||||
if (Object.prototype.hasOwnProperty.call(suggestionsAndMatchScore, suggestion)) {
|
||||
//suggestionsAndFinalScore[suggestion] = suggestionsAndMatchScore[suggestion] -
|
||||
// suggestionsAndDistance[suggestion];
|
||||
suggestionsAndFinalScore[suggestion] = suggestionsAndMatchScore[suggestion] / suggestion.length;
|
||||
}
|
||||
}
|
||||
|
||||
/* Make an array of suggestions and make sure to rank them in the
|
||||
* ascending scores order. */
|
||||
var suggestions = [];
|
||||
for (suggestion in suggestionsAndFinalScore) {
|
||||
if (Object.prototype.hasOwnProperty.call(suggestionsAndFinalScore, suggestion)) {
|
||||
suggestions.push(suggestion);
|
||||
}
|
||||
}
|
||||
|
||||
suggestions.sort(function (firstSuggestion, secondSuggestion) {
|
||||
return suggestionsAndFinalScore[secondSuggestion] - suggestionsAndFinalScore[firstSuggestion];
|
||||
});
|
||||
|
||||
return suggestions;
|
||||
},
|
||||
|
||||
/* Return the number of consecutive letters starting from the first
|
||||
* letter in suggestion that match prefix. For instance,
|
||||
* this.computeSimpleMatchScore(cod, codiad) will return 3. If
|
||||
* suggestion is shorter than prefix, return a score of zero. The score
|
||||
* is computed using a Vim-like smartcase behavior. */
|
||||
computeSimpleMatchScore: function (prefix, suggestion) {
|
||||
/* Use a Vim-like smartcase behavior. If prefix is all lowercase,
|
||||
* compute the match score case insensitive, if it is not, compute
|
||||
* the score case sensitive. */
|
||||
var localSuggestion = this._isLowerCase(prefix) ? suggestion.toLowerCase() : suggestion;
|
||||
|
||||
if (localSuggestion.length < prefix.length) {
|
||||
return 0;
|
||||
} else if (localSuggestion === prefix) {
|
||||
return prefix.length;
|
||||
} else {
|
||||
var score = 0;
|
||||
for (var i = 0; i < prefix.length; ++i) {
|
||||
if (localSuggestion[i] === prefix[i]) {
|
||||
++score;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return score;
|
||||
}
|
||||
},
|
||||
|
||||
/* Return true if suggestion fuzzily matches prefix. Because everybody
|
||||
* loves fuzzy matches.
|
||||
* For instance, this.isMatchingFuzzily(mlf, mylongfunctionname)
|
||||
* will return true. The score is computed using a Vim-like smartcase
|
||||
* behavior. */
|
||||
isMatchingFuzzily: function (prefix, suggestion) {
|
||||
/* Use a Vim-like smartcase behavior. If prefix is all lowercase,
|
||||
* compute the match score case insensitive, if it is not, compute
|
||||
* the score case sensitive. */
|
||||
var localSuggestion = this._isLowerCase(prefix) ? suggestion.toLowerCase() : suggestion;
|
||||
|
||||
/* Escape the characters that have a special meaning for regex in
|
||||
* the prefix. */
|
||||
var localPrefix = prefix.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
||||
|
||||
var fuzzyRegex = '^.*?';
|
||||
for (var i = 0; i < localPrefix.length; ++i) {
|
||||
if (localPrefix[i] === '\\') {
|
||||
fuzzyRegex += localPrefix[i];
|
||||
++i;
|
||||
}
|
||||
|
||||
fuzzyRegex += localPrefix[i];
|
||||
fuzzyRegex += '.*?';
|
||||
}
|
||||
|
||||
if (localSuggestion.search(fuzzyRegex) !== -1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
getMatchIndexes: function (prefix, suggestion) {
|
||||
/* Use a Vim-like smartcase behavior. If prefix is all lowercase,
|
||||
* find the match indexes case insensitive, if it is not, find them
|
||||
* case sensitive. */
|
||||
var localSuggestion = this._isLowerCase(prefix) ? suggestion.toLowerCase() : suggestion;
|
||||
|
||||
var matchIndexes = [];
|
||||
var startIndex = 0;
|
||||
for (var i = 0; i < prefix.length; ++i) {
|
||||
var index = localSuggestion.indexOf(prefix[i], startIndex);
|
||||
matchIndexes.push(index);
|
||||
startIndex = index + 1;
|
||||
}
|
||||
|
||||
return matchIndexes;
|
||||
},
|
||||
|
||||
_isLowerCase: function (str) {
|
||||
return (str.toLowerCase() === str);
|
||||
},
|
||||
|
||||
_ensureVisible: function (el, parent) {
|
||||
var offset = 1;
|
||||
var paneMin = parent.scrollTop();
|
||||
var paneMax = paneMin + parent.innerHeight();
|
||||
var itemMin = el.position().top + paneMin - offset;
|
||||
var itemMax = itemMin + el.outerHeight() + 2*offset;
|
||||
if (itemMax > paneMax) {
|
||||
parent.stop().animate({
|
||||
scrollTop: itemMax - parent.innerHeight()
|
||||
}, 100);
|
||||
} else if (itemMin < paneMin) {
|
||||
parent.stop().animate({
|
||||
scrollTop: itemMin
|
||||
}, 100);
|
||||
}
|
||||
},
|
||||
|
||||
_computeTopOffset: function () {
|
||||
/* FIXME How to handle multiple cursors? This seems to compute the
|
||||
* offset using the position of the last created cursor. */
|
||||
var cursor = $('.ace_cursor');
|
||||
if (cursor.length > 0) {
|
||||
var fontSize = codiad.editor.getActive().container.style.fontSize.replace('px', '');
|
||||
var interLine = 1.7;
|
||||
cursor = $(cursor[0]);
|
||||
var top = cursor.offset().top + fontSize * interLine;
|
||||
return top;
|
||||
}
|
||||
},
|
||||
|
||||
_computeLeftOffset: function () {
|
||||
/* FIXME How to handle multiple cursors? This seems to compute the
|
||||
* offset using the position of the last created cursor. */
|
||||
var cursor = $('.ace_cursor');
|
||||
if (cursor.length > 0) {
|
||||
cursor = $(cursor[0]);
|
||||
var left = cursor.offset().left;
|
||||
return left;
|
||||
}
|
||||
},
|
||||
|
||||
/* Set of helper methods to manipulate the editor. */
|
||||
_getEditor: function () {
|
||||
return codiad.editor.getActive();
|
||||
},
|
||||
|
||||
_getEditSession: function () {
|
||||
return codiad.editor.getActive().getSession();
|
||||
},
|
||||
|
||||
_getDocument: function () {
|
||||
return codiad.editor.getActive().getSession().getDocument();
|
||||
},
|
||||
|
||||
/* Some unit tests. */
|
||||
//i don't need to translate this... this is just for testing things...
|
||||
_testSimpleMatchScorer: function () {
|
||||
var prefix = 'myprefix';
|
||||
var suggestion = 'myprefixisshort';
|
||||
var score = this.computeSimpleMatchScore(prefix, suggestion);
|
||||
if (score !== 8) {
|
||||
alert('_testSimpleMatchScorer lowercase test failed.');
|
||||
}
|
||||
|
||||
prefix = 'MYPREFIX';
|
||||
suggestion = 'MYPREFIXISSHORT';
|
||||
score = this.computeSimpleMatchScore(prefix, suggestion);
|
||||
if (score !== 8) {
|
||||
alert('_testSimpleMatchScorer uppercase test failed.');
|
||||
}
|
||||
|
||||
prefix = 'myPrefix';
|
||||
suggestion = 'myprefixisshort';
|
||||
score = this.computeSimpleMatchScore(prefix, suggestion);
|
||||
if (score !== 2) {
|
||||
alert('_testSimpleMatchScorer mixed case vs. lowercase test failed.');
|
||||
}
|
||||
|
||||
prefix = 'myPrefixIs';
|
||||
suggestion = 'myPrefixIsShort';
|
||||
score = this.computeSimpleMatchScore(prefix, suggestion);
|
||||
if (score !== 10) {
|
||||
alert('_testSimpleMatchScorer mixed case test failed.');
|
||||
}
|
||||
},
|
||||
|
||||
_testFuzzyMatcher: function () {
|
||||
var isMatching = this.isMatchingFuzzily('mlf', 'mylongfunctionname');
|
||||
if (!isMatching) {
|
||||
alert('_testFuzzyMatcher mlf vs. mylongfunctionname failed.');
|
||||
}
|
||||
|
||||
isMatching = this.isMatchingFuzzily('mLn', 'myLongFunctionName');
|
||||
if (!isMatching) {
|
||||
alert('_testFuzzyMatcher mLn vs. myLongFunctionName failed.');
|
||||
}
|
||||
isMatching = this.isMatchingFuzzily('mLFuny', 'myLongFunctionName');
|
||||
if (isMatching) {
|
||||
alert('_testFuzzyMatcher mLFuny. myLongFunctionName failed.');
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
})(this, jQuery);
|
||||
11
var/www/ide/components/editor/ace-editor/ace.js
Executable file
5
var/www/ide/components/editor/ace-editor/ext-beautify.js
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
ace.define("ace/ext/beautify/php_rules",["require","exports","module","ace/token_iterator"],function(e,t,n){"use strict";var r=e("ace/token_iterator").TokenIterator;t.newLines=[{type:"support.php_tag",value:"<?php"},{type:"support.php_tag",value:"<?"},{type:"support.php_tag",value:"?>"},{type:"paren.lparen",value:"{",indent:!0},{type:"paren.rparen",breakBefore:!0,value:"}",indent:!1},{type:"paren.rparen",breakBefore:!0,value:"})",indent:!1,dontBreak:!0},{type:"comment"},{type:"text",value:";"},{type:"text",value:":",context:"php"},{type:"keyword",value:"case",indent:!0,dontBreak:!0},{type:"keyword",value:"default",indent:!0,dontBreak:!0},{type:"keyword",value:"break",indent:!1,dontBreak:!0},{type:"punctuation.doctype.end",value:">"},{type:"meta.tag.punctuation.end",value:">"},{type:"meta.tag.punctuation.begin",value:"<",blockTag:!0,indent:!0,dontBreak:!0},{type:"meta.tag.punctuation.begin",value:"</",indent:!1,breakBefore:!0,dontBreak:!0},{type:"punctuation.operator",value:";"}],t.spaces=[{type:"xml-pe",prepend:!0},{type:"entity.other.attribute-name",prepend:!0},{type:"storage.type",value:"var",append:!0},{type:"storage.type",value:"function",append:!0},{type:"keyword.operator",value:"="},{type:"keyword",value:"as",prepend:!0,append:!0},{type:"keyword",value:"function",append:!0},{type:"support.function",next:/[^\(]/,append:!0},{type:"keyword",value:"or",append:!0,prepend:!0},{type:"keyword",value:"and",append:!0,prepend:!0},{type:"keyword",value:"case",append:!0},{type:"keyword.operator",value:"||",append:!0,prepend:!0},{type:"keyword.operator",value:"&&",append:!0,prepend:!0}],t.singleTags=["!doctype","area","base","br","hr","input","img","link","meta"],t.transform=function(e,n,r){var i=e.getCurrentToken(),s=t.newLines,o=t.spaces,u=t.singleTags,a="",f=0,l=!1,c,h,p={},d,v={},m=!1,g="";while(i!==null){console.log(i);if(!i){i=e.stepForward();continue}i.type=="support.php_tag"&&i.value!="?>"?r="php":i.type=="support.php_tag"&&i.value=="?>"?r="html":i.type=="meta.tag.name.style"&&r!="css"?r="css":i.type=="meta.tag.name.style"&&r=="css"?r="html":i.type=="meta.tag.name.script"&&r!="js"?r="js":i.type=="meta.tag.name.script"&&r=="js"&&(r="html"),v=e.stepForward(),v&&v.type.indexOf("meta.tag.name")==0&&(d=v.value),p.type=="support.php_tag"&&p.value=="<?="&&(l=!0),i.type=="meta.tag.name"&&(i.value=i.value.toLowerCase()),i.type=="text"&&(i.value=i.value.trim());if(!i.value){i=v;continue}g=i.value;for(var y in o)i.type==o[y].type&&(!o[y].value||i.value==o[y].value)&&v&&(!o[y].next||o[y].next.test(v.value))&&(o[y].prepend&&(g=" "+i.value),o[y].append&&(g+=" "));i.type.indexOf("meta.tag.name")==0&&(c=i.value),m=!1;for(y in s)if(i.type==s[y].type&&(!s[y].value||i.value==s[y].value)&&(!s[y].blockTag||u.indexOf(d)===-1)&&(!s[y].context||s[y].context===r)){s[y].indent===!1&&f--;if(s[y].breakBefore&&(!s[y].prev||s[y].prev.test(p.value))){a+="\n",m=!0;for(y=0;y<f;y++)a+=" "}break}if(l===!1)for(y in s)if(p.type==s[y].type&&(!s[y].value||p.value==s[y].value)&&(!s[y].blockTag||u.indexOf(c)===-1)&&(!s[y].context||s[y].context===r)){s[y].indent===!0&&f++;if(!s[y].dontBreak&&!m){a+="\n";for(y=0;y<f;y++)a+=" "}break}a+=g,p.type=="support.php_tag"&&p.value=="?>"&&(l=!1),h=c,p=i,i=v;if(i===null)break}return a}}),ace.define("ace/ext/beautify",["require","exports","module","ace/token_iterator","ace/ext/beautify/php_rules"],function(e,t,n){"use strict";var r=e("ace/token_iterator").TokenIterator,i=e("./beautify/php_rules").transform;t.beautify=function(e){var t=new r(e,0,0),n=t.getCurrentToken(),s=e.$modeId.split("/").pop(),o=i(t,s);e.doc.setValue(o)},t.commands=[{name:"beautify",exec:function(e){t.beautify(e.session)},bindKey:"Ctrl-Shift-B"}]});
|
||||
(function() {
|
||||
ace.require(["ace/ext/beautify"], function() {});
|
||||
})();
|
||||
|
||||
5
var/www/ide/components/editor/ace-editor/ext-chromevox.js
Executable file
5
var/www/ide/components/editor/ace-editor/ext-elastic_tabstops_lite.js
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
ace.define("ace/ext/elastic_tabstops_lite",["require","exports","module","ace/editor","ace/config"],function(e,t,n){"use strict";var r=function(e){this.$editor=e;var t=this,n=[],r=!1;this.onAfterExec=function(){r=!1,t.processRows(n),n=[]},this.onExec=function(){r=!0},this.onChange=function(e){r&&(n.indexOf(e.start.row)==-1&&n.push(e.start.row),e.end.row!=e.start.row&&n.push(e.end.row))}};(function(){this.processRows=function(e){this.$inChange=!0;var t=[];for(var n=0,r=e.length;n<r;n++){var i=e[n];if(t.indexOf(i)>-1)continue;var s=this.$findCellWidthsForBlock(i),o=this.$setBlockCellWidthsToMax(s.cellWidths),u=s.firstRow;for(var a=0,f=o.length;a<f;a++){var l=o[a];t.push(u),this.$adjustRow(u,l),u++}}this.$inChange=!1},this.$findCellWidthsForBlock=function(e){var t=[],n,r=e;while(r>=0){n=this.$cellWidthsForRow(r);if(n.length==0)break;t.unshift(n),r--}var i=r+1;r=e;var s=this.$editor.session.getLength();while(r<s-1){r++,n=this.$cellWidthsForRow(r);if(n.length==0)break;t.push(n)}return{cellWidths:t,firstRow:i}},this.$cellWidthsForRow=function(e){var t=this.$selectionColumnsForRow(e),n=[-1].concat(this.$tabsForRow(e)),r=n.map(function(e){return 0}).slice(1),i=this.$editor.session.getLine(e);for(var s=0,o=n.length-1;s<o;s++){var u=n[s]+1,a=n[s+1],f=this.$rightmostSelectionInCell(t,a),l=i.substring(u,a);r[s]=Math.max(l.replace(/\s+$/g,"").length,f-u)}return r},this.$selectionColumnsForRow=function(e){var t=[],n=this.$editor.getCursorPosition();return this.$editor.session.getSelection().isEmpty()&&e==n.row&&t.push(n.column),t},this.$setBlockCellWidthsToMax=function(e){var t=!0,n,r,i,s=this.$izip_longest(e);for(var o=0,u=s.length;o<u;o++){var a=s[o];if(!a.push){console.error(a);continue}a.push(NaN);for(var f=0,l=a.length;f<l;f++){var c=a[f];t&&(n=f,i=0,t=!1);if(isNaN(c)){r=f;for(var h=n;h<r;h++)e[h][o]=i;t=!0}i=Math.max(i,c)}}return e},this.$rightmostSelectionInCell=function(e,t){var n=0;if(e.length){var r=[];for(var i=0,s=e.length;i<s;i++)e[i]<=t?r.push(i):r.push(0);n=Math.max.apply(Math,r)}return n},this.$tabsForRow=function(e){var t=[],n=this.$editor.session.getLine(e),r=/\t/g,i;while((i=r.exec(n))!=null)t.push(i.index);return t},this.$adjustRow=function(e,t){var n=this.$tabsForRow(e);if(n.length==0)return;var r=0,i=-1,s=this.$izip(t,n);for(var o=0,u=s.length;o<u;o++){var a=s[o][0],f=s[o][1];i+=1+a,f+=r;var l=i-f;if(l==0)continue;var c=this.$editor.session.getLine(e).substr(0,f),h=c.replace(/\s*$/g,""),p=c.length-h.length;l>0&&(this.$editor.session.getDocument().insertInLine({row:e,column:f+1},Array(l+1).join(" ")+" "),this.$editor.session.getDocument().removeInLine(e,f,f+1),r+=l),l<0&&p>=-l&&(this.$editor.session.getDocument().removeInLine(e,f+l,f),r+=l)}},this.$izip_longest=function(e){if(!e[0])return[];var t=e[0].length,n=e.length;for(var r=1;r<n;r++){var i=e[r].length;i>t&&(t=i)}var s=[];for(var o=0;o<t;o++){var u=[];for(var r=0;r<n;r++)e[r][o]===""?u.push(NaN):u.push(e[r][o]);s.push(u)}return s},this.$izip=function(e,t){var n=e.length>=t.length?t.length:e.length,r=[];for(var i=0;i<n;i++){var s=[e[i],t[i]];r.push(s)}return r}}).call(r.prototype),t.ElasticTabstopsLite=r;var i=e("../editor").Editor;e("../config").defineOptions(i.prototype,"editor",{useElasticTabstops:{set:function(e){e?(this.elasticTabstops||(this.elasticTabstops=new r(this)),this.commands.on("afterExec",this.elasticTabstops.onAfterExec),this.commands.on("exec",this.elasticTabstops.onExec),this.on("change",this.elasticTabstops.onChange)):this.elasticTabstops&&(this.commands.removeListener("afterExec",this.elasticTabstops.onAfterExec),this.commands.removeListener("exec",this.elasticTabstops.onExec),this.removeListener("change",this.elasticTabstops.onChange))}}})});
|
||||
(function() {
|
||||
ace.require(["ace/ext/elastic_tabstops_lite"], function() {});
|
||||
})();
|
||||
|
||||
5
var/www/ide/components/editor/ace-editor/ext-emmet.js
Executable file
5
var/www/ide/components/editor/ace-editor/ext-error_marker.js
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
;
|
||||
(function() {
|
||||
ace.require(["ace/ext/error_marker"], function() {});
|
||||
})();
|
||||
|
||||
5
var/www/ide/components/editor/ace-editor/ext-keybinding_menu.js
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
ace.define("ace/ext/menu_tools/overlay_page",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var r=e("../../lib/dom"),i="#ace_settingsmenu, #kbshortcutmenu {background-color: #F7F7F7;color: black;box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);padding: 1em 0.5em 2em 1em;overflow: auto;position: absolute;margin: 0;bottom: 0;right: 0;top: 0;z-index: 9991;cursor: default;}.ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);background-color: rgba(255, 255, 255, 0.6);color: black;}.ace_optionsMenuEntry:hover {background-color: rgba(100, 100, 100, 0.1);-webkit-transition: all 0.5s;transition: all 0.3s}.ace_closeButton {background: rgba(245, 146, 146, 0.5);border: 1px solid #F48A8A;border-radius: 50%;padding: 7px;position: absolute;right: -8px;top: -8px;z-index: 1000;}.ace_closeButton{background: rgba(245, 146, 146, 0.9);}.ace_optionsMenuKey {color: darkslateblue;font-weight: bold;}.ace_optionsMenuCommand {color: darkcyan;font-weight: normal;}";r.importCssString(i),n.exports.overlayPage=function(t,n,i,s,o,u){function l(e){e.keyCode===27&&a.click()}i=i?"top: "+i+";":"",o=o?"bottom: "+o+";":"",s=s?"right: "+s+";":"",u=u?"left: "+u+";":"";var a=document.createElement("div"),f=document.createElement("div");a.style.cssText="margin: 0; padding: 0; position: fixed; top:0; bottom:0; left:0; right:0;z-index: 9990; background-color: rgba(0, 0, 0, 0.3);",a.addEventListener("click",function(){document.removeEventListener("keydown",l),a.parentNode.removeChild(a),t.focus(),a=null}),document.addEventListener("keydown",l),f.style.cssText=i+s+o+u,f.addEventListener("click",function(e){e.stopPropagation()});var c=r.createElement("div");c.style.position="relative";var h=r.createElement("div");h.className="ace_closeButton",h.addEventListener("click",function(){a.click()}),c.appendChild(h),f.appendChild(c),f.appendChild(n),a.appendChild(f),document.body.appendChild(a),t.blur()}}),ace.define("ace/ext/menu_tools/get_editor_keyboard_shortcuts",["require","exports","module","ace/lib/keys"],function(e,t,n){"use strict";var r=e("../../lib/keys");n.exports.getEditorKeybordShortcuts=function(e){var t=r.KEY_MODS,n=[],i={};return e.keyBinding.$handlers.forEach(function(e){var t=e.commandKeyBinding;for(var r in t){var s=r.replace(/(^|-)\w/g,function(e){return e.toUpperCase()}),o=t[r];Array.isArray(o)||(o=[o]),o.forEach(function(e){typeof e!="string"&&(e=e.name),i[e]?i[e].key+="|"+s:(i[e]={key:s,command:e},n.push(i[e]))})}}),n}}),ace.define("ace/ext/keybinding_menu",["require","exports","module","ace/editor","ace/ext/menu_tools/overlay_page","ace/ext/menu_tools/get_editor_keyboard_shortcuts"],function(e,t,n){"use strict";function i(t){if(!document.getElementById("kbshortcutmenu")){var n=e("./menu_tools/overlay_page").overlayPage,r=e("./menu_tools/get_editor_keyboard_shortcuts").getEditorKeybordShortcuts,i=r(t),s=document.createElement("div"),o=i.reduce(function(e,t){return e+'<div class="ace_optionsMenuEntry"><span class="ace_optionsMenuCommand">'+t.command+"</span> : "+'<span class="ace_optionsMenuKey">'+t.key+"</span></div>"},"");s.id="kbshortcutmenu",s.innerHTML="<h1>Keyboard Shortcuts</h1>"+o+"</div>",n(t,s,"0","0","0",null)}}var r=e("ace/editor").Editor;n.exports.init=function(e){r.prototype.showKeyboardShortcuts=function(){i(this)},e.commands.addCommands([{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e,t){e.showKeyboardShortcuts()}}])}});
|
||||
(function() {
|
||||
ace.require(["ace/ext/keybinding_menu"], function() {});
|
||||
})();
|
||||
|
||||
5
var/www/ide/components/editor/ace-editor/ext-language_tools.js
Executable file
5
var/www/ide/components/editor/ace-editor/ext-linking.js
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
ace.define("ace/ext/linking",["require","exports","module","ace/editor","ace/config"],function(e,t,n){function i(e){var t=e.editor,n=e.getAccelKey();if(n){var t=e.editor,r=e.getDocumentPosition(),i=t.session,s=i.getTokenAt(r.row,r.column);t._emit("linkHover",{position:r,token:s})}}function s(e){var t=e.getAccelKey(),n=e.getButton();if(n==0&&t){var r=e.editor,i=e.getDocumentPosition(),s=r.session,o=s.getTokenAt(i.row,i.column);r._emit("linkClick",{position:i,token:o})}}var r=e("ace/editor").Editor;e("../config").defineOptions(r.prototype,"editor",{enableLinking:{set:function(e){e?(this.on("click",s),this.on("mousemove",i)):(this.off("click",s),this.off("mousemove",i))},value:!1}})});
|
||||
(function() {
|
||||
ace.require(["ace/ext/linking"], function() {});
|
||||
})();
|
||||
|
||||
5
var/www/ide/components/editor/ace-editor/ext-modelist.js
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
ace.define("ace/ext/modelist",["require","exports","module"],function(e,t,n){"use strict";function i(e){var t=a.text,n=e.split(/[\/\\]/).pop();for(var i=0;i<r.length;i++)if(r[i].supportsFile(n)){t=r[i];break}return t}var r=[],s=function(e,t,n){this.name=e,this.caption=t,this.mode="ace/mode/"+e,this.extensions=n;var r;/\^/.test(n)?r=n.replace(/\|(\^)?/g,function(e,t){return"$|"+(t?"^":"^.*\\.")})+"$":r="^.*\\.("+n+")$",this.extRe=new RegExp(r,"gi")};s.prototype.supportsFile=function(e){return e.match(this.extRe)};var o={ABAP:["abap"],ABC:["abc"],ActionScript:["as"],ADA:["ada|adb"],Apache_Conf:["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],AsciiDoc:["asciidoc|adoc"],Assembly_x86:["asm|a"],AutoHotKey:["ahk"],BatchFile:["bat|cmd"],C_Cpp:["cpp|c|cc|cxx|h|hh|hpp|ino"],C9Search:["c9search_results"],Cirru:["cirru|cr"],Clojure:["clj|cljs"],Cobol:["CBL|COB"],coffee:["coffee|cf|cson|^Cakefile"],ColdFusion:["cfm"],CSharp:["cs"],CSS:["css"],Curly:["curly"],D:["d|di"],Dart:["dart"],Diff:["diff|patch"],Dockerfile:["^Dockerfile"],Dot:["dot"],Dummy:["dummy"],DummySyntax:["dummy"],Eiffel:["e|ge"],EJS:["ejs"],Elixir:["ex|exs"],Elm:["elm"],Erlang:["erl|hrl"],Forth:["frt|fs|ldr"],FTL:["ftl"],Gcode:["gcode"],Gherkin:["feature"],Gitignore:["^.gitignore"],Glsl:["glsl|frag|vert"],Gobstones:["gbs"],golang:["go"],Groovy:["groovy"],HAML:["haml"],Handlebars:["hbs|handlebars|tpl|mustache"],Haskell:["hs"],haXe:["hx"],HTML:["html|htm|xhtml"],HTML_Elixir:["eex|html.eex"],HTML_Ruby:["erb|rhtml|html.erb"],INI:["ini|conf|cfg|prefs"],Io:["io"],Jack:["jack"],Jade:["jade"],Java:["java"],JavaScript:["js|jsm|jsx"],JSON:["json"],JSONiq:["jq"],JSP:["jsp"],JSX:["jsx"],Julia:["jl"],LaTeX:["tex|latex|ltx|bib"],Lean:["lean|hlean"],LESS:["less"],Liquid:["liquid"],Lisp:["lisp"],LiveScript:["ls"],LogiQL:["logic|lql"],LSL:["lsl"],Lua:["lua"],LuaPage:["lp"],Lucene:["lucene"],Makefile:["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],Markdown:["md|markdown"],Mask:["mask"],MATLAB:["matlab"],Maze:["mz"],MEL:["mel"],MUSHCode:["mc|mush"],MySQL:["mysql"],Nix:["nix"],NSIS:["nsi|nsh"],ObjectiveC:["m|mm"],OCaml:["ml|mli"],Pascal:["pas|p"],Perl:["pl|pm"],pgSQL:["pgsql"],PHP:["php|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],Powershell:["ps1"],Praat:["praat|praatscript|psc|proc"],Prolog:["plg|prolog"],Properties:["properties"],Protobuf:["proto"],Python:["py"],R:["r"],Razor:["cshtml"],RDoc:["Rd"],RHTML:["Rhtml"],RST:["rst"],Ruby:["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],Rust:["rs"],SASS:["sass"],SCAD:["scad"],Scala:["scala"],Scheme:["scm|sm|rkt|oak|scheme"],SCSS:["scss"],SH:["sh|bash|^.bashrc"],SJS:["sjs"],Smarty:["smarty|tpl"],snippets:["snippets"],Soy_Template:["soy"],Space:["space"],SQL:["sql"],SQLServer:["sqlserver"],Stylus:["styl|stylus"],SVG:["svg"],Swift:["swift"],Tcl:["tcl"],Tex:["tex"],Text:["txt"],Textile:["textile"],Toml:["toml"],Twig:["twig|swig"],Typescript:["ts|typescript|str"],Vala:["vala"],VBScript:["vbs|vb"],Velocity:["vm"],Verilog:["v|vh|sv|svh"],VHDL:["vhd|vhdl"],Wollok:["wlk|wpgm|wtest"],XML:["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],XQuery:["xq"],YAML:["yaml|yml"],Django:["html"]},u={ObjectiveC:"Objective-C",CSharp:"C#",golang:"Go",C_Cpp:"C and C++",coffee:"CoffeeScript",HTML_Ruby:"HTML (Ruby)",HTML_Elixir:"HTML (Elixir)",FTL:"FreeMarker"},a={};for(var f in o){var l=o[f],c=(u[f]||f).replace(/_/g," "),h=f.toLowerCase(),p=new s(h,c,l[0]);a[h]=p,r.push(p)}n.exports={getModeForPath:i,modes:r,modesByName:a}});
|
||||
(function() {
|
||||
ace.require(["ace/ext/modelist"], function() {});
|
||||
})();
|
||||
|
||||
5
var/www/ide/components/editor/ace-editor/ext-old_ie.js
Executable file
5
var/www/ide/components/editor/ace-editor/ext-searchbox.js
Executable file
5
var/www/ide/components/editor/ace-editor/ext-settings_menu.js
Executable file
5
var/www/ide/components/editor/ace-editor/ext-spellcheck.js
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
ace.define("ace/ext/spellcheck",["require","exports","module","ace/lib/event","ace/editor","ace/config"],function(e,t,n){"use strict";var r=e("../lib/event");t.contextMenuHandler=function(e){var t=e.target,n=t.textInput.getElement();if(!t.selection.isEmpty())return;var i=t.getCursorPosition(),s=t.session.getWordRange(i.row,i.column),o=t.session.getTextRange(s);t.session.tokenRe.lastIndex=0;if(!t.session.tokenRe.test(o))return;var u="",a=o+" "+u;n.value=a,n.setSelectionRange(o.length,o.length+1),n.setSelectionRange(0,0),n.setSelectionRange(0,o.length);var f=!1;r.addListener(n,"keydown",function l(){r.removeListener(n,"keydown",l),f=!0}),t.textInput.setInputHandler(function(e){console.log(e,a,n.selectionStart,n.selectionEnd);if(e==a)return"";if(e.lastIndexOf(a,0)===0)return e.slice(a.length);if(e.substr(n.selectionEnd)==a)return e.slice(0,-a.length);if(e.slice(-2)==u){var r=e.slice(0,-2);if(r.slice(-1)==" ")return f?r.substring(0,n.selectionEnd):(r=r.slice(0,-1),t.session.replace(s,r),"")}return e})};var i=e("../editor").Editor;e("../config").defineOptions(i.prototype,"editor",{spellcheck:{set:function(e){var n=this.textInput.getElement();n.spellcheck=!!e,e?this.on("nativecontextmenu",t.contextMenuHandler):this.removeListener("nativecontextmenu",t.contextMenuHandler)},value:!0}})});
|
||||
(function() {
|
||||
ace.require(["ace/ext/spellcheck"], function() {});
|
||||
})();
|
||||
|
||||
5
var/www/ide/components/editor/ace-editor/ext-split.js
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
ace.define("ace/split",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/editor","ace/virtual_renderer","ace/edit_session"],function(e,t,n){"use strict";function l(e,t){this.$u=e,this.$doc=t}var r=e("./lib/oop"),i=e("./lib/lang"),s=e("./lib/event_emitter").EventEmitter,o=e("./editor").Editor,u=e("./virtual_renderer").VirtualRenderer,a=e("./edit_session").EditSession,f=function(e,t,n){this.BELOW=1,this.BESIDE=0,this.$container=e,this.$theme=t,this.$splits=0,this.$editorCSS="",this.$editors=[],this.$orientation=this.BESIDE,this.setSplits(n||1),this.$cEditor=this.$editors[0],this.on("focus",function(e){this.$cEditor=e}.bind(this))};(function(){r.implement(this,s),this.$createEditor=function(){var e=document.createElement("div");e.className=this.$editorCSS,e.style.cssText="position: absolute; top:0px; bottom:0px",this.$container.appendChild(e);var t=new o(new u(e,this.$theme));return t.on("focus",function(){this._emit("focus",t)}.bind(this)),this.$editors.push(t),t.setFontSize(this.$fontSize),t},this.setSplits=function(e){var t;if(e<1)throw"The number of splits have to be > 0!";if(e==this.$splits)return;if(e>this.$splits){while(this.$splits<this.$editors.length&&this.$splits<e)t=this.$editors[this.$splits],this.$container.appendChild(t.container),t.setFontSize(this.$fontSize),this.$splits++;while(this.$splits<e)this.$createEditor(),this.$splits++}else while(this.$splits>e)t=this.$editors[this.$splits-1],this.$container.removeChild(t.container),this.$splits--;this.resize()},this.getSplits=function(){return this.$splits},this.getEditor=function(e){return this.$editors[e]},this.getCurrentEditor=function(){return this.$cEditor},this.focus=function(){this.$cEditor.focus()},this.blur=function(){this.$cEditor.blur()},this.setTheme=function(e){this.$editors.forEach(function(t){t.setTheme(e)})},this.setKeyboardHandler=function(e){this.$editors.forEach(function(t){t.setKeyboardHandler(e)})},this.forEach=function(e,t){this.$editors.forEach(e,t)},this.$fontSize="",this.setFontSize=function(e){this.$fontSize=e,this.forEach(function(t){t.setFontSize(e)})},this.$cloneSession=function(e){var t=new a(e.getDocument(),e.getMode()),n=e.getUndoManager();if(n){var r=new l(n,t);t.setUndoManager(r)}return t.$informUndoManager=i.delayedCall(function(){t.$deltas=[]}),t.setTabSize(e.getTabSize()),t.setUseSoftTabs(e.getUseSoftTabs()),t.setOverwrite(e.getOverwrite()),t.setBreakpoints(e.getBreakpoints()),t.setUseWrapMode(e.getUseWrapMode()),t.setUseWorker(e.getUseWorker()),t.setWrapLimitRange(e.$wrapLimitRange.min,e.$wrapLimitRange.max),t.$foldData=e.$cloneFoldData(),t},this.setSession=function(e,t){var n;t==null?n=this.$cEditor:n=this.$editors[t];var r=this.$editors.some(function(t){return t.session===e});return r&&(e=this.$cloneSession(e)),n.setSession(e),e},this.getOrientation=function(){return this.$orientation},this.setOrientation=function(e){if(this.$orientation==e)return;this.$orientation=e,this.resize()},this.resize=function(){var e=this.$container.clientWidth,t=this.$container.clientHeight,n;if(this.$orientation==this.BESIDE){var r=e/this.$splits;for(var i=0;i<this.$splits;i++)n=this.$editors[i],n.container.style.width=r+"px",n.container.style.top="0px",n.container.style.left=i*r+"px",n.container.style.height=t+"px",n.resize()}else{var s=t/this.$splits;for(var i=0;i<this.$splits;i++)n=this.$editors[i],n.container.style.width=e+"px",n.container.style.top=i*s+"px",n.container.style.left="0px",n.container.style.height=s+"px",n.resize()}}}).call(f.prototype),function(){this.execute=function(e){this.$u.execute(e)},this.undo=function(){var e=this.$u.undo(!0);e&&this.$doc.selection.setSelectionRange(e)},this.redo=function(){var e=this.$u.redo(!0);e&&this.$doc.selection.setSelectionRange(e)},this.reset=function(){this.$u.reset()},this.hasUndo=function(){return this.$u.hasUndo()},this.hasRedo=function(){return this.$u.hasRedo()}}.call(l.prototype),t.Split=f}),ace.define("ace/ext/split",["require","exports","module","ace/split"],function(e,t,n){"use strict";n.exports=e("../split")});
|
||||
(function() {
|
||||
ace.require(["ace/ext/split"], function() {});
|
||||
})();
|
||||
|
||||
5
var/www/ide/components/editor/ace-editor/ext-static_highlight.js
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
ace.define("ace/ext/static_highlight",["require","exports","module","ace/edit_session","ace/layer/text","ace/config","ace/lib/dom"],function(e,t,n){"use strict";var r=e("../edit_session").EditSession,i=e("../layer/text").Text,s=".ace_static_highlight {font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', 'Droid Sans Mono', monospace;font-size: 12px;white-space: pre-wrap}.ace_static_highlight .ace_gutter {width: 2em;text-align: right;padding: 0 3px 0 0;margin-right: 3px;}.ace_static_highlight.ace_show_gutter .ace_line {padding-left: 2.6em;}.ace_static_highlight .ace_line { position: relative; }.ace_static_highlight .ace_gutter-cell {-moz-user-select: -moz-none;-khtml-user-select: none;-webkit-user-select: none;user-select: none;top: 0;bottom: 0;left: 0;position: absolute;}.ace_static_highlight .ace_gutter-cell:before {content: counter(ace_line, decimal);counter-increment: ace_line;}.ace_static_highlight {counter-reset: ace_line;}",o=e("../config"),u=e("../lib/dom"),a=function(){this.config={}};a.prototype=i.prototype;var f=function(e,t,n){var r=e.className.match(/lang-(\w+)/),i=t.mode||r&&"ace/mode/"+r[1];if(!i)return!1;var s=t.theme||"ace/theme/textmate",o="",a=[];if(e.firstElementChild){var l=0;for(var c=0;c<e.childNodes.length;c++){var h=e.childNodes[c];h.nodeType==3?(l+=h.data.length,o+=h.data):a.push(l,h)}}else o=u.getInnerText(e),t.trim&&(o=o.trim());f.render(o,i,s,t.firstLineNumber,!t.showGutter,function(t){u.importCssString(t.css,"ace_highlight"),e.innerHTML=t.html;var r=e.firstChild.firstChild;for(var i=0;i<a.length;i+=2){var s=t.session.doc.indexToPosition(a[i]),o=a[i+1],f=r.children[s.row];f&&f.appendChild(o)}n&&n()})};f.render=function(e,t,n,i,s,u){function h(){var r=f.renderSync(e,t,n,i,s);return u?u(r):r}var a=1,l=r.prototype.$modes;typeof n=="string"&&(a++,o.loadModule(["theme",n],function(e){n=e,--a||h()}));var c;return t&&typeof t=="object"&&!t.getTokenizer&&(c=t,t=c.path),typeof t=="string"&&(a++,o.loadModule(["mode",t],function(e){if(!l[t]||c)l[t]=new e.Mode(c);t=l[t],--a||h()})),--a||h()},f.renderSync=function(e,t,n,i,o){i=parseInt(i||1,10);var u=new r("");u.setUseWorker(!1),u.setMode(t);var f=new a;f.setSession(u),u.setValue(e);var l=[],c=u.getLength();for(var h=0;h<c;h++)l.push("<div class='ace_line'>"),o||l.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'></span>"),f.$renderLine(l,h,!0,!1),l.push("\n</div>");var p="<div class='"+n.cssClass+"'>"+"<div class='ace_static_highlight"+(o?"":" ace_show_gutter")+"' style='counter-reset:ace_line "+(i-1)+"'>"+l.join("")+"</div>"+"</div>";return f.destroy(),{css:s+n.cssText,html:p,session:u}},n.exports=f,n.exports.highlight=f});
|
||||
(function() {
|
||||
ace.require(["ace/ext/static_highlight"], function() {});
|
||||
})();
|
||||
|
||||
5
var/www/ide/components/editor/ace-editor/ext-statusbar.js
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
ace.define("ace/ext/statusbar",["require","exports","module","ace/lib/dom","ace/lib/lang"],function(e,t,n){"use strict";var r=e("ace/lib/dom"),i=e("ace/lib/lang"),s=function(e,t){this.element=r.createElement("div"),this.element.className="ace_status-indicator",this.element.style.cssText="display: inline-block;",t.appendChild(this.element);var n=i.delayedCall(function(){this.updateStatus(e)}.bind(this)).schedule.bind(null,100);e.on("changeStatus",n),e.on("changeSelection",n),e.on("keyboardActivity",n)};(function(){this.updateStatus=function(e){function n(e,n){e&&t.push(e,n||"|")}var t=[];n(e.keyBinding.getStatusText(e)),e.commands.recording&&n("REC");var r=e.selection,i=r.lead;if(!r.isEmpty()){var s=e.getSelectionRange();n("("+(s.end.row-s.start.row)+":"+(s.end.column-s.start.column)+")"," ")}n(i.row+":"+i.column," "),r.rangeCount&&n("["+r.rangeCount+"]"," "),t.pop(),this.element.textContent=t.join("")}}).call(s.prototype),t.StatusBar=s});
|
||||
(function() {
|
||||
ace.require(["ace/ext/statusbar"], function() {});
|
||||
})();
|
||||
|
||||
5
var/www/ide/components/editor/ace-editor/ext-textarea.js
Executable file
5
var/www/ide/components/editor/ace-editor/ext-themelist.js
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
ace.define("ace/ext/themelist",["require","exports","module","ace/lib/fixoldbrowsers"],function(e,t,n){"use strict";e("ace/lib/fixoldbrowsers");var r=[["Chrome"],["Clouds"],["Crimson Editor"],["Dawn"],["Dreamweaver"],["Eclipse"],["GitHub"],["IPlastic"],["Solarized Light"],["TextMate"],["Tomorrow"],["XCode"],["Kuroir"],["KatzenMilch"],["SQL Server","sqlserver","light"],["Ambiance","ambiance","dark"],["Chaos","chaos","dark"],["Clouds Midnight","clouds_midnight","dark"],["Cobalt","cobalt","dark"],["idle Fingers","idle_fingers","dark"],["krTheme","kr_theme","dark"],["Merbivore","merbivore","dark"],["Merbivore Soft","merbivore_soft","dark"],["Mono Industrial","mono_industrial","dark"],["Monokai","monokai","dark"],["Pastel on dark","pastel_on_dark","dark"],["Solarized Dark","solarized_dark","dark"],["Terminal","terminal","dark"],["Tomorrow Night","tomorrow_night","dark"],["Tomorrow Night Blue","tomorrow_night_blue","dark"],["Tomorrow Night Bright","tomorrow_night_bright","dark"],["Tomorrow Night 80s","tomorrow_night_eighties","dark"],["Twilight","twilight","dark"],["Vibrant Ink","vibrant_ink","dark"]];t.themesByName={},t.themes=r.map(function(e){var n=e[1]||e[0].replace(/ /g,"_").toLowerCase(),r={caption:e[0],theme:"ace/theme/"+n,isDark:e[2]=="dark",name:n};return t.themesByName[n]=r,r})});
|
||||
(function() {
|
||||
ace.require(["ace/ext/themelist"], function() {});
|
||||
})();
|
||||
|
||||
5
var/www/ide/components/editor/ace-editor/ext-whitespace.js
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
ace.define("ace/ext/whitespace",["require","exports","module","ace/lib/lang"],function(e,t,n){"use strict";var r=e("../lib/lang");t.$detectIndentation=function(e,t){function c(e){var t=0;for(var r=e;r<n.length;r+=e)t+=n[r]||0;return t}var n=[],r=[],i=0,s=0,o=Math.min(e.length,1e3);for(var u=0;u<o;u++){var a=e[u];if(!/^\s*[^*+\-\s]/.test(a))continue;if(a[0]==" ")i++,s=-Number.MAX_VALUE;else{var f=a.match(/^ */)[0].length;if(f&&a[f]!=" "){var l=f-s;l>0&&!(s%l)&&!(f%l)&&(r[l]=(r[l]||0)+1),n[f]=(n[f]||0)+1}s=f}while(u<o&&a[a.length-1]=="\\")a=e[u++]}var h=r.reduce(function(e,t){return e+t},0),p={score:0,length:0},d=0;for(var u=1;u<12;u++){var v=c(u);u==1?(d=v,v=n[1]?.9:.8,n.length||(v=0)):v/=d,r[u]&&(v+=r[u]/h),v>p.score&&(p={score:v,length:u})}if(p.score&&p.score>1.4)var m=p.length;if(i>d+1){if(m==1||d<i/4||p.score<1.8)m=undefined;return{ch:" ",length:m}}if(d>i+1)return{ch:" ",length:m}},t.detectIndentation=function(e){var n=e.getLines(0,1e3),r=t.$detectIndentation(n)||{};return r.ch&&e.setUseSoftTabs(r.ch==" "),r.length&&e.setTabSize(r.length),r},t.trimTrailingSpace=function(e,t){var n=e.getDocument(),r=n.getAllLines(),i=t?-1:0;for(var s=0,o=r.length;s<o;s++){var u=r[s],a=u.search(/\s+$/);a>i&&n.removeInLine(s,a,u.length)}},t.convertIndentation=function(e,t,n){var i=e.getTabString()[0],s=e.getTabSize();n||(n=s),t||(t=i);var o=t==" "?t:r.stringRepeat(t,n),u=e.doc,a=u.getAllLines(),f={},l={};for(var c=0,h=a.length;c<h;c++){var p=a[c],d=p.match(/^\s*/)[0];if(d){var v=e.$getStringScreenWidth(d)[0],m=Math.floor(v/s),g=v%s,y=f[m]||(f[m]=r.stringRepeat(o,m));y+=l[g]||(l[g]=r.stringRepeat(" ",g)),y!=d&&(u.removeInLine(c,0,d.length),u.insertInLine({row:c,column:0},y))}}e.setTabSize(n),e.setUseSoftTabs(t==" ")},t.$parseStringArg=function(e){var t={};/t/.test(e)?t.ch=" ":/s/.test(e)&&(t.ch=" ");var n=e.match(/\d+/);return n&&(t.length=parseInt(n[0],10)),t},t.$parseArg=function(e){return e?typeof e=="string"?t.$parseStringArg(e):typeof e.text=="string"?t.$parseStringArg(e.text):e:{}},t.commands=[{name:"detectIndentation",exec:function(e){t.detectIndentation(e.session)}},{name:"trimTrailingSpace",exec:function(e){t.trimTrailingSpace(e.session)}},{name:"convertIndentation",exec:function(e,n){var r=t.$parseArg(n);t.convertIndentation(e.session,r.ch,r.length)}},{name:"setIndentation",exec:function(e,n){var r=t.$parseArg(n);r.length&&e.session.setTabSize(r.length),r.ch&&e.session.setUseSoftTabs(r.ch==" ")}}]});
|
||||
(function() {
|
||||
ace.require(["ace/ext/whitespace"], function() {});
|
||||
})();
|
||||
|
||||
1
var/www/ide/components/editor/ace-editor/keybinding-emacs.js
Executable file
1
var/www/ide/components/editor/ace-editor/keybinding-vim.js
Executable file
1
var/www/ide/components/editor/ace-editor/mode-abap.js
Executable file
1
var/www/ide/components/editor/ace-editor/mode-abc.js
Executable file
|
|
@ -0,0 +1 @@
|
|||
ace.define("ace/mode/abc_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:["zupfnoter.information.comment.line.percentage","information.keyword","in formation.keyword.embedded"],regex:"(%%%%)(hn\\.[a-z]*)(.*)",comment:"Instruction Comment"},{token:["information.comment.line.percentage","information.keyword.embedded"],regex:"(%%)(.*)",comment:"Instruction Comment"},{token:"comment.line.percentage",regex:"%.*",comment:"Comments"},{token:"barline.keyword.operator",regex:"[\\[:]*[|:][|\\]:]*(?:\\[?[0-9]+)?|\\[[0-9]+",comment:"Bar lines"},{token:["information.keyword.embedded","information.argument.string.unquoted"],regex:"(\\[[A-Za-z]:)([^\\]]*\\])",comment:"embedded Header lines"},{token:["information.keyword","information.argument.string.unquoted"],regex:"^([A-Za-z]:)([^%\\\\]*)",comment:"Header lines"},{token:["text","entity.name.function","string.unquoted","text"],regex:"(\\[)([A-Z]:)(.*?)(\\])",comment:"Inline fields"},{token:["accent.constant.language","pitch.constant.numeric","duration.constant.numeric"],regex:"([\\^=_]*)([A-Ga-gz][,']*)([0-9]*/*[><0-9]*)",comment:"Notes"},{token:"zupfnoter.jumptarget.string.quoted",regex:'[\\"!]\\^\\:.*?[\\"!]',comment:"Zupfnoter jumptarget"},{token:"zupfnoter.goto.string.quoted",regex:'[\\"!]\\^\\@.*?[\\"!]',comment:"Zupfnoter goto"},{token:"zupfnoter.annotation.string.quoted",regex:'[\\"!]\\^\\!.*?[\\"!]',comment:"Zupfnoter annoation"},{token:"zupfnoter.annotationref.string.quoted",regex:'[\\"!]\\^\\#.*?[\\"!]',comment:"Zupfnoter annotation reference"},{token:"chordname.string.quoted",regex:'[\\"!]\\^.*?[\\"!]',comment:"abc chord"},{token:"string.quoted",regex:'[\\"!].*?[\\"!]',comment:"abc annotation"}]},this.normalizeRules()};s.metaData={fileTypes:["abc"],name:"ABC",scopeName:"text.abcnotation"},r.inherits(s,i),t.ABCHighlightRules=s}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\{|\[)[^\}\]]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);if(this.singleLineBlockCommentRe.test(r)&&!this.startRegionRe.test(r)&&!this.tripleStarBlockCommentRe.test(r))return"";var i=this._getFoldWidgetBase(e,t,n);return!i&&this.startRegionRe.test(r)?"start":i},this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n);if(this.startRegionRe.test(i))return this.getCommentRegionBlock(e,i,n);var s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!="all"&&(u=null)),u}if(t==="markbegin")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,"all",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)},this.getCommentRegionBlock=function(e,t,n){var r=t.search(/\s*$/),s=e.getLength(),o=n,u=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,a=1;while(++n<s){t=e.getLine(n);var f=u.exec(t);if(!f)continue;f[1]?a--:a++;if(!a)break}var l=n;if(l>o)return new i(o,r,l,t.length)}}.call(o.prototype)}),ace.define("ace/mode/abc",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/abc_highlight_rules","ace/mode/folding/cstyle"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./abc_highlight_rules").ABCHighlightRules,o=e("./folding/cstyle").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.$id="ace/mode/abc"}.call(u.prototype),t.Mode=u})
|
||||
1
var/www/ide/components/editor/ace-editor/mode-actionscript.js
Executable file
1
var/www/ide/components/editor/ace-editor/mode-ada.js
Executable file
|
|
@ -0,0 +1 @@
|
|||
ace.define("ace/mode/ada_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){var e="abort|else|new|return|abs|elsif|not|reverse|abstract|end|null|accept|entry|select|access|exception|of|separate|aliased|exit|or|some|all|others|subtype|and|for|out|synchronized|array|function|overriding|at|tagged|generic|package|task|begin|goto|pragma|terminate|body|private|then|if|procedure|type|case|in|protected|constant|interface|until||is|raise|use|declare|range|delay|limited|record|when|delta|loop|rem|while|digits|renames|with|do|mod|requeue|xor",t="true|false|null",n="count|min|max|avg|sum|rank|now|coalesce|main",r=this.createKeywordMapper({"support.function":n,keyword:e,"constant.language":t},"identifier",!0);this.$rules={start:[{token:"comment",regex:"--.*$"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:r,regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"paren.lparen",regex:"[\\(]"},{token:"paren.rparen",regex:"[\\)]"},{token:"text",regex:"\\s+"}]}};r.inherits(s,i),t.AdaHighlightRules=s}),ace.define("ace/mode/ada",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ada_highlight_rules","ace/range"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./ada_highlight_rules").AdaHighlightRules,o=e("../range").Range,u=function(){this.HighlightRules=s};r.inherits(u,i),function(){this.lineCommentStart="--",this.$id="ace/mode/ada"}.call(u.prototype),t.Mode=u})
|
||||
1
var/www/ide/components/editor/ace-editor/mode-apache_conf.js
Executable file
1
var/www/ide/components/editor/ace-editor/mode-applescript.js
Executable file
1
var/www/ide/components/editor/ace-editor/mode-asciidoc.js
Executable file
1
var/www/ide/components/editor/ace-editor/mode-assembly_x86.js
Executable file
1
var/www/ide/components/editor/ace-editor/mode-autohotkey.js
Executable file
1
var/www/ide/components/editor/ace-editor/mode-batchfile.js
Executable file
|
|
@ -0,0 +1 @@
|
|||
ace.define("ace/mode/batchfile_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"keyword.command.dosbatch",regex:"\\b(?:append|assoc|at|attrib|break|cacls|cd|chcp|chdir|chkdsk|chkntfs|cls|cmd|color|comp|compact|convert|copy|date|del|dir|diskcomp|diskcopy|doskey|echo|endlocal|erase|fc|find|findstr|format|ftype|graftabl|help|keyb|label|md|mkdir|mode|more|move|path|pause|popd|print|prompt|pushd|rd|recover|ren|rename|replace|restore|rmdir|set|setlocal|shift|sort|start|subst|time|title|tree|type|ver|verify|vol|xcopy)\\b",caseInsensitive:!0},{token:"keyword.control.statement.dosbatch",regex:"\\b(?:goto|call|exit)\\b",caseInsensitive:!0},{token:"keyword.control.conditional.if.dosbatch",regex:"\\bif\\s+not\\s+(?:exist|defined|errorlevel|cmdextversion)\\b",caseInsensitive:!0},{token:"keyword.control.conditional.dosbatch",regex:"\\b(?:if|else)\\b",caseInsensitive:!0},{token:"keyword.control.repeat.dosbatch",regex:"\\bfor\\b",caseInsensitive:!0},{token:"keyword.operator.dosbatch",regex:"\\b(?:EQU|NEQ|LSS|LEQ|GTR|GEQ)\\b"},{token:["doc.comment","comment"],regex:"(?:^|\\b)(rem)($|\\s.*$)",caseInsensitive:!0},{token:"comment.line.colons.dosbatch",regex:"::.*$"},{include:"variable"},{token:"punctuation.definition.string.begin.shell",regex:'"',push:[{token:"punctuation.definition.string.end.shell",regex:'"',next:"pop"},{include:"variable"},{defaultToken:"string.quoted.double.dosbatch"}]},{token:"keyword.operator.pipe.dosbatch",regex:"[|]"},{token:"keyword.operator.redirect.shell",regex:"&>|\\d*>&\\d*|\\d*(?:>>|>|<)|\\d*<&|\\d*<>"}],variable:[{token:"constant.numeric",regex:"%%\\w+|%[*\\d]|%\\w+%"},{token:"constant.numeric",regex:"%~\\d+"},{token:["markup.list","constant.other","markup.list"],regex:"(%)(\\w+)(%?)"}]},this.normalizeRules()};s.metaData={name:"Batch File",scopeName:"source.dosbatch",fileTypes:["bat"]},r.inherits(s,i),t.BatchFileHighlightRules=s}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\{|\[)[^\}\]]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);if(this.singleLineBlockCommentRe.test(r)&&!this.startRegionRe.test(r)&&!this.tripleStarBlockCommentRe.test(r))return"";var i=this._getFoldWidgetBase(e,t,n);return!i&&this.startRegionRe.test(r)?"start":i},this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n);if(this.startRegionRe.test(i))return this.getCommentRegionBlock(e,i,n);var s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!="all"&&(u=null)),u}if(t==="markbegin")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,"all",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)},this.getCommentRegionBlock=function(e,t,n){var r=t.search(/\s*$/),s=e.getLength(),o=n,u=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,a=1;while(++n<s){t=e.getLine(n);var f=u.exec(t);if(!f)continue;f[1]?a--:a++;if(!a)break}var l=n;if(l>o)return new i(o,r,l,t.length)}}.call(o.prototype)}),ace.define("ace/mode/batchfile",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/batchfile_highlight_rules","ace/mode/folding/cstyle"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./batchfile_highlight_rules").BatchFileHighlightRules,o=e("./folding/cstyle").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart="::",this.blockComment="",this.$id="ace/mode/batchfile"}.call(u.prototype),t.Mode=u})
|
||||
1
var/www/ide/components/editor/ace-editor/mode-c9search.js
Executable file
|
|
@ -0,0 +1 @@
|
|||
ace.define("ace/mode/c9search_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";function o(e,t){try{return new RegExp(e,t)}catch(n){}}var r=e("../lib/oop"),i=e("../lib/lang"),s=e("./text_highlight_rules").TextHighlightRules,u=function(){this.$rules={start:[{tokenNames:["c9searchresults.constant.numeric","c9searchresults.text","c9searchresults.text","c9searchresults.keyword"],regex:"(^\\s+[0-9]+)(:\\s)(.+)",onMatch:function(e,t,n){var r=this.splitRegex.exec(e),i=this.tokenNames,s=[{type:i[0],value:r[1]},{type:i[1],value:r[2]}],o=n[1],u=r[3],a,f=0;if(o&&o.exec){o.lastIndex=0;while(a=o.exec(u)){var l=u.substring(f,a.index);f=o.lastIndex,l&&s.push({type:i[2],value:l});if(a[0])s.push({type:i[3],value:a[0]});else if(!l)break}}return f<u.length&&s.push({type:i[2],value:u.substr(f)}),s}},{token:["string","text"],regex:"(\\S.*)(:$)"},{regex:"Searching for .*$",onMatch:function(e,t,n){var r=e.split("");if(r.length<3)return"text";var s,u,a,f=0,l=[{value:r[f++]+"'",type:"text"},{value:u=r[f++],type:"text"},{value:"'"+r[f++],type:"text"}];r[2]!==" in"&&(a=r[f],l.push({value:"'"+r[f++]+"'",type:"text"},{value:r[f++],type:"text"})),l.push({value:" "+r[f++]+" ",type:"text"}),r[f+1]?(s=r[f+1],l.push({value:"("+r[f+1]+")",type:"text"}),f+=1):f-=1;while(f++<r.length)r[f]&&l.push({value:r[f],type:"text"});a&&(u=a,s=""),u&&(/regex/.test(s)||(u=i.escapeRegExp(u)),/whole/.test(s)&&(u="\\b"+u+"\\b"));var c=u&&o("("+u+")",/ sensitive/.test(s)?"g":"ig");return c&&(n[0]=t,n[1]=c),l}},{regex:"\\d+",token:"constant.numeric"}]}};r.inherits(u,s),t.C9SearchHighlightRules=u}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),ace.define("ace/mode/folding/c9search",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(){};r.inherits(o,s),function(){this.foldingStartMarker=/^(\S.*\:|Searching for.*)$/,this.foldingStopMarker=/^(\s+|Found.*)$/,this.getFoldWidgetRange=function(e,t,n){var r=e.doc.getAllLines(n),s=r[n],o=/^(Found.*|Searching for.*)$/,u=/^(\S.*\:|\s*)$/,a=o.test(s)?o:u,f=n,l=n;if(this.foldingStartMarker.test(s)){for(var c=n+1,h=e.getLength();c<h;c++)if(a.test(r[c]))break;l=c}else if(this.foldingStopMarker.test(s)){for(var c=n-1;c>=0;c--){s=r[c];if(a.test(s))break}f=c}if(f!=l){var p=s.length;return a===o&&(p=s.search(/\(Found[^)]+\)$|$/)),new i(f,p,l,0)}}}.call(o.prototype)}),ace.define("ace/mode/c9search",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/c9search_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/c9search"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./c9search_highlight_rules").C9SearchHighlightRules,o=e("./matching_brace_outdent").MatchingBraceOutdent,u=e("./folding/c9search").FoldMode,a=function(){this.HighlightRules=s,this.$outdent=new o,this.foldingRules=new u};r.inherits(a,i),function(){this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t);return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id="ace/mode/c9search"}.call(a.prototype),t.Mode=a})
|
||||
1
var/www/ide/components/editor/ace-editor/mode-c_cpp.js
Executable file
1
var/www/ide/components/editor/ace-editor/mode-cirru.js
Executable file
|
|
@ -0,0 +1 @@
|
|||
ace.define("ace/mode/cirru_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"constant.numeric",regex:/[\d\.]+/},{token:"comment.line.double-dash",regex:/--/,next:"comment"},{token:"storage.modifier",regex:/\(/},{token:"storage.modifier",regex:/\,/,next:"line"},{token:"support.function",regex:/[^\(\)\"\s]+/,next:"line"},{token:"string.quoted.double",regex:/"/,next:"string"},{token:"storage.modifier",regex:/\)/}],comment:[{token:"comment.line.double-dash",regex:/\ +[^\n]+/,next:"start"}],string:[{token:"string.quoted.double",regex:/"/,next:"line"},{token:"constant.character.escape",regex:/\\/,next:"escape"},{token:"string.quoted.double",regex:/[^\\\"]+/}],escape:[{token:"constant.character.escape",regex:/./,next:"string"}],line:[{token:"constant.numeric",regex:/[\d\.]+/},{token:"markup.raw",regex:/^\s*/,next:"start"},{token:"storage.modifier",regex:/\$/,next:"start"},{token:"variable.parameter",regex:/[^\(\)\"\s]+/},{token:"storage.modifier",regex:/\(/,next:"start"},{token:"storage.modifier",regex:/\)/},{token:"markup.raw",regex:/^\ */,next:"start"},{token:"string.quoted.double",regex:/"/,next:"string"}]}};r.inherits(s,i),t.CirruHighlightRules=s}),ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("./fold_mode").FoldMode,s=e("../../range").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!="#")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!="#")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\S/),a=s.search(/\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?"start":"","";if(u==-1){if(i==a&&r[i]=="#"&&s[i]=="#")return e.foldWidgets[n-1]="",e.foldWidgets[n+1]="","start"}else if(u==i&&r[i]=="#"&&o[i]=="#"&&e.getLine(n-2).search(/\S/)==-1)return e.foldWidgets[n-1]="start",e.foldWidgets[n+1]="","";return u!=-1&&u<i?e.foldWidgets[n-1]="start":e.foldWidgets[n-1]="",i<a?"start":""}}.call(o.prototype)}),ace.define("ace/mode/cirru",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/cirru_highlight_rules","ace/mode/folding/coffee"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./cirru_highlight_rules").CirruHighlightRules,o=e("./folding/coffee").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart="--",this.$id="ace/mode/cirru"}.call(u.prototype),t.Mode=u})
|
||||
1
var/www/ide/components/editor/ace-editor/mode-clojure.js
Executable file
1
var/www/ide/components/editor/ace-editor/mode-cobol.js
Executable file
|
|
@ -0,0 +1 @@
|
|||
ace.define("ace/mode/cobol_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){var e="ACCEPT|MERGE|SUM|ADD||MESSAGE|TABLE|ADVANCING|MODE|TAPE|AFTER|MULTIPLY|TEST|ALL|NEGATIVE|TEXT|ALPHABET|NEXT|THAN|ALSO|NO|THEN|ALTERNATE|NOT|THROUGH|AND|NUMBER|THRU|ANY|OCCURS|TIME|ARE|OF|TO|AREA|OFF|TOP||ASCENDING|OMITTED|TRUE|ASSIGN|ON|TYPE|AT|OPEN|UNIT|AUTHOR|OR|UNTIL|BEFORE|OTHER|UP|BLANK|OUTPUT|USE|BLOCK|PAGE|USING|BOTTOM|PERFORM|VALUE|BY|PIC|VALUES|CALL|PICTURE|WHEN|CANCEL|PLUS|WITH|CD|POINTER|WRITE|CHARACTER|POSITION||ZERO|CLOSE|POSITIVE|ZEROS|COLUMN|PROCEDURE|ZEROES|COMMA|PROGRAM|COMMON|PROGRAM-ID|COMMUNICATION|QUOTE|COMP|RANDOM|COMPUTE|READ|CONTAINS|RECEIVE|CONFIGURATION|RECORD|CONTINUE|REDEFINES|CONTROL|REFERENCE|COPY|REMAINDER|COUNT|REPLACE|DATA|REPORT|DATE|RESERVE|DAY|RESET|DELETE|RETURN|DESTINATION|REWIND|DISABLE|REWRITE|DISPLAY|RIGHT|DIVIDE|RUN|DOWN|SAME|ELSE|SEARCH|ENABLE|SECTION|END|SELECT|ENVIRONMENT|SENTENCE|EQUAL|SET|ERROR|SIGN|EXIT|SEQUENTIAL|EXTERNAL|SIZE|FLASE|SORT|FILE|SOURCE|LENGTH|SPACE|LESS|STANDARD|LIMIT|START|LINE|STOP|LOCK|STRING|LOW-VALUE|SUBTRACT",t="true|false|null",n="count|min|max|avg|sum|rank|now|coalesce|main",r=this.createKeywordMapper({"support.function":n,keyword:e,"constant.language":t},"identifier",!0);this.$rules={start:[{token:"comment",regex:"\\*.*$"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:r,regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"paren.lparen",regex:"[\\(]"},{token:"paren.rparen",regex:"[\\)]"},{token:"text",regex:"\\s+"}]}};r.inherits(s,i),t.CobolHighlightRules=s}),ace.define("ace/mode/cobol",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/cobol_highlight_rules","ace/range"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./cobol_highlight_rules").CobolHighlightRules,o=e("../range").Range,u=function(){this.HighlightRules=s};r.inherits(u,i),function(){this.lineCommentStart="*",this.$id="ace/mode/cobol"}.call(u.prototype),t.Mode=u})
|
||||