Skip to content

Commit

Permalink
chore: collation catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
金伟 authored and 金伟 committed Oct 6, 2019
1 parent 55535ab commit 9bd42dc
Show file tree
Hide file tree
Showing 1,821 changed files with 231,279 additions and 0 deletions.
33 changes: 33 additions & 0 deletions js/Demo/01ChainCall.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script>
function _$(els){


}


function Demo(){

}
Demo.prototype ={
setName: function(name){

this.name = name;
},

getName: function(){
return this.name
}
}
window.$ = function(){
return new Demo();
};
</script>
</body>
</html>
40 changes: 40 additions & 0 deletions js/Demo/02designPattern.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>设计模式</title>
<script src="jquery-1.7.1.js"></script>
</head>
<body>
<button>设计模式</button>
<script>

/*
//第一种
var createMask = function(){
return document.body.append(document.createElement("div"));
}
$("button").click(function(){
var mask = createMask();
mask.show();
});
*/

//不需要是浪费
var mask = document.body.append(document.createElement("div"));
$("button").click(function(){
mask.show();
});

var mask;
var createMask = function(){
if(mask){
return mask;
}else{
mask = document.body.append(document.createElement("div"));
return mask;
}
}
</script>
</body>
</html>
83 changes: 83 additions & 0 deletions js/Demo/03singleTon.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="jquery-1.8.2.js"></script>
<style type="text/css">
.mask{ width: 100%; height: 100%; opacity:0.5; filter: alpha(opacity=50); background-color: #000; position: absolute; left: 0; top: 0px; z-index: 2000;}
</style>

<style type="text/css">
.base-dialog{ width: 270px; height: 170px; position: absolute; z-index: 2; background-color: #fff; color: #fff; border: 1px solid #c0bfbf;}
.dialog-title{ height: 32px; line-height: 32px; text-indent: 1em; background-color: #000; }
.dialog-content{ height: 100px;}
.dialog-button{ height: 60px;}
</style>

</head>
<body>

<button class="button">button</button>

<script>
var singleton = function(){
var mask, dialog, zIndex = 2000;
return function(){
zIndex += 2;
mask= $("<div class='mask'></div>").css("z-index", zIndex+0);
dialog = $(singleton._templates).css("z-index", zIndex+1)
$("body").append(dialog);
$("body").append(mask);
}
}();



$(".button").click(function(){
singleton();
});


$("body").on("click", ".ok", function(){
singleton();
});

$("body").on("click", ".cancle", function(){
var parents = $(this).parents(".base-dialog")
var zIndex = parents.css("z-index");
var curIndex = 0;

//删除当前窗口
parents.remove();

//删除相应的背景层
$(".mask").each(function(i){
curIndex = parseInt($(this).css("z-index"));
if(zIndex == curIndex + 1){
$(this).remove();
}
});



});




singleton._templates =
'<div class="base-dialog">'
+ '<div class="dialog-title">标题</div>'
+ '<div class="dialog-content">'
+ '内容'
+ '</div>'
+ '<div class="dialog-button">'
+ '<button class="button-text ok"><span>确定</span></button>'
+ '<button class="button-text cancle"><span>取消</span></button>'
+ '</div>'
+ '</div>';
</script>

</body>
</html>
90 changes: 90 additions & 0 deletions js/Demo/04cookie.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>

<script>
// document.cookie = encodeURIComponent("cookieName") + "="+
// encodeURIComponent("jinwei value") + encodeURIComponent("; domain=baidu.com");

// var cookieAll = decodeURIComponent(document.cookie);
// console.log("cookie获取:",cookieAll);
// alert(cookieAll);

var cookieUtil = {
getValue: function(cName){
"use strict";

var cookieName = decodeURIComponent(cName),
cookieStr = decodeURIComponent(document.cookie),
cookieStart = cookieStr.indexOf(cookieName),
cookieValue,
cookieEnd;

if(cookieStart != "-1"){
cookieEnd = cookieStr.indexOf(";", cookieStart);
if(cookieEnd == "-1"){
cookieValue = cookieStr.substring(cookieStart + cookieName.length +1);
}else{
cookieValue = cookieStr.substring(cookieStart + cookieName.length +1, cookieEnd);
}
}
return cookieValue;
},

set: function(name, value, expires, path, domain, secure){
var cookieStr = encodeURIComponent(name) + "="
+ encodeURIComponent(value);



if(expires instanceof Date){
cookieStr += "; expires="+expires;
}

if(path){
cookieStr += "; expires="+path;
}

if(domain){
cookieStr += "; domain="+ domain;
}

if(secure){
cookieStr += + "; secure";
}

document.cookie = cookieStr;
},

remove: function(name, path, domain, secure){
this.set(name, "", new Date(0), path, domain, secure)
}

}



var curDate = new Date().getTime();
//cookieUtil.set("cookieName2", "co value", +new Date()+60*60*24*1000, "/JavaScript/Demo/", "http://localhost:81", "secure");
cookieUtil.set("cookieName4", "co value2", new Date(2014, 1, 28, 10, 7));
//cookieUtil.remove("cookieName3");

// var j = cookieUtil.getValue("cookieName");
// var jj = cookieUtil.getValue("domain");
// console.log("2:",j, jj);



var cookieAll = decodeURIComponent(document.cookie);
alert("All cookie:", cookieAll);


</script>


</body>
</html>
15 changes: 15 additions & 0 deletions js/Demo/05BOM.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>

<script src="../jQuery/jquery-1.11.1.js"></script>
</head>
<body>
<form>
<input required="" type="text">
<label alt="请输入名称" placeholder="名称"></label>
</form>
</body>
</html>
13 changes: 13 additions & 0 deletions js/Demo/06AJAX.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
/**
* Created by JetBrains PhpStorm.
* User: jinwei
* Date: 14-3-5
* Time: 上午11:21
* To change this template use File | Settings | File Templates.
*/

echo "jinwei text";


//phpinfo();
1 change: 1 addition & 0 deletions js/Demo/06Ajax.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"111"
Loading

0 comments on commit 9bd42dc

Please sign in to comment.