/* * by @psyonline ( http://www.psyonline.kr/, majorartist@gmail.com ) */ 'use strict'; var MAINSTYLE = { mode: '', isViewMode: false, areaWidth: 0, areaHeight: 0, scrollTop: 0, content: function() { var $section = $('section'), $articles = $('article'), mode = MAINSTYLE.mode, isLocaleNetworkView = false; MAINSTYLE.articles.setItem($articles); return { getContentWidth: function() { return $section.length ? $section[0].offsetWidth : document.body.offsetWidth; }, resize: function() { //$section.css('minHeight', MAINSTYLE.areaHeight); »ó´Ü 91 »©¸é ´ÃÀüüȭ¸é } } }, articles: (function() { var $articles = [], visiblesMap, visibleListeners, dataName = 'data-visible'; // if set 'data-visible' attribute to 'visible' to element, skip check. visibleListeners = { 'default': function() { setVisibled(this); } } function getName($target) { var matches = $target.attr('class').match(/article-([a-z]+)/); return matches ? matches[1] : ''; } function setVisibled(target, attributeValue) { $(target).css('visibility', 'visible').attr(dataName, attributeValue || 'visible'); } return { setItem: function(_$articles) { var $newArticle, i = 0, max = $articles.length; // remove for (; i < max; i++) { $articles[i].unbind('visible invisible'); } visiblesMap = {}; $articles.length = 0; // add for (i = 0, max = _$articles.length; i < max; i++) { $newArticle = $(_$articles[i]); setVisibled($newArticle); } }, setVisibled: setVisibled } })(), createPaging: function($paging, length) { for (var html = [], i = 0; i < length; i++) { html.push(''+ (i+1) +''); } $paging.html(html.join('')); }, smoothScrollTop: function(v, time, callback) { $('html, body')._animate({scrollTop: v}, {queue: false, duration: time || 1000, easing: 'easeInOutQuart', complete: callback}); }, resize: function(ignore) { var width, height, sizeModeChanged; width = document.documentElement.offsetWidth; height = $(window).height(); MAINSTYLE.areaWidth = document.documentElement.offsetWidth; MAINSTYLE.areaHeight = $(window).height(); MAINSTYLE.content.resize(sizeModeChanged); MAINSTYLE.index && MAINSTYLE.index.resize(); }, initialize: function() { if ($.browser.ie && 9 > $.browser.ie) { // fix ie8 error - HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917) $(function() { MAINSTYLE._initialize(); }); } else { MAINSTYLE._initialize(); } }, _initialize: function() { var browser = $.browser, $win = $(window); this.content = this.content(); this.index && this.index.initialize(); this.resize(); $win.resize(this.resize); } }