미디어위키:Libre.js: 두 판 사이의 차이

편집 요약 없음
잔글편집 요약 없음
27번째 줄: 27번째 줄:
  * 20150825
  * 20150825
  */
  */
$(document).ready(function(){
window.addEventListener("load",function(){
var result = {
var result = {
selected : void 0,
selected : void 0,

2015년 8월 25일 (화) 21:44 판

/* 이 자바스크립트 설정은 리브레 스킨을 사용하는 사용자에게 적용됩니다 */
/**
 * 알림
 * 20150728
 */
$(document).ready(function() {
	$.ajax({
		url: (mw) ? mw.util.wikiScript("api") : "//librewiki.net/api.php",
		method: "get",
		data: {
			"action": "query",
			"meta": "notifications",
			"format": "json",
			"notprop": "count"
		},
		dataType: "json"
	}).done(function(msg) {
		if (msg.query.notifications.count != 0) {
			$(document.body).addClass("has-notification");
			$(".mw-echo-notifications-badge").append('<span class="notify-count">' + msg.query.notifications.count + '</span>');
		}
	});
});

/**
 * 스크롤을 옮길 때 검색 결과가 따라옵니다.
 * 20150825
 */
window.addEventListener("load",function(){
	var result = {
		selected : void 0,
		set : function(obje){
			result.selected = obje;
		},
		adjust : function(){
			if(result.selected){
				var $i = $(result.selected);
				$(".suggestions").css({top:$i.offset().top+$i.outerHeight(true)});
			}
		}
	};

	$(".form-control").click(function(){result.set(this);});
	$(document).scroll(result.adjust);
});