First Initial

This commit is contained in:
Nakorn Rientrakrunchai
2020-02-20 15:02:39 +07:00
commit 8b98125e49
3048 changed files with 760804 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
{
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 100, // Maximum error before stopping.
// Predefined globals whom JSHint will ignore.
"browser" : true, // Standard browser globals e.g. `window`, `document`.
"node" : false,
"rhino" : false,
"couch" : false,
"wsh" : true, // Windows Scripting Host.
"jquery" : true,
"prototypejs" : false,
"mootools" : false,
"dojo" : false,
"predef" : [ // Custom globals.
//"exampleVar",
//"anotherCoolGlobal",
//"iLoveDouglas"
],
// Development.
"debug" : false, // Allow debugger statements e.g. browser breakpoints.
"devel" : true, // Allow developments statements e.g. `console.log();`.
// ECMAScript 5.
"es5" : true, // Allow ECMAScript 5 syntax.
"strict" : false, // Require `use strict` pragma in every file.
"globalstrict" : false, // Allow global "use strict" (also enables 'strict').
// The Good Parts.
"asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons).
"laxbreak" : true, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
"bitwise" : true, // Prohibit bitwise operators (&, |, ^, etc.).
"boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
"curly" : true, // Require {} for every new block or scope.
"eqeqeq" : false, // Require triple equals i.e. `===`.
"eqnull" : false, // Tolerate use of `== null`.
"evil" : false, // Tolerate use of `eval`.
"expr" : false, // Tolerate `ExpressionStatement` as Programs.
"forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`.
"immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
"latedef" : true, // Prohipit variable use before definition.
"loopfunc" : false, // Allow functions to be defined within loops.
"noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`.
"regexp" : false, // Prohibit `.` and `[^...]` in regular expressions.
"regexdash" : false, // Tolerate unescaped last dash i.e. `[-...]`.
"scripturl" : true, // Tolerate script-targeted URLs.
"shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`.
"supernew" : false, // Tolerate `new function () { ... };` and `new Object;`.
"undef" : true, // Require all non-global variables be declared before they are used.
// Personal styling preferences.
"newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`.
"noempty" : true, // Prohibit use of empty blocks.
"nonew" : true, // Prohibit use of constructors for side-effects.
"nomen" : false, // Prohibit use of initial or trailing underbars in names.
"onevar" : false, // Allow only one `var` statement per function.
"plusplus" : false, // Prohibit use of `++` & `--`.
"sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
"trailing" : true, // Prohibit trailing whitespaces.
"white" : false, // Check against strict whitespace and indentation rules.
"indent" : 4 // Specify indentation spacing
}

View File

@@ -0,0 +1,163 @@
#!/bin/sh
cd ../media/src
# DEFAULTS
CLOSURE="/usr/local/closure_compiler/compiler.jar"
JSDOC="/usr/local/jsdoc/jsdoc"
CMD=$1
MAIN_FILE="../js/jquery.dataTables.js"
MIN_FILE="../js/jquery.dataTables.min.js"
VERSION=$(grep " * @version " DataTables.js | awk -F" " '{ print $3 }')
echo ""
echo " DataTables build ($VERSION)"
echo ""
IFS='%'
cp DataTables.js DataTables.js.build
echo " Building main script"
grep "require(" DataTables.js.build > /dev/null
while [ $? -eq 0 ]; do
REQUIRE=$(grep "require(" DataTables.js.build | head -n 1)
SPACER=$(echo ${REQUIRE} | cut -d r -f 1)
FILE=$(echo ${REQUIRE} | sed -e "s#^.*require('##g" -e "s#');##")
DIR=$(echo ${FILE} | cut -d \. -f 1)
sed "s#^#${SPACER}#" < ${DIR}/${FILE} > ${DIR}/${FILE}.build
sed -e "/${REQUIRE}/r ${DIR}/${FILE}.build" -e "/${REQUIRE}/d" < DataTables.js.build > DataTables.js.out
mv DataTables.js.out DataTables.js.build
rm ${DIR}/${FILE}.build
grep "require(" DataTables.js.build > /dev/null
done
mv DataTables.js.build $MAIN_FILE
if [ "$CMD" != "debug" ]; then
if [ "$CMD" = "jshint" -o "$CMD" = "" -o "$CMD" = "cdn" ]; then
echo " JSHint"
jshint $MAIN_FILE --config ../../scripts/jshint.config
if [ $? -ne 0 ]; then
echo " Errors occured - exiting"
exit 1
else
echo " Pass"
fi
fi
if [ "$CMD" = "compress" -o "$CMD" = "" -o "$CMD" = "cdn" ]; then
echo " Minification"
echo "/*
* File: jquery.dataTables.min.js
* Version: $VERSION
* Author: Allan Jardine (www.sprymedia.co.uk)
* Info: www.datatables.net
*
* Copyright 2008-2012 Allan Jardine, all rights reserved.
*
* This source file is free software, under either the GPL v2 license or a
* BSD style license, available at:
* http://datatables.net/license_gpl2
* http://datatables.net/license_bsd
*
* This source file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
*/" > $MIN_FILE
java -jar $CLOSURE --js $MAIN_FILE >> $MIN_FILE
echo " Min JS file size: $(ls -l $MIN_FILE | awk -F" " '{ print $5 }')"
fi
if [ "$CMD" = "docs" -o "$CMD" = "" ]; then
echo " Documentation"
$JSDOC -d ../../docs -t JSDoc-DataTables $MAIN_FILE
fi
if [ "$CMD" = "cdn" ]; then
echo " CDN"
if [ -d ../../cdn ]; then
rm -Rf ../../cdn
fi
mkdir ../../cdn
mkdir ../../cdn/css
cp $MAIN_FILE ../../cdn
cp $MIN_FILE ../../cdn
cp ../css/jquery.dataTables.css ../../cdn/css
cp ../css/jquery.dataTables_themeroller.css ../../cdn/css
cp -r ../images ../../cdn/
rm ../../cdn/images/Sorting\ icons.psd
fi
fi
# Back to DataTables root dir
cd ../..
#
# Packaging files
#
cat <<EOF > package.json
{
"name": "DataTables",
"version": "${VERSION}",
"title": "DataTables",
"author": {
"name": "Allan Jardine",
"url": "http://sprymedia.co.uk"
},
"licenses": [
{
"type": "BSD",
"url": "http://datatables.net/license_bsd"
},
{
"type": "GPLv2",
"url": "http://datatables.net/license_gpl2"
}
],
"dependencies": {
"jquery": "1.4 - 1.8"
},
"description": "DataTables enhances HTML tables with the ability to sort, filter and page the data in the table very easily. It provides a comprehensive API and set of configuration options, allowing you to consume data from virtually any data source.",
"keywords": [
"DataTables",
"DataTable",
"table",
"grid",
"filter",
"sort",
"page",
"internationalisable"
],
"homepage": "http://datatables.net"
}
EOF
cat <<EOF > component.json
{
"name": "DataTables",
"version": "${VERSION}",
"main": [
"./media/js/jquery.dataTables.js",
"./media/css/jquery.dataTables.css",
],
"dependencies": {
"jquery": "~1.8.0"
}
}
EOF
echo " Done\n"

View File

@@ -0,0 +1,109 @@
#!/bin/sh
ENABLE=$1
echo ""
echo " DataTables unit tests"
echo ""
if [ ! "$ENABLE" = "Enable" -a ! "$ENABLE" = "Disable" -o "ENABLE" = "-h" ]; then
echo " Enable or Disable must be given as the first argument."
echo " Optionally the second argument can be given as an integer to enable/disable a certain "
echo " set of tests or the string 'sanity' to run the sanity check for all data types."
echo ""
exit 1
fi
cd ../media/unit_testing
if [ "$ENABLE" = "Enable" ]; then
if [ ! -d tests ]; then
echo " Building test directory"
mkdir tests
mkdir tests/1_dom
mkdir tests/2_js
mkdir tests/3_ajax
mkdir tests/4_server-side
mkdir tests/5_ajax_objects
mkdir tests/6_delayed_rendering
fi
echo " Enabling:"
if [ ! -z $2 ]; then
if [ "$2" = "sanity" ]; then
echo " Sanity checks"
mv tests_onhold/1_dom/_zero_config.js tests/1_dom/
mv tests_onhold/2_js/_zero_config.js tests/2_js/
mv tests_onhold/3_ajax/_zero_config.js tests/3_ajax/
mv tests_onhold/4_server-side/_zero_config.js tests/4_server-side/
mv tests_onhold/5_ajax_objects/_zero_config.js tests/5_ajax_objects/
mv tests_onhold/6_delayed_rendering/_zero_config.js tests/6_delayed_rendering/
elif [ $2 -eq 1 ]; then
echo " DOM"
mv tests_onhold/1_dom/* tests/1_dom/
elif [ $2 -eq 2 ]; then
echo " JS"
mv tests_onhold/2_js/* tests/2_js/
elif [ $2 -eq 3 ]; then
echo " Ajax"
mv tests_onhold/3_ajax/* tests/3_ajax/
elif [ $2 -eq 4 ]; then
echo " SErver-side"
mv tests_onhold/4_server-side/* tests/4_server-side/
elif [ $2 -eq 5 ]; then
echo " Ajax objects"
mv tests_onhold/5_ajax_objects/* tests/5_ajax_objects/
elif [ $2 -eq 6 ]; then
echo " Delayed rendering"
mv tests_onhold/6_delayed_rendering/* tests/6_delayed_rendering/
fi
else
echo " All tests"
mv tests_onhold/1_dom/* tests/1_dom/
mv tests_onhold/2_js/* tests/2_js/
mv tests_onhold/3_ajax/* tests/3_ajax/
mv tests_onhold/4_server-side/* tests/4_server-side/
mv tests_onhold/5_ajax_objects/* tests/5_ajax_objects/
mv tests_onhold/6_delayed_rendering/* tests/6_delayed_rendering/
fi
else
echo " Disabling:"
if [ ! -z $2 ]; then
if [ "$2" = "sanity" ]; then
echo " Sanity checks"
mv tests/1_dom/* tests_onhold/1_dom/
mv tests/2_js/* tests_onhold/2_js/
mv tests/3_ajax/* tests_onhold/3_ajax/
mv tests/4_server-side/* tests_onhold/4_server-side/
mv tests/5_ajax_objects/* tests_onhold/5_ajax_objects/
mv tests/6_delayed_rendering/* tests_onhold/6_delayed_rendering/
elif [ $2 -eq 1 ]; then
echo " DOM"
mv tests/1_dom/* tests_onhold/1_dom/
elif [ $2 -eq 2 ]; then
echo " JS"
mv tests/2_js/* tests_onhold/2_js/
elif [ $2 -eq 3 ]; then
echo " Ajax"
mv tests/3_ajax/* tests_onhold/3_ajax/
elif [ $2 -eq 4 ]; then
echo " Server-side"
mv tests/4_server-side/* tests_onhold/4_server-side/
elif [ $2 -eq 5 ]; then
echo " Ajax objects"
mv tests/5_ajax_objects/* tests_onhold/5_ajax_objects/
elif [ $2 -eq 6 ]; then
echo " Delayed rendering"
mv tests/6_delayed_rendering/* tests_onhold/6_delayed_rendering/
fi
else
echo " All tests"
mv tests/1_dom/* tests_onhold/1_dom/
mv tests/2_js/* tests_onhold/2_js/
mv tests/3_ajax/* tests_onhold/3_ajax/
mv tests/4_server-side/* tests_onhold/4_server-side/
mv tests/5_ajax_objects/* tests_onhold/5_ajax_objects/
mv tests/6_delayed_rendering/* tests_onhold/6_delayed_rendering/
fi
fi