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,11 +1,11 @@
$(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);
@ -18,7 +18,7 @@ $(function() {
}); });
window.onscroll = function() { window.onscroll = function () {
var position = $(window).scrollTop(); var position = $(window).scrollTop();
if (position > 50) { if (position > 50) {
$('.uparrow').fadeIn(); $('.uparrow').fadeIn();
@ -28,7 +28,7 @@ window.onscroll = function() {
$('.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();
} }
@ -41,16 +41,16 @@ if (document.all) {
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;
@ -61,35 +61,35 @@ function trapRefreshIE(){
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") { if (typeof (history.pushState) != "undefined") {
$.ajax({ $.ajax({
async: true async: true
, url: h_link , url: h_link
, beforeSend: function() {} , beforeSend: function () { }
, success: function(data) { , success: function (data) {
// Toss // Toss
var response = data; var response = data;
var temp_content = $(response).find(obj_id).clone(); var temp_content = $(response).find(obj_id).clone();
$(obj_id).fadeOut(300, function(){$(this).empty().append(temp_content.html());}).fadeIn(300, function() { $(obj_id).fadeOut(300, function () { $(this).empty().append(temp_content.html()); }).fadeIn(300, function () {
$(obj_id).find('img').attr('title', ''); $(obj_id).find('img').attr('title', '');
$(obj_id).find('img[usemap]').rwdImageMaps(); $(obj_id).find('img[usemap]').rwdImageMaps();
var link = url; var link = url;
var link_obj = { Title: '', Url: link}; var link_obj = { Title: '', Url: link };
history.pushState(link_obj, link_obj.Title, link_obj.Url); history.pushState(link_obj, link_obj.Title, link_obj.Url);
}); });
} }
, error: function(data, status, err) { , error: function (data, status, err) {
$(obj_id).fadeOut(300, function(){$(this).empty(); }); $(obj_id).fadeOut(300, function () { $(this).empty(); });
} }
, complete: function() { , complete: function () {
// Complete // Complete
} }
}); });
} else { } else {
location.href=url; location.href = url;
} }
} }
@ -102,12 +102,12 @@ function fn_save_title(val, 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,14 +6,14 @@ 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();
} }
} }
@ -22,14 +22,14 @@ function autosave() {
// 변수에 저장해 놓은 값과 다를 경우에만 임시 저장함 // 변수에 저장해 놓은 값과 다를 경우에만 임시 저장함
if (save_wr_subject != this.wr_subject.value || save_wr_content != this.wr_content.value) { if (save_wr_subject != this.wr_subject.value || save_wr_content != this.wr_content.value) {
$.ajax({ $.ajax({
url: g5_bbs_url+"/ajax.autosave.php", url: g5_bbs_url + "/ajax.autosave.php",
data: { data: {
"uid" : this.uid.value, "uid": this.uid.value,
"subject": this.wr_subject.value, "subject": this.wr_subject.value,
"content": this.wr_content.value "content": this.wr_content.value
}, },
type: "POST", type: "POST",
success: function(data){ success: function (data) {
if (data) { if (data) {
$("#autosave_count").html(data); $("#autosave_count").html(data);
} }
@ -41,28 +41,28 @@ function autosave() {
}); });
} }
$(function(){ $(function () {
if (g5_is_member) { if (g5_is_member) {
setInterval(autosave, AUTOSAVE_INTERVAL * 1000); setInterval(autosave, AUTOSAVE_INTERVAL * 1000);
} }
// 임시저장된 글목록을 가져옴 // 임시저장된 글목록을 가져옴
$("#btn_autosave").click(function(){ $("#btn_autosave").click(function () {
if ($("#autosave_pop").is(":hidden")) { if ($("#autosave_pop").is(":hidden")) {
$.get(g5_bbs_url+"/ajax.autosavelist.php", function(data){ $.get(g5_bbs_url + "/ajax.autosavelist.php", function (data) {
//alert(data); //alert(data);
//console.log( "Data: " + data); //console.log( "Data: " + data);
$("#autosave_pop ul").empty(); $("#autosave_pop ul").empty();
if ($(data).find("list").find("item").length > 0) { if ($(data).find("list").find("item").length > 0) {
$(data).find("list").find("item").each(function(i) { $(data).find("list").find("item").each(function (i) {
var id = $(this).find("id").text(); var id = $(this).find("id").text();
var uid = $(this).find("uid").text(); var uid = $(this).find("uid").text();
var subject = $(this).find("subject").text(); var subject = $(this).find("subject").text();
var datetime = $(this).find("datetime").text(); var datetime = $(this).find("datetime").text();
$("#autosave_pop ul") $("#autosave_pop ul")
.append('<li><a href="#none" class="autosave_load">'+subject+'</a><span>'+datetime+' <button type="button" class="autosave_del">삭제</button></span></li>') .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+")") .find("li:eq(" + i + ")")
.data({ as_id: id, uid: uid }); .data({ as_id: id, uid: uid });
}); });
} }
@ -74,22 +74,22 @@ $(function(){
}); });
// 임시저장된 글 제목과 내용을 가져와서 제목과 내용 입력박스에 노출해 줌 // 임시저장된 글 제목과 내용을 가져와서 제목과 내용 입력박스에 노출해 줌
$(document).on( "click", ".autosave_load", function(){ $(document).on("click", ".autosave_load", function () {
var $li = $(this).parents("li"); var $li = $(this).parents("li");
var as_id = $li.data("as_id"); var as_id = $li.data("as_id");
var as_uid = $li.data("uid"); var as_uid = $li.data("uid");
$("#fwrite input[name='uid']").val(as_uid); $("#fwrite input[name='uid']").val(as_uid);
$.get(g5_bbs_url+"/ajax.autosaveload.php", {"as_id":as_id}, function(data){ $.get(g5_bbs_url + "/ajax.autosaveload.php", { "as_id": as_id }, function (data) {
var subject = $(data).find("item").find("subject").text(); var subject = $(data).find("item").find("subject").text();
var content = $(data).find("item").find("content").text(); var content = $(data).find("item").find("content").text();
$("#wr_subject").val(subject); $("#wr_subject").val(subject);
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") {
CKEDITOR.instances.wr_content.setData(content); CKEDITOR.instances.wr_content.setData(content);
} else if (g5_editor.indexOf("cheditor5") != -1 && typeof(ed_wr_content)!="undefined") { } else if (g5_editor.indexOf("cheditor5") != -1 && typeof (ed_wr_content) != "undefined") {
ed_wr_content.putContents(content); ed_wr_content.putContents(content);
} else { } else {
if(typeof put_editor_wr_content == "function") { if (typeof put_editor_wr_content == "function") {
put_editor_wr_content(content); put_editor_wr_content(content);
} }
} }
@ -100,10 +100,10 @@ $(function(){
$("#autosave_pop").hide(); $("#autosave_pop").hide();
}); });
$(document).on( "click", ".autosave_del", function(){ $(document).on("click", ".autosave_del", function () {
var $li = $(this).parents("li"); var $li = $(this).parents("li");
var as_id = $li.data("as_id"); var as_id = $li.data("as_id");
$.get(g5_bbs_url+"/ajax.autosavedel.php", {"as_id":as_id}, function(data){ $.get(g5_bbs_url + "/ajax.autosavedel.php", { "as_id": as_id }, function (data) {
if (data == -1) { if (data == -1) {
alert("임시 저장된글을 삭제중에 오류가 발생하였습니다."); alert("임시 저장된글을 삭제중에 오류가 발생하였습니다.");
} else { } else {
@ -113,5 +113,5 @@ $(function(){
}); });
}); });
$(".autosave_close").click(function(){ $("#autosave_pop").hide(); }); $(".autosave_close").click(function () { $("#autosave_pop").hide(); });
}); });

View file

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

View file

@ -3,8 +3,7 @@ var errmsg = "";
var errfld = null; var errfld = null;
// 필드 검사 // 필드 검사
function check_field(fld, msg) function check_field(fld, msg) {
{
if ((fld.value = trim(fld.value)) == "") if ((fld.value = trim(fld.value)) == "")
error_field(fld, msg); error_field(fld, msg);
else else
@ -13,8 +12,7 @@ function check_field(fld, msg)
} }
// 필드 오류 표시 // 필드 오류 표시
function error_field(fld, msg) function error_field(fld, msg) {
{
if (msg != "") if (msg != "")
errmsg += msg + "\n"; errmsg += msg + "\n";
if (!errfld) errfld = fld; if (!errfld) errfld = fld;
@ -22,33 +20,27 @@ function error_field(fld, msg)
} }
// 필드를 깨끗하게 // 필드를 깨끗하게
function clear_field(fld) function clear_field(fld) {
{
fld.style.background = "#FFFFFF"; fld.style.background = "#FFFFFF";
} }
function trim(s) function trim(s) {
{
var t = ""; var t = "";
var from_pos = to_pos = 0; var from_pos = to_pos = 0;
for (i=0; i<s.length; i++) for (i = 0; i < s.length; i++) {
{
if (s.charAt(i) == ' ') if (s.charAt(i) == ' ')
continue; continue;
else else {
{
from_pos = i; from_pos = i;
break; break;
} }
} }
for (i=s.length; i>=0; i--) for (i = s.length; i >= 0; i--) {
{ if (s.charAt(i - 1) == ' ')
if (s.charAt(i-1) == ' ')
continue; continue;
else else {
{
to_pos = i; to_pos = i;
break; break;
} }
@ -61,8 +53,7 @@ function trim(s)
// 자바스크립트로 PHP의 number_format 흉내를 냄 // 자바스크립트로 PHP의 number_format 흉내를 냄
// 숫자에 , 를 출력 // 숫자에 , 를 출력
function number_format(data) function number_format(data) {
{
var tmp = ''; var tmp = '';
var number = ''; var number = '';
@ -71,57 +62,50 @@ function number_format(data)
var i; var i;
var sign = data.match(/^[\+\-]/); var sign = data.match(/^[\+\-]/);
if(sign) { if (sign) {
data = data.replace(/^[\+\-]/, ""); data = data.replace(/^[\+\-]/, "");
} }
len = data.length; len = data.length;
mod = (len % cutlen); mod = (len % cutlen);
k = cutlen - mod; k = cutlen - mod;
for (i=0; i<data.length; i++) for (i = 0; i < data.length; i++) {
{
number = number + data.charAt(i); number = number + data.charAt(i);
if (i < data.length - 1) if (i < data.length - 1) {
{
k++; k++;
if ((k % cutlen) == 0) if ((k % cutlen) == 0) {
{
number = number + comma; number = number + comma;
k = 0; k = 0;
} }
} }
} }
if(sign != null) if (sign != null)
number = sign+number; number = sign + number;
return number; return number;
} }
// 새 창 // 새 창
function popup_window(url, winname, opt) function popup_window(url, winname, opt) {
{
window.open(url, winname, opt); window.open(url, winname, opt);
} }
// 폼메일 창 // 폼메일 창
function popup_formmail(url) function popup_formmail(url) {
{
opt = 'scrollbars=yes,width=417,height=385,top=10,left=20'; opt = 'scrollbars=yes,width=417,height=385,top=10,left=20';
popup_window(url, "wformmail", opt); popup_window(url, "wformmail", opt);
} }
// , 를 없앤다. // , 를 없앤다.
function no_comma(data) function no_comma(data) {
{
var tmp = ''; var tmp = '';
var comma = ','; var comma = ',';
var i; var i;
for (i=0; i<data.length; i++) for (i = 0; i < data.length; i++) {
{
if (data.charAt(i) != comma) if (data.charAt(i) != comma)
tmp += data.charAt(i); tmp += data.charAt(i);
} }
@ -129,9 +113,8 @@ function no_comma(data)
} }
// 삭제 검사 확인 // 삭제 검사 확인
function del(href) function del(href) {
{ if (confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n정말 삭제하시겠습니까?")) {
if(confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n정말 삭제하시겠습니까?")) {
var iev = -1; var iev = -1;
if (navigator.appName == 'Microsoft Internet Explorer') { if (navigator.appName == 'Microsoft Internet Explorer') {
var ua = navigator.userAgent; var ua = navigator.userAgent;
@ -150,41 +133,36 @@ function del(href)
} }
// 쿠키 입력 // 쿠키 입력
function set_cookie(name, value, expirehours, domain) function set_cookie(name, value, expirehours, domain) {
{
var today = new Date(); var today = new Date();
today.setTime(today.getTime() + (60*60*1000*expirehours)); today.setTime(today.getTime() + (60 * 60 * 1000 * expirehours));
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + ";"; document.cookie = name + "=" + escape(value) + "; path=/; expires=" + today.toGMTString() + ";";
if (domain) { if (domain) {
document.cookie += "domain=" + domain + ";"; document.cookie += "domain=" + domain + ";";
} }
} }
// 쿠키 얻음 // 쿠키 얻음
function get_cookie(name) function get_cookie(name) {
{
var find_sw = false; var find_sw = false;
var start, end; var start, end;
var i = 0; var i = 0;
for (i=0; i<= document.cookie.length; i++) for (i = 0; i <= document.cookie.length; i++) {
{
start = i; start = i;
end = start + name.length; end = start + name.length;
if(document.cookie.substring(start, end) == name) if (document.cookie.substring(start, end) == name) {
{
find_sw = true find_sw = true
break break
} }
} }
if (find_sw == true) if (find_sw == true) {
{
start = end + 1; start = end + 1;
end = document.cookie.indexOf(";", start); end = document.cookie.indexOf(";", start);
if(end < start) if (end < start)
end = document.cookie.length; end = document.cookie.length;
return unescape(document.cookie.substring(start, end)); return unescape(document.cookie.substring(start, end));
@ -193,58 +171,50 @@ function get_cookie(name)
} }
// 쿠키 지움 // 쿠키 지움
function delete_cookie(name) function delete_cookie(name) {
{
var today = new Date(); var today = new Date();
today.setTime(today.getTime() - 1); today.setTime(today.getTime() - 1);
var value = get_cookie(name); var value = get_cookie(name);
if(value != "") if (value != "")
document.cookie = name + "=" + value + "; path=/; expires=" + today.toGMTString(); document.cookie = name + "=" + value + "; path=/; expires=" + today.toGMTString();
} }
var last_id = null; var last_id = null;
function menu(id) function menu(id) {
{ if (id != last_id) {
if (id != last_id)
{
if (last_id != null) if (last_id != null)
document.getElementById(last_id).style.display = "none"; document.getElementById(last_id).style.display = "none";
document.getElementById(id).style.display = "block"; document.getElementById(id).style.display = "block";
last_id = id; last_id = id;
} }
else else {
{
document.getElementById(id).style.display = "none"; document.getElementById(id).style.display = "none";
last_id = null; last_id = null;
} }
} }
function textarea_decrease(id, row) function textarea_decrease(id, row) {
{
if (document.getElementById(id).rows - row > 0) if (document.getElementById(id).rows - row > 0)
document.getElementById(id).rows -= row; document.getElementById(id).rows -= row;
} }
function textarea_original(id, row) function textarea_original(id, row) {
{
document.getElementById(id).rows = row; document.getElementById(id).rows = row;
} }
function textarea_increase(id, row) function textarea_increase(id, row) {
{
document.getElementById(id).rows += row; document.getElementById(id).rows += row;
} }
// 글숫자 검사 // 글숫자 검사
function check_byte(content, target) function check_byte(content, target) {
{
var i = 0; var i = 0;
var cnt = 0; var cnt = 0;
var ch = ''; var ch = '';
var cont = document.getElementById(content).value; var cont = document.getElementById(content).value;
for (i=0; i<cont.length; i++) { for (i = 0; i < cont.length; i++) {
ch = cont.charAt(i); ch = cont.charAt(i);
if (escape(ch).length > 4) { if (escape(ch).length > 4) {
cnt += 2; cnt += 2;
@ -259,15 +229,13 @@ function check_byte(content, target)
} }
// 브라우저에서 오브젝트의 왼쪽 좌표 // 브라우저에서 오브젝트의 왼쪽 좌표
function get_left_pos(obj) function get_left_pos(obj) {
{
var parentObj = null; var parentObj = null;
var clientObj = obj; var clientObj = obj;
//var left = obj.offsetLeft + document.body.clientLeft; //var left = obj.offsetLeft + document.body.clientLeft;
var left = obj.offsetLeft; var left = obj.offsetLeft;
while((parentObj=clientObj.offsetParent) != null) while ((parentObj = clientObj.offsetParent) != null) {
{
left = left + parentObj.offsetLeft; left = left + parentObj.offsetLeft;
clientObj = parentObj; clientObj = parentObj;
} }
@ -276,15 +244,13 @@ function get_left_pos(obj)
} }
// 브라우저에서 오브젝트의 상단 좌표 // 브라우저에서 오브젝트의 상단 좌표
function get_top_pos(obj) function get_top_pos(obj) {
{
var parentObj = null; var parentObj = null;
var clientObj = obj; var clientObj = obj;
//var top = obj.offsetTop + document.body.clientTop; //var top = obj.offsetTop + document.body.clientTop;
var top = obj.offsetTop; var top = obj.offsetTop;
while((parentObj=clientObj.offsetParent) != null) while ((parentObj = clientObj.offsetParent) != null) {
{
top = top + parentObj.offsetTop; top = top + parentObj.offsetTop;
clientObj = parentObj; clientObj = parentObj;
} }
@ -292,34 +258,31 @@ function get_top_pos(obj)
return top; return top;
} }
function flash_movie(src, ids, width, height, wmode) function flash_movie(src, ids, width, height, wmode) {
{
var wh = ""; var wh = "";
if (parseInt(width) && parseInt(height)) if (parseInt(width) && parseInt(height))
wh = " width='"+width+"' height='"+height+"' "; wh = " width='" + width + "' height='" + height + "' ";
return "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' "+wh+" id="+ids+"><param name=wmode value="+wmode+"><param name=movie value="+src+"><param name=quality value=high><embed src="+src+" quality=high wmode="+wmode+" type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash' "+wh+"></embed></object>"; return "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' " + wh + " id=" + ids + "><param name=wmode value=" + wmode + "><param name=movie value=" + src + "><param name=quality value=high><embed src=" + src + " quality=high wmode=" + wmode + " type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash' " + wh + "></embed></object>";
} }
function obj_movie(src, ids, width, height, autostart) function obj_movie(src, ids, width, height, autostart) {
{
var wh = ""; var wh = "";
if (parseInt(width) && parseInt(height)) if (parseInt(width) && parseInt(height))
wh = " width='"+width+"' height='"+height+"' "; wh = " width='" + width + "' height='" + height + "' ";
if (!autostart) autostart = false; if (!autostart) autostart = false;
return "<embed src='"+src+"' "+wh+" autostart='"+autostart+"'></embed>"; return "<embed src='" + src + "' " + wh + " autostart='" + autostart + "'></embed>";
} }
function doc_write(cont) function doc_write(cont) {
{
document.write(cont); document.write(cont);
} }
var win_password_lost = function(href) { var win_password_lost = function (href) {
window.open(href, "win_password_lost", "left=50, top=50, width=617, height=330, scrollbars=1"); window.open(href, "win_password_lost", "left=50, top=50, width=617, height=330, scrollbars=1");
} }
$(document).ready(function(){ $(document).ready(function () {
$("#login_password_lost, #ol_password_lost").click(function(){ $("#login_password_lost, #ol_password_lost").click(function () {
win_password_lost(this.href); win_password_lost(this.href);
return false; return false;
}); });
@ -328,7 +291,7 @@ $(document).ready(function(){
/** /**
* 포인트 * 포인트
**/ **/
var win_point = function(href) { var win_point = function (href) {
var new_win = window.open(href, 'win_point', 'left=100,top=100,width=600, height=600, scrollbars=1'); var new_win = window.open(href, 'win_point', 'left=100,top=100,width=600, height=600, scrollbars=1');
new_win.focus(); new_win.focus();
} }
@ -336,7 +299,7 @@ var win_point = function(href) {
/** /**
* 쪽지 * 쪽지
**/ **/
var win_memo = function(href) { var win_memo = function (href) {
var new_win = window.open(href, 'win_memo', 'left=100,top=100,width=620,height=500,scrollbars=1'); var new_win = window.open(href, 'win_memo', 'left=100,top=100,width=620,height=500,scrollbars=1');
new_win.focus(); new_win.focus();
} }
@ -344,7 +307,7 @@ var win_memo = function(href) {
/** /**
* 메일 * 메일
**/ **/
var win_email = function(href) { var win_email = function (href) {
var new_win = window.open(href, 'win_email', 'left=100,top=100,width=600,height=580,scrollbars=0'); var new_win = window.open(href, 'win_email', 'left=100,top=100,width=600,height=580,scrollbars=0');
new_win.focus(); new_win.focus();
} }
@ -352,7 +315,7 @@ var win_email = function(href) {
/** /**
* 자기소개 * 자기소개
**/ **/
var win_profile = function(href) { var win_profile = function (href) {
var new_win = window.open(href, 'win_profile', 'left=100,top=100,width=620,height=510,scrollbars=1'); var new_win = window.open(href, 'win_profile', 'left=100,top=100,width=620,height=510,scrollbars=1');
new_win.focus(); new_win.focus();
} }
@ -360,7 +323,7 @@ var win_profile = function(href) {
/** /**
* 스크랩 * 스크랩
**/ **/
var win_scrap = function(href) { var win_scrap = function (href) {
var new_win = window.open(href, 'win_scrap', 'left=100,top=100,width=600,height=600,scrollbars=1'); var new_win = window.open(href, 'win_scrap', 'left=100,top=100,width=600,height=600,scrollbars=1');
new_win.focus(); new_win.focus();
} }
@ -368,7 +331,7 @@ var win_scrap = function(href) {
/** /**
* 홈페이지 * 홈페이지
**/ **/
var win_homepage = function(href) { var win_homepage = function (href) {
var new_win = window.open(href, 'win_homepage', ''); var new_win = window.open(href, 'win_homepage', '');
new_win.focus(); new_win.focus();
} }
@ -376,15 +339,15 @@ var win_homepage = function(href) {
/** /**
* 우편번호 * 우편번호
**/ **/
var win_zip = function(frm_name, frm_zip, frm_addr1, frm_addr2, frm_addr3, frm_jibeon) { var win_zip = function (frm_name, frm_zip, frm_addr1, frm_addr2, frm_addr3, frm_jibeon) {
if(typeof daum === 'undefined'){ if (typeof daum === 'undefined') {
alert("다음 우편번호 postcode.v2.js 파일이 로드되지 않았습니다."); alert("다음 우편번호 postcode.v2.js 파일이 로드되지 않았습니다.");
return false; return false;
} }
var zip_case = 1; //0이면 레이어, 1이면 페이지에 끼워 넣기, 2이면 새창 var zip_case = 1; //0이면 레이어, 1이면 페이지에 끼워 넣기, 2이면 새창
var complete_fn = function(data){ var complete_fn = function (data) {
// 팝업에서 검색결과 항목을 클릭했을때 실행할 코드를 작성하는 부분. // 팝업에서 검색결과 항목을 클릭했을때 실행할 코드를 작성하는 부분.
// 각 주소의 노출 규칙에 따라 주소를 조합한다. // 각 주소의 노출 규칙에 따라 주소를 조합한다.
@ -401,17 +364,17 @@ var win_zip = function(frm_name, frm_zip, frm_addr1, frm_addr2, frm_addr3, frm_j
} }
// 사용자가 선택한 주소가 도로명 타입일때 조합한다. // 사용자가 선택한 주소가 도로명 타입일때 조합한다.
if(data.userSelectedType === 'R'){ if (data.userSelectedType === 'R') {
//법정동명이 있을 경우 추가한다. //법정동명이 있을 경우 추가한다.
if(data.bname !== ''){ if (data.bname !== '') {
extraAddr += data.bname; extraAddr += data.bname;
} }
// 건물명이 있을 경우 추가한다. // 건물명이 있을 경우 추가한다.
if(data.buildingName !== ''){ if (data.buildingName !== '') {
extraAddr += (extraAddr !== '' ? ', ' + data.buildingName : data.buildingName); extraAddr += (extraAddr !== '' ? ', ' + data.buildingName : data.buildingName);
} }
// 조합형주소의 유무에 따라 양쪽에 괄호를 추가하여 최종 주소를 만든다. // 조합형주소의 유무에 따라 양쪽에 괄호를 추가하여 최종 주소를 만든다.
extraAddr = (extraAddr !== '' ? ' ('+ extraAddr +')' : ''); extraAddr = (extraAddr !== '' ? ' (' + extraAddr + ')' : '');
} }
// 우편번호와 주소 정보를 해당 필드에 넣고, 커서를 상세주소 필드로 이동한다. // 우편번호와 주소 정보를 해당 필드에 넣고, 커서를 상세주소 필드로 이동한다.
@ -422,16 +385,16 @@ var win_zip = function(frm_name, frm_zip, frm_addr1, frm_addr2, frm_addr3, frm_j
of[frm_addr1].value = fullAddr; of[frm_addr1].value = fullAddr;
of[frm_addr3].value = extraAddr; of[frm_addr3].value = extraAddr;
if(of[frm_jibeon] !== undefined){ if (of[frm_jibeon] !== undefined) {
of[frm_jibeon].value = data.userSelectedType; of[frm_jibeon].value = data.userSelectedType;
} }
of[frm_addr2].focus(); of[frm_addr2].focus();
}; };
switch(zip_case) { switch (zip_case) {
case 1 : //iframe을 이용하여 페이지에 끼워 넣기 case 1: //iframe을 이용하여 페이지에 끼워 넣기
var daum_pape_id = 'daum_juso_page'+frm_zip, var daum_pape_id = 'daum_juso_page' + frm_zip,
element_wrap = document.getElementById(daum_pape_id), element_wrap = document.getElementById(daum_pape_id),
currentScroll = Math.max(document.body.scrollTop, document.documentElement.scrollTop); currentScroll = Math.max(document.body.scrollTop, document.documentElement.scrollTop);
if (element_wrap == null) { if (element_wrap == null) {
@ -439,15 +402,15 @@ var win_zip = function(frm_name, frm_zip, frm_addr1, frm_addr2, frm_addr3, frm_j
element_wrap.setAttribute("id", daum_pape_id); element_wrap.setAttribute("id", daum_pape_id);
element_wrap.style.cssText = 'display:none;border:1px solid;left:0;width:100%;height:300px;margin:5px 0;position:relative;-webkit-overflow-scrolling:touch;'; element_wrap.style.cssText = 'display:none;border:1px solid;left:0;width:100%;height:300px;margin:5px 0;position:relative;-webkit-overflow-scrolling:touch;';
element_wrap.innerHTML = '<img src="//i1.daumcdn.net/localimg/localimages/07/postcode/320/close.png" id="btnFoldWrap" style="cursor:pointer;position:absolute;right:0px;top:-21px;z-index:1" class="close_daum_juso" alt="접기 버튼">'; element_wrap.innerHTML = '<img src="//i1.daumcdn.net/localimg/localimages/07/postcode/320/close.png" id="btnFoldWrap" style="cursor:pointer;position:absolute;right:0px;top:-21px;z-index:1" class="close_daum_juso" alt="접기 버튼">';
jQuery('form[name="'+frm_name+'"]').find('input[name="'+frm_addr1+'"]').before(element_wrap); jQuery('form[name="' + frm_name + '"]').find('input[name="' + frm_addr1 + '"]').before(element_wrap);
jQuery("#"+daum_pape_id).off("click", ".close_daum_juso").on("click", ".close_daum_juso", function(e){ jQuery("#" + daum_pape_id).off("click", ".close_daum_juso").on("click", ".close_daum_juso", function (e) {
e.preventDefault(); e.preventDefault();
jQuery(this).parent().hide(); jQuery(this).parent().hide();
}); });
} }
new daum.Postcode({ new daum.Postcode({
oncomplete: function(data) { oncomplete: function (data) {
complete_fn(data); complete_fn(data);
// iframe을 넣은 element를 안보이게 한다. // iframe을 넣은 element를 안보이게 한다.
element_wrap.style.display = 'none'; element_wrap.style.display = 'none';
@ -456,25 +419,25 @@ var win_zip = function(frm_name, frm_zip, frm_addr1, frm_addr2, frm_addr3, frm_j
}, },
// 우편번호 찾기 화면 크기가 조정되었을때 실행할 코드를 작성하는 부분. // 우편번호 찾기 화면 크기가 조정되었을때 실행할 코드를 작성하는 부분.
// iframe을 넣은 element의 높이값을 조정한다. // iframe을 넣은 element의 높이값을 조정한다.
onresize : function(size) { onresize: function (size) {
element_wrap.style.height = size.height + "px"; element_wrap.style.height = size.height + "px";
}, },
width : '100%', width: '100%',
height : '100%' height: '100%'
}).embed(element_wrap); }).embed(element_wrap);
// iframe을 넣은 element를 보이게 한다. // iframe을 넣은 element를 보이게 한다.
element_wrap.style.display = 'block'; element_wrap.style.display = 'block';
break; break;
case 2 : //새창으로 띄우기 case 2: //새창으로 띄우기
new daum.Postcode({ new daum.Postcode({
oncomplete: function(data) { oncomplete: function (data) {
complete_fn(data); complete_fn(data);
} }
}).open(); }).open();
break; break;
default : //iframe을 이용하여 레이어 띄우기 default: //iframe을 이용하여 레이어 띄우기
var rayer_id = 'daum_juso_rayer'+frm_zip, var rayer_id = 'daum_juso_rayer' + frm_zip,
element_layer = document.getElementById(rayer_id); element_layer = document.getElementById(rayer_id);
if (element_layer == null) { if (element_layer == null) {
element_layer = document.createElement("div"); element_layer = document.createElement("div");
@ -482,20 +445,20 @@ var win_zip = function(frm_name, frm_zip, frm_addr1, frm_addr2, frm_addr3, frm_j
element_layer.style.cssText = 'display:none;border:5px solid;position:fixed;width:300px;height:460px;left:50%;margin-left:-155px;top:50%;margin-top:-235px;overflow:hidden;-webkit-overflow-scrolling:touch;z-index:10000'; element_layer.style.cssText = 'display:none;border:5px solid;position:fixed;width:300px;height:460px;left:50%;margin-left:-155px;top:50%;margin-top:-235px;overflow:hidden;-webkit-overflow-scrolling:touch;z-index:10000';
element_layer.innerHTML = '<img src="//i1.daumcdn.net/localimg/localimages/07/postcode/320/close.png" id="btnCloseLayer" style="cursor:pointer;position:absolute;right:-3px;top:-3px;z-index:1" class="close_daum_juso" alt="닫기 버튼">'; element_layer.innerHTML = '<img src="//i1.daumcdn.net/localimg/localimages/07/postcode/320/close.png" id="btnCloseLayer" style="cursor:pointer;position:absolute;right:-3px;top:-3px;z-index:1" class="close_daum_juso" alt="닫기 버튼">';
document.body.appendChild(element_layer); document.body.appendChild(element_layer);
jQuery("#"+rayer_id).off("click", ".close_daum_juso").on("click", ".close_daum_juso", function(e){ jQuery("#" + rayer_id).off("click", ".close_daum_juso").on("click", ".close_daum_juso", function (e) {
e.preventDefault(); e.preventDefault();
jQuery(this).parent().hide(); jQuery(this).parent().hide();
}); });
} }
new daum.Postcode({ new daum.Postcode({
oncomplete: function(data) { oncomplete: function (data) {
complete_fn(data); complete_fn(data);
// iframe을 넣은 element를 안보이게 한다. // iframe을 넣은 element를 안보이게 한다.
element_layer.style.display = 'none'; element_layer.style.display = 'none';
}, },
width : '100%', width: '100%',
height : '100%' height: '100%'
}).embed(element_layer); }).embed(element_layer);
// iframe을 넣은 element를 보이게 한다. // iframe을 넣은 element를 보이게 한다.
@ -506,8 +469,7 @@ var win_zip = function(frm_name, frm_zip, frm_addr1, frm_addr2, frm_addr3, frm_j
/** /**
* 새로운 비밀번호 분실 : 101123 * 새로운 비밀번호 분실 : 101123
**/ **/
win_password_lost = function(href) win_password_lost = function (href) {
{
var new_win = window.open(href, 'win_password_lost', 'width=617, height=330, scrollbars=1'); var new_win = window.open(href, 'win_password_lost', 'width=617, height=330, scrollbars=1');
new_win.focus(); new_win.focus();
} }
@ -515,7 +477,7 @@ win_password_lost = function(href)
/** /**
* 설문조사 결과 * 설문조사 결과
**/ **/
var win_poll = function(href) { var win_poll = function (href) {
var new_win = window.open(href, 'win_poll', 'width=616, height=500, scrollbars=1'); var new_win = window.open(href, 'win_poll', 'width=616, height=500, scrollbars=1');
new_win.focus(); new_win.focus();
} }
@ -524,11 +486,11 @@ var win_poll = function(href) {
* 스크린리더 미사용자를 위한 스크립트 - 지운아빠 2013-04-22 * 스크린리더 미사용자를 위한 스크립트 - 지운아빠 2013-04-22
* alt 값만 갖는 그래픽 링크에 마우스오버 title 부여, 마우스아웃 title 제거 * alt 값만 갖는 그래픽 링크에 마우스오버 title 부여, 마우스아웃 title 제거
**/ **/
$(function() { $(function () {
$('a img').mouseover(function() { $('a img').mouseover(function () {
$a_img_title = $(this).attr('alt'); $a_img_title = $(this).attr('alt');
$(this).attr('title', $a_img_title); $(this).attr('title', $a_img_title);
}).mouseout(function() { }).mouseout(function () {
$(this).attr('title', ''); $(this).attr('title', '');
}); });
}); });
@ -536,9 +498,8 @@ $(function() {
/** /**
* 텍스트 리사이즈 * 텍스트 리사이즈
**/ **/
function font_resize(id, rmv_class, add_class) function font_resize(id, rmv_class, add_class) {
{ var $el = $("#" + id);
var $el = $("#"+id);
$el.removeClass(rmv_class).addClass(add_class); $el.removeClass(rmv_class).addClass(add_class);
@ -549,55 +510,54 @@ function font_resize(id, rmv_class, add_class)
/** /**
* 댓글 수정 토큰 * 댓글 수정 토큰
**/ **/
function set_comment_token(f) function set_comment_token(f) {
{ if (typeof f.token === "undefined")
if(typeof f.token === "undefined")
$(f).prepend('<input type="hidden" name="token" value="">'); $(f).prepend('<input type="hidden" name="token" value="">');
$.ajax({ $.ajax({
url: g5_bbs_url+"/ajax.comment_token.php", url: g5_bbs_url + "/ajax.comment_token.php",
type: "GET", type: "GET",
dataType: "json", dataType: "json",
async: false, async: false,
cache: false, cache: false,
success: function(data, textStatus) { success: function (data, textStatus) {
f.token.value = data.token; f.token.value = data.token;
} }
}); });
} }
$(function(){ $(function () {
$(".win_point").click(function() { $(".win_point").click(function () {
win_point(this.href); win_point(this.href);
return false; return false;
}); });
$(".win_memo").click(function() { $(".win_memo").click(function () {
win_memo(this.href); win_memo(this.href);
return false; return false;
}); });
$(".win_email").click(function() { $(".win_email").click(function () {
win_email(this.href); win_email(this.href);
return false; return false;
}); });
$(".win_scrap").click(function() { $(".win_scrap").click(function () {
win_scrap(this.href); win_scrap(this.href);
return false; return false;
}); });
$(".win_profile").click(function() { $(".win_profile").click(function () {
win_profile(this.href); win_profile(this.href);
return false; return false;
}); });
$(".win_homepage").click(function() { $(".win_homepage").click(function () {
win_homepage(this.href); win_homepage(this.href);
return false; return false;
}); });
$(".win_password_lost").click(function() { $(".win_password_lost").click(function () {
win_password_lost(this.href); win_password_lost(this.href);
return false; return false;
}); });
@ -611,60 +571,60 @@ $(function(){
// 사이드뷰 // 사이드뷰
var sv_hide = false; var sv_hide = false;
$(".sv_member, .sv_guest").click(function() { $(".sv_member, .sv_guest").click(function () {
$(".sv").removeClass("sv_on"); $(".sv").removeClass("sv_on");
$(this).closest(".sv_wrap").find(".sv").addClass("sv_on"); $(this).closest(".sv_wrap").find(".sv").addClass("sv_on");
}); });
$(".sv, .sv_wrap").hover( $(".sv, .sv_wrap").hover(
function() { function () {
sv_hide = false; sv_hide = false;
}, },
function() { function () {
sv_hide = true; sv_hide = true;
} }
); );
$(".sv_member, .sv_guest").focusin(function() { $(".sv_member, .sv_guest").focusin(function () {
sv_hide = false; sv_hide = false;
$(".sv").removeClass("sv_on"); $(".sv").removeClass("sv_on");
$(this).closest(".sv_wrap").find(".sv").addClass("sv_on"); $(this).closest(".sv_wrap").find(".sv").addClass("sv_on");
}); });
$(".sv a").focusin(function() { $(".sv a").focusin(function () {
sv_hide = false; sv_hide = false;
}); });
$(".sv a").focusout(function() { $(".sv a").focusout(function () {
sv_hide = true; sv_hide = true;
}); });
// 셀렉트 ul // 셀렉트 ul
var sel_hide = false; var sel_hide = false;
$('.sel_btn').click(function() { $('.sel_btn').click(function () {
$('.sel_ul').removeClass('sel_on'); $('.sel_ul').removeClass('sel_on');
$(this).siblings('.sel_ul').addClass('sel_on'); $(this).siblings('.sel_ul').addClass('sel_on');
}); });
$(".sel_wrap").hover( $(".sel_wrap").hover(
function() { function () {
sel_hide = false; sel_hide = false;
}, },
function() { function () {
sel_hide = true; sel_hide = true;
} }
); );
$('.sel_a').focusin(function() { $('.sel_a').focusin(function () {
sel_hide = false; sel_hide = false;
}); });
$('.sel_a').focusout(function() { $('.sel_a').focusout(function () {
sel_hide = true; sel_hide = true;
}); });
$(document).click(function() { $(document).click(function () {
if(sv_hide) { // 사이드뷰 해제 if (sv_hide) { // 사이드뷰 해제
$(".sv").removeClass("sv_on"); $(".sv").removeClass("sv_on");
} }
if (sel_hide) { // 셀렉트 ul 해제 if (sel_hide) { // 셀렉트 ul 해제
@ -672,8 +632,8 @@ $(function(){
} }
}); });
$(document).focusin(function() { $(document).focusin(function () {
if(sv_hide) { // 사이드뷰 해제 if (sv_hide) { // 사이드뷰 해제
$(".sv").removeClass("sv_on"); $(".sv").removeClass("sv_on");
} }
if (sel_hide) { // 셀렉트 ul 해제 if (sel_hide) { // 셀렉트 ul 해제
@ -681,7 +641,7 @@ $(function(){
} }
}); });
$(document).on( "keyup change", "textarea#wr_content[maxlength]", function(){ $(document).on("keyup change", "textarea#wr_content[maxlength]", function () {
var str = $(this).val(); var str = $(this).val();
var mx = parseInt($(this).attr("maxlength")); var mx = parseInt($(this).attr("maxlength"));
if (str.length > mx) { if (str.length > mx) {
@ -691,21 +651,20 @@ $(function(){
}); });
}); });
function get_write_token(bo_table) function get_write_token(bo_table) {
{
var token = ""; var token = "";
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: g5_bbs_url+"/write_token.php", url: g5_bbs_url + "/write_token.php",
data: { bo_table: bo_table }, data: { bo_table: bo_table },
cache: false, cache: false,
async: false, async: false,
dataType: "json", dataType: "json",
success: function(data) { success: function (data) {
if(data.error) { if (data.error) {
alert(data.error); alert(data.error);
if(data.url) if (data.url)
document.location.href = data.url; document.location.href = data.url;
return false; return false;
@ -718,20 +677,20 @@ function get_write_token(bo_table)
return token; return token;
} }
$(function() { $(function () {
$(document).on("click", "form[name=fwrite] input:submit, form[name=fwrite] button:submit, form[name=fwrite] input:image", function() { $(document).on("click", "form[name=fwrite] input:submit, form[name=fwrite] button:submit, form[name=fwrite] input:image", function () {
var f = this.form; var f = this.form;
var bo_table = f.bo_table.value; var bo_table = f.bo_table.value;
var token = get_write_token(bo_table); var token = get_write_token(bo_table);
if(!token) { if (!token) {
alert("토큰 정보가 올바르지 않습니다."); alert("토큰 정보가 올바르지 않습니다.");
return false; return false;
} }
var $f = $(f); var $f = $(f);
if(typeof f.token === "undefined") if (typeof f.token === "undefined")
$f.prepend('<input type="hidden" name="token" value="">'); $f.prepend('<input type="hidden" name="token" value="">');
$f.find("input[name=token]").val(token); $f.find("input[name=token]").val(token);
@ -747,30 +706,30 @@ function ajax_load(url, obj, list_id, rel_id, etc_value) {
var keyword = obj.value; var keyword = obj.value;
var obj_id = obj.getAttribute('id'); var obj_id = obj.getAttribute('id');
var list_obj = $('#'+list_id+' .list'); var list_obj = $('#' + list_id + ' .list');
if(typeof(etc_value) == 'undefined') { if (typeof (etc_value) == 'undefined') {
etc_value = ''; etc_value = '';
} }
$.ajax({ $.ajax({
type: 'get' type: 'get'
, async: true , async: true
, url: url+"?keyword="+keyword+"&input_obj="+obj_id+"&output_obj="+rel_id+"&list_obj="+list_id+"&option="+etc_value , url: url + "?keyword=" + keyword + "&input_obj=" + obj_id + "&output_obj=" + rel_id + "&list_obj=" + list_id + "&option=" + etc_value
, beforeSend: function() { , beforeSend: function () {
//list_obj.empty(); //list_obj.empty();
} }
, success: function(data) { , success: function (data) {
var response = data.trim(); var response = data.trim();
if(response) { if (response) {
list_obj.html(response); list_obj.html(response);
list_obj.focus(); list_obj.focus();
} else { } else {
list_obj.empty(); list_obj.empty();
} }
} }
, error: function(data, status, err) { } , error: function (data, status, err) { }
, complete: function() { } , complete: function () { }
}); });
} }
@ -798,6 +757,6 @@ function get_ajax_member(obj, list_id, rel_id, etc_value) {
function select_item(list_id, in_id, in_value, out_id, out_value) { function select_item(list_id, in_id, in_value, out_id, out_value) {
document.getElementById(in_id).value = in_value; document.getElementById(in_id).value = in_value;
document.getElementById(out_id).value = out_value; document.getElementById(out_id).value = out_value;
$('#'+list_id+' .list').empty(); $('#' + list_id + ' .list').empty();
return false; return false;
} }

View file

@ -44,7 +44,7 @@
// 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) {

View file

@ -1,31 +1,29 @@
(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 $element = this.find(cfg.element);
var $this = this; var $this = this;
if($element.size() < 1) if ($element.size() < 1)
return; return;
function item_arrange() function item_arrange() {
{
var $el = $element.filter(":first"); var $el = $element.filter(":first");
var padding = 0; var padding = 0;
if($el.data("padding-right") == undefined) { if ($el.data("padding-right") == undefined) {
padding = parseInt($el.css("padding-right")); padding = parseInt($el.css("padding-right"));
$el.data("padding-right", padding); $el.data("padding-right", padding);
} }
@ -33,32 +31,32 @@
padding = $el.data("padding-right"); padding = $el.data("padding-right");
$element.css("padding-left", 0).css("padding-right", padding); $element.css("padding-left", 0).css("padding-right", padding);
$element.filter("."+cfg.clear).removeClass(cfg.clear); $element.filter("." + cfg.clear).removeClass(cfg.clear);
var wrap_width = parseInt($this.width()); var wrap_width = parseInt($this.width());
var item_width = parseInt($el.outerWidth()); var item_width = parseInt($el.outerWidth());
var line_count = parseInt((wrap_width + padding) / item_width); var line_count = parseInt((wrap_width + padding) / item_width);
if(line_count == 0) if (line_count == 0)
return; return;
var space = parseInt(wrap_width % item_width); var space = parseInt(wrap_width % item_width);
if((space + padding) < item_width) { if ((space + padding) < item_width) {
space = wrap_width - ((item_width - padding) * line_count); space = wrap_width - ((item_width - padding) * line_count);
var new_padding = parseInt(space / (line_count * 2)); var new_padding = parseInt(space / (line_count * 2));
if(new_padding > padding) if (new_padding > padding)
$element.css("padding-left", new_padding+"px").css("padding-right", new_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)").css("padding-right", 0);
$element.filter(":nth-child("+line_count+"n+1)").addClass(cfg.clear); $element.filter(":nth-child(" + line_count + "n+1)").addClass(cfg.clear);
} }
item_arrange(); item_arrange();
$(window).resize(function() { $(window).resize(function () {
item_arrange(); item_arrange();
}); });
} }

View file

@ -1,23 +1,23 @@
$(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");
@ -26,19 +26,19 @@ $(function(){
} }
}); });
$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");
@ -46,27 +46,27 @@ $(function(){
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();
} }
}); });
@ -77,29 +77,28 @@ function submenu_hide() {
$(".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) { if (max_menu_count > 0 && (idx + 1) % max_menu_count == 0) {
el.removeClass("gnb_1dli_over").addClass("gnb_1dli_over2"); el.removeClass("gnb_1dli_over").addClass("gnb_1dli_over2");
left = 0; left = 0;
} else { } else {

View file

@ -1,14 +1,14 @@
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;
} }
}); });
@ -17,17 +17,17 @@ var reg_mb_id_check = function() {
// 추천인 검사 // 추천인 검사
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;
} }
}); });
@ -35,18 +35,18 @@ var reg_mb_recommend_check = function() {
} }
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;
} }
}); });
@ -54,18 +54,18 @@ var reg_mb_nick_check = function() {
} }
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;
} }
}); });
@ -73,18 +73,18 @@ var reg_mb_email_check = function() {
} }
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;
} }
}); });

View file

@ -8,20 +8,20 @@
* 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),
@ -36,12 +36,12 @@
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));
@ -51,9 +51,9 @@
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());
}); });

View file

@ -4,87 +4,87 @@
* 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);
} }

View file

@ -1,8 +1,7 @@
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,4 +1,4 @@
if (typeof(MD5_JS) == 'undefined') // 한번만 실행 if (typeof (MD5_JS) == 'undefined') // 한번만 실행
{ {
var MD5_JS = true; var MD5_JS = true;
@ -7,94 +7,92 @@ if (typeof(MD5_JS) == 'undefined') // 한번만 실행
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; var olda = a; var oldb = b; var oldc = c; var oldd = d;
a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936); a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936);
d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586); d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819); c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330); b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897); a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426); d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341); c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983); b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416); a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417); d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
c = md5_ff(c, d, a, b, x[i+10], 17, -42063); c = md5_ff(c, d, a, b, x[i + 10], 17, -42063);
b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162); b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682); a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
d = md5_ff(d, a, b, c, x[i+13], 12, -40341101); d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290); c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329); 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_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_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_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_hh(a, b, c, d, x, s, t) { return md5_cmn(b ^ c ^ d, a, b, x, s, t); }
@ -102,12 +100,11 @@ if (typeof(MD5_JS) == 'undefined') // 한번만 실행
function core_hmac_md5(key, data) { function core_hmac_md5(key, data) {
var bkey = str2binl(key); var bkey = str2binl(key);
if(bkey.length > 16) if (bkey.length > 16)
bkey = core_md5(bkey, key.length * chrsz); bkey = core_md5(bkey, key.length * chrsz);
var ipad = Array(16), opad = Array(16); var ipad = Array(16), opad = Array(16);
for(var i = 0; i < 16; i++) for (var i = 0; i < 16; i++) {
{
ipad[i] = bkey[i] ^ 0x36363636; ipad[i] = bkey[i] ^ 0x36363636;
opad[i] = bkey[i] ^ 0x5C5C5C5C; opad[i] = bkey[i] ^ 0x5C5C5C5C;
} }
@ -119,45 +116,39 @@ if (typeof(MD5_JS) == 'undefined') // 한번만 실행
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 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 bit_rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); }
function str2binl(str) function str2binl(str) {
{
var bin = Array(); var mask = (1 << chrsz) - 1; var bin = Array(); var mask = (1 << chrsz) - 1;
for(var i = 0; i < str.length * chrsz; i += chrsz) for (var i = 0; i < str.length * chrsz; i += chrsz)
bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32); bin[i >> 5] |= (str.charCodeAt(i / chrsz) & mask) << (i % 32);
return bin; return bin;
} }
function binl2str(bin) function binl2str(bin) {
{
var str = ""; var mask = (1 << chrsz) - 1; var str = ""; var mask = (1 << chrsz) - 1;
for(var i = 0; i < bin.length * 32; i += chrsz) for (var i = 0; i < bin.length * 32; i += chrsz)
str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask); return str; str += String.fromCharCode((bin[i >> 5] >>> (i % 32)) & mask); return str;
} }
function binl2hex(binarray) function binl2hex(binarray) {
{
var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; var str = ""; var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; var str = "";
for(var i = 0; i < binarray.length * 4; i++) 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); str += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xF) + hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8)) & 0xF);
return str; return str;
} }
function binl2b64(binarray) function binl2b64(binarray) {
{
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var str = ""; var str = "";
for(var i = 0; i < binarray.length * 4; i += 3) for (var i = 0; i < binarray.length * 4; i += 3) {
{ var triplet = (((binarray[i >> 2] >> 8 * (i % 4)) & 0xFF) << 16)
var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16) | (((binarray[i + 1 >> 2] >> 8 * ((i + 1) % 4)) & 0xFF) << 8)
| (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 ) | ((binarray[i + 2 >> 2] >> 8 * ((i + 2) % 4)) & 0xFF);
| ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF); for (var j = 0; j < 4; j++) {
for(var j = 0; j < 4; j++) if (i * 8 + j * 6 > binarray.length * 32)
{
if(i * 8 + j * 6 > binarray.length * 32)
str += b64pad; str += b64pad;
else else
str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); str += tab.charAt((triplet >> 6 * (3 - j)) & 0x3F);
} }
} }
return str; return str;

View file

@ -14,7 +14,8 @@
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
/** /**
@ -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;
@ -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;
@ -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 (
@ -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,14 +1,13 @@
(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 });
} }
} }
@ -19,21 +18,20 @@
$img.removeAttr("height") $img.removeAttr("height")
.css("height", ""); .css("height", "");
function image_resize() function image_resize() {
{
var width = $this.width(); var width = $this.width();
$img.each(function() { $img.each(function () {
if($(this).data("width") == undefined) if ($(this).data("width") == undefined)
$(this).data("width", $(this).width()); $(this).data("width", $(this).width());
if($(this).data("width") > width) { if ($(this).data("width") > width) {
$(this).removeAttr("width") $(this).removeAttr("width")
.removeAttr("height") .removeAttr("height")
.css("width","") .css("width", "")
.css("height", ""); .css("height", "");
if($(this).data("width") > width) { if ($(this).data("width") > width) {
$(this).css("width", "100%"); $(this).css("width", "100%");
} }
} else { } else {
@ -42,25 +40,24 @@
}); });
} }
$(window).on("load", function() { $(window).on("load", function () {
image_resize(); image_resize();
}); });
$(window).on("resize", function() { $(window).on("resize", function () {
image_resize(); image_resize();
}); });
} }
$.fn.viewimageresize2 = function(selector) $.fn.viewimageresize2 = 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 });
} }
} }
@ -68,26 +65,25 @@
var $img = this.find(cfg.selector); var $img = this.find(cfg.selector);
var $this = this; var $this = this;
function image_resize() function image_resize() {
{
var width = $this.width(); var width = $this.width();
$img.each(function() { $img.each(function () {
$(this).removeAttr("width") $(this).removeAttr("width")
.removeAttr("height") .removeAttr("height")
.css("width","") .css("width", "")
.css("height", ""); .css("height", "");
if($(this).data("width") == undefined) if ($(this).data("width") == undefined)
$(this).data("width", $(this).width()); $(this).data("width", $(this).width());
if($(this).data("width") > width) { if ($(this).data("width") > width) {
$(this).css("width", "100%"); $(this).css("width", "100%");
} }
}); });
} }
$(window).on("resize", function() { $(window).on("resize", function () {
image_resize(); image_resize();
}); });

View file

@ -4,61 +4,57 @@ 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 { } else {
return text; return text;
} }
} else { } else {
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);
} }
} }
// 양쪽 공백 없애기 // 양쪽 공백 없애기
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();
} }
@ -66,8 +62,7 @@ function wrestTelNum(fld)
} }
// 이메일주소 형식 검사 // 이메일주소 형식 검사
function wrestEmail(fld) function wrestEmail(fld) {
{
if (!wrestTrim(fld)) return; if (!wrestTrim(fld)) return;
//var pattern = /(\S+)@(\S+)\.(\S+)/; 이메일주소에 한글 사용시 //var pattern = /(\S+)@(\S+)\.(\S+)/; 이메일주소에 한글 사용시
@ -81,8 +76,7 @@ function wrestEmail(fld)
} }
// 한글인지 검사 (자음, 모음 조합된 한글만 가능) // 한글인지 검사 (자음, 모음 조합된 한글만 가능)
function wrestHangul(fld) function wrestHangul(fld) {
{
if (!wrestTrim(fld)) return; if (!wrestTrim(fld)) return;
//var pattern = /([^가-힣\x20])/i; //var pattern = /([^가-힣\x20])/i;
@ -97,8 +91,7 @@ function wrestHangul(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;
@ -113,8 +106,7 @@ function wrestHangul2(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;
@ -128,8 +120,7 @@ function wrestHangulAlNum(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;
@ -144,8 +135,7 @@ function wrestHangulAlpha(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') {
@ -158,8 +148,7 @@ function wrestNumeric(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]+$)/;
@ -174,8 +163,7 @@ function wrestAlpha(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]+$)/;
@ -189,8 +177,7 @@ function wrestAlNum(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\_]+$)/;
@ -204,29 +191,27 @@ function wrestAlNum_(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();
} }
@ -234,8 +219,7 @@ function wrestImgExt(fld)
} }
// 확장자 // 확장자
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]
@ -244,15 +228,14 @@ function wrestExtension(fld, css)
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)) {
@ -264,20 +247,19 @@ function wrestNospace(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);
} }
@ -291,24 +273,24 @@ function wrestSubmit()
el.style.backgroundColor = wrestFldDefaultColor; el.style.backgroundColor = wrestFldDefaultColor;
// 배열의 길이만큼 돌려라 // 배열의 길이만큼 돌려라
for (var k=0; k<array_css.length; k++) { for (var k = 0; k < array_css.length; k++) {
var css = array_css[k]; var css = array_css[k];
switch (css) { switch (css) {
case "required" : wrestRequired(el); break; case "required": wrestRequired(el); break;
case "trim" : wrestTrim(el); break; case "trim": wrestTrim(el); break;
case "email" : wrestEmail(el); break; case "email": wrestEmail(el); break;
case "hangul" : wrestHangul(el); break; case "hangul": wrestHangul(el); break;
case "hangul2" : wrestHangul2(el); break; case "hangul2": wrestHangul2(el); break;
case "hangulalpha" : wrestHangulAlpha(el); break; case "hangulalpha": wrestHangulAlpha(el); break;
case "hangulalnum" : wrestHangulAlNum(el); break; case "hangulalnum": wrestHangulAlNum(el); break;
case "nospace" : wrestNospace(el); break; case "nospace": wrestNospace(el); break;
case "numeric" : wrestNumeric(el); break; case "numeric": wrestNumeric(el); break;
case "alpha" : wrestAlpha(el); break; case "alpha": wrestAlpha(el); break;
case "alnum" : wrestAlNum(el); break; case "alnum": wrestAlNum(el); break;
case "alnum_" : wrestAlNum_(el); break; case "alnum_": wrestAlNum_(el); break;
case "telnum" : wrestTelNum(el); break; // 김선용 2006.3 - 전화번호 형식 검사 case "telnum": wrestTelNum(el); break; // 김선용 2006.3 - 전화번호 형식 검사
case "imgext" : wrestImgExt(el); break; case "imgext": wrestImgExt(el); break;
default : default:
if (/^extension\=/.test(css)) { if (/^extension\=/.test(css)) {
wrestExtension(el, css); break; wrestExtension(el, css); break;
} }
@ -328,17 +310,17 @@ function wrestSubmit()
// 오류메세지를 위한 element 추가 // 오류메세지를 위한 element 추가
var msg_el = document.createElement("strong"); var msg_el = document.createElement("strong");
msg_el.id = "msg_"+id; msg_el.id = "msg_" + id;
msg_el.className = "msg_sound_only"; msg_el.className = "msg_sound_only";
msg_el.innerHTML = wrestMsg; msg_el.innerHTML = wrestMsg;
wrestFld.parentNode.insertBefore(msg_el, wrestFld); wrestFld.parentNode.insertBefore(msg_el, wrestFld);
var new_href = document.location.href.replace(/#msg.+$/, "")+"#msg_"+id; var new_href = document.location.href.replace(/#msg.+$/, "") + "#msg_" + id;
document.location.href = new_href; document.location.href = new_href;
//wrestFld.style.backgroundColor = wrestFldBackColor; //wrestFld.style.backgroundColor = wrestFldBackColor;
if (typeof(wrestFld.select) != "undefined") if (typeof (wrestFld.select) != "undefined")
wrestFld.select(); wrestFld.select();
wrestFld.focus(); wrestFld.focus();
} }
@ -353,8 +335,7 @@ function wrestSubmit()
// 초기에 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) {
@ -365,7 +346,7 @@ function wrestInitialized()
} }
// 폼필드 자동검사 // 폼필드 자동검사
$(document).ready(function(){ $(document).ready(function () {
// onload // onload
wrestInitialized(); wrestInitialized();
}); });