사용자:하늘/common.js: 두 판 사이의 차이

편집 요약 없음
편집 요약 없음
29번째 줄: 29번째 줄:
var $topButton = $( '#to-top' );
var $topButton = $( '#to-top' );


$topButton.css( {
$topButton.css( {} ).click( function() {
'font-size' : '14pt',
'border-radius': '0.35rem',
'background-color' : '#0077ff',
'color': '#FFF',
'position': 'fixed',
'bottom': '-30px',
'left': '4px',
'cursor': 'pointer',
'transition': 'bottom 0.5s',
'-webkit-transition': 'bottom 0.5s',
'user-select': 'none',
'-webkit-user-select': 'none',
'-moz-user-select': 'none',
'-ms-user-select': 'none'
} ).click( function() {
$( 'html, body' ).animate( { scrollTop: 0 }, 'slow' );
$( 'html, body' ).animate( { scrollTop: 0 }, 'slow' );
} );
} );
65번째 줄: 50번째 줄:
var hminus=height-window.innerHeight-"100";
var hminus=height-window.innerHeight-"100";


$bottomButton.css( {
$bottomButton.css( {} ).click( function() {
'font-size':'14pt',
'background-color':'#0077ff',
'border-radius': '0.35rem',
'color': '#FFF',
'position': 'fixed',
'bottom': '-30px',
'left': '42pt',
'cursor': 'pointer',
'transition': 'bottom 0.5s',
'-webkit-transition': 'bottom 0.5s',
'user-select': 'none',
'-webkit-user-select': 'none',
'-moz-user-select': 'none',
'-ms-user-select': 'none'
} ).click( function() {
$( 'html, body' ).animate( { scrollTop:height}, 'slow' );
$( 'html, body' ).animate( { scrollTop:height}, 'slow' );
} );
} );

2021년 2월 16일 (화) 16:32 판

mw.loader.load('//librewiki.net/index.php?title=사용자:Utolee90/status.js&action=raw&ctype=text/javascript');


function esAddingButton() {
  /*
  esAddButton('버튼 이름', '버튼을 누르면 입력 될 편집 요약', '버튼을 가리키면 툴팁으로 뜨는 설명')
  위와 같은 형식으로 새로운 버튼을 추가 할 수 있습니다.
  */ 
  esAddButton('문법', '잘못된 위키문법을 고침', '위키문법 수정')
  esAddButton('삭', '[[백:삭|삭제 신청]]함', '삭제 신청')
  esAddButton('정리', '문서의 모양 및 구성을 정리함', '문서 정리')
  esAddButton('토막', '[[백:토막글|토막글]] 틀을 닮', '토막글')
  esAddButton('공용대체', '로컬 파일을 [[commons:|공용]]의 파일로 대체함', '공용으로 파일 대체')
}

// 로컬 파일 설명 안 보고 바로 공용으로 넘기기(영어 위키백과, 위키데이터에서 퍼옴)
mw.loader.load('//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-imagelinks.js&action=raw&ctype=text/javascript');

/* 
이 스크립트는 Minecraft Wiki의 Majr의 goToTop.js를 
(http://minecraftwiki.net/wiki/User:Majr/goToTop.js/)
리브레 위키의 사용자 Utolee90이 재가공해서 만들었습니다.
*/
/* 위로 올라가는 버튼을 만듭니다. */
$( function() {
'use strict';

$( 'body' ).append( '<span id="to-top">▲ 위</span>' );
var $topButton = $( '#to-top' );

$topButton.css( {} ).click( function() {
	$( 'html, body' ).animate( { scrollTop: 0 }, 'slow' );
} );
/* 위에서 100픽셀 이내에 있으면 위 버튼을 숨깁니다. */
$( window ).scroll( function() {
	if ( $( window ).scrollTop() > 100 ) {
		$topButton.css( 'bottom', '4px' );
	} else {
		$topButton.css( 'bottom', '-30px' );
	}
} );
} );
/* 아래 버튼을 만듭니다. */
$( function() {
'use strict';

$( 'body' ).append( '<span id="to-bottom">▼아래</span>' );
var $bottomButton = $( '#to-bottom' );
var height=document.body.scrollHeight;
var hminus=height-window.innerHeight-"100";

$bottomButton.css( {} ).click( function() {
	$( 'html, body' ).animate( { scrollTop:height}, 'slow' );
} );
/*아래에서 100픽셀 이내이면 아래 버튼을 숨깁니다. */
$( window ).scroll( function() {
	if ( $( window ).scrollTop () <hminus ) {
		$bottomButton.css( 'bottom', '4px' );
	} else {
		$bottomButton.css( 'bottom', '-30px' );
	}
} );
} );