미디어위키:Gadget-Vector.js: 두 판 사이의 차이
식물 vs 좀비 위키
편집 요약 없음 |
편집 요약 없음 |
||
| 350번째 줄: | 350번째 줄: | ||
'use strict'; | 'use strict'; | ||
var ACTION_OFFSET = 230; | |||
var SEARCH_GAP = 15; | |||
var SEARCH_WIDTH = 175; | |||
function syncV33Layout() { | |||
var content = document.querySelector('#content'); | var content = document.querySelector('#content'); | ||
var leftNavigation = document.getElementById('left-navigation'); | var leftNavigation = document.getElementById('left-navigation'); | ||
var rightNavigation = document.getElementById('right-navigation'); | var rightNavigation = document.getElementById('right-navigation'); | ||
var search = document.getElementById('pvz-content-search'); | |||
var rightGap; | var rightGap; | ||
var navigationTop; | var navigationTop; | ||
if (!content || !leftNavigation | if (!content || !leftNavigation) { | ||
return; | return; | ||
} | } | ||
| 466번째 줄: | 385번째 줄: | ||
); | ); | ||
rightNavigation.style.setProperty( | if (rightNavigation) { | ||
'top', | rightNavigation.style.setProperty( | ||
'position', | |||
'important' | 'absolute', | ||
'important' | |||
); | |||
rightNavigation.style.setProperty( | |||
'top', | |||
navigationTop + 'px', | |||
'important' | |||
); | |||
rightNavigation.style.setProperty( | |||
'right', | |||
(rightGap + ACTION_OFFSET) + 'px', | |||
'important' | |||
); | |||
rightNavigation.style.setProperty( | |||
'left', | |||
'auto', | |||
'important' | |||
); | |||
rightNavigation.style.setProperty( | |||
'display', | |||
'flex', | |||
'important' | |||
); | |||
rightNavigation.style.setProperty( | |||
'align-items', | |||
'flex-end', | |||
'important' | |||
); | |||
rightNavigation.style.setProperty( | |||
'justify-content', | |||
'flex-end', | |||
'important' | |||
); | |||
rightNavigation.style.setProperty( | |||
'width', | |||
'max-content', | |||
'important' | |||
); | |||
rightNavigation.style.setProperty( | |||
'margin', | |||
'0', | |||
'important' | |||
); | |||
rightNavigation.style.setProperty( | |||
'transform', | |||
'none', | |||
'important' | |||
); | |||
} | |||
if (search) { | |||
'right', | search.style.setProperty( | ||
'position', | |||
'absolute', | |||
'important' | |||
); | |||
search.style.setProperty( | |||
'top', | |||
' | navigationTop + 'px', | ||
'important' | 'important' | ||
); | |||
search.style.setProperty( | |||
'right', | |||
(rightGap + SEARCH_GAP) + 'px', | |||
'important' | |||
); | |||
search.style.setProperty( | |||
'left', | |||
'auto', | |||
'important' | |||
); | |||
search.style.setProperty( | |||
'width', | |||
SEARCH_WIDTH + 'px', | |||
'important' | |||
); | |||
search.style.setProperty( | |||
'max-width', | |||
SEARCH_WIDTH + 'px', | |||
'important' | |||
); | |||
} | |||
} | } | ||
function | function initV33Layout() { | ||
var observer; | var observer; | ||
syncV33Layout(); | |||
window.addEventListener( | window.addEventListener( | ||
'resize', | 'resize', | ||
syncV33Layout, | |||
{ passive: true } | { passive: true } | ||
); | ); | ||
| 498번째 줄: | 485번째 줄: | ||
window.addEventListener( | window.addEventListener( | ||
'orientationchange', | 'orientationchange', | ||
syncV33Layout, | |||
{ passive: true } | { passive: true } | ||
); | ); | ||
observer = new MutationObserver(function () { | observer = new MutationObserver(function () { | ||
window.requestAnimationFrame( | window.requestAnimationFrame(syncV33Layout); | ||
}); | }); | ||
| 515번째 줄: | 502번째 줄: | ||
document.addEventListener( | document.addEventListener( | ||
'DOMContentLoaded', | 'DOMContentLoaded', | ||
initV33Layout, | |||
{ once: true } | { once: true } | ||
); | ); | ||
} else { | } else { | ||
initV33Layout(); | |||
} | } | ||
}()); | }()); | ||
