update code style and patch admin page with amberstone.js

This commit is contained in:
Amberstone 2024-09-19 20:59:56 +09:00
parent d149ccdae2
commit ac40c50b8b
Signed by: amber
GPG key ID: 094B0E55F98D8BF1
21 changed files with 1971 additions and 1937 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

@ -241,7 +241,7 @@ if (!defined('G5_IS_ADMIN')) {
</div> </div>
</div> </div>
<div id="ins_ft"> <div id="ins_ft">
<strong>AVOCADO EDITION : LIGHT</strong> <strong>AVOCADO EDITION : AMBER</strong>
<p>GPL! OPEN SOURCE GNUBOARD</p> <p>GPL! OPEN SOURCE GNUBOARD</p>
</div> </div>

View file

@ -4,8 +4,8 @@
상수 선언 상수 선언
********************/ ********************/
define('G5_VERSION', '아보카도 에디션 : Light'); define('G5_VERSION', '아보카도 에디션 : Amber');
define('G5_GNUBOARD_VER', '2.2.2'); define('G5_GNUBOARD_VER', '2.2.3');
// 이 상수가 정의되지 않으면 각각의 개별 페이지는 별도로 실행될 수 없음 // 이 상수가 정의되지 않으면 각각의 개별 페이지는 별도로 실행될 수 없음
define('_GNUBOARD_', true); define('_GNUBOARD_', true);

View file

@ -1,4 +1,8 @@
프로그램 명칭 : 아보카도 에디션 : Light (Avocado Edition Light) 프로그램 명칭 : 아보카도 에디션 : Amber (Avocado Edition Amber)
코드 수정 및 보안패치, 확장 : Arcturus https://info.drk.st/
---------------------------------------------------
저작자 : Avocado https://avocado-edition-rout.postype.com/ 저작자 : Avocado https://avocado-edition-rout.postype.com/

View file

@ -1,115 +1,115 @@
$(function() { $(function () {
$('img').attr('title', ''); $('img').attr('title', '');
$('img[usemap]').rwdImageMaps(); $('img[usemap]').rwdImageMaps();
$('#header_control_box').on('click', function() { $('#header_control_box').on('click', function () {
$('html').toggleClass('close-header'); $('html').toggleClass('close-header');
if($('html').hasClass('close-header')) { if ($('html').hasClass('close-header')) {
// 닫힘상태 // 닫힘상태
// - 쿠키 설정 // - 쿠키 설정
set_cookie('header_close', 'close', 365, g5_cookie_domain); set_cookie('header_close', 'close', 365, g5_cookie_domain);
} else { } else {
// 열림상태 // 열림상태
// - 쿠키 제거 // - 쿠키 제거
delete_cookie('header_close'); delete_cookie('header_close');
} }
}); });
}); });
window.onscroll = function() { window.onscroll = function () {
var position = $(window).scrollTop(); var position = $(window).scrollTop();
if (position > 50) { if (position > 50) {
$('.uparrow').fadeIn(); $('.uparrow').fadeIn();
} else { } else {
$('.uparrow').fadeOut(); $('.uparrow').fadeOut();
} }
$('.scroll-fix').css('transform', "translatey(" + position + "px)"); $('.scroll-fix').css('transform', "translatey(" + position + "px)");
} }
$(document).on("keydown", "textarea", function(e) { $(document).on("keydown", "textarea", function (e) {
if ((e.keyCode == 10 || e.keyCode == 13) && e.ctrlKey) { if ((e.keyCode == 10 || e.keyCode == 13) && e.ctrlKey) {
$(this).parents('form').submit(); $(this).parents('form').submit();
} }
}); });
if (document.all) { if (document.all) {
document.onkeydown = trapRefreshIE; document.onkeydown = trapRefreshIE;
} else { } else {
document.captureEvents(Event.KEYDOWN) document.captureEvents(Event.KEYDOWN)
document.onkeydown = trapRefreshNS; document.onkeydown = trapRefreshNS;
} }
function trapRefreshNS(e){ function trapRefreshNS(e) {
if (e.keyCode == 116){ if (e.keyCode == 116) {
e.cancelBubble = true; e.cancelBubble = true;
e.returnValue = false; e.returnValue = false;
document.location.reload(); document.location.reload();
} }
} }
function trapRefreshIE(){ function trapRefreshIE() {
if (event.keyCode == 116){ if (event.keyCode == 116) {
event.keyCode = 0; event.keyCode = 0;
event.cancelBubble = true; event.cancelBubble = true;
event.returnValue = false; event.returnValue = false;
document.location.reload(); document.location.reload();
} }
} }
function ajax_link_url(url, obj_id) { function ajax_link_url(url, obj_id) {
var h_link = url; var h_link = url;
if(typeof(history.pushState) != "undefined") {
$.ajax({
async: true
, url: h_link
, beforeSend: function() {}
, success: function(data) {
// Toss
var response = data;
var temp_content = $(response).find(obj_id).clone();
$(obj_id).fadeOut(300, function(){$(this).empty().append(temp_content.html());}).fadeIn(300, function() { if (typeof (history.pushState) != "undefined") {
$.ajax({
$(obj_id).find('img').attr('title', ''); async: true
$(obj_id).find('img[usemap]').rwdImageMaps(); , url: h_link
, beforeSend: function () { }
, success: function (data) {
// Toss
var response = data;
var temp_content = $(response).find(obj_id).clone();
var link = url; $(obj_id).fadeOut(300, function () { $(this).empty().append(temp_content.html()); }).fadeIn(300, function () {
var link_obj = { Title: '', Url: link};
history.pushState(link_obj, link_obj.Title, link_obj.Url); $(obj_id).find('img').attr('title', '');
}); $(obj_id).find('img[usemap]').rwdImageMaps();
}
, error: function(data, status, err) { var link = url;
$(obj_id).fadeOut(300, function(){$(this).empty(); }); var link_obj = { Title: '', Url: link };
} history.pushState(link_obj, link_obj.Title, link_obj.Url);
, complete: function() { });
// Complete }
} , error: function (data, status, err) {
}); $(obj_id).fadeOut(300, function () { $(this).empty(); });
} else { }
location.href=url; , complete: function () {
} // Complete
}
});
} else {
location.href = url;
}
} }
function fn_save_title(val, ch_id) { function fn_save_title(val, ch_id) {
var formData = new FormData(); var formData = new FormData();
var ch_id = ch_id; var ch_id = ch_id;
var ti_id = val; var ti_id = val;
formData.append("ch_id", ch_id); formData.append("ch_id", ch_id);
formData.append("ti_id", ti_id); formData.append("ti_id", ti_id);
$.ajax({ $.ajax({
url:g5_url+'/mypage/character/title_update.php' url: g5_url + '/mypage/character/title_update.php'
, data: formData , data: formData
, processData: false , processData: false
, contentType: false , contentType: false
, type: 'POST' , type: 'POST'
, success: function(data){ , success: function (data) {
} }
}); });
} }

View file

@ -0,0 +1,114 @@
/**
* amberstone
* @author arcturus (contact@sharlayan.net / https://info.drk.st/about)
* @version 1.1.3
*/
function pad(num, len = 2) {
return num.toFixed(0).padStart(len, '0');
}
function serializeForm(form) {
var formData = new FormData(form);
var params = new URLSearchParams();
formData.forEach(function (value, key) {
params.append(key, value);
});
return params.toString();
}
function createHtmlFromJson(jsonData) {
function createElementRecursive(data) {
if (typeof data !== 'object' || data === null) {
return document.createTextNode(String(data));
}
const element = createElement(data.type || 'div', data);
if (data.children) {
if (Array.isArray(data.children)) {
data.children.forEach(child => {
element.appendChild(createElementRecursive(child));
});
} else {
element.appendChild(createElementRecursive(data.children));
}
}
return element;
}
return createElementRecursive(jsonData);
}
function createElement(type, data) {
const elem = document.createElement(type);
if (typeof data === 'object') {
if (data.hasOwnProperty('classList')) {
if (Array.isArray(data.classList)) {
for (const cl of data.classList) {
elem.classList.add(cl);
}
} else if (typeof data.classList === 'string') {
elem.classList.add(data.classList);
}
}
if (data.hasOwnProperty('css')) {
if (typeof data.css === 'object') {
for (const css in data.css) {
elem.style.setProperty(css, data.css[css]);
}
}
}
if (data.hasOwnProperty('textContent')) {
elem.textContent = data.textContent;
}
if (data.hasOwnProperty('innerHTML')) {
elem.innerHTML = data.innerHTML;
}
if (data.hasOwnProperty('attributes')) {
if (typeof data.attributes === 'object') {
for (const attr in data.attributes) {
elem.setAttribute(attr, data.attributes[attr]);
}
}
}
} else if (Array.isArray(data) && data.length > 0) {
for (const cl of data) {
elem.classList.add(cl);
}
} else if (typeof data === 'string') {
elem.classList.add(data);
}
return elem;
}
function sendRequest(url, data, type, callback, useUrlEncoded = true) {
var xhr = new XMLHttpRequest();
xhr.open(type, url, true);
if (useUrlEncoded) {
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
data = new URLSearchParams(data).toString();
} else {
xhr.setRequestHeader('Content-Type', 'application/json');
data = JSON.stringify(data);
}
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
if (xhr.status >= 200 && xhr.status < 300) {
callback(null, xhr.responseText);
} else {
callback(xhr.statusText, null);
}
}
};
xhr.send(type === 'POST' ? data : null);
}

View file

@ -6,112 +6,112 @@ var save_wr_subject = null;
var save_wr_content = null; var save_wr_content = null;
function autosave() { function autosave() {
$("form#fwrite").each(function() { $("form#fwrite").each(function () {
if(g5_editor != "") { if (g5_editor != "") {
if (g5_editor.indexOf("ckeditor4") != -1 && typeof(CKEDITOR.instances.wr_content)!="undefined") { if (g5_editor.indexOf("ckeditor4") != -1 && typeof (CKEDITOR.instances.wr_content) != "undefined") {
this.wr_content.value = CKEDITOR.instances.wr_content.getData(); this.wr_content.value = CKEDITOR.instances.wr_content.getData();
} else if (g5_editor.indexOf("cheditor5") != -1 && typeof(ed_wr_content)!="undefined") { } else if (g5_editor.indexOf("cheditor5") != -1 && typeof (ed_wr_content) != "undefined") {
this.wr_content.value = ed_wr_content.outputBodyHTML(); this.wr_content.value = ed_wr_content.outputBodyHTML();
} else { } else {
if(typeof get_editor_wr_content == "function") { if (typeof get_editor_wr_content == "function") {
this.wr_content.value = get_editor_wr_content(); this.wr_content.value = get_editor_wr_content();
}
}
} }
}
// 변수에 저장해 놓은 값과 다를 경우에만 임시 저장함
if (save_wr_subject != this.wr_subject.value || save_wr_content != this.wr_content.value) {
$.ajax({
url: g5_bbs_url+"/ajax.autosave.php",
data: {
"uid" : this.uid.value,
"subject": this.wr_subject.value,
"content": this.wr_content.value
},
type: "POST",
success: function(data){
if (data) {
$("#autosave_count").html(data);
}
}
});
save_wr_subject = this.wr_subject.value;
save_wr_content = this.wr_content.value;
}
});
}
$(function(){
if (g5_is_member) {
setInterval(autosave, AUTOSAVE_INTERVAL * 1000);
} }
// 임시저장된 글목록을 가져옴 // 변수에 저장해 놓은 값과 다를 경우에만 임시 저장함
$("#btn_autosave").click(function(){ if (save_wr_subject != this.wr_subject.value || save_wr_content != this.wr_content.value) {
if ($("#autosave_pop").is(":hidden")) { $.ajax({
$.get(g5_bbs_url+"/ajax.autosavelist.php", function(data){ url: g5_bbs_url + "/ajax.autosave.php",
//alert(data); data: {
//console.log( "Data: " + data); "uid": this.uid.value,
$("#autosave_pop ul").empty(); "subject": this.wr_subject.value,
if ($(data).find("list").find("item").length > 0) { "content": this.wr_content.value
$(data).find("list").find("item").each(function(i) { },
var id = $(this).find("id").text(); type: "POST",
var uid = $(this).find("uid").text(); success: function (data) {
var subject = $(this).find("subject").text(); if (data) {
var datetime = $(this).find("datetime").text(); $("#autosave_count").html(data);
$("#autosave_pop ul") }
.append('<li><a href="#none" class="autosave_load">'+subject+'</a><span>'+datetime+' <button type="button" class="autosave_del">삭제</button></span></li>')
.find("li:eq("+i+")")
.data({ as_id: id, uid: uid });
});
}
}, "xml");
$("#autosave_pop").show();
} else {
$("#autosave_pop").hide();
} }
}); });
save_wr_subject = this.wr_subject.value;
save_wr_content = this.wr_content.value;
}
});
}
// 임시저장된 글 제목과 내용을 가져와서 제목과 내용 입력박스에 노출해 줌 $(function () {
$(document).on( "click", ".autosave_load", function(){
var $li = $(this).parents("li");
var as_id = $li.data("as_id");
var as_uid = $li.data("uid");
$("#fwrite input[name='uid']").val(as_uid);
$.get(g5_bbs_url+"/ajax.autosaveload.php", {"as_id":as_id}, function(data){
var subject = $(data).find("item").find("subject").text();
var content = $(data).find("item").find("content").text();
$("#wr_subject").val(subject);
if(g5_editor != "") {
if (g5_editor.indexOf("ckeditor4") != -1 && typeof(CKEDITOR.instances.wr_content)!="undefined") {
CKEDITOR.instances.wr_content.setData(content);
} else if (g5_editor.indexOf("cheditor5") != -1 && typeof(ed_wr_content)!="undefined") {
ed_wr_content.putContents(content);
} else {
if(typeof put_editor_wr_content == "function") {
put_editor_wr_content(content);
}
}
} else {
$("#fwrite #wr_content").val(content);
}
}, "xml");
$("#autosave_pop").hide();
});
$(document).on( "click", ".autosave_del", function(){ if (g5_is_member) {
var $li = $(this).parents("li"); setInterval(autosave, AUTOSAVE_INTERVAL * 1000);
var as_id = $li.data("as_id"); }
$.get(g5_bbs_url+"/ajax.autosavedel.php", {"as_id":as_id}, function(data){
if (data == -1) {
alert("임시 저장된글을 삭제중에 오류가 발생하였습니다.");
} else {
$("#autosave_count").html(data);
$li.remove();
}
});
});
$(".autosave_close").click(function(){ $("#autosave_pop").hide(); }); // 임시저장된 글목록을 가져옴
$("#btn_autosave").click(function () {
if ($("#autosave_pop").is(":hidden")) {
$.get(g5_bbs_url + "/ajax.autosavelist.php", function (data) {
//alert(data);
//console.log( "Data: " + data);
$("#autosave_pop ul").empty();
if ($(data).find("list").find("item").length > 0) {
$(data).find("list").find("item").each(function (i) {
var id = $(this).find("id").text();
var uid = $(this).find("uid").text();
var subject = $(this).find("subject").text();
var datetime = $(this).find("datetime").text();
$("#autosave_pop ul")
.append('<li><a href="#none" class="autosave_load">' + subject + '</a><span>' + datetime + ' <button type="button" class="autosave_del">삭제</button></span></li>')
.find("li:eq(" + i + ")")
.data({ as_id: id, uid: uid });
});
}
}, "xml");
$("#autosave_pop").show();
} else {
$("#autosave_pop").hide();
}
});
// 임시저장된 글 제목과 내용을 가져와서 제목과 내용 입력박스에 노출해 줌
$(document).on("click", ".autosave_load", function () {
var $li = $(this).parents("li");
var as_id = $li.data("as_id");
var as_uid = $li.data("uid");
$("#fwrite input[name='uid']").val(as_uid);
$.get(g5_bbs_url + "/ajax.autosaveload.php", { "as_id": as_id }, function (data) {
var subject = $(data).find("item").find("subject").text();
var content = $(data).find("item").find("content").text();
$("#wr_subject").val(subject);
if (g5_editor != "") {
if (g5_editor.indexOf("ckeditor4") != -1 && typeof (CKEDITOR.instances.wr_content) != "undefined") {
CKEDITOR.instances.wr_content.setData(content);
} else if (g5_editor.indexOf("cheditor5") != -1 && typeof (ed_wr_content) != "undefined") {
ed_wr_content.putContents(content);
} else {
if (typeof put_editor_wr_content == "function") {
put_editor_wr_content(content);
}
}
} else {
$("#fwrite #wr_content").val(content);
}
}, "xml");
$("#autosave_pop").hide();
});
$(document).on("click", ".autosave_del", function () {
var $li = $(this).parents("li");
var as_id = $li.data("as_id");
$.get(g5_bbs_url + "/ajax.autosavedel.php", { "as_id": as_id }, function (data) {
if (data == -1) {
alert("임시 저장된글을 삭제중에 오류가 발생하였습니다.");
} else {
$("#autosave_count").html(data);
$li.remove();
}
});
});
$(".autosave_close").click(function () { $("#autosave_pop").hide(); });
}); });

View file

@ -1,80 +1,72 @@
// 본인확인 인증창 호출 // 본인확인 인증창 호출
function certify_win_open(type, url) function certify_win_open(type, url) {
{ if (type == 'kcb-ipin') {
if(type == 'kcb-ipin') var popupWindow = window.open(url, "kcbPop", "left=200, top=100, status=0, width=450, height=550");
{ popupWindow.focus();
var popupWindow = window.open( url, "kcbPop", "left=200, top=100, status=0, width=450, height=550" ); }
popupWindow.focus(); else if (type == 'kcb-hp') {
var popupWindow = window.open(url, "auth_popup", "left=200, top=100, width=430, height=590, scrollbar=yes");
popupWindow.focus();
}
else if (type == 'kcp-hp') {
if ($("input[name=veri_up_hash]").size() < 1)
$("input[name=cert_no]").after('<input type="hidden" name="veri_up_hash" value="">');
if (navigator.userAgent.indexOf("Android") > - 1 || navigator.userAgent.indexOf("iPhone") > - 1) {
var $frm = $(event.target.form);
if ($("#kcp_cert").size() < 1) {
$frm.wrap('<div id="cert_info"></div>');
$("#cert_info").append('<form name="form_temp" method="post">')
.after('<iframe id="kcp_cert" name="kcp_cert" width="100%" height="700" frameborder="0" scrolling="no" style="display:none"></iframe>');
}
var temp_form = document.form_temp;
temp_form.target = "kcp_cert";
temp_form.action = url;
document.getElementById("cert_info").style.display = "none";
document.getElementById("kcp_cert").style.display = "";
temp_form.submit();
} }
else if(type == 'kcb-hp') else {
{ var return_gubun;
var popupWindow = window.open( url, "auth_popup", "left=200, top=100, width=430, height=590, scrollbar=yes" ); var width = 410;
popupWindow.focus(); var height = 500;
}
else if(type == 'kcp-hp') var leftpos = screen.width / 2 - (width / 2);
{ var toppos = screen.height / 2 - (height / 2);
if($("input[name=veri_up_hash]").size() < 1)
$("input[name=cert_no]").after('<input type="hidden" name="veri_up_hash" value="">'); var winopts = "width=" + width + ", height=" + height + ", toolbar=no,status=no,statusbar=no,menubar=no,scrollbars=no,resizable=no";
var position = ",left=" + leftpos + ", top=" + toppos;
if( navigator.userAgent.indexOf("Android") > - 1 || navigator.userAgent.indexOf("iPhone") > - 1 ) var AUTH_POP = window.open(url, 'auth_popup', winopts + position);
{
var $frm = $(event.target.form);
if($("#kcp_cert").size() < 1) {
$frm.wrap('<div id="cert_info"></div>');
$("#cert_info").append('<form name="form_temp" method="post">')
.after('<iframe id="kcp_cert" name="kcp_cert" width="100%" height="700" frameborder="0" scrolling="no" style="display:none"></iframe>');
}
var temp_form = document.form_temp;
temp_form.target = "kcp_cert";
temp_form.action = url;
document.getElementById( "cert_info" ).style.display = "none";
document.getElementById( "kcp_cert" ).style.display = "";
temp_form.submit();
}
else
{
var return_gubun;
var width = 410;
var height = 500;
var leftpos = screen.width / 2 - ( width / 2 );
var toppos = screen.height / 2 - ( height / 2 );
var winopts = "width=" + width + ", height=" + height + ", toolbar=no,status=no,statusbar=no,menubar=no,scrollbars=no,resizable=no";
var position = ",left=" + leftpos + ", top=" + toppos;
var AUTH_POP = window.open(url,'auth_popup', winopts + position);
}
}
else if(type == 'lg-hp')
{
var popupWindow = window.open( url, "auth_popup", "left=200, top=100, width=400, height=400, scrollbar=yes" );
popupWindow.focus();
} }
}
else if (type == 'lg-hp') {
var popupWindow = window.open(url, "auth_popup", "left=200, top=100, width=400, height=400, scrollbar=yes");
popupWindow.focus();
}
} }
// 인증체크 // 인증체크
function cert_confirm() function cert_confirm() {
{ var type;
var type; var val = document.fregisterform.cert_type.value
var val = document.fregisterform.cert_type.value
switch(val) { switch (val) {
case "ipin": case "ipin":
type = "아이핀"; type = "아이핀";
break; break;
case "hp": case "hp":
type = "휴대폰"; type = "휴대폰";
break; break;
default: default:
return true; return true;
} }
if(confirm("이미 "+type+"으로 본인확인을 완료하셨습니다.\n\n이전 인증을 취소하고 다시 인증하시겠습니까?")) if (confirm("이미 " + type + "으로 본인확인을 완료하셨습니다.\n\n이전 인증을 취소하고 다시 인증하시겠습니까?"))
return true; return true;
else else
return false; return false;
} }

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,3 @@
/*! HTML5 Shiv vpre3.6 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed /*! HTML5 Shiv vpre3.6 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
Uncompressed source: https://github.com/aFarkas/html5shiv */ Uncompressed source: https://github.com/aFarkas/html5shiv */
(function(a,b){function h(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function i(){var a=l.elements;return typeof a=="string"?a.split(" "):a}function j(a){var b={},c=a.createElement,f=a.createDocumentFragment,g=f();a.createElement=function(a){if(!l.shivMethods)return c(a);var f;return b[a]?f=b[a].cloneNode():e.test(a)?f=(b[a]=c(a)).cloneNode():f=c(a),f.canHaveChildren&&!d.test(a)?g.appendChild(f):f},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+i().join().replace(/\w+/g,function(a){return c(a),g.createElement(a),'c("'+a+'")'})+");return n}")(l,g)}function k(a){var b;return a.documentShived?a:(l.shivCSS&&!f&&(b=!!h(a,"article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio{display:none}canvas,video{display:inline-block;*display:inline;*zoom:1}[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}mark{background:#FF0;color:#000}")),g||(b=!j(a)),b&&(a.documentShived=b),a)}var c=a.html5||{},d=/^<|^(?:button|form|map|select|textarea|object|iframe|option|optgroup)$/i,e=/^<|^(?:a|b|button|code|div|fieldset|form|h1|h2|h3|h4|h5|h6|i|iframe|img|input|label|li|link|ol|option|p|param|q|script|select|span|strong|style|table|tbody|td|textarea|tfoot|th|thead|tr|ul)$/i,f,g;(function(){var c=b.createElement("a");c.innerHTML="<xyz></xyz>",f="hidden"in c,f&&typeof injectElementWithStyles=="function"&&injectElementWithStyles("#modernizr{}",function(b){b.hidden=!0,f=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle).display=="none"}),g=c.childNodes.length==1||function(){try{b.createElement("a")}catch(a){return!0}var c=b.createDocumentFragment();return typeof c.cloneNode=="undefined"||typeof c.createDocumentFragment=="undefined"||typeof c.createElement=="undefined"}()})();var l={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:k};a.html5=l,k(b)})(this,document) (function(a,b){function h(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function i(){var a=l.elements;return typeof a=="string"?a.split(" "):a}function j(a){var b={},c=a.createElement,f=a.createDocumentFragment,g=f();a.createElement=function(a){if(!l.shivMethods)return c(a);var f;return b[a]?f=b[a].cloneNode():e.test(a)?f=(b[a]=c(a)).cloneNode():f=c(a),f.canHaveChildren&&!d.test(a)?g.appendChild(f):f},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+i().join().replace(/\w+/g,function(a){return c(a),g.createElement(a),'c("'+a+'")'})+");return n}")(l,g)}function k(a){var b;return a.documentShived?a:(l.shivCSS&&!f&&(b=!!h(a,"article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio{display:none}canvas,video{display:inline-block;*display:inline;*zoom:1}[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}mark{background:#FF0;color:#000}")),g||(b=!j(a)),b&&(a.documentShived=b),a)}var c=a.html5||{},d=/^<|^(?:button|form|map|select|textarea|object|iframe|option|optgroup)$/i,e=/^<|^(?:a|b|button|code|div|fieldset|form|h1|h2|h3|h4|h5|h6|i|iframe|img|input|label|li|link|ol|option|p|param|q|script|select|span|strong|style|table|tbody|td|textarea|tfoot|th|thead|tr|ul)$/i,f,g;(function(){var c=b.createElement("a");c.innerHTML="<xyz></xyz>",f="hidden"in c,f&&typeof injectElementWithStyles=="function"&&injectElementWithStyles("#modernizr{}",function(b){b.hidden=!0,f=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle).display=="none"}),g=c.childNodes.length==1||function(){try{b.createElement("a")}catch(a){return!0}var c=b.createDocumentFragment();return typeof c.cloneNode=="undefined"||typeof c.createDocumentFragment=="undefined"||typeof c.createElement=="undefined"}()})();var l={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:k};a.html5=l,k(b)})(this,document)

View file

@ -6,109 +6,109 @@
* Released under the MIT license * Released under the MIT license
*/ */
(function (factory) { (function (factory) {
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
// AMD (Register as an anonymous module) // AMD (Register as an anonymous module)
define(['jquery'], factory); define(['jquery'], factory);
} else if (typeof exports === 'object') { } else if (typeof exports === 'object') {
// Node/CommonJS // Node/CommonJS
module.exports = factory(require('jquery')); module.exports = factory(require('jquery'));
} else { } else {
// Browser globals // Browser globals
factory(jQuery); factory(jQuery);
} }
}(function ($) { }(function ($) {
var pluses = /\+/g; var pluses = /\+/g;
function encode(s) { function encode(s) {
return config.raw ? s : encodeURIComponent(s); return config.raw ? s : encodeURIComponent(s);
} }
function decode(s) { function decode(s) {
return config.raw ? s : decodeURIComponent(s); return config.raw ? s : decodeURIComponent(s);
} }
function stringifyCookieValue(value) { function stringifyCookieValue(value) {
return encode(config.json ? JSON.stringify(value) : String(value)); return encode(config.json ? JSON.stringify(value) : String(value));
} }
function parseCookieValue(s) { function parseCookieValue(s) {
if (s.indexOf('"') === 0) { if (s.indexOf('"') === 0) {
// This is a quoted cookie as according to RFC2068, unescape... // This is a quoted cookie as according to RFC2068, unescape...
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
} }
try { try {
// Replace server-side written pluses with spaces. // Replace server-side written pluses with spaces.
// If we can't decode the cookie, ignore it, it's unusable. // If we can't decode the cookie, ignore it, it's unusable.
// If we can't parse the cookie, ignore it, it's unusable. // If we can't parse the cookie, ignore it, it's unusable.
s = decodeURIComponent(s.replace(pluses, ' ')); s = decodeURIComponent(s.replace(pluses, ' '));
return config.json ? JSON.parse(s) : s; return config.json ? JSON.parse(s) : s;
} catch(e) {} } catch (e) { }
} }
function read(s, converter) { function read(s, converter) {
var value = config.raw ? s : parseCookieValue(s); var value = config.raw ? s : parseCookieValue(s);
return $.isFunction(converter) ? converter(value) : value; return $.isFunction(converter) ? converter(value) : value;
} }
var config = $.cookie = function (key, value, options) { var config = $.cookie = function (key, value, options) {
// Write // Write
if (arguments.length > 1 && !$.isFunction(value)) { if (arguments.length > 1 && !$.isFunction(value)) {
options = $.extend({}, config.defaults, options); options = $.extend({}, config.defaults, options);
if (typeof options.expires === 'number') { if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date(); var days = options.expires, t = options.expires = new Date();
t.setMilliseconds(t.getMilliseconds() + days * 864e+5); t.setMilliseconds(t.getMilliseconds() + days * 864e+5);
} }
return (document.cookie = [ return (document.cookie = [
encode(key), '=', stringifyCookieValue(value), encode(key), '=', stringifyCookieValue(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '', options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '', options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : '' options.secure ? '; secure' : ''
].join('')); ].join(''));
} }
// Read // Read
var result = key ? undefined : {}, var result = key ? undefined : {},
// To prevent the for loop in the first place assign an empty array // To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all. Also prevents odd result when // in case there are no cookies at all. Also prevents odd result when
// calling $.cookie(). // calling $.cookie().
cookies = document.cookie ? document.cookie.split('; ') : [], cookies = document.cookie ? document.cookie.split('; ') : [],
i = 0, i = 0,
l = cookies.length; l = cookies.length;
for (; i < l; i++) { for (; i < l; i++) {
var parts = cookies[i].split('='), var parts = cookies[i].split('='),
name = decode(parts.shift()), name = decode(parts.shift()),
cookie = parts.join('='); cookie = parts.join('=');
if (key === name) { if (key === name) {
// If second argument (value) is a function it's a converter... // If second argument (value) is a function it's a converter...
result = read(cookie, value); result = read(cookie, value);
break; break;
} }
// Prevent storing a cookie that we couldn't decode. // Prevent storing a cookie that we couldn't decode.
if (!key && (cookie = read(cookie)) !== undefined) { if (!key && (cookie = read(cookie)) !== undefined) {
result[name] = cookie; result[name] = cookie;
} }
} }
return result; return result;
}; };
config.defaults = {}; config.defaults = {};
$.removeCookie = function (key, options) { $.removeCookie = function (key, options) {
// Must not alter options, thus extending a fresh object... // Must not alter options, thus extending a fresh object...
$.cookie(key, '', $.extend({}, options, { expires: -1 })); $.cookie(key, '', $.extend({}, options, { expires: -1 }));
return !$.cookie(key); return !$.cookie(key);
}; };
})); }));

View file

@ -1,65 +1,63 @@
(function($) { (function ($) {
$.fn.fancyList = function(element, clear) $.fn.fancyList = function (element, clear) {
{ var cfg = {
var cfg = { element: "li",
element: "li", clear: "clear"
clear: "clear" };
};
if(typeof element == "object") if (typeof element == "object")
cfg = $.extend( cfg, element ); cfg = $.extend(cfg, element);
else { else {
if(element) if (element)
cfg = $.extend( cfg, { element: element } ); cfg = $.extend(cfg, { element: element });
if(clear) if (clear)
cfg = $.extend( cfg, { clear: clear } ); cfg = $.extend(cfg, { clear: clear });
}
var $element = this.find(cfg.element);
var $this = this;
if($element.size() < 1)
return;
function item_arrange()
{
var $el = $element.filter(":first");
var padding = 0;
if($el.data("padding-right") == undefined) {
padding = parseInt($el.css("padding-right"));
$el.data("padding-right", padding);
}
else
padding = $el.data("padding-right");
$element.css("padding-left", 0).css("padding-right", padding);
$element.filter("."+cfg.clear).removeClass(cfg.clear);
var wrap_width = parseInt($this.width());
var item_width = parseInt($el.outerWidth());
var line_count = parseInt((wrap_width + padding) / item_width);
if(line_count == 0)
return;
var space = parseInt(wrap_width % item_width);
if((space + padding) < item_width) {
space = wrap_width - ((item_width - padding) * line_count);
var new_padding = parseInt(space / (line_count * 2));
if(new_padding > padding)
$element.css("padding-left", new_padding+"px").css("padding-right", new_padding);
}
$element.filter(":nth-child("+line_count+"n)").css("padding-right", 0);
$element.filter(":nth-child("+line_count+"n+1)").addClass(cfg.clear);
}
item_arrange();
$(window).resize(function() {
item_arrange();
});
} }
}(jQuery));
var $element = this.find(cfg.element);
var $this = this;
if ($element.size() < 1)
return;
function item_arrange() {
var $el = $element.filter(":first");
var padding = 0;
if ($el.data("padding-right") == undefined) {
padding = parseInt($el.css("padding-right"));
$el.data("padding-right", padding);
}
else
padding = $el.data("padding-right");
$element.css("padding-left", 0).css("padding-right", padding);
$element.filter("." + cfg.clear).removeClass(cfg.clear);
var wrap_width = parseInt($this.width());
var item_width = parseInt($el.outerWidth());
var line_count = parseInt((wrap_width + padding) / item_width);
if (line_count == 0)
return;
var space = parseInt(wrap_width % item_width);
if ((space + padding) < item_width) {
space = wrap_width - ((item_width - padding) * line_count);
var new_padding = parseInt(space / (line_count * 2));
if (new_padding > padding)
$element.css("padding-left", new_padding + "px").css("padding-right", new_padding);
}
$element.filter(":nth-child(" + line_count + "n)").css("padding-right", 0);
$element.filter(":nth-child(" + line_count + "n+1)").addClass(cfg.clear);
}
item_arrange();
$(window).resize(function () {
item_arrange();
});
}
}(jQuery));

View file

@ -1,109 +1,108 @@
$(function(){ $(function () {
var hide_menu = false; var hide_menu = false;
var mouse_event = false; var mouse_event = false;
var oldX = oldY = 0; var oldX = oldY = 0;
$(document).mousemove(function(e) { $(document).mousemove(function (e) {
if(oldX == 0) { if (oldX == 0) {
oldX = e.pageX; oldX = e.pageX;
oldY = e.pageY; oldY = e.pageY;
} }
if(oldX != e.pageX || oldY != e.pageY) { if (oldX != e.pageX || oldY != e.pageY) {
mouse_event = true; mouse_event = true;
} }
}); });
// 주메뉴 // 주메뉴
var $gnb = $(".gnb_1dli > a"); var $gnb = $(".gnb_1dli > a");
$gnb.mouseover(function() { $gnb.mouseover(function () {
if(mouse_event) { if (mouse_event) {
$("#hd").addClass("hd_zindex"); $("#hd").addClass("hd_zindex");
$(".gnb_1dli").removeClass("gnb_1dli_over gnb_1dli_over2 gnb_1dli_on"); $(".gnb_1dli").removeClass("gnb_1dli_over gnb_1dli_over2 gnb_1dli_on");
$(this).parent().addClass("gnb_1dli_over gnb_1dli_on"); $(this).parent().addClass("gnb_1dli_over gnb_1dli_on");
menu_rearrange($(this).parent()); menu_rearrange($(this).parent());
hide_menu = false; hide_menu = false;
} }
}); });
$gnb.mouseout(function() { $gnb.mouseout(function () {
hide_menu = true; hide_menu = true;
}); });
$(".gnb_2dli").mouseover(function() { $(".gnb_2dli").mouseover(function () {
hide_menu = false; hide_menu = false;
}); });
$(".gnb_2dli").mouseout(function() { $(".gnb_2dli").mouseout(function () {
hide_menu = true; hide_menu = true;
}); });
$gnb.focusin(function() { $gnb.focusin(function () {
$("#hd").addClass("hd_zindex"); $("#hd").addClass("hd_zindex");
$(".gnb_1dli").removeClass("gnb_1dli_over gnb_1dli_over2 gnb_1dli_on"); $(".gnb_1dli").removeClass("gnb_1dli_over gnb_1dli_over2 gnb_1dli_on");
$(this).parent().addClass("gnb_1dli_over gnb_1dli_on"); $(this).parent().addClass("gnb_1dli_over gnb_1dli_on");
menu_rearrange($(this).parent()); menu_rearrange($(this).parent());
hide_menu = false; hide_menu = false;
}); });
$gnb.focusout(function() { $gnb.focusout(function () {
hide_menu = true; hide_menu = true;
}); });
$(".gnb_2da").focusin(function() { $(".gnb_2da").focusin(function () {
$(".gnb_1dli").removeClass("gnb_1dli_over gnb_1dli_over2 gnb_1dli_on"); $(".gnb_1dli").removeClass("gnb_1dli_over gnb_1dli_over2 gnb_1dli_on");
var $gnb_li = $(this).closest(".gnb_1dli").addClass("gnb_1dli_over gnb_1dli_on"); var $gnb_li = $(this).closest(".gnb_1dli").addClass("gnb_1dli_over gnb_1dli_on");
menu_rearrange($(this).closest(".gnb_1dli")); menu_rearrange($(this).closest(".gnb_1dli"));
hide_menu = false; hide_menu = false;
}); });
$(".gnb_2da").focusout(function() { $(".gnb_2da").focusout(function () {
hide_menu = true; hide_menu = true;
}); });
$('#gnb_1dul>li').bind('mouseleave',function(){ $('#gnb_1dul>li').bind('mouseleave', function () {
submenu_hide(); submenu_hide();
}); });
$(document).bind('click focusin',function(){ $(document).bind('click focusin', function () {
if(hide_menu) { if (hide_menu) {
submenu_hide(); submenu_hide();
} }
}); });
}); });
function submenu_hide() { function submenu_hide() {
$("#hd").removeClass("hd_zindex"); $("#hd").removeClass("hd_zindex");
$(".gnb_1dli").removeClass("gnb_1dli_over gnb_1dli_over2 gnb_1dli_on"); $(".gnb_1dli").removeClass("gnb_1dli_over gnb_1dli_over2 gnb_1dli_on");
} }
function menu_rearrange(el) function menu_rearrange(el) {
{ var width = $("#gnb_1dul").width();
var width = $("#gnb_1dul").width(); var left = w1 = w2 = 0;
var left = w1 = w2 = 0; var idx = $(".gnb_1dli").index(el);
var idx = $(".gnb_1dli").index(el); var max_menu_count = 0;
var max_menu_count = 0; var $gnb_1dli;
var $gnb_1dli;
for(i=0; i<=idx; i++) { for (i = 0; i <= idx; i++) {
$gnb_1dli = $(".gnb_1dli:eq("+i+")"); $gnb_1dli = $(".gnb_1dli:eq(" + i + ")");
w1 = $gnb_1dli.outerWidth(); w1 = $gnb_1dli.outerWidth();
if($gnb_1dli.find(".gnb_2dul").size()) if ($gnb_1dli.find(".gnb_2dul").size())
w2 = $gnb_1dli.find(".gnb_2dli > a").outerWidth(true); w2 = $gnb_1dli.find(".gnb_2dli > a").outerWidth(true);
else else
w2 = w1; w2 = w1;
if((left + w2) > width) { if ((left + w2) > width) {
if(max_menu_count == 0) if (max_menu_count == 0)
max_menu_count = i + 1; max_menu_count = i + 1;
}
if(max_menu_count > 0 && (idx + 1) % max_menu_count == 0) {
el.removeClass("gnb_1dli_over").addClass("gnb_1dli_over2");
left = 0;
} else {
left += w1;
}
} }
}
if (max_menu_count > 0 && (idx + 1) % max_menu_count == 0) {
el.removeClass("gnb_1dli_over").addClass("gnb_1dli_over2");
left = 0;
} else {
left += w1;
}
}
}

View file

@ -1,92 +1,92 @@
var reg_mb_id_check = function() { var reg_mb_id_check = function () {
var result = ""; var result = "";
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: g5_bbs_url+"/ajax.mb_id.php", url: g5_bbs_url + "/ajax.mb_id.php",
data: { data: {
"reg_mb_id": encodeURIComponent($("#reg_mb_id").val()) "reg_mb_id": encodeURIComponent($("#reg_mb_id").val())
}, },
cache: false, cache: false,
async: false, async: false,
success: function(data) { success: function (data) {
result = data; result = data;
} }
}); });
return result; return result;
} }
// 추천인 검사 // 추천인 검사
var reg_mb_recommend_check = function() { var reg_mb_recommend_check = function () {
var result = ""; var result = "";
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: g5_bbs_url+"/ajax.mb_recommend.php", url: g5_bbs_url + "/ajax.mb_recommend.php",
data: { data: {
"reg_mb_recommend": encodeURIComponent($("#reg_mb_recommend").val()) "reg_mb_recommend": encodeURIComponent($("#reg_mb_recommend").val())
}, },
cache: false, cache: false,
async: false, async: false,
success: function(data) { success: function (data) {
result = data; result = data;
} }
}); });
return result; return result;
} }
var reg_mb_nick_check = function() { var reg_mb_nick_check = function () {
var result = ""; var result = "";
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: g5_bbs_url+"/ajax.mb_nick.php", url: g5_bbs_url + "/ajax.mb_nick.php",
data: { data: {
"reg_mb_nick": ($("#reg_mb_nick").val()), "reg_mb_nick": ($("#reg_mb_nick").val()),
"reg_mb_id": encodeURIComponent($("#reg_mb_id").val()) "reg_mb_id": encodeURIComponent($("#reg_mb_id").val())
}, },
cache: false, cache: false,
async: false, async: false,
success: function(data) { success: function (data) {
result = data; result = data;
} }
}); });
return result; return result;
} }
var reg_mb_email_check = function() { var reg_mb_email_check = function () {
var result = ""; var result = "";
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: g5_bbs_url+"/ajax.mb_email.php", url: g5_bbs_url + "/ajax.mb_email.php",
data: { data: {
"reg_mb_email": $("#reg_mb_email").val(), "reg_mb_email": $("#reg_mb_email").val(),
"reg_mb_id": encodeURIComponent($("#reg_mb_id").val()) "reg_mb_id": encodeURIComponent($("#reg_mb_id").val())
}, },
cache: false, cache: false,
async: false, async: false,
success: function(data) { success: function (data) {
result = data; result = data;
} }
}); });
return result; return result;
} }
var reg_mb_hp_check = function() { var reg_mb_hp_check = function () {
var result = ""; var result = "";
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: g5_bbs_url+"/ajax.mb_hp.php", url: g5_bbs_url + "/ajax.mb_hp.php",
data: { data: {
"reg_mb_hp": $("#reg_mb_hp").val(), "reg_mb_hp": $("#reg_mb_hp").val(),
"reg_mb_id": encodeURIComponent($("#reg_mb_id").val()) "reg_mb_id": encodeURIComponent($("#reg_mb_id").val())
}, },
cache: false, cache: false,
async: false, async: false,
success: function(data) { success: function (data) {
result = data; result = data;
} }
}); });
return result; return result;
} }

View file

@ -8,60 +8,60 @@
* http://mattstow.com * http://mattstow.com
* Licensed under the MIT license * Licensed under the MIT license
*/ */
;(function($) { ; (function ($) {
$.fn.rwdImageMaps = function() { $.fn.rwdImageMaps = function () {
var $img = this; var $img = this;
var rwdImageMap = function() { var rwdImageMap = function () {
$img.each(function() { $img.each(function () {
if (typeof($(this).attr('usemap')) == 'undefined') if (typeof ($(this).attr('usemap')) == 'undefined')
return; return;
var that = this, var that = this,
$that = $(that); $that = $(that);
// Since WebKit doesn't know the height until after the image has loaded, perform everything in an onload copy // Since WebKit doesn't know the height until after the image has loaded, perform everything in an onload copy
$('<img />').on('load', function() { $('<img />').on('load', function () {
var attrW = 'width', var attrW = 'width',
attrH = 'height', attrH = 'height',
w = $that.attr(attrW), w = $that.attr(attrW),
h = $that.attr(attrH); h = $that.attr(attrH);
if (!w || !h) { if (!w || !h) {
var temp = new Image(); var temp = new Image();
temp.src = $that.attr('src'); temp.src = $that.attr('src');
if (!w) if (!w)
w = temp.width; w = temp.width;
if (!h) if (!h)
h = temp.height; h = temp.height;
} }
var wPercent = $that.width()/100, var wPercent = $that.width() / 100,
hPercent = $that.height()/100, hPercent = $that.height() / 100,
map = $that.attr('usemap').replace('#', ''), map = $that.attr('usemap').replace('#', ''),
c = 'coords'; c = 'coords';
$('map[name="' + map + '"]').find('area').each(function() { $('map[name="' + map + '"]').find('area').each(function () {
var $this = $(this); var $this = $(this);
if (!$this.data(c)) if (!$this.data(c))
$this.data(c, $this.attr(c)); $this.data(c, $this.attr(c));
var coords = $this.data(c).split(','), var coords = $this.data(c).split(','),
coordsPercent = new Array(coords.length); coordsPercent = new Array(coords.length);
for (var i = 0; i < coordsPercent.length; ++i) { for (var i = 0; i < coordsPercent.length; ++i) {
if (i % 2 === 0) if (i % 2 === 0)
coordsPercent[i] = parseInt(((coords[i]/w)*100)*wPercent); coordsPercent[i] = parseInt(((coords[i] / w) * 100) * wPercent);
else else
coordsPercent[i] = parseInt(((coords[i]/h)*100)*hPercent); coordsPercent[i] = parseInt(((coords[i] / h) * 100) * hPercent);
} }
$this.attr(c, coordsPercent.toString()); $this.attr(c, coordsPercent.toString());
}); });
}).attr('src', $that.attr('src')); }).attr('src', $that.attr('src'));
}); });
}; };
$(window).resize(rwdImageMap).trigger('resize'); $(window).resize(rwdImageMap).trigger('resize');
return this; return this;
}; };
})(jQuery); })(jQuery);

View file

@ -4,90 +4,90 @@
* http://composite.tistory.com * http://composite.tistory.com
* This project licensed under a MIT License. * This project licensed under a MIT License.
**************************************************************************************/; **************************************************************************************/;
(function($){ (function ($) {
//default properties. //default properties.
var a=/a/i,defs={ var a = /a/i, defs = {
liitem:'li', item:'a',next:'[&gt;{5}]',prev:'[{4}&lt;]',format:'[{0}]', liitem: 'li', item: 'a', next: '[&gt;{5}]', prev: '[{4}&lt;]', format: '[{0}]',
itemClass:'',appendhtml:'',sideClass:'paging-side',prevClass:'paging-side', itemClass: '', appendhtml: '', sideClass: 'paging-side', prevClass: 'paging-side',
itemCurrent:'active',length:10,max:1,current:1,append:false itemCurrent: 'active', length: 10, max: 1, current: 1, append: false
,href:'#{0}',event:true,first:'[1&lt;&lt;]',last:'[&gt;&gt;{6}]' , href: '#{0}', event: true, first: '[1&lt;&lt;]', last: '[&gt;&gt;{6}]'
},InStr=function(strSearch, charSearchFor) { }, InStr = function (strSearch, charSearchFor) {
return strSearch.indexOf(charSearchFor); return strSearch.indexOf(charSearchFor);
},format=function(str){ }, format = function (str) {
var arg=arguments; var arg = arguments;
return str.replace(/\{(\d+)\}/g,function(m,d){ return str.replace(/\{(\d+)\}/g, function (m, d) {
if(+d<0) return m; if (+d < 0) return m;
else return arg[+d+1]||""; else return arg[+d + 1] || "";
}); });
},item,make=function(op,page,cls,str){ }, item, make = function (op, page, cls, str) {
var is_current = false; var is_current = false;
if( InStr( cls , op.itemCurrent) > -1 ){ if (InStr(cls, op.itemCurrent) > -1) {
item=document.createElement("strong"); item = document.createElement("strong");
is_current = true; is_current = true;
} else { } else {
item=document.createElement(op.item); item = document.createElement(op.item);
} }
item.className=cls; item.className = cls;
item.innerHTML=format(str,page,op.length,op.start,op.end,op.start-1,op.end+1,op.max); item.innerHTML = format(str, page, op.length, op.start, op.end, op.start - 1, op.end + 1, op.max);
if(a.test(op.item)) item.href=format(op.href,page); if (a.test(op.item)) item.href = format(op.href, page);
if(op.event){ if (op.event) {
$(item).bind('click',function(e){ $(item).bind('click', function (e) {
var fired=true; var fired = true;
if($.isFunction(op.onclick)) fired=op.onclick.call(item,e,page,op); if ($.isFunction(op.onclick)) fired = op.onclick.call(item, e, page, op);
if(fired==undefined||fired) if (fired == undefined || fired)
op.origin.paging($.extend({},op,{current:page})); op.origin.paging($.extend({}, op, { current: page }));
return fired; return fired;
}); });
/* /*
$liitem= $(document.createElement(op.liitem)); $liitem= $(document.createElement(op.liitem));
$liitem.addClass(cls); $liitem.addClass(cls);
$liitem.append($(item)); $liitem.append($(item));
*/ */
if(op.appendhtml){ if (op.appendhtml) {
$(item).append(op.appendhtml); $(item).append(op.appendhtml);
} }
$(item).appendTo(op.origin); $(item).appendTo(op.origin);
if( is_current ){ if (is_current) {
$(item).prepend('<span class="sound_only">열린</span>'); $(item).prepend('<span class="sound_only">열린</span>');
} else { } else {
(op.origin).append('\n'); (op.origin).append('\n');
} }
//bind event for each elements. //bind event for each elements.
var ev='on'; var ev = 'on';
switch(str){ switch (str) {
case op.prev:ev+='prev';break; case op.prev: ev += 'prev'; break;
case op.next:ev+='next';break; case op.next: ev += 'next'; break;
case op.first:ev+='first';break; case op.first: ev += 'first'; break;
case op.last:ev+='last';break; case op.last: ev += 'last'; break;
default:ev+='item';break; default: ev += 'item'; break;
} }
if($.isFunction(op[ev])) op[ev].call(item,page,op); if ($.isFunction(op[ev])) op[ev].call(item, page, op);
} }
return item; return item;
}; };
$.fn.paging=function(op){ $.fn.paging = function (op) {
op=$.extend({origin:this},defs,op||{});this.html(''); op = $.extend({ origin: this }, defs, op || {}); this.html('');
if(op.max<1) op.max=1; if(op.current<1) op.current=1; if (op.max < 1) op.max = 1; if (op.current < 1) op.current = 1;
op.start=Math.floor((op.current-1)/op.length)*op.length+1; op.start = Math.floor((op.current - 1) / op.length) * op.length + 1;
op.end=op.start-1+op.length; op.end = op.start - 1 + op.length;
if(op.end>op.max) op.end=op.max; if (op.end > op.max) op.end = op.max;
if(!op.append) this.empty(); if (!op.append) this.empty();
//prev button //prev button
if(op.current>op.length){ if (op.current > op.length) {
//if(op.first!==false) make(op,1,op.sideClass,op.first); //if(op.first!==false) make(op,1,op.sideClass,op.first);
make(op,op.start-1,op.prevClass,op.prev); make(op, op.start - 1, op.prevClass, op.prev);
} }
//pages button //pages button
for(var i=op.start;i<=op.end;i++){ for (var i = op.start; i <= op.end; i++) {
make(op,i,op.itemClass+(i==op.current?' '+op.itemCurrent:''),op.format); make(op, i, op.itemClass + (i == op.current ? ' ' + op.itemCurrent : ''), op.format);
} }
//next button //next button
if(op.current<=Math.floor(op.max/op.length)*op.length){ if (op.current <= Math.floor(op.max / op.length) * op.length) {
if(op.max > op.length && op.max > op.end ){ make(op,op.end+1,op.sideClass,op.next); } if (op.max > op.length && op.max > op.end) { make(op, op.end + 1, op.sideClass, op.next); }
//if(op.last!==false) make(op,op.max,op.sideClass,op.last); //if(op.last!==false) make(op,op.max,op.sideClass,op.last);
} }
//last button //last button
}; };
})(jQuery); })(jQuery);

View file

@ -1,10 +1,9 @@
function kakaolink_send(text, url) function kakaolink_send(text, url) {
{ // 카카오톡 링크 버튼을 생성합니다. 처음 한번만 호출하면 됩니다.
// 카카오톡 링크 버튼을 생성합니다. 처음 한번만 호출하면 됩니다. Kakao.Link.sendTalkLink({
Kakao.Link.sendTalkLink({ webLink: {
webLink : { text: String(text),
text: String(text), url: url // 앱 설정의 웹 플랫폼에 등록한 도메인의 URL이어야 합니다.
url: url // 앱 설정의 웹 플랫폼에 등록한 도메인의 URL이어야 합니다. }
} });
}); }
}

View file

@ -1,165 +1,156 @@
if (typeof(MD5_JS) == 'undefined') // 한번만 실행 if (typeof (MD5_JS) == 'undefined') // 한번만 실행
{ {
var MD5_JS = true; var MD5_JS = true;
/* See http://pajhome.org.uk/crypt/md5 for more info */ /* See http://pajhome.org.uk/crypt/md5 for more info */
var hexcase = 0; var hexcase = 0;
var b64pad = ""; var b64pad = "";
var chrsz = 8; var chrsz = 8;
function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));} function hex_md5(s) { return binl2hex(core_md5(str2binl(s), s.length * chrsz)); }
function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));} function b64_md5(s) { return binl2b64(core_md5(str2binl(s), s.length * chrsz)); }
function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));} function str_md5(s) { return binl2str(core_md5(str2binl(s), s.length * chrsz)); }
function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); } function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); } function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); } function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }
function core_md5(x, len) function core_md5(x, len) {
{ x[len >> 5] |= 0x80 << ((len) % 32); x[(((len + 64) >>> 9) << 4) + 14] = len;
x[len >> 5] |= 0x80 << ((len) % 32); x[(((len + 64) >>> 9) << 4) + 14] = len; var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878;
var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; for (var i = 0; i < x.length; i += 16) {
for(var i = 0; i < x.length; i += 16) var olda = a; var oldb = b; var oldc = c; var oldd = d;
{ a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936);
var olda = a; var oldb = b; var oldc = c; var oldd = d; d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936); c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586); b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819); a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330); d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897); c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426); b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341); a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983); d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416); c = md5_ff(c, d, a, b, x[i + 10], 17, -42063);
d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417); b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
c = md5_ff(c, d, a, b, x[i+10], 17, -42063); a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162); d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682); c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
d = md5_ff(d, a, b, c, x[i+13], 12, -40341101); b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329);
a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510); a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632); d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
c = md5_gg(c, d, a, b, x[i+11], 14, 643717713); c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302); b = md5_gg(b, c, d, a, x[i + 0], 20, -373897302);
a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691); a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083); d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
c = md5_gg(c, d, a, b, x[i+15], 14, -660478335); c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848); b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438); a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690); d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961); c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501); b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467); a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784); d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473); c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734); b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558); a = md5_hh(a, b, c, d, x[i + 5], 4, -378558);
d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463); d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562); c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
b = md5_hh(b, c, d, a, x[i+14], 23, -35309556); b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060); a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353); d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632); c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640); b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174); a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222); d = md5_hh(d, a, b, c, x[i + 0], 11, -358537222);
c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979); c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189); b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487); a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
d = md5_hh(d, a, b, c, x[i+12], 11, -421815835); d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
c = md5_hh(c, d, a, b, x[i+15], 16, 530742520); c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651); b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844); a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844);
d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415); d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905); c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055); b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571); a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606); d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
c = md5_ii(c, d, a, b, x[i+10], 15, -1051523); c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799); b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359); a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
d = md5_ii(d, a, b, c, x[i+15], 10, -30611744); d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380); c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649); b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070); a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379); d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259); c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551); b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
a = safe_add(a, olda); b = safe_add(b, oldb); c = safe_add(c, oldc); d = safe_add(d, oldd); a = safe_add(a, olda); b = safe_add(b, oldb); c = safe_add(c, oldc); d = safe_add(d, oldd);
} }
return Array(a, b, c, d); return Array(a, b, c, d);
}
function md5_cmn(q, a, b, x, s, t) { return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b); }
function md5_ff(a, b, c, d, x, s, t) { return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); }
function md5_gg(a, b, c, d, x, s, t) { return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); }
function md5_hh(a, b, c, d, x, s, t) { return md5_cmn(b ^ c ^ d, a, b, x, s, t); }
function md5_ii(a, b, c, d, x, s, t) { return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); }
function core_hmac_md5(key, data) {
var bkey = str2binl(key);
if (bkey.length > 16)
bkey = core_md5(bkey, key.length * chrsz);
var ipad = Array(16), opad = Array(16);
for (var i = 0; i < 16; i++) {
ipad[i] = bkey[i] ^ 0x36363636;
opad[i] = bkey[i] ^ 0x5C5C5C5C;
} }
function md5_cmn(q, a, b, x, s, t) { return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); } var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
function md5_ff(a, b, c, d, x, s, t) { return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); } return core_md5(opad.concat(hash), 512 + 128);
function md5_gg(a, b, c, d, x, s, t) { return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); } }
function md5_hh(a, b, c, d, x, s, t) { return md5_cmn(b ^ c ^ d, a, b, x, s, t); }
function md5_ii(a, b, c, d, x, s, t) { return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); }
function core_hmac_md5(key, data) { function safe_add(x, y) { var lsw = (x & 0xFFFF) + (y & 0xFFFF); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); }
var bkey = str2binl(key); function bit_rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); }
if(bkey.length > 16)
bkey = core_md5(bkey, key.length * chrsz);
var ipad = Array(16), opad = Array(16); function str2binl(str) {
for(var i = 0; i < 16; i++) var bin = Array(); var mask = (1 << chrsz) - 1;
{ for (var i = 0; i < str.length * chrsz; i += chrsz)
ipad[i] = bkey[i] ^ 0x36363636; bin[i >> 5] |= (str.charCodeAt(i / chrsz) & mask) << (i % 32);
opad[i] = bkey[i] ^ 0x5C5C5C5C; return bin;
} }
var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz); function binl2str(bin) {
return core_md5(opad.concat(hash), 512 + 128); var str = ""; var mask = (1 << chrsz) - 1;
for (var i = 0; i < bin.length * 32; i += chrsz)
str += String.fromCharCode((bin[i >> 5] >>> (i % 32)) & mask); return str;
}
function binl2hex(binarray) {
var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; var str = "";
for (var i = 0; i < binarray.length * 4; i++)
str += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xF) + hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8)) & 0xF);
return str;
}
function binl2b64(binarray) {
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var str = "";
for (var i = 0; i < binarray.length * 4; i += 3) {
var triplet = (((binarray[i >> 2] >> 8 * (i % 4)) & 0xFF) << 16)
| (((binarray[i + 1 >> 2] >> 8 * ((i + 1) % 4)) & 0xFF) << 8)
| ((binarray[i + 2 >> 2] >> 8 * ((i + 2) % 4)) & 0xFF);
for (var j = 0; j < 4; j++) {
if (i * 8 + j * 6 > binarray.length * 32)
str += b64pad;
else
str += tab.charAt((triplet >> 6 * (3 - j)) & 0x3F);
}
} }
return str;
function safe_add(x, y) { var lsw = (x & 0xFFFF) + (y & 0xFFFF); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); } }
function bit_rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); } }
function str2binl(str)
{
var bin = Array(); var mask = (1 << chrsz) - 1;
for(var i = 0; i < str.length * chrsz; i += chrsz)
bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
return bin;
}
function binl2str(bin)
{
var str = ""; var mask = (1 << chrsz) - 1;
for(var i = 0; i < bin.length * 32; i += chrsz)
str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask); return str;
}
function binl2hex(binarray)
{
var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; var str = "";
for(var i = 0; i < binarray.length * 4; i++)
str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);
return str;
}
function binl2b64(binarray)
{
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var str = "";
for(var i = 0; i < binarray.length * 4; i += 3)
{
var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16)
| (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )
| ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);
for(var j = 0; j < 4; j++)
{
if(i * 8 + j * 6 > binarray.length * 32)
str += b64pad;
else
str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
}
}
return str;
}
}

View file

@ -12,9 +12,10 @@
(function (global, factory) { (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) : typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.Swiper = factory()); (global = global || self, global.Swiper = factory());
}(this, function () { 'use strict'; }(this, function () {
'use strict';
/** /**
* SSR Window 1.0.1 * SSR Window 1.0.1
@ -29,10 +30,10 @@
*/ */
var doc = (typeof document === 'undefined') ? { var doc = (typeof document === 'undefined') ? {
body: {}, body: {},
addEventListener: function addEventListener() {}, addEventListener: function addEventListener() { },
removeEventListener: function removeEventListener() {}, removeEventListener: function removeEventListener() { },
activeElement: { activeElement: {
blur: function blur() {}, blur: function blur() { },
nodeName: '', nodeName: '',
}, },
querySelector: function querySelector() { querySelector: function querySelector() {
@ -46,7 +47,7 @@
}, },
createEvent: function createEvent() { createEvent: function createEvent() {
return { return {
initEvent: function initEvent() {}, initEvent: function initEvent() { },
}; };
}, },
createElement: function createElement() { createElement: function createElement() {
@ -54,7 +55,7 @@
children: [], children: [],
childNodes: [], childNodes: [],
style: {}, style: {},
setAttribute: function setAttribute() {}, setAttribute: function setAttribute() { },
getElementsByTagName: function getElementsByTagName() { getElementsByTagName: function getElementsByTagName() {
return []; return [];
}, },
@ -73,8 +74,8 @@
CustomEvent: function CustomEvent() { CustomEvent: function CustomEvent() {
return this; return this;
}, },
addEventListener: function addEventListener() {}, addEventListener: function addEventListener() { },
removeEventListener: function removeEventListener() {}, removeEventListener: function removeEventListener() { },
getComputedStyle: function getComputedStyle() { getComputedStyle: function getComputedStyle() {
return { return {
getPropertyValue: function getPropertyValue() { getPropertyValue: function getPropertyValue() {
@ -82,11 +83,11 @@
}, },
}; };
}, },
Image: function Image() {}, Image: function Image() { },
Date: function Date() {}, Date: function Date() { },
screen: {}, screen: {},
setTimeout: function setTimeout() {}, setTimeout: function setTimeout() { },
clearTimeout: function clearTimeout() {}, clearTimeout: function clearTimeout() { },
} : window; // eslint-disable-line } : window; // eslint-disable-line
/** /**
@ -123,7 +124,7 @@
} }
} }
if (selector) { if (selector) {
// String // String
if (typeof selector === 'string') { if (typeof selector === 'string') {
var els; var els;
var tempParent; var tempParent;
@ -297,7 +298,7 @@
var assign; var assign;
var args = [], len = arguments.length; var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ]; while (len--) args[len] = arguments[len];
var eventType = args[0]; var eventType = args[0];
var targetSelector = args[1]; var targetSelector = args[1];
var listener = args[2]; var listener = args[2];
@ -365,7 +366,7 @@
var assign; var assign;
var args = [], len = arguments.length; var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ]; while (len--) args[len] = arguments[len];
var eventType = args[0]; var eventType = args[0];
var targetSelector = args[1]; var targetSelector = args[1];
var listener = args[2]; var listener = args[2];
@ -408,7 +409,7 @@
} }
function trigger() { function trigger() {
var args = [], len = arguments.length; var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ]; while (len--) args[len] = arguments[len];
var events = args[0].split(' '); var events = args[0].split(' ');
var eventData = args[1]; var eventData = args[1];
@ -627,7 +628,7 @@
} }
function append() { function append() {
var args = [], len = arguments.length; var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ]; while (len--) args[len] = arguments[len];
var newChild; var newChild;
@ -798,7 +799,7 @@
} }
function add() { function add() {
var args = [], len = arguments.length; var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ]; while (len--) args[len] = arguments[len];
var dom = this; var dom = this;
var i; var i;
@ -875,7 +876,7 @@
}); });
}, },
nextTick: function nextTick(callback, delay) { nextTick: function nextTick(callback, delay) {
if ( delay === void 0 ) delay = 0; if (delay === void 0) delay = 0;
return setTimeout(callback, delay); return setTimeout(callback, delay);
}, },
@ -883,7 +884,7 @@
return Date.now(); return Date.now();
}, },
getTranslate: function getTranslate(el, axis) { getTranslate: function getTranslate(el, axis) {
if ( axis === void 0 ) axis = 'x'; if (axis === void 0) axis = 'x';
var matrix; var matrix;
var curTransform; var curTransform;
@ -946,7 +947,7 @@
}, },
extend: function extend() { extend: function extend() {
var args = [], len$1 = arguments.length; var args = [], len$1 = arguments.length;
while ( len$1-- ) args[ len$1 ] = arguments[ len$1 ]; while (len$1--) args[len$1] = arguments[len$1];
var to = Object(args[0]); var to = Object(args[0]);
for (var i = 1; i < args.length; i += 1) { for (var i = 1; i < args.length; i += 1) {
@ -1008,7 +1009,7 @@
}()); }());
var SwiperClass = function SwiperClass(params) { var SwiperClass = function SwiperClass(params) {
if ( params === void 0 ) params = {}; if (params === void 0) params = {};
var self = this; var self = this;
self.params = params; self.params = params;
@ -1025,7 +1026,7 @@
var staticAccessors = { components: { configurable: true } }; var staticAccessors = { components: { configurable: true } };
SwiperClass.prototype.on = function on (events, handler, priority) { SwiperClass.prototype.on = function on(events, handler, priority) {
var self = this; var self = this;
if (typeof handler !== 'function') { return self; } if (typeof handler !== 'function') { return self; }
var method = priority ? 'unshift' : 'push'; var method = priority ? 'unshift' : 'push';
@ -1036,12 +1037,12 @@
return self; return self;
}; };
SwiperClass.prototype.once = function once (events, handler, priority) { SwiperClass.prototype.once = function once(events, handler, priority) {
var self = this; var self = this;
if (typeof handler !== 'function') { return self; } if (typeof handler !== 'function') { return self; }
function onceHandler() { function onceHandler() {
var args = [], len = arguments.length; var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ]; while (len--) args[len] = arguments[len];
handler.apply(self, args); handler.apply(self, args);
self.off(events, onceHandler); self.off(events, onceHandler);
@ -1053,7 +1054,7 @@
return self.on(events, onceHandler, priority); return self.on(events, onceHandler, priority);
}; };
SwiperClass.prototype.off = function off (events, handler) { SwiperClass.prototype.off = function off(events, handler) {
var self = this; var self = this;
if (!self.eventsListeners) { return self; } if (!self.eventsListeners) { return self; }
events.split(' ').forEach(function (event) { events.split(' ').forEach(function (event) {
@ -1070,9 +1071,9 @@
return self; return self;
}; };
SwiperClass.prototype.emit = function emit () { SwiperClass.prototype.emit = function emit() {
var args = [], len = arguments.length; var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ]; while (len--) args[len] = arguments[len];
var self = this; var self = this;
if (!self.eventsListeners) { return self; } if (!self.eventsListeners) { return self; }
@ -1103,7 +1104,7 @@
return self; return self;
}; };
SwiperClass.prototype.useModulesParams = function useModulesParams (instanceParams) { SwiperClass.prototype.useModulesParams = function useModulesParams(instanceParams) {
var instance = this; var instance = this;
if (!instance.modules) { return; } if (!instance.modules) { return; }
Object.keys(instance.modules).forEach(function (moduleName) { Object.keys(instance.modules).forEach(function (moduleName) {
@ -1115,8 +1116,8 @@
}); });
}; };
SwiperClass.prototype.useModules = function useModules (modulesParams) { SwiperClass.prototype.useModules = function useModules(modulesParams) {
if ( modulesParams === void 0 ) modulesParams = {}; if (modulesParams === void 0) modulesParams = {};
var instance = this; var instance = this;
if (!instance.modules) { return; } if (!instance.modules) { return; }
@ -1154,9 +1155,9 @@
Class.use(components); Class.use(components);
}; };
SwiperClass.installModule = function installModule (module) { SwiperClass.installModule = function installModule(module) {
var params = [], len = arguments.length - 1; var params = [], len = arguments.length - 1;
while ( len-- > 0 ) params[ len ] = arguments[ len + 1 ]; while (len-- > 0) params[len] = arguments[len + 1];
var Class = this; var Class = this;
if (!Class.prototype.modules) { Class.prototype.modules = {}; } if (!Class.prototype.modules) { Class.prototype.modules = {}; }
@ -1181,21 +1182,21 @@
return Class; return Class;
}; };
SwiperClass.use = function use (module) { SwiperClass.use = function use(module) {
var params = [], len = arguments.length - 1; var params = [], len = arguments.length - 1;
while ( len-- > 0 ) params[ len ] = arguments[ len + 1 ]; while (len-- > 0) params[len] = arguments[len + 1];
var Class = this; var Class = this;
if (Array.isArray(module)) { if (Array.isArray(module)) {
module.forEach(function (m) { return Class.installModule(m); }); module.forEach(function (m) { return Class.installModule(m); });
return Class; return Class;
} }
return Class.installModule.apply(Class, [ module ].concat( params )); return Class.installModule.apply(Class, [module].concat(params));
}; };
Object.defineProperties( SwiperClass, staticAccessors ); Object.defineProperties(SwiperClass, staticAccessors);
function updateSize () { function updateSize() {
var swiper = this; var swiper = this;
var width; var width;
var height; var height;
@ -1225,7 +1226,7 @@
}); });
} }
function updateSlides () { function updateSlides() {
var swiper = this; var swiper = this;
var params = swiper.params; var params = swiper.params;
@ -1520,7 +1521,7 @@
} }
} }
function updateAutoHeight (speed) { function updateAutoHeight(speed) {
var swiper = this; var swiper = this;
var activeSlides = []; var activeSlides = [];
var newHeight = 0; var newHeight = 0;
@ -1553,7 +1554,7 @@
if (newHeight) { swiper.$wrapperEl.css('height', (newHeight + "px")); } if (newHeight) { swiper.$wrapperEl.css('height', (newHeight + "px")); }
} }
function updateSlidesOffset () { function updateSlidesOffset() {
var swiper = this; var swiper = this;
var slides = swiper.slides; var slides = swiper.slides;
for (var i = 0; i < slides.length; i += 1) { for (var i = 0; i < slides.length; i += 1) {
@ -1561,8 +1562,8 @@
} }
} }
function updateSlidesProgress (translate) { function updateSlidesProgress(translate) {
if ( translate === void 0 ) translate = (this && this.translate) || 0; if (translate === void 0) translate = (this && this.translate) || 0;
var swiper = this; var swiper = this;
var params = swiper.params; var params = swiper.params;
@ -1591,8 +1592,8 @@
var slideBefore = -(offsetCenter - slide.swiperSlideOffset); var slideBefore = -(offsetCenter - slide.swiperSlideOffset);
var slideAfter = slideBefore + swiper.slidesSizesGrid[i]; var slideAfter = slideBefore + swiper.slidesSizesGrid[i];
var isVisible = (slideBefore >= 0 && slideBefore < swiper.size - 1) var isVisible = (slideBefore >= 0 && slideBefore < swiper.size - 1)
|| (slideAfter > 1 && slideAfter <= swiper.size) || (slideAfter > 1 && slideAfter <= swiper.size)
|| (slideBefore <= 0 && slideAfter >= swiper.size); || (slideBefore <= 0 && slideAfter >= swiper.size);
if (isVisible) { if (isVisible) {
swiper.visibleSlides.push(slide); swiper.visibleSlides.push(slide);
swiper.visibleSlidesIndexes.push(i); swiper.visibleSlidesIndexes.push(i);
@ -1604,7 +1605,7 @@
swiper.visibleSlides = $(swiper.visibleSlides); swiper.visibleSlides = $(swiper.visibleSlides);
} }
function updateProgress (translate) { function updateProgress(translate) {
var swiper = this; var swiper = this;
if (typeof translate === 'undefined') { if (typeof translate === 'undefined') {
var multiplier = swiper.rtlTranslate ? -1 : 1; var multiplier = swiper.rtlTranslate ? -1 : 1;
@ -1648,7 +1649,7 @@
swiper.emit('progress', progress); swiper.emit('progress', progress);
} }
function updateSlidesClasses () { function updateSlidesClasses() {
var swiper = this; var swiper = this;
var slides = swiper.slides; var slides = swiper.slides;
@ -1717,7 +1718,7 @@
} }
} }
function updateActiveIndex (newActiveIndex) { function updateActiveIndex(newActiveIndex) {
var swiper = this; var swiper = this;
var translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; var translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
var slidesGrid = swiper.slidesGrid; var slidesGrid = swiper.slidesGrid;
@ -1778,7 +1779,7 @@
} }
} }
function updateClickedSlide (e) { function updateClickedSlide(e) {
var swiper = this; var swiper = this;
var params = swiper.params; var params = swiper.params;
var slide = $(e.target).closest(("." + (params.slideClass)))[0]; var slide = $(e.target).closest(("." + (params.slideClass)))[0];
@ -1818,8 +1819,8 @@
updateClickedSlide: updateClickedSlide, updateClickedSlide: updateClickedSlide,
}; };
function getTranslate (axis) { function getTranslate(axis) {
if ( axis === void 0 ) axis = this.isHorizontal() ? 'x' : 'y'; if (axis === void 0) axis = this.isHorizontal() ? 'x' : 'y';
var swiper = this; var swiper = this;
@ -1841,7 +1842,7 @@
return currentTranslate || 0; return currentTranslate || 0;
} }
function setTranslate (translate, byController) { function setTranslate(translate, byController) {
var swiper = this; var swiper = this;
var rtl = swiper.rtlTranslate; var rtl = swiper.rtlTranslate;
var params = swiper.params; var params = swiper.params;
@ -1886,11 +1887,11 @@
swiper.emit('setTranslate', swiper.translate, byController); swiper.emit('setTranslate', swiper.translate, byController);
} }
function minTranslate () { function minTranslate() {
return (-this.snapGrid[0]); return (-this.snapGrid[0]);
} }
function maxTranslate () { function maxTranslate() {
return (-this.snapGrid[this.snapGrid.length - 1]); return (-this.snapGrid[this.snapGrid.length - 1]);
} }
@ -1901,7 +1902,7 @@
maxTranslate: maxTranslate, maxTranslate: maxTranslate,
}; };
function setTransition (duration, byController) { function setTransition(duration, byController) {
var swiper = this; var swiper = this;
if (!swiper.params.cssMode) { if (!swiper.params.cssMode) {
@ -1911,8 +1912,8 @@
swiper.emit('setTransition', duration, byController); swiper.emit('setTransition', duration, byController);
} }
function transitionStart (runCallbacks, direction) { function transitionStart(runCallbacks, direction) {
if ( runCallbacks === void 0 ) runCallbacks = true; if (runCallbacks === void 0) runCallbacks = true;
var swiper = this; var swiper = this;
var activeIndex = swiper.activeIndex; var activeIndex = swiper.activeIndex;
@ -1946,8 +1947,8 @@
} }
} }
function transitionEnd$1 (runCallbacks, direction) { function transitionEnd$1(runCallbacks, direction) {
if ( runCallbacks === void 0 ) runCallbacks = true; if (runCallbacks === void 0) runCallbacks = true;
var swiper = this; var swiper = this;
var activeIndex = swiper.activeIndex; var activeIndex = swiper.activeIndex;
@ -1986,12 +1987,12 @@
transitionEnd: transitionEnd$1, transitionEnd: transitionEnd$1,
}; };
function slideTo (index, speed, runCallbacks, internal) { function slideTo(index, speed, runCallbacks, internal) {
var obj; var obj;
if ( index === void 0 ) index = 0; if (index === void 0) index = 0;
if ( speed === void 0 ) speed = this.params.speed; if (speed === void 0) speed = this.params.speed;
if ( runCallbacks === void 0 ) runCallbacks = true; if (runCallbacks === void 0) runCallbacks = true;
var swiper = this; var swiper = this;
var slideIndex = index; var slideIndex = index;
if (slideIndex < 0) { slideIndex = 0; } if (slideIndex < 0) { slideIndex = 0; }
@ -2067,7 +2068,7 @@
} else { } else {
// eslint-disable-next-line // eslint-disable-next-line
if (wrapperEl.scrollTo) { if (wrapperEl.scrollTo) {
wrapperEl.scrollTo(( obj = {}, obj[isH ? 'left' : 'top'] = -translate, obj.behavior = 'smooth', obj )); wrapperEl.scrollTo((obj = {}, obj[isH ? 'left' : 'top'] = -translate, obj.behavior = 'smooth', obj));
} else { } else {
wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -translate; wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -translate;
} }
@ -2111,10 +2112,10 @@
return true; return true;
} }
function slideToLoop (index, speed, runCallbacks, internal) { function slideToLoop(index, speed, runCallbacks, internal) {
if ( index === void 0 ) index = 0; if (index === void 0) index = 0;
if ( speed === void 0 ) speed = this.params.speed; if (speed === void 0) speed = this.params.speed;
if ( runCallbacks === void 0 ) runCallbacks = true; if (runCallbacks === void 0) runCallbacks = true;
var swiper = this; var swiper = this;
var newIndex = index; var newIndex = index;
@ -2126,9 +2127,9 @@
} }
/* eslint no-unused-vars: "off" */ /* eslint no-unused-vars: "off" */
function slideNext (speed, runCallbacks, internal) { function slideNext(speed, runCallbacks, internal) {
if ( speed === void 0 ) speed = this.params.speed; if (speed === void 0) speed = this.params.speed;
if ( runCallbacks === void 0 ) runCallbacks = true; if (runCallbacks === void 0) runCallbacks = true;
var swiper = this; var swiper = this;
var params = swiper.params; var params = swiper.params;
@ -2144,9 +2145,9 @@
} }
/* eslint no-unused-vars: "off" */ /* eslint no-unused-vars: "off" */
function slidePrev (speed, runCallbacks, internal) { function slidePrev(speed, runCallbacks, internal) {
if ( speed === void 0 ) speed = this.params.speed; if (speed === void 0) speed = this.params.speed;
if ( runCallbacks === void 0 ) runCallbacks = true; if (runCallbacks === void 0) runCallbacks = true;
var swiper = this; var swiper = this;
var params = swiper.params; var params = swiper.params;
@ -2186,18 +2187,18 @@
} }
/* eslint no-unused-vars: "off" */ /* eslint no-unused-vars: "off" */
function slideReset (speed, runCallbacks, internal) { function slideReset(speed, runCallbacks, internal) {
if ( speed === void 0 ) speed = this.params.speed; if (speed === void 0) speed = this.params.speed;
if ( runCallbacks === void 0 ) runCallbacks = true; if (runCallbacks === void 0) runCallbacks = true;
var swiper = this; var swiper = this;
return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal); return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal);
} }
/* eslint no-unused-vars: "off" */ /* eslint no-unused-vars: "off" */
function slideToClosest (speed, runCallbacks, internal) { function slideToClosest(speed, runCallbacks, internal) {
if ( speed === void 0 ) speed = this.params.speed; if (speed === void 0) speed = this.params.speed;
if ( runCallbacks === void 0 ) runCallbacks = true; if (runCallbacks === void 0) runCallbacks = true;
var swiper = this; var swiper = this;
var index = swiper.activeIndex; var index = swiper.activeIndex;
@ -2217,7 +2218,7 @@
return swiper.slideTo(index, speed, runCallbacks, internal); return swiper.slideTo(index, speed, runCallbacks, internal);
} }
function slideToClickedSlide () { function slideToClickedSlide() {
var swiper = this; var swiper = this;
var params = swiper.params; var params = swiper.params;
var $wrapperEl = swiper.$wrapperEl; var $wrapperEl = swiper.$wrapperEl;
@ -2273,7 +2274,7 @@
slideToClickedSlide: slideToClickedSlide, slideToClickedSlide: slideToClickedSlide,
}; };
function loopCreate () { function loopCreate() {
var swiper = this; var swiper = this;
var params = swiper.params; var params = swiper.params;
var $wrapperEl = swiper.$wrapperEl; var $wrapperEl = swiper.$wrapperEl;
@ -2317,7 +2318,7 @@
} }
} }
function loopFix () { function loopFix() {
var swiper = this; var swiper = this;
var params = swiper.params; var params = swiper.params;
var activeIndex = swiper.activeIndex; var activeIndex = swiper.activeIndex;
@ -2356,7 +2357,7 @@
swiper.allowSlideNext = allowSlideNext; swiper.allowSlideNext = allowSlideNext;
} }
function loopDestroy () { function loopDestroy() {
var swiper = this; var swiper = this;
var $wrapperEl = swiper.$wrapperEl; var $wrapperEl = swiper.$wrapperEl;
var params = swiper.params; var params = swiper.params;
@ -2371,7 +2372,7 @@
loopDestroy: loopDestroy, loopDestroy: loopDestroy,
}; };
function setGrabCursor (moving) { function setGrabCursor(moving) {
var swiper = this; var swiper = this;
if (Support.touch || !swiper.params.simulateTouch || (swiper.params.watchOverflow && swiper.isLocked) || swiper.params.cssMode) { return; } if (Support.touch || !swiper.params.simulateTouch || (swiper.params.watchOverflow && swiper.isLocked) || swiper.params.cssMode) { return; }
var el = swiper.el; var el = swiper.el;
@ -2381,7 +2382,7 @@
el.style.cursor = moving ? 'grabbing' : 'grab'; el.style.cursor = moving ? 'grabbing' : 'grab';
} }
function unsetGrabCursor () { function unsetGrabCursor() {
var swiper = this; var swiper = this;
if (Support.touch || (swiper.params.watchOverflow && swiper.isLocked) || swiper.params.cssMode) { return; } if (Support.touch || (swiper.params.watchOverflow && swiper.isLocked) || swiper.params.cssMode) { return; }
swiper.el.style.cursor = ''; swiper.el.style.cursor = '';
@ -2392,7 +2393,7 @@
unsetGrabCursor: unsetGrabCursor, unsetGrabCursor: unsetGrabCursor,
}; };
function appendSlide (slides) { function appendSlide(slides) {
var swiper = this; var swiper = this;
var $wrapperEl = swiper.$wrapperEl; var $wrapperEl = swiper.$wrapperEl;
var params = swiper.params; var params = swiper.params;
@ -2414,7 +2415,7 @@
} }
} }
function prependSlide (slides) { function prependSlide(slides) {
var swiper = this; var swiper = this;
var params = swiper.params; var params = swiper.params;
var $wrapperEl = swiper.$wrapperEl; var $wrapperEl = swiper.$wrapperEl;
@ -2441,7 +2442,7 @@
swiper.slideTo(newActiveIndex, 0, false); swiper.slideTo(newActiveIndex, 0, false);
} }
function addSlide (index, slides) { function addSlide(index, slides) {
var swiper = this; var swiper = this;
var $wrapperEl = swiper.$wrapperEl; var $wrapperEl = swiper.$wrapperEl;
var params = swiper.params; var params = swiper.params;
@ -2496,7 +2497,7 @@
} }
} }
function removeSlide (slidesIndexes) { function removeSlide(slidesIndexes) {
var swiper = this; var swiper = this;
var params = swiper.params; var params = swiper.params;
var $wrapperEl = swiper.$wrapperEl; var $wrapperEl = swiper.$wrapperEl;
@ -2539,7 +2540,7 @@
} }
} }
function removeAllSlides () { function removeAllSlides() {
var swiper = this; var swiper = this;
var slidesIndexes = []; var slidesIndexes = [];
@ -2670,7 +2671,7 @@
return device; return device;
}()); }());
function onTouchStart (event) { function onTouchStart(event) {
var swiper = this; var swiper = this;
var data = swiper.touchEventsData; var data = swiper.touchEventsData;
var params = swiper.params; var params = swiper.params;
@ -2710,7 +2711,7 @@
if ( if (
edgeSwipeDetection edgeSwipeDetection
&& ((startX <= edgeSwipeThreshold) && ((startX <= edgeSwipeThreshold)
|| (startX >= win.screen.width - edgeSwipeThreshold)) || (startX >= win.screen.width - edgeSwipeThreshold))
) { ) {
return; return;
} }
@ -2749,7 +2750,7 @@
swiper.emit('touchStart', e); swiper.emit('touchStart', e);
} }
function onTouchMove (event) { function onTouchMove(event) {
var swiper = this; var swiper = this;
var data = swiper.touchEventsData; var data = swiper.touchEventsData;
var params = swiper.params; var params = swiper.params;
@ -2820,7 +2821,7 @@
var diffX = touches.currentX - touches.startX; var diffX = touches.currentX - touches.startX;
var diffY = touches.currentY - touches.startY; var diffY = touches.currentY - touches.startY;
if (swiper.params.threshold && Math.sqrt((Math.pow( diffX, 2 )) + (Math.pow( diffY, 2 ))) < swiper.params.threshold) { return; } if (swiper.params.threshold && Math.sqrt((Math.pow(diffX, 2)) + (Math.pow(diffY, 2))) < swiper.params.threshold) { return; }
if (typeof data.isScrolling === 'undefined') { if (typeof data.isScrolling === 'undefined') {
var touchAngle; var touchAngle;
@ -2892,10 +2893,10 @@
} }
if ((diff > 0 && data.currentTranslate > swiper.minTranslate())) { if ((diff > 0 && data.currentTranslate > swiper.minTranslate())) {
disableParentSwiper = false; disableParentSwiper = false;
if (params.resistance) { data.currentTranslate = (swiper.minTranslate() - 1) + (Math.pow( (-swiper.minTranslate() + data.startTranslate + diff), resistanceRatio )); } if (params.resistance) { data.currentTranslate = (swiper.minTranslate() - 1) + (Math.pow((-swiper.minTranslate() + data.startTranslate + diff), resistanceRatio)); }
} else if (diff < 0 && data.currentTranslate < swiper.maxTranslate()) { } else if (diff < 0 && data.currentTranslate < swiper.maxTranslate()) {
disableParentSwiper = false; disableParentSwiper = false;
if (params.resistance) { data.currentTranslate = (swiper.maxTranslate() + 1) - (Math.pow( (swiper.maxTranslate() - data.startTranslate - diff), resistanceRatio )); } if (params.resistance) { data.currentTranslate = (swiper.maxTranslate() + 1) - (Math.pow((swiper.maxTranslate() - data.startTranslate - diff), resistanceRatio)); }
} }
if (disableParentSwiper) { if (disableParentSwiper) {
@ -2954,7 +2955,7 @@
swiper.setTranslate(data.currentTranslate); swiper.setTranslate(data.currentTranslate);
} }
function onTouchEnd (event) { function onTouchEnd(event) {
var swiper = this; var swiper = this;
var data = swiper.touchEventsData; var data = swiper.touchEventsData;
@ -3228,7 +3229,7 @@
} }
} }
function onResize () { function onResize() {
var swiper = this; var swiper = this;
var params = swiper.params; var params = swiper.params;
@ -3282,7 +3283,7 @@
} }
} }
function onClick (e) { function onClick(e) {
var swiper = this; var swiper = this;
if (!swiper.allowClick) { if (!swiper.allowClick) {
if (swiper.params.preventClicks) { e.preventDefault(); } if (swiper.params.preventClicks) { e.preventDefault(); }
@ -3293,7 +3294,7 @@
} }
} }
function onScroll () { function onScroll() {
var swiper = this; var swiper = this;
var wrapperEl = swiper.wrapperEl; var wrapperEl = swiper.wrapperEl;
swiper.previousTranslate = swiper.translate; swiper.previousTranslate = swiper.translate;
@ -3418,11 +3419,11 @@
detachEvents: detachEvents, detachEvents: detachEvents,
}; };
function setBreakpoint () { function setBreakpoint() {
var swiper = this; var swiper = this;
var activeIndex = swiper.activeIndex; var activeIndex = swiper.activeIndex;
var initialized = swiper.initialized; var initialized = swiper.initialized;
var loopedSlides = swiper.loopedSlides; if ( loopedSlides === void 0 ) loopedSlides = 0; var loopedSlides = swiper.loopedSlides; if (loopedSlides === void 0) loopedSlides = 0;
var params = swiper.params; var params = swiper.params;
var $el = swiper.$el; var $el = swiper.$el;
var breakpoints = params.breakpoints; var breakpoints = params.breakpoints;
@ -3487,7 +3488,7 @@
} }
} }
function getBreakpoint (breakpoints) { function getBreakpoint(breakpoints) {
// Get breakpoint for window width // Get breakpoint for window width
if (!breakpoints) { return undefined; } if (!breakpoints) { return undefined; }
var breakpoint = false; var breakpoint = false;
@ -3507,7 +3508,7 @@
var breakpoints = { setBreakpoint: setBreakpoint, getBreakpoint: getBreakpoint }; var breakpoints = { setBreakpoint: setBreakpoint, getBreakpoint: getBreakpoint };
function addClasses () { function addClasses() {
var swiper = this; var swiper = this;
var classNames = swiper.classNames; var classNames = swiper.classNames;
var params = swiper.params; var params = swiper.params;
@ -3551,7 +3552,7 @@
$el.addClass(classNames.join(' ')); $el.addClass(classNames.join(' '));
} }
function removeClasses () { function removeClasses() {
var swiper = this; var swiper = this;
var $el = swiper.$el; var $el = swiper.$el;
var classNames = swiper.classNames; var classNames = swiper.classNames;
@ -3561,7 +3562,7 @@
var classes = { addClasses: addClasses, removeClasses: removeClasses }; var classes = { addClasses: addClasses, removeClasses: removeClasses };
function loadImage (imageEl, src, srcset, sizes, checkForComplete, callback) { function loadImage(imageEl, src, srcset, sizes, checkForComplete, callback) {
var image; var image;
function onReady() { function onReady() {
if (callback) { callback(); } if (callback) { callback(); }
@ -3589,7 +3590,7 @@
} }
} }
function preloadImages () { function preloadImages() {
var swiper = this; var swiper = this;
swiper.imagesToLoad = swiper.$el.find('img'); swiper.imagesToLoad = swiper.$el.find('img');
function onReady() { function onReady() {
@ -3792,7 +3793,7 @@
var assign; var assign;
var args = [], len = arguments.length; var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ]; while (len--) args[len] = arguments[len];
var el; var el;
var params; var params;
if (args.length === 1 && args[0].constructor && args[0].constructor === Object) { if (args.length === 1 && args[0].constructor && args[0].constructor === Object) {
@ -4001,13 +4002,13 @@
return swiper; return swiper;
} }
if ( SwiperClass ) Swiper.__proto__ = SwiperClass; if (SwiperClass) Swiper.__proto__ = SwiperClass;
Swiper.prototype = Object.create( SwiperClass && SwiperClass.prototype ); Swiper.prototype = Object.create(SwiperClass && SwiperClass.prototype);
Swiper.prototype.constructor = Swiper; Swiper.prototype.constructor = Swiper;
var staticAccessors = { extendedDefaults: { configurable: true },defaults: { configurable: true },Class: { configurable: true },$: { configurable: true } }; var staticAccessors = { extendedDefaults: { configurable: true }, defaults: { configurable: true }, Class: { configurable: true }, $: { configurable: true } };
Swiper.prototype.slidesPerViewDynamic = function slidesPerViewDynamic () { Swiper.prototype.slidesPerViewDynamic = function slidesPerViewDynamic() {
var swiper = this; var swiper = this;
var params = swiper.params; var params = swiper.params;
var slides = swiper.slides; var slides = swiper.slides;
@ -4042,7 +4043,7 @@
return spv; return spv;
}; };
Swiper.prototype.update = function update () { Swiper.prototype.update = function update() {
var swiper = this; var swiper = this;
if (!swiper || swiper.destroyed) { return; } if (!swiper || swiper.destroyed) { return; }
var snapGrid = swiper.snapGrid; var snapGrid = swiper.snapGrid;
@ -4085,8 +4086,8 @@
swiper.emit('update'); swiper.emit('update');
}; };
Swiper.prototype.changeDirection = function changeDirection (newDirection, needUpdate) { Swiper.prototype.changeDirection = function changeDirection(newDirection, needUpdate) {
if ( needUpdate === void 0 ) needUpdate = true; if (needUpdate === void 0) needUpdate = true;
var swiper = this; var swiper = this;
var currentDirection = swiper.params.direction; var currentDirection = swiper.params.direction;
@ -4118,7 +4119,7 @@
return swiper; return swiper;
}; };
Swiper.prototype.init = function init () { Swiper.prototype.init = function init() {
var swiper = this; var swiper = this;
if (swiper.initialized) { return; } if (swiper.initialized) { return; }
@ -4173,9 +4174,9 @@
swiper.emit('init'); swiper.emit('init');
}; };
Swiper.prototype.destroy = function destroy (deleteInstance, cleanStyles) { Swiper.prototype.destroy = function destroy(deleteInstance, cleanStyles) {
if ( deleteInstance === void 0 ) deleteInstance = true; if (deleteInstance === void 0) deleteInstance = true;
if ( cleanStyles === void 0 ) cleanStyles = true; if (cleanStyles === void 0) cleanStyles = true;
var swiper = this; var swiper = this;
var params = swiper.params; var params = swiper.params;
@ -4211,7 +4212,7 @@
params.slideVisibleClass, params.slideVisibleClass,
params.slideActiveClass, params.slideActiveClass,
params.slideNextClass, params.slideNextClass,
params.slidePrevClass ].join(' ')) params.slidePrevClass].join(' '))
.removeAttr('style') .removeAttr('style')
.removeAttr('data-swiper-slide-index'); .removeAttr('data-swiper-slide-index');
} }
@ -4234,7 +4235,7 @@
return null; return null;
}; };
Swiper.extendDefaults = function extendDefaults (newDefaults) { Swiper.extendDefaults = function extendDefaults(newDefaults) {
Utils.extend(extendedDefaults, newDefaults); Utils.extend(extendedDefaults, newDefaults);
}; };
@ -4254,7 +4255,7 @@
return $; return $;
}; };
Object.defineProperties( Swiper, staticAccessors ); Object.defineProperties(Swiper, staticAccessors);
return Swiper; return Swiper;
}(SwiperClass)); }(SwiperClass));
@ -4339,7 +4340,7 @@
var Observer = { var Observer = {
func: win.MutationObserver || win.WebkitMutationObserver, func: win.MutationObserver || win.WebkitMutationObserver,
attach: function attach(target, options) { attach: function attach(target, options) {
if ( options === void 0 ) options = {}; if (options === void 0) options = {};
var swiper = this; var swiper = this;
@ -4706,7 +4707,7 @@
[swiperOffset.left, swiperOffset.top], [swiperOffset.left, swiperOffset.top],
[swiperOffset.left + swiper.width, swiperOffset.top], [swiperOffset.left + swiper.width, swiperOffset.top],
[swiperOffset.left, swiperOffset.top + swiper.height], [swiperOffset.left, swiperOffset.top + swiper.height],
[swiperOffset.left + swiper.width, swiperOffset.top + swiper.height] ]; [swiperOffset.left + swiper.width, swiperOffset.top + swiper.height]];
for (var i = 0; i < swiperCoord.length; i += 1) { for (var i = 0; i < swiperCoord.length; i += 1) {
var point = swiperCoord[i]; var point = swiperCoord[i];
if ( if (
@ -5391,8 +5392,8 @@
paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass); paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass);
} else { } else {
paginationHTML = "<span class=\"" + (params.currentClass) + "\"></span>" paginationHTML = "<span class=\"" + (params.currentClass) + "\"></span>"
+ ' / ' + ' / '
+ "<span class=\"" + (params.totalClass) + "\"></span>"; + "<span class=\"" + (params.totalClass) + "\"></span>";
} }
$el.html(paginationHTML); $el.html(paginationHTML);
} }
@ -5982,7 +5983,7 @@
}); });
}, },
setTransition: function setTransition(duration) { setTransition: function setTransition(duration) {
if ( duration === void 0 ) duration = this.params.speed; if (duration === void 0) duration = this.params.speed;
var swiper = this; var swiper = this;
var $el = swiper.$el; var $el = swiper.$el;
@ -6046,7 +6047,7 @@
var y1 = e.targetTouches[0].pageY; var y1 = e.targetTouches[0].pageY;
var x2 = e.targetTouches[1].pageX; var x2 = e.targetTouches[1].pageX;
var y2 = e.targetTouches[1].pageY; var y2 = e.targetTouches[1].pageY;
var distance = Math.sqrt((Math.pow( (x2 - x1), 2 )) + (Math.pow( (y2 - y1), 2 ))); var distance = Math.sqrt((Math.pow((x2 - x1), 2)) + (Math.pow((y2 - y1), 2)));
return distance; return distance;
}, },
// Events // Events
@ -6097,10 +6098,10 @@
zoom.scale = (gesture.scaleMove / gesture.scaleStart) * zoom.currentScale; zoom.scale = (gesture.scaleMove / gesture.scaleStart) * zoom.currentScale;
} }
if (zoom.scale > gesture.maxRatio) { if (zoom.scale > gesture.maxRatio) {
zoom.scale = (gesture.maxRatio - 1) + (Math.pow( ((zoom.scale - gesture.maxRatio) + 1), 0.5 )); zoom.scale = (gesture.maxRatio - 1) + (Math.pow(((zoom.scale - gesture.maxRatio) + 1), 0.5));
} }
if (zoom.scale < params.minRatio) { if (zoom.scale < params.minRatio) {
zoom.scale = (params.minRatio + 1) - (Math.pow( ((params.minRatio - zoom.scale) + 1), 0.5 )); zoom.scale = (params.minRatio + 1) - (Math.pow(((params.minRatio - zoom.scale) + 1), 0.5));
} }
gesture.$imageEl.transform(("translate3d(0,0,0) scale(" + (zoom.scale) + ")")); gesture.$imageEl.transform(("translate3d(0,0,0) scale(" + (zoom.scale) + ")"));
}, },
@ -6204,17 +6205,17 @@
image.currentY = (image.touchesCurrent.y - image.touchesStart.y) + image.startY; image.currentY = (image.touchesCurrent.y - image.touchesStart.y) + image.startY;
if (image.currentX < image.minX) { if (image.currentX < image.minX) {
image.currentX = (image.minX + 1) - (Math.pow( ((image.minX - image.currentX) + 1), 0.8 )); image.currentX = (image.minX + 1) - (Math.pow(((image.minX - image.currentX) + 1), 0.8));
} }
if (image.currentX > image.maxX) { if (image.currentX > image.maxX) {
image.currentX = (image.maxX - 1) + (Math.pow( ((image.currentX - image.maxX) + 1), 0.8 )); image.currentX = (image.maxX - 1) + (Math.pow(((image.currentX - image.maxX) + 1), 0.8));
} }
if (image.currentY < image.minY) { if (image.currentY < image.minY) {
image.currentY = (image.minY + 1) - (Math.pow( ((image.minY - image.currentY) + 1), 0.8 )); image.currentY = (image.minY + 1) - (Math.pow(((image.minY - image.currentY) + 1), 0.8));
} }
if (image.currentY > image.maxY) { if (image.currentY > image.maxY) {
image.currentY = (image.maxY - 1) + (Math.pow( ((image.currentY - image.maxY) + 1), 0.8 )); image.currentY = (image.maxY - 1) + (Math.pow(((image.currentY - image.maxY) + 1), 0.8));
} }
// Velocity // Velocity
@ -6583,7 +6584,7 @@
var Lazy = { var Lazy = {
loadInSlide: function loadInSlide(index, loadInDuplicate) { loadInSlide: function loadInSlide(index, loadInDuplicate) {
if ( loadInDuplicate === void 0 ) loadInDuplicate = true; if (loadInDuplicate === void 0) loadInDuplicate = true;
var swiper = this; var swiper = this;
var params = swiper.params.lazy; var params = swiper.params.lazy;

View file

@ -1,96 +1,92 @@
(function($) { (function ($) {
$.fn.viewimageresize = function(selector) $.fn.viewimageresize = function (selector) {
{ var cfg = {
var cfg = { selector: "img"
selector: "img" };
};
if(typeof selector == "object") { if (typeof selector == "object") {
cfg = $.extend(cfg, selector); cfg = $.extend(cfg, selector);
} else { } else {
if(selector) { if (selector) {
cfg = $.extend({ selector: selector }); cfg = $.extend({ selector: selector });
} }
} }
var $img = this.find(cfg.selector); var $img = this.find(cfg.selector);
var $this = this; var $this = this;
$img.removeAttr("height") $img.removeAttr("height")
.css("height", "");
function image_resize() {
var width = $this.width();
$img.each(function () {
if ($(this).data("width") == undefined)
$(this).data("width", $(this).width());
if ($(this).data("width") > width) {
$(this).removeAttr("width")
.removeAttr("height")
.css("width", "")
.css("height", ""); .css("height", "");
function image_resize() if ($(this).data("width") > width) {
{ $(this).css("width", "100%");
var width = $this.width(); }
$img.each(function() {
if($(this).data("width") == undefined)
$(this).data("width", $(this).width());
if($(this).data("width") > width) {
$(this).removeAttr("width")
.removeAttr("height")
.css("width","")
.css("height", "");
if($(this).data("width") > width) {
$(this).css("width", "100%");
}
} else {
$(this).attr("width", $(this).data("width"));
}
});
}
$(window).on("load", function() {
image_resize();
});
$(window).on("resize", function() {
image_resize();
});
}
$.fn.viewimageresize2 = function(selector)
{
var cfg = {
selector: "img"
};
if(typeof selector == "object") {
cfg = $.extend(cfg, selector);
} else { } else {
if(selector) { $(this).attr("width", $(this).data("width"));
cfg = $.extend({ selector: selector });
}
} }
});
var $img = this.find(cfg.selector);
var $this = this;
function image_resize()
{
var width = $this.width();
$img.each(function() {
$(this).removeAttr("width")
.removeAttr("height")
.css("width","")
.css("height", "");
if($(this).data("width") == undefined)
$(this).data("width", $(this).width());
if($(this).data("width") > width) {
$(this).css("width", "100%");
}
});
}
$(window).on("resize", function() {
image_resize();
});
image_resize();
} }
}(jQuery));
$(window).on("load", function () {
image_resize();
});
$(window).on("resize", function () {
image_resize();
});
}
$.fn.viewimageresize2 = function (selector) {
var cfg = {
selector: "img"
};
if (typeof selector == "object") {
cfg = $.extend(cfg, selector);
} else {
if (selector) {
cfg = $.extend({ selector: selector });
}
}
var $img = this.find(cfg.selector);
var $this = this;
function image_resize() {
var width = $this.width();
$img.each(function () {
$(this).removeAttr("width")
.removeAttr("height")
.css("width", "")
.css("height", "");
if ($(this).data("width") == undefined)
$(this).data("width", $(this).width());
if ($(this).data("width") > width) {
$(this).css("width", "100%");
}
});
}
$(window).on("resize", function () {
image_resize();
});
image_resize();
}
}(jQuery));

View file

@ -4,368 +4,349 @@ var wrestFldDefaultColor = "";
//var wrestFldBackColor = "#ff3061"; //var wrestFldBackColor = "#ff3061";
// subject 속성값을 얻어 return, 없으면 tag의 name을 넘김 // subject 속성값을 얻어 return, 없으면 tag의 name을 넘김
function wrestItemname(fld) function wrestItemname(fld) {
{ //return fld.getAttribute("title") ? fld.getAttribute("title") : ( fld.getAttribute("alt") ? fld.getAttribute("alt") : fld.name );
//return fld.getAttribute("title") ? fld.getAttribute("title") : ( fld.getAttribute("alt") ? fld.getAttribute("alt") : fld.name ); var id = fld.getAttribute("id");
var id = fld.getAttribute("id"); var labels = document.getElementsByTagName("label");
var labels = document.getElementsByTagName("label"); var el = null;
var el = null;
for(i=0; i<labels.length; i++) { for (i = 0; i < labels.length; i++) {
if(id == labels[i].htmlFor) { if (id == labels[i].htmlFor) {
el = labels[i]; el = labels[i];
break; break;
}
} }
}
if(el != null) { if (el != null) {
var text = el.innerHTML.replace(/[<].*[>].*[<]\/+.*[>]/gi, ""); var text = el.innerHTML.replace(/[<].*[>].*[<]\/+.*[>]/gi, "");
if(text == '') { if (text == '') {
return fld.getAttribute("title") ? fld.getAttribute("title") : ( fld.getAttribute("placeholder") ? fld.getAttribute("placeholder") : fld.name ); return fld.getAttribute("title") ? fld.getAttribute("title") : (fld.getAttribute("placeholder") ? fld.getAttribute("placeholder") : fld.name);
} else {
return text;
}
} else { } else {
return fld.getAttribute("title") ? fld.getAttribute("title") : ( fld.getAttribute("placeholder") ? fld.getAttribute("placeholder") : fld.name ); return text;
} }
} else {
return fld.getAttribute("title") ? fld.getAttribute("title") : (fld.getAttribute("placeholder") ? fld.getAttribute("placeholder") : fld.name);
}
} }
// 양쪽 공백 없애기 // 양쪽 공백 없애기
function wrestTrim(fld) function wrestTrim(fld) {
{ var pattern = /(^\s+)|(\s+$)/g; // \s 공백 문자
var pattern = /(^\s+)|(\s+$)/g; // \s 공백 문자 return fld.value.replace(pattern, "");
return fld.value.replace(pattern, "");
} }
// 필수 입력 검사 // 필수 입력 검사
function wrestRequired(fld) function wrestRequired(fld) {
{ if (wrestTrim(fld) == "") {
if (wrestTrim(fld) == "") { if (wrestFld == null) {
if (wrestFld == null) { // 셀렉트박스일 경우에도 필수 선택 검사합니다.
// 셀렉트박스일 경우에도 필수 선택 검사합니다. wrestMsg = wrestItemname(fld) + " : 필수 " + (fld.type == "select-one" ? "선택" : "입력") + "입니다.\n";
wrestMsg = wrestItemname(fld) + " : 필수 "+(fld.type=="select-one"?"선택":"입력")+"입니다.\n"; wrestFld = fld;
wrestFld = fld;
}
} }
}
} }
// 김선용 2006.3 - 전화번호(휴대폰) 형식 검사 : 123-123(4)-5678 // 김선용 2006.3 - 전화번호(휴대폰) 형식 검사 : 123-123(4)-5678
function wrestTelNum(fld) function wrestTelNum(fld) {
{ if (!wrestTrim(fld)) return;
if (!wrestTrim(fld)) return;
var pattern = /^[0-9]{2,3}-[0-9]{3,4}-[0-9]{4}$/; var pattern = /^[0-9]{2,3}-[0-9]{3,4}-[0-9]{4}$/;
if(!pattern.test(fld.value)){ if (!pattern.test(fld.value)) {
if(wrestFld == null){ if (wrestFld == null) {
wrestMsg = wrestItemname(fld)+" : 전화번호 형식이 올바르지 않습니다.\n\n하이픈(-)을 포함하여 입력하세요.\n"; wrestMsg = wrestItemname(fld) + " : 전화번호 형식이 올바르지 않습니다.\n\n하이픈(-)을 포함하여 입력하세요.\n";
wrestFld = fld; wrestFld = fld;
fld.select(); fld.select();
}
} }
}
} }
// 이메일주소 형식 검사 // 이메일주소 형식 검사
function wrestEmail(fld) function wrestEmail(fld) {
{ if (!wrestTrim(fld)) return;
if (!wrestTrim(fld)) return;
//var pattern = /(\S+)@(\S+)\.(\S+)/; 이메일주소에 한글 사용시 //var pattern = /(\S+)@(\S+)\.(\S+)/; 이메일주소에 한글 사용시
var pattern = /([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)\.([0-9a-zA-Z_-]+)/; var pattern = /([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)\.([0-9a-zA-Z_-]+)/;
if (!pattern.test(fld.value)) { if (!pattern.test(fld.value)) {
if (wrestFld == null) { if (wrestFld == null) {
wrestMsg = wrestItemname(fld) + " : 이메일주소 형식이 아닙니다.\n"; wrestMsg = wrestItemname(fld) + " : 이메일주소 형식이 아닙니다.\n";
wrestFld = fld; wrestFld = fld;
}
} }
}
} }
// 한글인지 검사 (자음, 모음 조합된 한글만 가능) // 한글인지 검사 (자음, 모음 조합된 한글만 가능)
function wrestHangul(fld) function wrestHangul(fld) {
{ if (!wrestTrim(fld)) return;
if (!wrestTrim(fld)) return;
//var pattern = /([^가-힣\x20])/i; //var pattern = /([^가-힣\x20])/i;
var pattern = /([^가-힣\x20])/; var pattern = /([^가-힣\x20])/;
if (pattern.test(fld.value)) { if (pattern.test(fld.value)) {
if (wrestFld == null) { if (wrestFld == null) {
wrestMsg = wrestItemname(fld) + ' : 한글이 아닙니다. (자음, 모음 조합된 한글만 가능)\n'; wrestMsg = wrestItemname(fld) + ' : 한글이 아닙니다. (자음, 모음 조합된 한글만 가능)\n';
wrestFld = fld; wrestFld = fld;
}
} }
}
} }
// 한글인지 검사2 (자음, 모음만 있는 한글도 가능) // 한글인지 검사2 (자음, 모음만 있는 한글도 가능)
function wrestHangul2(fld) function wrestHangul2(fld) {
{ if (!wrestTrim(fld)) return;
if (!wrestTrim(fld)) return;
var pattern = /([^가-힣ㄱ-ㅎㅏ-ㅣ\x20])/i; var pattern = /([^가-힣ㄱ-ㅎㅏ-ㅣ\x20])/i;
//var pattern = /([^가-힣ㄱ-ㅎㅏ-ㅣ\x20])/; //var pattern = /([^가-힣ㄱ-ㅎㅏ-ㅣ\x20])/;
if (pattern.test(fld.value)) { if (pattern.test(fld.value)) {
if (wrestFld == null) { if (wrestFld == null) {
wrestMsg = wrestItemname(fld) + ' : 한글이 아닙니다.\n'; wrestMsg = wrestItemname(fld) + ' : 한글이 아닙니다.\n';
wrestFld = fld; wrestFld = fld;
}
} }
}
} }
// 한글,영문,숫자인지 검사3 // 한글,영문,숫자인지 검사3
function wrestHangulAlNum(fld) function wrestHangulAlNum(fld) {
{ if (!wrestTrim(fld)) return;
if (!wrestTrim(fld)) return;
var pattern = /([^가-힣\x20^a-z^A-Z^0-9])/i; var pattern = /([^가-힣\x20^a-z^A-Z^0-9])/i;
if (pattern.test(fld.value)) { if (pattern.test(fld.value)) {
if (wrestFld == null) { if (wrestFld == null) {
wrestMsg = wrestItemname(fld) + ' : 한글, 영문, 숫자가 아닙니다.\n'; wrestMsg = wrestItemname(fld) + ' : 한글, 영문, 숫자가 아닙니다.\n';
wrestFld = fld; wrestFld = fld;
}
} }
}
} }
// 한글,영문 인지 검사 // 한글,영문 인지 검사
function wrestHangulAlpha(fld) function wrestHangulAlpha(fld) {
{ if (!wrestTrim(fld)) return;
if (!wrestTrim(fld)) return;
var pattern = /([^가-힣\x20^a-z^A-Z])/i; var pattern = /([^가-힣\x20^a-z^A-Z])/i;
if (pattern.test(fld.value)) { if (pattern.test(fld.value)) {
if (wrestFld == null) { if (wrestFld == null) {
wrestMsg = wrestItemname(fld) + ' : 한글, 영문이 아닙니다.\n'; wrestMsg = wrestItemname(fld) + ' : 한글, 영문이 아닙니다.\n';
wrestFld = fld; wrestFld = fld;
}
} }
}
} }
// 숫자인지검사 // 숫자인지검사
// 배부른꿀꿀이님 추가 (http://dasir.com) 2003-06-24 // 배부른꿀꿀이님 추가 (http://dasir.com) 2003-06-24
function wrestNumeric(fld) function wrestNumeric(fld) {
{ if (fld.value.length > 0) {
if (fld.value.length > 0) { for (i = 0; i < fld.value.length; i++) {
for (i = 0; i < fld.value.length; i++) { if (fld.value.charAt(i) < '0' || fld.value.charAt(i) > '9') {
if (fld.value.charAt(i) < '0' || fld.value.charAt(i) > '9') { wrestMsg = wrestItemname(fld) + " : 숫자가 아닙니다.\n";
wrestMsg = wrestItemname(fld) + " : 숫자가 아닙니다.\n"; wrestFld = fld;
wrestFld = fld; }
}
}
} }
}
} }
// 영문자 검사 // 영문자 검사
// 배부른꿀꿀이님 추가 (http://dasir.com) 2003-06-24 // 배부른꿀꿀이님 추가 (http://dasir.com) 2003-06-24
function wrestAlpha(fld) function wrestAlpha(fld) {
{ if (!wrestTrim(fld)) return;
if (!wrestTrim(fld)) return;
var pattern = /(^[a-zA-Z]+$)/; var pattern = /(^[a-zA-Z]+$)/;
if (!pattern.test(fld.value)) { if (!pattern.test(fld.value)) {
if (wrestFld == null) { if (wrestFld == null) {
wrestMsg = wrestItemname(fld) + " : 영문이 아닙니다.\n"; wrestMsg = wrestItemname(fld) + " : 영문이 아닙니다.\n";
wrestFld = fld; wrestFld = fld;
}
} }
}
} }
// 영문자와 숫자 검사 // 영문자와 숫자 검사
// 배부른꿀꿀이님 추가 (http://dasir.com) 2003-07-07 // 배부른꿀꿀이님 추가 (http://dasir.com) 2003-07-07
function wrestAlNum(fld) function wrestAlNum(fld) {
{ if (!wrestTrim(fld)) return;
if (!wrestTrim(fld)) return;
var pattern = /(^[a-zA-Z0-9]+$)/; var pattern = /(^[a-zA-Z0-9]+$)/;
if (!pattern.test(fld.value)) { if (!pattern.test(fld.value)) {
if (wrestFld == null) { if (wrestFld == null) {
wrestMsg = wrestItemname(fld) + " : 영문 또는 숫자가 아닙니다.\n"; wrestMsg = wrestItemname(fld) + " : 영문 또는 숫자가 아닙니다.\n";
wrestFld = fld; wrestFld = fld;
} }
} }
} }
// 영문자와 숫자 그리고 _ 검사 // 영문자와 숫자 그리고 _ 검사
function wrestAlNum_(fld) function wrestAlNum_(fld) {
{ if (!wrestTrim(fld)) return;
if (!wrestTrim(fld)) return;
var pattern = /(^[a-zA-Z0-9\_]+$)/; var pattern = /(^[a-zA-Z0-9\_]+$)/;
if (!pattern.test(fld.value)) { if (!pattern.test(fld.value)) {
if (wrestFld == null) { if (wrestFld == null) {
wrestMsg = wrestItemname(fld) + " : 영문, 숫자, _ 가 아닙니다.\n"; wrestMsg = wrestItemname(fld) + " : 영문, 숫자, _ 가 아닙니다.\n";
wrestFld = fld; wrestFld = fld;
} }
} }
} }
// 최소 길이 검사 // 최소 길이 검사
function wrestMinLength(fld) function wrestMinLength(fld) {
{ if (!wrestTrim(fld)) return;
if (!wrestTrim(fld)) return;
var minlength = fld.getAttribute("minlength"); var minlength = fld.getAttribute("minlength");
if (wrestFld == null) { if (wrestFld == null) {
if (fld.value.length < parseInt(minlength)) { if (fld.value.length < parseInt(minlength)) {
wrestMsg = wrestItemname(fld) + " : 최소 "+minlength+"글자 이상 입력하세요.\n"; wrestMsg = wrestItemname(fld) + " : 최소 " + minlength + "글자 이상 입력하세요.\n";
wrestFld = fld; wrestFld = fld;
}
} }
}
} }
// 이미지 확장자 // 이미지 확장자
function wrestImgExt(fld) function wrestImgExt(fld) {
{ if (!wrestTrim(fld)) return;
if (!wrestTrim(fld)) return;
var pattern = /\.(gif|jpg|png)$/i; // jpeg 는 제외 var pattern = /\.(gif|jpg|png)$/i; // jpeg 는 제외
if(!pattern.test(fld.value)){ if (!pattern.test(fld.value)) {
if(wrestFld == null){ if (wrestFld == null) {
wrestMsg = wrestItemname(fld)+" : 이미지 파일이 아닙니다.\n.gif .jpg .png 파일만 가능합니다.\n"; wrestMsg = wrestItemname(fld) + " : 이미지 파일이 아닙니다.\n.gif .jpg .png 파일만 가능합니다.\n";
wrestFld = fld; wrestFld = fld;
fld.select(); fld.select();
}
} }
}
} }
// 확장자 // 확장자
function wrestExtension(fld, css) function wrestExtension(fld, css) {
{ if (!wrestTrim(fld)) return;
if (!wrestTrim(fld)) return;
var str = css.split("="); // ext=?? <-- str[1] var str = css.split("="); // ext=?? <-- str[1]
var src = fld.value.split("."); var src = fld.value.split(".");
var ext = src[src.length - 1]; var ext = src[src.length - 1];
if (wrestFld == null) { if (wrestFld == null) {
if (ext.toLowerCase() < str[1].toLowerCase()) { if (ext.toLowerCase() < str[1].toLowerCase()) {
wrestMsg = wrestItemname(fld) + " : ."+str[1]+" 파일만 가능합니다.\n"; wrestMsg = wrestItemname(fld) + " : ." + str[1] + " 파일만 가능합니다.\n";
wrestFld = fld; wrestFld = fld;
}
} }
}
} }
// 공백 검사후 공백을 "" 로 변환 // 공백 검사후 공백을 "" 로 변환
function wrestNospace(fld) function wrestNospace(fld) {
{ var pattern = /(\s)/g; // \s 공백 문자
var pattern = /(\s)/g; // \s 공백 문자
if (pattern.test(fld.value)) { if (pattern.test(fld.value)) {
if (wrestFld == null) { if (wrestFld == null) {
wrestMsg = wrestItemname(fld) + " : 공백이 없어야 합니다.\n"; wrestMsg = wrestItemname(fld) + " : 공백이 없어야 합니다.\n";
wrestFld = fld; wrestFld = fld;
}
} }
}
} }
// submit 할 때 속성을 검사한다. // submit 할 때 속성을 검사한다.
function wrestSubmit() function wrestSubmit() {
{ wrestMsg = "";
wrestMsg = ""; wrestFld = null;
wrestFld = null;
var attr = null; var attr = null;
// 해당폼에 대한 요소의 개수만큼 돌려라 // 해당폼에 대한 요소의 개수만큼 돌려라
for (var i=0; i<this.elements.length; i++) { for (var i = 0; i < this.elements.length; i++) {
var el = this.elements[i]; var el = this.elements[i];
// Input tag 의 type 이 text, file, password 일때만 // Input tag 의 type 이 text, file, password 일때만
// 셀렉트 박스일때도 필수 선택 검사합니다. select-one // 셀렉트 박스일때도 필수 선택 검사합니다. select-one
if (el.type=="text" || el.type=="hidden" || el.type=="file" || el.type=="password" || el.type=="select-one" || el.type=="textarea") { if (el.type == "text" || el.type == "hidden" || el.type == "file" || el.type == "password" || el.type == "select-one" || el.type == "textarea") {
if (el.getAttribute("required") != null) { if (el.getAttribute("required") != null) {
wrestRequired(el); wrestRequired(el);
}
if (el.getAttribute("minlength") != null) {
wrestMinLength(el);
}
var array_css = el.className.split(" "); // class 를 공백으로 나눔
el.style.backgroundColor = wrestFldDefaultColor;
// 배열의 길이만큼 돌려라
for (var k = 0; k < array_css.length; k++) {
var css = array_css[k];
switch (css) {
case "required": wrestRequired(el); break;
case "trim": wrestTrim(el); break;
case "email": wrestEmail(el); break;
case "hangul": wrestHangul(el); break;
case "hangul2": wrestHangul2(el); break;
case "hangulalpha": wrestHangulAlpha(el); break;
case "hangulalnum": wrestHangulAlNum(el); break;
case "nospace": wrestNospace(el); break;
case "numeric": wrestNumeric(el); break;
case "alpha": wrestAlpha(el); break;
case "alnum": wrestAlNum(el); break;
case "alnum_": wrestAlNum_(el); break;
case "telnum": wrestTelNum(el); break; // 김선용 2006.3 - 전화번호 형식 검사
case "imgext": wrestImgExt(el); break;
default:
if (/^extension\=/.test(css)) {
wrestExtension(el, css); break;
} }
} // switch (css)
} // for (k)
} // if (el)
} // for (i)
if (el.getAttribute("minlength") != null) { // 필드가 null 이 아니라면 오류메세지 출력후 포커스를 해당 오류 필드로 옮김
wrestMinLength(el); // 오류 필드는 배경색상을 바꾼다.
} if (wrestFld != null) {
// 경고메세지 출력
alert(wrestMsg);
var array_css = el.className.split(" "); // class 를 공백으로 나눔 if (wrestFld.style.display != "none") {
var id = wrestFld.getAttribute("id");
el.style.backgroundColor = wrestFldDefaultColor; // 오류메세지를 위한 element 추가
var msg_el = document.createElement("strong");
msg_el.id = "msg_" + id;
msg_el.className = "msg_sound_only";
msg_el.innerHTML = wrestMsg;
wrestFld.parentNode.insertBefore(msg_el, wrestFld);
// 배열의 길이만큼 돌려라 var new_href = document.location.href.replace(/#msg.+$/, "") + "#msg_" + id;
for (var k=0; k<array_css.length; k++) {
var css = array_css[k];
switch (css) {
case "required" : wrestRequired(el); break;
case "trim" : wrestTrim(el); break;
case "email" : wrestEmail(el); break;
case "hangul" : wrestHangul(el); break;
case "hangul2" : wrestHangul2(el); break;
case "hangulalpha" : wrestHangulAlpha(el); break;
case "hangulalnum" : wrestHangulAlNum(el); break;
case "nospace" : wrestNospace(el); break;
case "numeric" : wrestNumeric(el); break;
case "alpha" : wrestAlpha(el); break;
case "alnum" : wrestAlNum(el); break;
case "alnum_" : wrestAlNum_(el); break;
case "telnum" : wrestTelNum(el); break; // 김선용 2006.3 - 전화번호 형식 검사
case "imgext" : wrestImgExt(el); break;
default :
if (/^extension\=/.test(css)) {
wrestExtension(el, css); break;
}
} // switch (css)
} // for (k)
} // if (el)
} // for (i)
// 필드가 null 이 아니라면 오류메세지 출력후 포커스를 해당 오류 필드로 옮김 document.location.href = new_href;
// 오류 필드는 배경색상을 바꾼다.
if (wrestFld != null) {
// 경고메세지 출력
alert(wrestMsg);
if (wrestFld.style.display != "none") { //wrestFld.style.backgroundColor = wrestFldBackColor;
var id = wrestFld.getAttribute("id"); if (typeof (wrestFld.select) != "undefined")
wrestFld.select();
// 오류메세지를 위한 element 추가 wrestFld.focus();
var msg_el = document.createElement("strong");
msg_el.id = "msg_"+id;
msg_el.className = "msg_sound_only";
msg_el.innerHTML = wrestMsg;
wrestFld.parentNode.insertBefore(msg_el, wrestFld);
var new_href = document.location.href.replace(/#msg.+$/, "")+"#msg_"+id;
document.location.href = new_href;
//wrestFld.style.backgroundColor = wrestFldBackColor;
if (typeof(wrestFld.select) != "undefined")
wrestFld.select();
wrestFld.focus();
}
return false;
} }
return false;
}
if (this.oldsubmit && this.oldsubmit() == false) if (this.oldsubmit && this.oldsubmit() == false)
return false; return false;
return true; return true;
} }
// 초기에 onsubmit을 가로채도록 한다. // 초기에 onsubmit을 가로채도록 한다.
function wrestInitialized() function wrestInitialized() {
{ for (var i = 0; i < document.forms.length; i++) {
for (var i = 0; i < document.forms.length; i++) { // onsubmit 이벤트가 있다면 저장해 놓는다.
// onsubmit 이벤트가 있다면 저장해 놓는다. if (document.forms[i].onsubmit) {
if (document.forms[i].onsubmit) { document.forms[i].oldsubmit = document.forms[i].onsubmit;
document.forms[i].oldsubmit = document.forms[i].onsubmit;
}
document.forms[i].onsubmit = wrestSubmit;
} }
document.forms[i].onsubmit = wrestSubmit;
}
} }
// 폼필드 자동검사 // 폼필드 자동검사
$(document).ready(function(){ $(document).ready(function () {
// onload // onload
wrestInitialized(); wrestInitialized();
}); });