Skip to content

Instantly share code, notes, and snippets.

@imyeonn
imyeonn / jquery.magnific-popup.min.js
Created March 7, 2018 00:32
jquery.magnific-popup.min.js
/*! Magnific Popup - v1.1.0 - 2016-02-20
* http://dimsemenov.com/plugins/magnific-popup/
* Copyright (c) 2016 Dmitry Semenov; */
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):window.jQuery||window.Zepto)}(function(a){var b,c,d,e,f,g,h="Close",i="BeforeClose",j="AfterClose",k="BeforeAppend",l="MarkupParse",m="Open",n="Change",o="mfp",p="."+o,q="mfp-ready",r="mfp-removing",s="mfp-prevent-close",t=function(){},u=!!window.jQuery,v=a(window),w=function(a,c){b.ev.on(o+a+p,c)},x=function(b,c,d,e){var f=document.createElement("div");return f.className="mfp-"+b,d&&(f.innerHTML=d),e?c&&c.appendChild(f):(f=a(f),c&&f.appendTo(c)),f},y=function(c,d){b.ev.triggerHandler(o+c,d),b.st.callbacks&&(c=c.charAt(0).toLowerCase()+c.slice(1),b.st.callbacks[c]&&b.st.callbacks[c].apply(b,a.isArray(d)?d:[d]))},z=function(c){return c===g&&b.currTemplate.closeBtn||(b.currTemplate.closeBtn=a(b.st.closeMarkup.replace("%title%",b.st.tClose)),g=c),b.currTemplate.closeBtn}
@imyeonn
imyeonn / others.sass
Last active March 9, 2018 10:09
sass
.mfp-bg
top: 0
left: 0
width: 100%
height: 100%
z-index: 1042
overflow: hidden
position: fixed
background: #0b0b0b
opacity: 0.8
@imyeonn
imyeonn / default.html
Created March 6, 2018 06:38
Adding Scripts
<script src="/assets/lib/jquery-1.12.0.min.js"></script>
<script src="/assets/lib/jquery.magnific-popup.min.js"></script>
<script src="/assets/js/index.js"></script>
// 이미지 alt 속 내용을 캡션으로 만들어줌
$('.post > p > img[alt]').replaceWith(function () {
return '<figure>'
+ '<a href="' + $(this).attr('src') + '" class="mg-link">'
+ '<img src="' + $(this).attr('src') + '"/></a>'
+ '<figcaption class="caption">' + $(this).attr('alt') + '</figcaption>'
+ '</figure>';
});
// 이미지를 magnific popup image viewer에 연결시킴
@imyeonn
imyeonn / jquery-1.12.0.min.js
Last active March 7, 2018 00:29
Magnific Popup in Jekyll
/*! jQuery v1.12.0 | (c) jQuery Foundation | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="1.12.0",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:func
<ul class="pagination" role="navigation">
{% if paginator.previous_page %}
<li id="page-prev"><a href="{{ site.url }}{{ paginator.previous_page_path }}"><span class="sr-only">Previous Page</span></a></li>
{% else %}
<li id="page-prev" class="disabled"><span class="sr-only">No Previous Page</span></li>
{% endif %}
{% for p in (1..paginator.total_pages) %}
{% if p == paginator.page %}
<li class="page-number active">{{ p }}</li>
<ul class="pagination" role="navigation">
<!-- 여기부터 -->
{% if paginator.total_pages <= 5 %}
{% assign first = 1 %}
{% assign last = paginator.total_pages %}
{% else %}
{% assign first = paginator.page | minus: 2 %}
{% if first < 1 %}
{% assign first = 1 %}