|
|
Line 1: |
Line 1: |
− | == Edit request --[[User:Sakutaro Takizawa]] ==
| |
| | | |
− | An edit request for [[:Widget:Akarin]] from [[User:Sakutaro Takizawa]]:
| |
− | :{{status|done|category=Pages that are protected from editing}}<!-- Please do not modify this line, leave it to the authorized person to fill in, the classification will be automatically removed after the status parameter is set to agree or reject -->
| |
− | Adding:
| |
− | <pre>
| |
− | <noinclude>This plug-in is used to introduce option buttons for controlling styles, and is only used for templates {{tl|Akarin}}.
| |
− |
| |
− | Author:[[User:AnnAngela|AnnAngela]], [[User:Nbdd0121|XYZ指示物 (Nbdd0121)]]
| |
− |
| |
− | Agreement:CC BY-NC-SA 3.0
| |
− | </noinclude><includeonly>
| |
− | <!--{if !isset($wgAkalin) || !$wgAkalin}--><!--{assign var="wgAkalin" value=true scope="global"}-->
| |
− | <style type="text/css">
| |
− | .apertureOfEvilEye {
| |
− | display: inline;
| |
− | padding: 0 1em;
| |
− | border-width: 1px 0 1px 1px;
| |
− | border-color: #a7d7f9;
| |
− | border-style: solid;
| |
− | cursor: pointer;
| |
− | }
| |
− | .apertureOfEvilEye:last-child {
| |
− | border-right-width: 1px;
| |
− | }
| |
− | </style>
| |
− | <scr{{subst:User:Sakutaro Takizawa}}ipt type="text/ja{{subst:User:Sakutaro Takizawa}}vascr{{subst:User:Sakutaro Takizawa}}ipt">
| |
− | window.RLQ = window.RLQ || [];
| |
− | window.RLQ.push(function() {
| |
− | window.widgetAkalin = function(element, defaultOpacity) {
| |
− | if (defaultOpacity > 1) defaultOpacity = 1;
| |
− | else if (defaultOpacity < 0) defaultOpacity = 0;
| |
− |
| |
− | var opacities = [0, 0.25, 0.5, 0.75, 1];
| |
− | if (opacities.indexOf(defaultOpacity) === -1) {
| |
− | opacities.push(defaultOpacity);
| |
− | opacities.sort();
| |
− | }
| |
− |
| |
− | for (var i = 0; i < opacities.length; i++)
| |
− | element.append('<div class="apertureOfEvilEye" title="' + opacities[i] + '">' + Math.round(opacities[i] * 100) + '%<' + '/div>');
| |
− |
| |
− | element.show();
| |
− | var allElements = element.parents('.infoBox').parent().children();
| |
− | var elements = allElements.not('#toc,.infoBox,.infotemplatebox').add(allElements.filter('h2').nextAll());
| |
− | var others = allElements.filter('#toc,.infoBox,.infotemplatebox');
| |
− | elements.css('transition', 'opacity 233ms');
| |
− | others.css('position', 'relative').css('z-index', '1');
| |
− | var button = element.find('.apertureOfEvilEye'),
| |
− | currentOpacity = element.find('#currentAkalinOpacity');
| |
− | button.on('click', function() {
| |
− | elements.css('opacity', this.title);
| |
− | currentOpacity.text($(this).text());
| |
− | });
| |
− | elements.css('opacity', defaultOpacity);
| |
− | currentOpacity.text(Math.round(defaultOpacity * 100) + '%');
| |
− | };
| |
− | });
| |
− | </scr{{subst:User:Sakutaro Takizawa}}ipt><!--{/if}-->
| |
− | <div style="display:none;"><!--{$hint|escape:'html'|default:'Aperture size of Evil eye(Current aperture size'}--><span id="currentAkalinOpacity"></span>):
| |
− | <scr{{subst:User:Sakutaro Takizawa}}ipt>
| |
− | window.RLQ.push(function(){
| |
− | var scr{{subst:User:Sakutaro Takizawa}}ipt = document.currentScr{{subst:User:Sakutaro Takizawa}}ipt || document.scr{{subst:User:Sakutaro Takizawa}}ipts[document.scr{{subst:User:Sakutaro Takizawa}}ipts.length -1];
| |
− | return function() {
| |
− | $(function(){
| |
− | widgetAkalin($(scr{{subst:User:Sakutaro Takizawa}}ipt).parent(), <!--{$opacity|validate:float|default:'0.8'}-->);
| |
− | });
| |
− | };
| |
− | }());
| |
− |
| |
− | </div>
| |
− | </includeonly>
| |
− | </pre>
| |
− |
| |
− | I found that the template {{tl|Akarin}} can't work properly on enmoe because it lacks this widget. The template will be used in the page [[Air Girl]], to make the English version is unified with the Chinese version [[:zh:大气娘]].--[[User:Sakutaro Takizawa|Sakutaro Takizawa]] ([[User talk:Sakutaro Takizawa|Talk]])
| |