Этот коммит содержится в:
2017-01-23 02:47:24 +03:00
родитель 9744d67202
Коммит 6644a5a52d
21 изменённых файлов: 649 добавлений и 9 удалений

Просмотреть файл

@@ -1,3 +1,50 @@
/**
* Created by Игорь on 23.01.2017.
*/
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
frontpage: {
src: 'js/*.js',
dest: '../public/js/script.js'
}
},
stylus: {
compile: {
options:{
compress:false
},
files: {
"../public/css/style.raw.css":'css/style.styl'
}
}
},
csso: {
search: {
files: {
'../public/css/style.css':'../public/css/style.raw.css'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-internal');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-csso');
grunt.loadNpmTasks('grunt-contrib-stylus');
grunt.registerTask('css',['stylus','csso']);
grunt.registerTask('js',['uglify']);
grunt.registerTask('default', ['css']);
grunt.registerTask('full',['css','js'])
};

Просмотреть файл

@@ -1,3 +1,30 @@
@import "ShortCSS/ShortCSS.styl"
@import "normalize/normalize.styl"
/** ptest css */
$link_color = #0063ff
$link_color_border = alpha($link_color,.3)
$link_hover_color = #ff475d
$link_hover_color_border = alpha($link_hover_color,.24)
$link_visited_color = #cf00cf
$link_visited_color_border = alpha($link_visited_color,.3)
a
-c $link_color
-td none
-brb 1 solid $link_color_border
&:visited
-c $link_visited_color
-brbc $link_visited_color_border
&:hover
&:visited:hover
-c $link_hover_color
-brbc $link_hover_color_border
.page
&__container
-wmax 800

55
grunt/js/bindReady.js Обычный файл
Просмотреть файл

@@ -0,0 +1,55 @@
/*
* http://javascript.ru/tutorial/events/ondomcontentloaded
* bindReady(function(){alert('dom load')})
*/
function bindReady(handler){
var called = false
function ready() { // (1)
if (called) return
called = true
handler()
}
if ( document.addEventListener ) { // (2)
document.addEventListener( "DOMContentLoaded", function(){
ready()
}, false )
} else if ( document.attachEvent ) { // (3)
// (3.1)
if ( document.documentElement.doScroll && window == window.top ) {
function tryScroll(){
if (called) return
if (!document.body) return
try {
document.documentElement.doScroll("left")
ready()
} catch(e) {
setTimeout(tryScroll, 0)
}
}
tryScroll()
}
// (3.2)
document.attachEvent("onreadystatechange", function(){
if ( document.readyState === "complete" ) {
ready()
}
})
}
// (4)
if (window.addEventListener)
window.addEventListener('load', ready, false)
else if (window.attachEvent)
window.attachEvent('onload', ready)
/* else // (4.1)
window.onload=ready
*/
}

58
grunt/js/foreach.js Обычный файл
Просмотреть файл

@@ -0,0 +1,58 @@
// Production steps of ECMA-262, Edition 5, 15.4.4.18
// Reference: http://es5.github.io/#x15.4.4.18
if (!Array.prototype.forEach) {
Array.prototype.forEach = function(callback, thisArg) {
var T, k;
if (this == null) {
throw new TypeError(' this is null or not defined');
}
// 1. Let O be the result of calling ToObject passing the |this| value as the argument.
var O = Object(this);
// 2. Let lenValue be the result of calling the Get internal method of O with the argument "length".
// 3. Let len be ToUint32(lenValue).
var len = O.length >>> 0;
// 4. If IsCallable(callback) is false, throw a TypeError exception.
// See: http://es5.github.com/#x9.11
if (typeof callback !== "function") {
throw new TypeError(callback + ' is not a function');
}
// 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
if (arguments.length > 1) {
T = thisArg;
}
// 6. Let k be 0
k = 0;
// 7. Repeat, while k < len
while (k < len) {
var kValue;
// a. Let Pk be ToString(k).
// This is implicit for LHS operands of the in operator
// b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk.
// This step can be combined with c
// c. If kPresent is true, then
if (k in O) {
// i. Let kValue be the result of calling the Get internal method of O with argument Pk.
kValue = O[k];
// ii. Call the Call internal method of callback with T as the this value and
// argument list containing kValue, k, and O.
callback.call(T, kValue, k, O);
}
// d. Increase k by 1.
k++;
}
// 8. return undefined
};
}

1
grunt/js/index.js Обычный файл
Просмотреть файл

@@ -0,0 +1 @@

91
grunt/js/xmlhttp.js Обычный файл
Просмотреть файл

@@ -0,0 +1,91 @@
//xmlHttpConnect
//xH.conn(URL,Method,Vars,Function done) - assync
//xH.syn(URL,Method,Vars) - sync, return result query
function xH()
{
var xmlhttp, bComplete = false;
try
{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch (e)
{
try
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch (e)
{
try
{
xmlhttp = new XMLHttpRequest();
}catch (e)
{
xmlhttp = false;
}
}
}
if (!xmlhttp) return null;
this.syn = function(sURL, sMethod, sVars)
{
if (!xmlhttp) return false;
sMethod = sMethod.toUpperCase();
if (sMethod == "GET")
{
xmlhttp.open(sMethod,sURL+"?"+sVars,false);
xmlhttp.send(null);
if (xmlhttp.status == 200)
{
return xmlhttp.responseText;
}
return false;
}
else
{
xmlhttp.open(sMethod, sURL, false);
xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send(sVars);
if (xmlhttp.status == 200)
{
return xmlhttp.responseText;
}
return false;
}
}
this.conn = function(sURL, sMethod, sVars, fnDone)
{
if (!xmlhttp) return false;
bComplete = false;
sMethod = sMethod.toUpperCase();
try
{
if (sMethod == "GET")
{
xmlhttp.open(sMethod, sURL+"?"+sVars, true);
sVars = "";
}
else
{
xmlhttp.open(sMethod, sURL, true);
xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send(sVars);
}
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && !bComplete)
{
bComplete = true;
fnDone(xmlhttp);
}
};
xmlhttp.send(sVars);
}
catch(z)
{
return false;
}
return true;
};
return this;
}

Просмотреть файл

@@ -1,4 +1,12 @@
{
"name": "ptest",
"version": "0.0.1"
"version": "0.0.1",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-csso": "~0.5.0",
"grunt-contrib-stylus": "~1.2.0",
"grunt-contrib-jshint": "~1.0.0",
"grunt-contrib-internal": "~1.2.2",
"grunt-contrib-uglify": "~2.0.0"
}
}