Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/css/combined.css |
— | — | @@ -132,16 +132,6 @@ |
133 | 133 | margin-left: 0; |
134 | 134 | margin-right: 0.5em; |
135 | 135 | } |
136 | | -.expandableField { |
137 | | - display: block; |
138 | | - float: left; |
139 | | -} |
140 | | -#simpleSearch { |
141 | | - overflow: auto; |
142 | | -} |
143 | | -div#simpleSearch button#searchButton { |
144 | | - margin: 0.4em 0 0 0; |
145 | | -} |
146 | 136 | /* wikiEditor plugin */ |
147 | 137 | |
148 | 138 | /* This ID (#editform) could change in MediaWiki */ |
— | — | @@ -580,222 +570,6 @@ |
581 | 571 | } |
582 | 572 | .wikiEditor-publish-dialog-options { |
583 | 573 | margin-top: 1.5em; |
584 | | -}/* wikiEditor toc module */ |
585 | | -.wikiEditor-ui-toc { |
586 | | - /* height and width are set dynamically */ |
587 | | - /*float: right;*/ |
588 | | - padding: 0; |
589 | | - overflow: auto; |
590 | | - overflow-x: hidden; |
591 | | -} |
592 | | -.wikiEditor-ui-toc { |
593 | | - border-left: solid silver 1px; |
594 | | -} |
595 | | -body.rtl .wikiEditor-ui-toc { |
596 | | - border-right: solid silver 1px; |
597 | | - border-left: none; |
598 | | -} |
599 | | -.wikiEditor-ui-toc ul { |
600 | | - padding: 0; |
601 | | - margin: 0; |
602 | | - list-style: none; |
603 | | - /* IE needs to be told in great detail how to act, or it misbehaves */ |
604 | | - list-style-image: none; |
605 | | - list-style-position: outside; |
606 | | - list-style-type: none; |
607 | | - width: 100%; |
608 | | -} |
609 | | -.tab-toc { |
610 | | - /* Should match the toolbar */ |
611 | | - background-image: url(../images/wikiEditor/toolbar/base.png?1); |
612 | | - background-position: left top; |
613 | | - background-repeat: repeat-x; |
614 | | - height: 26px; |
615 | | - padding: 3px 0; |
616 | | - line-height: 26px; |
617 | | - padding-left: 1em; |
618 | | - border-bottom: solid 1px silver; |
619 | | - white-space: nowrap; |
620 | | - overflow: hidden; |
621 | | -} |
622 | | -body.rtl .tab-toc { |
623 | | - background-position: right top; |
624 | | - padding-right: 2em; |
625 | | -} |
626 | | -.tab-toc a { |
627 | | - outline: none; |
628 | | -} |
629 | | -.wikiEditor-ui-toc li { |
630 | | - padding: 0; |
631 | | - margin: 0; |
632 | | -} |
633 | | -.wikiEditor-ui-toc ul ul { |
634 | | - padding: 0; |
635 | | - margin: 0; |
636 | | - margin-bottom: 0 !important; |
637 | | - margin-top: 0 !important; |
638 | | - list-style: none; |
639 | | - background-image: none; |
640 | | -} |
641 | | -.wikiEditor-ui-toc ul li div { |
642 | | - display: block; |
643 | | - font-size: 0.9em; |
644 | | - cursor: pointer; |
645 | | - color: #0645ad; |
646 | | -} |
647 | | -.wikiEditor-ui-toc ul li div { |
648 | | - padding: 0.125em; |
649 | | - padding-left: 1em; |
650 | | -} |
651 | | -body.rtl .wikiEditor-ui-toc ul li div { |
652 | | - padding-right: 1em; |
653 | | - padding-left: 0; |
654 | | -} |
655 | | -.wikiEditor-ui-toc ul ul li div { |
656 | | - padding-left: 2em; |
657 | | -} |
658 | | -body.rtl .wikiEditor-ui-toc ul ul li div { |
659 | | - padding-right: 2em; |
660 | | - padding-left: 0; |
661 | | -} |
662 | | -.wikiEditor-ui-toc ul ul ul li div { |
663 | | - padding-left: 3em; |
664 | | -} |
665 | | -body.rtl .wikiEditor-ui-toc ul ul ul li div { |
666 | | - padding-right: 3em; |
667 | | - padding-left: 0; |
668 | | -} |
669 | | -.wikiEditor-ui-toc ul ul ul ul li div { |
670 | | - padding-left: 4em; |
671 | | -} |
672 | | -body.rtl .wikiEditor-ui-toc ul ul ul ul li div { |
673 | | - padding-right: 4em; |
674 | | - padding-left: 0; |
675 | | -} |
676 | | -.wikiEditor-ui-toc ul ul ul ul ul li div { |
677 | | - padding-left: 5em; |
678 | | -} |
679 | | -body.rtl .wikiEditor-ui-toc ul ul ul ul ul li div { |
680 | | - padding-right: 5em; |
681 | | - padding-left: 0; |
682 | | -} |
683 | | -.wikiEditor-ui-toc ul ul ul ul ul ul li div { |
684 | | - padding-left: 6em; |
685 | | -} |
686 | | -body.rtl wikiEditor-ui-toc ul ul ul ul ul ul li div { |
687 | | - padding-right: 6em; |
688 | | - padding-left: 0; |
689 | | -} |
690 | | -.wikiEditor-ui-toc ul li div.current { |
691 | | - background-color: #FAFAFA; |
692 | | - color: #333333; |
693 | | -} |
694 | | -.wikiEditor-ui-toc ul li div.section-0 { |
695 | | - font-size: 1em; |
696 | | - padding-top: 0.5em; |
697 | | - padding-bottom: 0.5em; |
698 | | - border-bottom: solid 1px #DDDDDD; |
699 | | -} |
700 | | - |
701 | | -/* Collapsing changes */ |
702 | | - |
703 | | -.wikiEditor-ui-toc { |
704 | | - overflow-y: hidden; |
705 | | - position: relative; |
706 | | -} |
707 | | -.wikiEditor-ui-toc ul { |
708 | | - overflow-y: auto; |
709 | | - overflow-x: hidden; |
710 | | - height: 100%; |
711 | | - margin-bottom: 0 !important; |
712 | | - |
713 | | -} |
714 | | - |
715 | | -.wikiEditor-ui-toc ul ul { |
716 | | - float: none; |
717 | | - height: auto; |
718 | | -} |
719 | | -#wikiEditor-ui-toc-collapse { |
720 | | - height: 100%; |
721 | | - width: 18px; |
722 | | - position: absolute; |
723 | | - top: 0; |
724 | | - left: 0; |
725 | | -} |
726 | | -.wikiEditor-ui-toc-collapse-open { |
727 | | - background: #f3f3f3 url(../images/wikiEditor/toc/close.png?1) 4px 50% no-repeat; |
728 | | - border-left: 1px solid #DDDDDD; |
729 | | -} |
730 | | -.wikiEditor-ui-toc-collapse-closed { |
731 | | - background: #f3f3f3 url(../images/wikiEditor/toc/open.png?1) 4px 50% no-repeat; |
732 | | -} |
733 | | - |
734 | | -/* Resizing Changes */ |
735 | | -.wikiEditor-ui-toc-resize-vertical, |
736 | | -.ui-resizable-w { |
737 | | - width: 4px; |
738 | | - position: absolute; |
739 | | - top: 0; |
740 | | - left: 0; |
741 | | - height: 100%; |
742 | | - cursor: ew-resize; |
743 | | -} |
744 | | -.wikiEditor-ui .wikiEditor-ui-right { |
745 | | - overflow: visible; |
746 | | -} |
747 | | -.wikiEditor-ui-right .ui-resizable-w { |
748 | | - left: 0px !important; |
749 | | - z-index: 0; |
750 | | -} |
751 | | - |
752 | | -.wikiEditor-ui-right .wikiEditor-ui-toc-resize-grip { |
753 | | - width: 5px; |
754 | | - height: 12px; |
755 | | - padding: 3px; |
756 | | - position: absolute; |
757 | | - top: 7px; |
758 | | - left: -12px !important; |
759 | | - cursor: ew-resize; |
760 | | - background: url(../images/wikiEditor/toc/grip.png?1) 50% 50% no-repeat; |
761 | | - z-index: 0; |
762 | | -} |
763 | | -body.rtl .wikiEditor-ui-right .wikiEditor-ui-toc-resize-grip { |
764 | | - right: 2px !important; |
765 | | -} |
766 | | -.wikiEditor-ui-toolbar .tab-toc { |
767 | | - float: right; |
768 | | - margin: 3px 16px 3px 3px; |
769 | | - line-height: 26px; |
770 | | -} |
771 | | -.wikiEditor-ui-toc-expandControl { |
772 | | - position: absolute; |
773 | | - z-index: 2; |
774 | | - top: 0px; |
775 | | - right: 10px; |
776 | | - height: 26px; |
777 | | - padding: 3px 0; |
778 | | - line-height: 26px; |
779 | | - padding-right: 1em; |
780 | | - white-space: nowrap; |
781 | | - overflow: hidden; |
782 | | -} |
783 | | -body.rtl .wikiEditor-ui-toc-expandControl { |
784 | | - padding-left: 1em; |
785 | | - padding-right: 0; |
786 | | - left: 10px; |
787 | | - right: auto; |
788 | | -} |
789 | | -.wikiEditor-ui-text textarea { |
790 | | - resize: none; |
791 | | -} |
792 | | -.wikiEditor-ui-text textarea:focus { |
793 | | - outline: none; |
794 | | -} |
795 | | - |
796 | | -/* Self Clearing for the wikiText view */ |
797 | | -.wikiEditor-ui-view-wikiText { |
798 | | - overflow: auto; |
799 | | - width: 100%; |
800 | 574 | }/* wikiEditor toolbar module */ |
801 | 575 | |
802 | 576 | .wikiEditor-ui-toolbar { |
— | — | @@ -1203,19 +977,3 @@ |
1204 | 978 | background: #e5e5e5; |
1205 | 979 | padding: 10px; |
1206 | 980 | } |
1207 | | -/* CSS for wikiEditor preview plugin */ |
1208 | | - |
1209 | | -.wikiEditor-preview-loading { |
1210 | | - padding: 1em; |
1211 | | - background-color: white; |
1212 | | -} |
1213 | | -.wikiEditor-preview-loading span { |
1214 | | - color: #666666; |
1215 | | -} |
1216 | | -.wikiEditor-preview-spinner { |
1217 | | - padding-right: 1em; |
1218 | | -} |
1219 | | -.wikiEditor-preview-contents { |
1220 | | - padding: 1em; |
1221 | | - background-color: white; |
1222 | | -} |
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/css/combined.min.css |
— | — | @@ -130,16 +130,6 @@ |
131 | 131 | margin-left:0; |
132 | 132 | margin-right:0.5em; |
133 | 133 | } |
134 | | -.expandableField{ |
135 | | -display:block; |
136 | | -float:left; |
137 | | -} |
138 | | -#simpleSearch{ |
139 | | -overflow:auto; |
140 | | -} |
141 | | -div#simpleSearch button#searchButton{ |
142 | | -margin:0.4em 0 0 0; |
143 | | -} |
144 | 134 | form#editform{ |
145 | 135 | margin:0; |
146 | 136 | padding:0; |
— | — | @@ -549,208 +539,6 @@ |
550 | 540 | .wikiEditor-publish-dialog-options{ |
551 | 541 | margin-top:1.5em; |
552 | 542 | } |
553 | | -.wikiEditor-ui-toc{ |
554 | | -padding:0; |
555 | | -overflow:auto; |
556 | | -overflow-x:hidden; |
557 | | -} |
558 | | -.wikiEditor-ui-toc{ |
559 | | -border-left:solid silver 1px; |
560 | | -} |
561 | | -body.rtl .wikiEditor-ui-toc{ |
562 | | -border-right:solid silver 1px; |
563 | | -border-left:none; |
564 | | -} |
565 | | -.wikiEditor-ui-toc ul{ |
566 | | -padding:0; |
567 | | -margin:0; |
568 | | -list-style:none; |
569 | | -list-style-image:none; |
570 | | -list-style-position:outside; |
571 | | -list-style-type:none; |
572 | | -width:100%; |
573 | | -} |
574 | | -.tab-toc{ |
575 | | -background-image:url(../images/wikiEditor/toolbar/base.png?1); |
576 | | -background-position:left top; |
577 | | -background-repeat:repeat-x; |
578 | | -height:26px; |
579 | | -padding:3px 0; |
580 | | -line-height:26px; |
581 | | -padding-left:1em; |
582 | | -border-bottom:solid 1px silver; |
583 | | -white-space:nowrap; |
584 | | -overflow:hidden; |
585 | | -} |
586 | | -body.rtl .tab-toc{ |
587 | | -background-position:right top; |
588 | | -padding-right:2em; |
589 | | -} |
590 | | -.tab-toc a{ |
591 | | -outline:none; |
592 | | -} |
593 | | -.wikiEditor-ui-toc li{ |
594 | | -padding:0; |
595 | | -margin:0; |
596 | | -} |
597 | | -.wikiEditor-ui-toc ul ul{ |
598 | | -padding:0; |
599 | | -margin:0; |
600 | | -margin-bottom:0 !important; |
601 | | -margin-top:0 !important; |
602 | | -list-style:none; |
603 | | -background-image:none; |
604 | | -} |
605 | | -.wikiEditor-ui-toc ul li div{ |
606 | | -display:block; |
607 | | -font-size:0.9em; |
608 | | -cursor:pointer; |
609 | | -color:#0645ad; |
610 | | -} |
611 | | -.wikiEditor-ui-toc ul li div{ |
612 | | -padding:0.125em; |
613 | | -padding-left:1em; |
614 | | -} |
615 | | -body.rtl .wikiEditor-ui-toc ul li div{ |
616 | | -padding-right:1em; |
617 | | -padding-left:0; |
618 | | -} |
619 | | -.wikiEditor-ui-toc ul ul li div{ |
620 | | -padding-left:2em; |
621 | | -} |
622 | | -body.rtl .wikiEditor-ui-toc ul ul li div{ |
623 | | -padding-right:2em; |
624 | | -padding-left:0; |
625 | | -} |
626 | | -.wikiEditor-ui-toc ul ul ul li div{ |
627 | | -padding-left:3em; |
628 | | -} |
629 | | -body.rtl .wikiEditor-ui-toc ul ul ul li div{ |
630 | | -padding-right:3em; |
631 | | -padding-left:0; |
632 | | -} |
633 | | -.wikiEditor-ui-toc ul ul ul ul li div{ |
634 | | -padding-left:4em; |
635 | | -} |
636 | | -body.rtl .wikiEditor-ui-toc ul ul ul ul li div{ |
637 | | -padding-right:4em; |
638 | | -padding-left:0; |
639 | | -} |
640 | | -.wikiEditor-ui-toc ul ul ul ul ul li div{ |
641 | | -padding-left:5em; |
642 | | -} |
643 | | -body.rtl .wikiEditor-ui-toc ul ul ul ul ul li div{ |
644 | | -padding-right:5em; |
645 | | -padding-left:0; |
646 | | -} |
647 | | -.wikiEditor-ui-toc ul ul ul ul ul ul li div{ |
648 | | -padding-left:6em; |
649 | | -} |
650 | | -body.rtl wikiEditor-ui-toc ul ul ul ul ul ul li div{ |
651 | | -padding-right:6em; |
652 | | -padding-left:0; |
653 | | -} |
654 | | -.wikiEditor-ui-toc ul li div.current{ |
655 | | -background-color:#FAFAFA; |
656 | | -color:#333333; |
657 | | -} |
658 | | -.wikiEditor-ui-toc ul li div.section-0{ |
659 | | -font-size:1em; |
660 | | -padding-top:0.5em; |
661 | | -padding-bottom:0.5em; |
662 | | -border-bottom:solid 1px #DDDDDD; |
663 | | -} |
664 | | -.wikiEditor-ui-toc{ |
665 | | -overflow-y:hidden; |
666 | | -position:relative; |
667 | | -} |
668 | | -.wikiEditor-ui-toc ul{ |
669 | | -overflow-y:auto; |
670 | | -overflow-x:hidden; |
671 | | -height:100%; |
672 | | -margin-bottom:0 !important; |
673 | | -} |
674 | | -.wikiEditor-ui-toc ul ul{ |
675 | | -float:none; |
676 | | -height:auto; |
677 | | -} |
678 | | -#wikiEditor-ui-toc-collapse{ |
679 | | -height:100%; |
680 | | -width:18px; |
681 | | -position:absolute; |
682 | | -top:0; |
683 | | -left:0; |
684 | | -} |
685 | | -.wikiEditor-ui-toc-collapse-open{ |
686 | | -background:#f3f3f3 url(../images/wikiEditor/toc/close.png?1) 4px 50% no-repeat; |
687 | | -border-left:1px solid #DDDDDD; |
688 | | -} |
689 | | -.wikiEditor-ui-toc-collapse-closed{ |
690 | | -background:#f3f3f3 url(../images/wikiEditor/toc/open.png?1) 4px 50% no-repeat; |
691 | | -} |
692 | | -.wikiEditor-ui-toc-resize-vertical, |
693 | | -.ui-resizable-w{ |
694 | | -width:4px; |
695 | | -position:absolute; |
696 | | -top:0; |
697 | | -left:0; |
698 | | -height:100%; |
699 | | -cursor:ew-resize; |
700 | | -} |
701 | | -.wikiEditor-ui .wikiEditor-ui-right{ |
702 | | -overflow:visible; |
703 | | -} |
704 | | -.wikiEditor-ui-right .ui-resizable-w{ |
705 | | -left:0px !important; |
706 | | -z-index:0; |
707 | | -} |
708 | | -.wikiEditor-ui-right .wikiEditor-ui-toc-resize-grip{ |
709 | | -width:5px; |
710 | | -height:12px; |
711 | | -padding:3px; |
712 | | -position:absolute; |
713 | | -top:7px; |
714 | | -left:-12px !important; |
715 | | -cursor:ew-resize; |
716 | | -background:url(../images/wikiEditor/toc/grip.png?1) 50% 50% no-repeat; |
717 | | -z-index:0; |
718 | | -} |
719 | | -body.rtl .wikiEditor-ui-right .wikiEditor-ui-toc-resize-grip{ |
720 | | -right:2px !important; |
721 | | -} |
722 | | -.wikiEditor-ui-toolbar .tab-toc{ |
723 | | -float:right; |
724 | | -margin:3px 16px 3px 3px; |
725 | | -line-height:26px; |
726 | | -} |
727 | | -.wikiEditor-ui-toc-expandControl{ |
728 | | -position:absolute; |
729 | | -z-index:2; |
730 | | -top:0px; |
731 | | -right:10px; |
732 | | -height:26px; |
733 | | -padding:3px 0; |
734 | | -line-height:26px; |
735 | | -padding-right:1em; |
736 | | -white-space:nowrap; |
737 | | -overflow:hidden; |
738 | | -} |
739 | | -body.rtl .wikiEditor-ui-toc-expandControl{ |
740 | | -padding-left:1em; |
741 | | -padding-right:0; |
742 | | -left:10px; |
743 | | -right:auto; |
744 | | -} |
745 | | -.wikiEditor-ui-text textarea{ |
746 | | -resize:none; |
747 | | -} |
748 | | -.wikiEditor-ui-text textarea:focus{ |
749 | | -outline:none; |
750 | | -} |
751 | | -.wikiEditor-ui-view-wikiText{ |
752 | | -overflow:auto; |
753 | | -width:100%; |
754 | | -} |
755 | 543 | .wikiEditor-ui-toolbar{ |
756 | 544 | position:relative; |
757 | 545 | width:100%; |
— | — | @@ -1138,17 +926,3 @@ |
1139 | 927 | background:#e5e5e5; |
1140 | 928 | padding:10px; |
1141 | 929 | } |
1142 | | -.wikiEditor-preview-loading{ |
1143 | | -padding:1em; |
1144 | | -background-color:white; |
1145 | | -} |
1146 | | -.wikiEditor-preview-loading span{ |
1147 | | -color:#666666; |
1148 | | -} |
1149 | | -.wikiEditor-preview-spinner{ |
1150 | | -padding-right:1em; |
1151 | | -} |
1152 | | -.wikiEditor-preview-contents{ |
1153 | | -padding:1em; |
1154 | | -background-color:white; |
1155 | | -} |
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Vector.combined.js |
— | — | @@ -336,122 +336,6 @@ |
337 | 337 | }); |
338 | 338 | //Global storage of fallback for onbeforeunload hook |
339 | 339 | var fallbackWindowOnBeforeUnload = null; |
340 | | -/* JavaScript for ExpandableSearch extension */ |
341 | | -$j( document ).ready( function() { |
342 | | - |
343 | | - // Only use this function in conjuction with the Vector skin |
344 | | - if( !wgVectorEnabledModules.expandablesearch || skin != 'vector' ) { |
345 | | - return true; |
346 | | - } |
347 | | - $j( '#searchInput' ) |
348 | | - .expandableField( { |
349 | | - 'beforeExpand': function( context ) { |
350 | | - // animate the containers border |
351 | | - $j( this ) |
352 | | - .parent() |
353 | | - .animate( { |
354 | | - 'borderTopColor': '#a0d8ff', |
355 | | - 'borderLeftColor': '#a0d8ff', |
356 | | - 'borderRightColor': '#a0d8ff', |
357 | | - 'borderBottomColor': '#a0d8ff' }, 'fast' ); |
358 | | - }, |
359 | | - 'beforeCondense': function( context ) { |
360 | | - // animate the containers border |
361 | | - $j( this ) |
362 | | - .parent() |
363 | | - .animate( { |
364 | | - 'borderTopColor': '#aaaaaa', |
365 | | - 'borderLeftColor': '#aaaaaa', |
366 | | - 'borderRightColor': '#aaaaaa', |
367 | | - 'borderBottomColor': '#aaaaaa' }, 'fast' ); |
368 | | - }, |
369 | | - 'afterExpand': function( context ) { |
370 | | - //trigger the collapsible tabs resize handler |
371 | | - if ( typeof $j.collapsibleTabs != 'undefined' ){ |
372 | | - $j.collapsibleTabs.handleResize(); |
373 | | - } |
374 | | - }, |
375 | | - 'afterCondense': function( context ) { |
376 | | - //trigger the collapsible tabs resize handler |
377 | | - if ( typeof $j.collapsibleTabs != 'undefined' ){ |
378 | | - $j.collapsibleTabs.handleResize(); |
379 | | - } |
380 | | - } |
381 | | - } ) |
382 | | - .siblings( 'button' ) |
383 | | - .css( 'float', 'right' ); |
384 | | -}); |
385 | | -/* Prototype code to demonstrate proposed edit page footer cleanups */ |
386 | | -/* First draft and will be changing greatly */ |
387 | | - |
388 | | -$j(document).ready( function() { |
389 | | - if( !wgVectorEnabledModules.footercleanup ) { |
390 | | - return true; |
391 | | - } |
392 | | - $j( '#editpage-copywarn' ) |
393 | | - .add( '.editOptions' ) |
394 | | - .wrapAll( '<div id="editpage-bottom"></div>' ); |
395 | | - $j( '#wpSummary' ) |
396 | | - .data( 'hint', |
397 | | - $j( '#wpSummaryLabel span small' ) |
398 | | - .remove() |
399 | | - .text() |
400 | | - // FIXME - Not a long-term solution. This change should be done in the message itself |
401 | | - .replace( /\)|\(/g, '' ) |
402 | | - ) |
403 | | - .change( function() { |
404 | | - if ( $j( this ).val().length == 0 ) { |
405 | | - $j( this ) |
406 | | - .addClass( 'inline-hint' ) |
407 | | - .val( $j( this ).data( 'hint' ) ); |
408 | | - } else { |
409 | | - $j( this ).removeClass( 'inline-hint' ); |
410 | | - } |
411 | | - } ) |
412 | | - .focus( function() { |
413 | | - if ( $j( this ).val() == $j( this ).data( 'hint' ) ) { |
414 | | - $j( this ) |
415 | | - .removeClass( 'inline-hint' ) |
416 | | - .val( "" ); |
417 | | - } |
418 | | - }) |
419 | | - .blur( function() { $j( this ).trigger( 'change' ); } ) |
420 | | - .trigger( 'change' ); |
421 | | - $j( '#wpSummary' ) |
422 | | - .add( '.editCheckboxes' ) |
423 | | - .wrapAll( '<div id="editpage-summary-fields"></div>' ); |
424 | | - |
425 | | - $j( '#editpage-specialchars' ).remove(); |
426 | | - |
427 | | - // transclusions |
428 | | - // FIXME - bad CSS styling here with double class selectors. Should address here. |
429 | | - var transclusionCount = $j( '.templatesUsed ul li' ).size(); |
430 | | - $j( '.templatesUsed ul' ) |
431 | | - .wrap( '<div id="transclusions-list" class="collapsible-list collapsed"></div>' ) |
432 | | - .parent() |
433 | | - // FIXME: i18n, remove link from message and let community add link to transclusion page if it exists |
434 | | - .prepend( '<label>This page contains <a href="http://en.wikipedia.org/wiki/transclusion">transclusions</a> of <strong>' |
435 | | - + transclusionCount |
436 | | - + '</strong> other pages.</label>' ); |
437 | | - $j( '.mw-templatesUsedExplanation' ).remove(); |
438 | | - |
439 | | - $j( '.collapsible-list label' ) |
440 | | - .click( function() { |
441 | | - $j( this ) |
442 | | - .parent() |
443 | | - .toggleClass( 'expanded' ) |
444 | | - .toggleClass( 'collapsed' ) |
445 | | - .find( 'ul' ) |
446 | | - .slideToggle( 'fast' ); |
447 | | - return false; |
448 | | - }) |
449 | | - .trigger( 'click' ); |
450 | | - $j( '#wpPreview, #wpDiff, .editHelp, #editpage-specialchars' ) |
451 | | - .remove(); |
452 | | - $j( '#mw-editform-cancel' ) |
453 | | - .remove() |
454 | | - .appendTo( '.editButtons' ); |
455 | | -} ); |
456 | 340 | /* JavaScript for SimpleSearch extension */ |
457 | 341 | |
458 | 342 | // Disable mwsuggest.js on searchInput |
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Vector.combined.min.js |
— | — | @@ -19,11 +19,7 @@ |
20 | 20 | $j('#wpTextbox1, #wpSummary').each(function(){$j(this).data('origtext',$j(this).val());});fallbackWindowOnBeforeUnload=window.onbeforeunload;window.onbeforeunload=function(){var fallbackResult=undefined;if(fallbackWindowOnBeforeUnload){fallbackResult=fallbackWindowOnBeforeUnload();} |
21 | 21 | if(fallbackResult!==undefined){return fallbackResult;} |
22 | 22 | if(wgAction=='submit'||$j('#wpTextbox1').data('origtext')!=$j('#wpTextbox1').val()||$j('#wpSummary').data('origtext')!=$j('#wpSummary').val()){return mw.usability.getMsg('vector-editwarning-warning');}} |
23 | | -$j('form').submit(function(){window.onbeforeunload=fallbackWindowOnBeforeUnload;});});var fallbackWindowOnBeforeUnload=null;$j(document).ready(function(){if(!wgVectorEnabledModules.expandablesearch||skin!='vector'){return true;} |
24 | | -$j('#searchInput').expandableField({'beforeExpand':function(context){$j(this).parent().animate({'borderTopColor':'#a0d8ff','borderLeftColor':'#a0d8ff','borderRightColor':'#a0d8ff','borderBottomColor':'#a0d8ff'},'fast');},'beforeCondense':function(context){$j(this).parent().animate({'borderTopColor':'#aaaaaa','borderLeftColor':'#aaaaaa','borderRightColor':'#aaaaaa','borderBottomColor':'#aaaaaa'},'fast');},'afterExpand':function(context){if(typeof $j.collapsibleTabs!='undefined'){$j.collapsibleTabs.handleResize();}},'afterCondense':function(context){if(typeof $j.collapsibleTabs!='undefined'){$j.collapsibleTabs.handleResize();}}}).siblings('button').css('float','right');});$j(document).ready(function(){if(!wgVectorEnabledModules.footercleanup){return true;} |
25 | | -$j('#editpage-copywarn').add('.editOptions').wrapAll('<div id="editpage-bottom"></div>');$j('#wpSummary').data('hint',$j('#wpSummaryLabel span small').remove().text().replace(/\)|\(/g,'')).change(function(){if($j(this).val().length==0){$j(this).addClass('inline-hint').val($j(this).data('hint'));}else{$j(this).removeClass('inline-hint');}}).focus(function(){if($j(this).val()==$j(this).data('hint')){$j(this).removeClass('inline-hint').val("");}}).blur(function(){$j(this).trigger('change');}).trigger('change');$j('#wpSummary').add('.editCheckboxes').wrapAll('<div id="editpage-summary-fields"></div>');$j('#editpage-specialchars').remove();var transclusionCount=$j('.templatesUsed ul li').size();$j('.templatesUsed ul').wrap('<div id="transclusions-list" class="collapsible-list collapsed"></div>').parent().prepend('<label>This page contains <a href="http://en.wikipedia.org/wiki/transclusion">transclusions</a> of <strong>' |
26 | | -+transclusionCount |
27 | | -+'</strong> other pages.</label>');$j('.mw-templatesUsedExplanation').remove();$j('.collapsible-list label').click(function(){$j(this).parent().toggleClass('expanded').toggleClass('collapsed').find('ul').slideToggle('fast');return false;}).trigger('click');$j('#wpPreview, #wpDiff, .editHelp, #editpage-specialchars').remove();$j('#mw-editform-cancel').remove().appendTo('.editButtons');});if(wgVectorEnabledModules.simplesearch&&skin=='vector'&&typeof os_autoload_inputs!=='undefined'&&os_autoload_forms!=='undefined'){os_autoload_inputs=[];os_autoload_forms=[];} |
| 23 | +$j('form').submit(function(){window.onbeforeunload=fallbackWindowOnBeforeUnload;});});var fallbackWindowOnBeforeUnload=null;if(wgVectorEnabledModules.simplesearch&&skin=='vector'&&typeof os_autoload_inputs!=='undefined'&&os_autoload_forms!=='undefined'){os_autoload_inputs=[];os_autoload_forms=[];} |
28 | 24 | $j(document).ready(function(){if(!wgVectorEnabledModules.simplesearch||skin!='vector'){return true;} |
29 | 25 | var mod={'browsers':{'ltr':{'opera':[['>=',9.6]],'blackberry':false,'ipod':false,'iphone':false},'rtl':{'opera':[['>=',9.6]],'blackberry':false,'ipod':false,'iphone':false}}};if(!$j.wikiEditor.isSupported(mod)){return true;} |
30 | 26 | $j('div#simpleSearch > input#searchInput').each(function(){$j('<label />').text(mw.usability.getMsg('vector-simplesearch-search')).css({'display':'none','position':'absolute','bottom':0,'padding':'0.25em','color':'#999999','cursor':'text'}).css(($j('body').is('.rtl')?'right':'left'),0).click(function(){$j(this).parent().find('input#searchInput').focus();}).appendTo($j(this).parent());if($j(this).val()==''){$j(this).parent().find('label').fadeIn(100);}}).bind('keypress',function(){if($j(this).parent().find('label:visible').size()>0) |
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js |
— | — | @@ -1,52 +1,3 @@ |
2 | | -/* JavaScript for WikiEditor Highlight module */ |
3 | | - |
4 | | -$j(document).ready( function() { |
5 | | - // Check preferences for highlight |
6 | | - if ( !wgWikiEditorEnabledModules.toc ) { //HACK |
7 | | - return true; |
8 | | - } |
9 | | - // Add the highlight module |
10 | | - if ( $j.fn.wikiEditor ) { |
11 | | - $j( 'textarea#wpTextbox1' ).wikiEditor( 'addModule', 'highlight' ); |
12 | | - } |
13 | | -}); |
14 | | -/* JavaScript for WikiEditor Preview module */ |
15 | | - |
16 | | -$j(document).ready( function() { |
17 | | - // Check preferences for preview |
18 | | - if ( !wgWikiEditorEnabledModules.preview ) { |
19 | | - return true; |
20 | | - } |
21 | | - // Add the preview module |
22 | | - if ( $j.fn.wikiEditor ) { |
23 | | - $j( 'textarea#wpTextbox1' ).wikiEditor( 'addModule', 'preview' ); |
24 | | - } |
25 | | -}); |
26 | | -/* JavaScript for WikiEditor Publish module */ |
27 | | - |
28 | | -$j(document).ready( function() { |
29 | | - // Check preferences for publish |
30 | | - if ( !wgWikiEditorEnabledModules.publish ) { |
31 | | - return true; |
32 | | - } |
33 | | - // Add the publish module |
34 | | - if ( $j.fn.wikiEditor ) { |
35 | | - $j( 'textarea#wpTextbox1' ).wikiEditor( 'addModule', 'publish' ); |
36 | | - } |
37 | | -}); |
38 | | -/* JavaScript for WikiEditor Toc module */ |
39 | | - |
40 | | -$j(document).ready( function() { |
41 | | - // Check preferences for toolbar |
42 | | - if ( !wgWikiEditorPreferences || !( wgWikiEditorPreferences.toc && wgWikiEditorPreferences.toc.enable ) ) { |
43 | | - return true; |
44 | | - } |
45 | | - // Add the toc module |
46 | | - if ( $j.fn.wikiEditor ) { |
47 | | - $j( 'textarea#wpTextbox1' ).wikiEditor( 'addModule', |
48 | | - { 'toc' : { 'rtl' : ( $j( 'body' ).is( '.rtl' ) ) } } ); |
49 | | - } |
50 | | -}); |
51 | 2 | /* JavaScript for WikiEditor Toolbar module */ |
52 | 3 | |
53 | 4 | $j(document).ready( function() { |
— | — | @@ -2093,29 +2044,3 @@ |
2094 | 2045 | |
2095 | 2046 | } } ); |
2096 | 2047 | |
2097 | | -/* JavaScript for WikiEditor Template Editor module */ |
2098 | | - |
2099 | | -$j(document).ready( function() { |
2100 | | - // Check preferences for templateEditor |
2101 | | - if ( !wgWikiEditorEnabledModules.templateEditor ) { |
2102 | | - return true; |
2103 | | - } |
2104 | | - //disable if in template namespace |
2105 | | - if ( wgNamespaceNumber == 10 ) { |
2106 | | - return true; |
2107 | | - } |
2108 | | - // Add the templateEditor module |
2109 | | - if ( $j.fn.wikiEditor ) { |
2110 | | - $j( 'textarea#wpTextbox1' ).wikiEditor( 'addModule', 'templateEditor' ); |
2111 | | - } |
2112 | | -}); |
2113 | | -/* JavaScript for AddMediaWizard gadget */ |
2114 | | -if ( wgWikiEditorEnabledModules.addMediaWizard ) { |
2115 | | - if( typeof mwAddMediaConfig == 'undefined' ) { |
2116 | | - mwAddMediaConfig = {}; |
2117 | | - } |
2118 | | - mwAddMediaConfig['enabled_providers'] = [ 'wiki_commons', 'upload' ]; |
2119 | | - |
2120 | | - // Transclude mwEmbed support |
2121 | | - importScriptURI( 'http://prototype.wikimedia.org/s-2/js/mwEmbed/remotes/mediaWiki.js?&uselang=' + wgUserLanguage ); |
2122 | | -} |
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js |
— | — | @@ -1,9 +1,5 @@ |
2 | 2 | |
3 | | -$j(document).ready(function(){if(!wgWikiEditorEnabledModules.toc){return true;} |
4 | | -if($j.fn.wikiEditor){$j('textarea#wpTextbox1').wikiEditor('addModule','highlight');}});$j(document).ready(function(){if(!wgWikiEditorEnabledModules.preview){return true;} |
5 | | -if($j.fn.wikiEditor){$j('textarea#wpTextbox1').wikiEditor('addModule','preview');}});$j(document).ready(function(){if(!wgWikiEditorEnabledModules.publish){return true;} |
6 | | -if($j.fn.wikiEditor){$j('textarea#wpTextbox1').wikiEditor('addModule','publish');}});$j(document).ready(function(){if(!wgWikiEditorPreferences||!(wgWikiEditorPreferences.toc&&wgWikiEditorPreferences.toc.enable)){return true;} |
7 | | -if($j.fn.wikiEditor){$j('textarea#wpTextbox1').wikiEditor('addModule',{'toc':{'rtl':($j('body').is('.rtl'))}});}});$j(document).ready(function(){if(!wgWikiEditorEnabledModules.toolbar){return true;} |
| 3 | +$j(document).ready(function(){if(!wgWikiEditorEnabledModules.toolbar){return true;} |
8 | 4 | if(wgWikiEditorPreferences.toolbar.dialogs&&$j.wikiEditor.isSupported($j.wikiEditor.modules.dialogs)){$j('#wpTextbox1').addClass('toolbar-dialogs');} |
9 | 5 | if($j.fn.wikiEditor&&$j.wikiEditor.isSupported($j.wikiEditor.modules.toolbar)){$j('#toolbar').remove();$j('#wpTextbox1').wikiEditor('addModule',{'toolbar':{'main':{type:'toolbar',groups:{'format':{tools:{'bold':{labelMsg:'wikieditor-toolbar-tool-bold',type:'button',offset:{'default':[2,-574],'en':[2,-142],'de':[2,-214],'fr':[2,-286],'es':[2,-358],'he':[2,-142],'it':[2,-286],'nl':[2,-502],'pt':[2,-358],'pt-br':[2,-358],'pl':[2,-142]},icon:{'default':'format-bold.png','en':'format-bold-B.png','de':'format-bold-F.png','fr':'format-bold-G.png','es':'format-bold-N.png','he':'format-bold-B.png','it':'format-bold-G.png','nl':'format-bold-V.png','pt':'format-bold-N.png','pt-br':'format-bold-N.png','pl':'format-bold-B.png'},action:{type:'encapsulate',options:{pre:"'''",periMsg:'wikieditor-toolbar-tool-bold-example',post:"'''"}}},'italic':{section:'main',group:'format',id:'italic',labelMsg:'wikieditor-toolbar-tool-italic',type:'button',offset:{'default':[2,-718],'en':[2,-862],'de':[2,-934],'fr':[2,-862],'es':[2,-790],'he':[2,-862],'it':[2,-790],'nl':[2,-790],'pt':[2,-862],'pt-br':[2,-862],'pl':[2,-862]},icon:{'default':'format-italic.png','en':'format-italic-I.png','de':'format-italic-K.png','fr':'format-italic-I.png','es':'format-italic-C.png','he':'format-italic-I.png','it':'format-italic-C.png','nl':'format-italic-C.png','pt':'format-italic-I.png','pt-br':'format-italic-I.png','pl':'format-italic-I.png'},action:{type:'encapsulate',options:{pre:"''",periMsg:'wikieditor-toolbar-tool-italic-example',post:"''"}}}}},'insert':{tools:{'xlink':{labelMsg:'wikieditor-toolbar-tool-xlink',type:'button',icon:'insert-xlink.png',offset:[-70,2],filters:['#wpTextbox1:not(.toolbar-dialogs)'],action:{type:'encapsulate',options:{pre:"[",periMsg:'wikieditor-toolbar-tool-xlink-example',post:"]"}}},'ilink':{labelMsg:'wikieditor-toolbar-tool-ilink',type:'button',icon:'insert-ilink.png',offset:[2,-1582],filters:['#wpTextbox1:not(.toolbar-dialogs)'],action:{type:'encapsulate',options:{pre:"[[",periMsg:'wikieditor-toolbar-tool-ilink-example',post:"]]"}}},'linkCGD':{labelMsg:'wikieditor-toolbar-tool-link',type:'button',icon:'insert-link.png',offset:[2,-1654],filters:['#wpTextbox1.toolbar-dialogs'],action:{type:'dialog',module:'insert-link'}},'file':{labelMsg:'wikieditor-toolbar-tool-file',type:'button',icon:'insert-file.png',offset:[2,-1438],action:{type:'encapsulate',options:{preMsg:['wikieditor-toolbar-tool-file-pre','[['],periMsg:'wikieditor-toolbar-tool-file-example',post:"]]"}}},'referenceCGD':{labelMsg:'wikieditor-toolbar-tool-reference',type:'button',icon:'insert-reference.png',offset:[2,-1798],filters:['body.ns-subject','#wpTextbox1.toolbar-dialogs'],action:{type:'dialog',module:'insert-reference'}},'reference':{labelMsg:'wikieditor-toolbar-tool-reference',filters:['body.ns-subject','#wpTextbox1:not(.toolbar-dialogs)'],type:'button',offset:[2,-1798],icon:'insert-reference.png',action:{type:'encapsulate',options:{pre:"<ref>",periMsg:'wikieditor-toolbar-tool-reference-example',post:"</ref>"}}},'signature':{labelMsg:'wikieditor-toolbar-tool-signature',filters:['body:not(.ns-0)'],type:'button',offset:[2,-1872],icon:'insert-signature.png',action:{type:'encapsulate',options:{post:"--~~~~"}}}}}}},'advanced':{labelMsg:'wikieditor-toolbar-section-advanced',type:'toolbar',groups:{'heading':{tools:{'heading':{labelMsg:'wikieditor-toolbar-tool-heading',type:'select',list:{'heading-2':{labelMsg:'wikieditor-toolbar-tool-heading-2',action:{type:'encapsulate',options:{pre:'== ',periMsg:'wikieditor-toolbar-tool-heading-example',post:' ==',regex:/^(\s*)(={1,6})(.*?)\2(\s*)$/,regexReplace:"\$1==\$3==\$4",ownline:true}}},'heading-3':{labelMsg:'wikieditor-toolbar-tool-heading-3',action:{type:'encapsulate',options:{pre:'=== ',periMsg:'wikieditor-toolbar-tool-heading-example',post:' ===',regex:/^(\s*)(={1,6})(.*?)\2(\s*)$/,regexReplace:"\$1===\$3===\$4",ownline:true}}},'heading-4':{labelMsg:'wikieditor-toolbar-tool-heading-4',action:{type:'encapsulate',options:{pre:'==== ',periMsg:'wikieditor-toolbar-tool-heading-example',post:' ====',regex:/^(\s*)(={1,6})(.*?)\2(\s*)$/,regexReplace:"\$1====\$3====\$4",ownline:true}}},'heading-5':{labelMsg:'wikieditor-toolbar-tool-heading-5',action:{type:'encapsulate',options:{pre:'===== ',periMsg:'wikieditor-toolbar-tool-heading-example',post:' =====',regex:/^(\s*)(={1,6})(.*?)\2(\s*)$/,regexReplace:"\$1=====\$3=====\$4",ownline:true}}}}}}},'format':{labelMsg:'wikieditor-toolbar-group-format',tools:{'ulist':{labelMsg:'wikieditor-toolbar-tool-ulist',type:'button',icon:'format-ulist.png',offset:[2,-1366],action:{type:'encapsulate',options:{pre:"* ",periMsg:'wikieditor-toolbar-tool-ulist-example',post:"",ownline:true}}},'olist':{labelMsg:'wikieditor-toolbar-tool-olist',type:'button',icon:'format-olist.png',offset:[2,-1078],action:{type:'encapsulate',options:{pre:"# ",periMsg:'wikieditor-toolbar-tool-olist-example',post:"",ownline:true}}},'indent':{labelMsg:'wikieditor-toolbar-tool-indent',type:'button',icon:'format-indent.png',offset:[2,-646],action:{type:'encapsulate',options:{pre:":",periMsg:'wikieditor-toolbar-tool-indent-example',post:"",ownline:true,splitlines:true}}},'nowiki':{labelMsg:'wikieditor-toolbar-tool-nowiki',type:'button',icon:'insert-nowiki.png',offset:[-70,-70],action:{type:'encapsulate',options:{pre:"<nowiki>",periMsg:'wikieditor-toolbar-tool-nowiki-example',post:"</nowiki>"}}},'newline':{labelMsg:'wikieditor-toolbar-tool-newline',type:'button',icon:'insert-newline.png',offset:[2,-1726],action:{type:'encapsulate',options:{pre:"<br />\n"}}}}},'size':{tools:{'big':{labelMsg:'wikieditor-toolbar-tool-big',type:'button',icon:'format-big.png',offset:[2,2],action:{type:'encapsulate',options:{pre:"<big>",periMsg:'wikieditor-toolbar-tool-big-example',post:"</big>"}}},'small':{labelMsg:'wikieditor-toolbar-tool-small',type:'button',icon:'format-small.png',offset:[2,-1150],action:{type:'encapsulate',options:{pre:"<small>",periMsg:'wikieditor-toolbar-tool-small-example',post:"</small>"}}},'superscript':{labelMsg:'wikieditor-toolbar-tool-superscript',type:'button',icon:'format-superscript.png',offset:[2,-1294],action:{type:'encapsulate',options:{pre:"<sup>",periMsg:'wikieditor-toolbar-tool-superscript-example',post:"</sup>"}}},'subscript':{labelMsg:'wikieditor-toolbar-tool-subscript',type:'button',icon:'format-subscript.png',offset:[2,-1222],action:{type:'encapsulate',options:{pre:"<sub>",periMsg:'wikieditor-toolbar-tool-subscript-example',post:"</sub>"}}}}},'insert':{labelMsg:'wikieditor-toolbar-group-insert',tools:{'gallery':{labelMsg:'wikieditor-toolbar-tool-gallery',type:'button',icon:'insert-gallery.png',offset:[2,-1510],action:{type:'encapsulate',options:{pre:"<gallery>\n",periMsg:'wikieditor-toolbar-tool-gallery-example',post:"\n</gallery>",ownline:true}}},'tableCGD':{labelMsg:'wikieditor-toolbar-tool-table',type:'button',icon:'insert-table.png',offset:[2,-1942],filters:['#wpTextbox1.toolbar-dialogs'],action:{type:'dialog',module:'insert-table'}},'table':{labelMsg:'wikieditor-toolbar-tool-table',type:'button',icon:'insert-table.png',offset:[2,-1942],filters:['#wpTextbox1:not(.toolbar-dialogs)'],action:{type:'encapsulate',options:{pre:"{| class=\"wikitable\" border=\"1\"\n|",periMsg:'wikieditor-toolbar-tool-table-example-old',post:"\n|}",ownline:true}}},'redirect':{labelMsg:'wikieditor-toolbar-tool-redirect',type:'button',icon:'insert-redirect.png',offset:[-70,-142],action:{type:'encapsulate',options:{pre:"#REDIRECT [[",periMsg:'wikieditor-toolbar-tool-redirect-example',post:"]]",ownline:true}}}}},'search':{tools:{'replace':{labelMsg:'wikieditor-toolbar-tool-replace',type:'button',icon:'search-replace.png',offset:[-70,-214],filters:['#wpTextbox1.toolbar-dialogs'],action:{type:'dialog',module:'search-and-replace'}}}}}},'characters':{labelMsg:'wikieditor-toolbar-section-characters',type:'booklet',deferLoad:true,pages:{'latin':{'labelMsg':'wikieditor-toolbar-characters-page-latin','layout':'characters','characters':["\u00c1","\u00e1","\u00c0","\u00e0","\u00c2","\u00e2","\u00c4","\u00e4","\u00c3","\u00e3","\u01cd","\u01ce","\u0100","\u0101","\u0102","\u0103","\u0104","\u0105","\u00c5","\u00e5","\u0106","\u0107","\u0108","\u0109","\u00c7","\u00e7","\u010c","\u010d","\u010a","\u010b","\u0110","\u0111","\u010e","\u010f","\u00c9","\u00e9","\u00c8","\u00e8","\u00ca","\u00ea","\u00cb","\u00eb","\u011a","\u011b","\u0112","\u0113","\u0114","\u0115","\u0116","\u0117","\u0118","\u0119","\u011c","\u011d","\u0122","\u0123","\u011e","\u011f","\u0120","\u0121","\u0124","\u0125","\u0126","\u0127","\u00cd","\u00ed","\u00cc","\u00ec","\u00ce","\u00ee","\u00cf","\u00ef","\u0128","\u0129","\u01cf","\u01d0","\u012a","\u012b","\u012c","\u012d","\u0130","\u0131","\u012e","\u012f","\u0134","\u0135","\u0136","\u0137","\u0139","\u013a","\u013b","\u013c","\u013d","\u013e","\u0141","\u0142","\u013f","\u0140","\u0143","\u0144","\u00d1","\u00f1","\u0145","\u0146","\u0147","\u0148","\u00d3","\u00f3","\u00d2","\u00f2","\u00d4","\u00f4","\u00d6","\u00f6","\u00d5","\u00f5","\u01d1","\u01d2","\u014c","\u014d","\u014e","\u014f","\u01ea","\u01eb","\u0150","\u0151","\u0154","\u0155","\u0156","\u0157","\u0158","\u0159","\u015a","\u015b","\u015c","\u015d","\u015e","\u015f","\u0160","\u0161","\u0162","\u0163","\u0164","\u0165","\u00da","\u00fa","\u00d9","\u00f9","\u00db","\u00fb","\u00dc","\u00fc","\u0168","\u0169","\u016e","\u016f","\u01d3","\u01d4","\u016a","\u016b","\u01d6","\u01d8","\u01da","\u01dc","\u016c","\u016d","\u0172","\u0173","\u0170","\u0171","\u0174","\u0175","\u00dd","\u00fd","\u0176","\u0177","\u0178","\u00ff","\u0232","\u0233","\u0179","\u017a","\u017d","\u017e","\u017b","\u017c","\u00c6","\u00e6","\u01e2","\u01e3","\u00d8","\u00f8","\u0152","\u0153","\u00df","\u00f0","\u00de","\u00fe","\u018f","\u0259"]},'latinextended':{'labelMsg':'wikieditor-toolbar-characters-page-latinextended','layout':'characters','characters':["\u1e00","\u1e01","\u1e9a","\u1ea0","\u1ea1","\u1ea2","\u1ea3","\u1ea4","\u1ea5","\u1ea6","\u1ea7","\u1ea8","\u1ea9","\u1eaa","\u1eab","\u1eac","\u1ead","\u1eae","\u1eaf","\u1eb0","\u1eb1","\u1eb2","\u1eb3","\u1eb4","\u1eb5","\u1eb6","\u1eb7","\u1e02","\u1e03","\u1e04","\u1e05","\u1e06","\u1e07","\u1e08","\u1e09","\u1e0a","\u1e0b","\u1e0c","\u1e0d","\u1e0e","\u1e0f","\u1e10","\u1e11","\u1e12","\u1e13","\u1e14","\u1e15","\u1e16","\u1e17","\u1e18","\u1e19","\u1e1a","\u1e1b","\u1e1c","\u1e1d","\u1eb8","\u1eb9","\u1eba","\u1ebb","\u1ebc","\u1ebd","\u1ebe","\u1ebf","\u1ec0","\u1ec1","\u1ec2","\u1ec3","\u1ec4","\u1ec5","\u1ec6","\u1ec7","\u1e1e","\u1e1f","\u1e20","\u1e21","\u1e22","\u1e23","\u1e24","\u1e25","\u1e26","\u1e27","\u1e28","\u1e29","\u1e2a","\u1e2b","\u1e96","\u1e2c","\u1e2d","\u1e2e","\u1e2f","\u1ec8","\u1ec9","\u1eca","\u1ecb","\u1e30","\u1e31","\u1e32","\u1e33","\u1e34","\u1e35","\u1e36","\u1e37","\u1e38","\u1e39","\u1e3a","\u1e3b","\u1e3c","\u1e3d","\u1efa","\u1efb","\u1e3e","\u1e3f","\u1e40","\u1e41","\u1e42","\u1e43","\u1e44","\u1e45","\u1e46","\u1e47","\u1e48","\u1e49","\u1e4a","\u1e4b","\u1e4c","\u1e4d","\u1e4e","\u1e4f","\u1e50","\u1e51","\u1e52","\u1e53","\u1ecc","\u1ecd","\u1ece","\u1ecf","\u1ed0","\u1ed1","\u1ed2","\u1ed3","\u1ed4","\u1ed5","\u1ed6","\u1ed7","\u1ed8","\u1ed9","\u1eda","\u1edb","\u1edc","\u1edd","\u1ede","\u1edf","\u1ee0","\u1ee1","\u1ee2","\u1ee3","\u1e54","\u1e55","\u1e56","\u1e57","\u1e58","\u1e59","\u1e5a","\u1e5b","\u1e5c","\u1e5d","\u1e5e","\u1e5f","\u1e60","\u1e61","\u1e9b","\u1e62","\u1e63","\u1e64","\u1e65","\u1e66","\u1e67","\u1e68","\u1e69","\u1e9c","\u1e9d","\u1e6a","\u1e6b","\u1e6c","\u1e6d","\u1e6e","\u1e6f","\u1e70","\u1e71","\u1e97","\u1e72","\u1e73","\u1e74","\u1e75","\u1e76","\u1e77","\u1e78","\u1e79","\u1e7a","\u1e7b","\u1ee4","\u1ee5","\u1ee6","\u1ee7","\u1ee8","\u1ee9","\u1eea","\u1eeb","\u1eec","\u1eed","\u1eee","\u1eef","\u1ef0","\u1ef1","\u1e7c","\u1e7d","\u1e7e","\u1e7f","\u1efc","\u1efd","\u1e80","\u1e81","\u1e82","\u1e83","\u1e84","\u1e85","\u1e86","\u1e87","\u1e88","\u1e89","\u1e98","\u1e8a","\u1e8b","\u1e8c","\u1e8d","\u1e8e","\u1e8f","\u1e99","\u1ef2","\u1ef3","\u1ef4","\u1ef5","\u1ef6","\u1ef7","\u1ef8","\u1ef9","\u1efe","\u1eff","\u1e90","\u1e91","\u1e92","\u1e93","\u1e94","\u1e95","\u1e9e","\u1e9f"]},'ipa':{labelMsg:'wikieditor-toolbar-characters-page-ipa',layout:'characters',characters:["p","t\u032a","t","\u0288","c","k","q","\u02a1","\u0294","b","d\u032a","d","\u0256","\u025f","\u0261","\u0262","\u0253","\u0257","\u0284","\u0260","\u029b","t\u0361s","t\u0361\u0283","t\u0361\u0255","d\u0361z","d\u0361\u0292","d\u0361\u0291","\u0278","f","\u03b8","s","\u0283","\u0285","\u0286","\u0282","\u0255","\u00e7","\u0267","x","\u03c7","\u0127","\u029c","h","\u03b2","v","\u028d","\u00f0","z","\u0292","\u0293","\u0290","\u0291","\u029d","\u0263","\u0281","\u0295","\u0296","\u02a2","\u0266","\u026c","\u026e","m","m\u0329","\u0271","\u0271\u0329","\u0271\u030d","n\u032a","n\u032a\u030d","n","n\u0329","\u0273","\u0273\u0329","\u0272","\u0272\u0329","\u014b","\u014b\u030d","\u014b\u0329","\u0274","\u0274\u0329","\u0299","\u0299\u0329","r","r\u0329","\u0280","\u0280\u0329","\u027e","\u027d","\u027f","\u027a","l\u032a","l\u032a\u0329","l","l\u0329","\u026b","\u026b\u0329","\u026d","\u026d\u0329","\u028e","\u028e\u0329","\u029f","\u029f\u0329","w","\u0265","\u028b","\u0279","\u027b","j","\u0270","\u0298","\u01c2","\u01c0","!","\u01c1","\u02b0","\u02b1","\u02b7","\u02b8","\u02b2","\u02b3","\u207f","\u02e1","\u02b4","\u02b5","\u02e2","\u02e3","\u02e0","\u02b6","\u02e4","\u02c1","\u02c0","\u02bc","i","i\u032f","\u0129","y","y\u032f","\u1ef9","\u026a","\u026a\u032f","\u026a\u0303","\u028f","\u028f\u032f","\u028f\u0303","\u0268","\u0268\u032f","\u0268\u0303","\u0289","\u0289\u032f","\u0289\u0303","\u026f","\u026f\u032f","\u026f\u0303","u","u\u032f","\u0169","\u028a","\u028a\u032f","\u028a\u0303","e","e\u032f","\u1ebd","\u00f8","\u00f8\u032f","\u00f8\u0303","\u0258","\u0258\u032f","\u0258\u0303","\u0275","\u0275\u032f","\u0275\u0303","\u0264","\u0264\u032f","\u0264\u0303","o","o\u032f","\u00f5","\u025b","\u025b\u032f","\u025b\u0303","\u0153","\u0153\u032f","\u0153\u0303","\u025c","\u025c\u032f","\u025c\u0303","\u0259","\u0259\u032f","\u0259\u0303","\u025e","\u025e\u032f","\u025e\u0303","\u028c","\u028c\u032f","\u028c\u0303","\u0254","\u0254\u032f","\u0254\u0303","\u00e6","\u00e6\u032f","\u00e6\u0303","\u0276","\u0276\u032f","\u0276\u0303","a","a\u032f","\u00e3","\u0250","\u0250\u032f","\u0250\u0303","\u0251","\u0251\u032f","\u0251\u0303","\u0252","\u0252\u032f","\u0252\u0303","\u02c8","\u02cc","\u02d0","\u02d1","\u02d8",".","\u203f","|","\u2016"]},'symbols':{'labelMsg':'wikieditor-toolbar-characters-page-symbols','layout':'characters','characters':["~","|","\u00a1","\u00bf","\u2020","\u2021","\u2194","\u2191","\u2193","\u2022","\u00b6","#","\u00bd","\u2153","\u2154","\u00bc","\u00be","\u215b","\u215c","\u215d","\u215e","\u221e","\u2018","\u201e","\u201c","\u2019","\u201d",{'label':"\u00ab\u00bb",'action':{'type':'encapsulate','options':{'pre':"\u00ab",'post':"\u00bb"}}},"\u00a4","\u20b3","\u0e3f","\u20b5","\u00a2","\u20a1","\u20a2","$","\u20ab","\u20af","\u20ac","\u20a0","\u20a3","\u0192","\u20b4","\u20ad","\u20a4","\u2133","\u20a5","\u20a6","\u2116","\u20a7","\u20b0","\u00a3","\u17db","\u20a8","\u20aa","\u09f3","\u20ae","\u20a9","\u00a5","\u2660","\u2663","\u2665","\u2666","m\u00b2","m\u00b3","\u2013","\u2014","\u2026","\u2018","\u201c","\u2019","\u201d","\u00b0","\u2033","\u2032","\u2248","\u2260","\u2264","\u2265","\u00b1","\u2212","\u00d7","\u00f7","\u2190","\u2192","\u00b7","\u00a7"]},'greek':{'labelMsg':'wikieditor-toolbar-characters-page-greek','layout':'characters','language':'hl','characters':["\u0391","\u0386","\u03b1","\u03ac","\u0392","\u03b2","\u0393","\u03b3","\u0394","\u03b4","\u0395","\u0388","\u03b5","\u03ad","\u0396","\u03b6","\u0397","\u0389","\u03b7","\u03ae","\u0398","\u03b8","\u0399","\u038a","\u03b9","\u03af","\u039a","\u03ba","\u039b","\u03bb","\u039c","\u03bc","\u039d","\u03bd","\u039e","\u03be","\u039f","\u038c","\u03bf","\u03cc","\u03a0","\u03c0","\u03a1","\u03c1","\u03a3","\u03c3","\u03c2","\u03a4","\u03c4","\u03a5","\u038e","\u03c5","\u03cd","\u03a6","\u03c6","\u03a7","\u03c7","\u03a8","\u03c8","\u03a9","\u038f","\u03c9","\u03ce"]},'cyrillic':{'labelMsg':'wikieditor-toolbar-characters-page-cyrillic','layout':'characters','characters':["\u0410","\u0430","\u04d8","\u04d9","\u0411","\u0431","\u0412","\u0432","\u0413","\u0433","\u0490","\u0491","\u0403","\u0453","\u0492","\u0493","\u0414","\u0434","\u0402","\u0452","\u0415","\u0435","\u0404","\u0454","\u0401","\u0451","\u0416","\u0436","\u0417","\u0437","\u0405","\u0455","\u0418","\u0438","\u0406","\u0456","\u0407","\u0457","\u0130","\u0419","\u0439","\u04e2","\u04e3","\u0408","\u0458","\u041a","\u043a","\u040c","\u045c","\u049a","\u049b","\u041b","\u043b","\u0409","\u0459","\u041c","\u043c","\u041d","\u043d","\u040a","\u045a","\u04a2","\u04a3","\u041e","\u043e","\u04e8","\u04e9","\u041f","\u043f","\u0420","\u0440","\u0421","\u0441","\u0422","\u0442","\u040b","\u045b","\u0423","\u0443","\u040e","\u045e","\u04ee","\u04ef","\u04b0","\u04b1","\u04ae","\u04af","\u0424","\u0444","\u0425","\u0445","\u04b2","\u04b3","\u04ba","\u04bb","\u0426","\u0446","\u0427","\u0447","\u04b6","\u04b7","\u040f","\u045f","\u0428","\u0448","\u0429","\u0449","\u042a","\u044a","\u042b","\u044b","\u042c","\u044c","\u042d","\u044d","\u042e","\u044e","\u042f","\u044f"]},'arabic':{'labelMsg':'wikieditor-toolbar-characters-page-arabic','layout':'characters','language':'ar','direction':'rtl','characters':["\u061b","\u061f","\u0621","\u0622","\u0623","\u0624","\u0625","\u0626","\u0627","\u0628","\u0629","\u062a","\u062b","\u062c","\u062d","\u062e","\u062f","\u0630","\u0631","\u0632","\u0633","\u0634","\u0635","\u0636","\u0637","\u0638","\u0639","\u063a","\u0641","\u0642","\u0643","\u0644","\u0645","\u0646","\u0647","\u0648","\u0649","\u064a","\u060c","\u067e","\u0686","\u0698","\u06af","\u06ad"]},'hebrew':{'labelMsg':'wikieditor-toolbar-characters-page-hebrew','layout':'characters','direction':'rtl','characters':["\u05d0","\u05d1","\u05d2","\u05d3","\u05d4","\u05d5","\u05d6","\u05d7","\u05d8","\u05d9","\u05db","\u05da","\u05dc","\u05de","\u05dd","\u05e0","\u05df","\u05e1","\u05e2","\u05e4","\u05e3","\u05e6","\u05e5","\u05e7","\u05e8","\u05e9","\u05ea","\u05f3","\u05f4","\u05f0","\u05f1","\u05f2","\u05d0","\u05d3","\u05d4","\u05d5","\u05d6","\u05d7","\u05d8","\u05d9","\u05da","\u05db","\u05dc","\u05dd","\u05de","\u05df","\u05e0","\u05e1","\u05e2","\u05e3","\u05e4","\u05be","\u05f3","\u05f4",["\u05b0\u25cc","\u05b0"],["\u05b1\u25cc","\u05b1"],["\u05b2\u25cc","\u05b2"],["\u05b3\u25cc","\u05b3"],["\u05b4\u25cc","\u05b4"],["\u05b5\u25cc","\u05b5"],["\u05b6\u25cc","\u05b6"],["\u05b7\u25cc","\u05b7"],["\u05b8\u25cc","\u05b8"],["\u05b9\u25cc","\u05b9"],["\u05bb\u25cc","\u05bb"],["\u05bc\u25cc","\u05bc"],["\u05c1\u25cc","\u05c1"],["\u05c2\u25cc","\u05c2"],["\u05c7\u25cc","\u05c7"],["\u0591\u25cc","\u0591"],["\u0592\u25cc","\u0592"],["\u0593\u25cc","\u0593"],["\u0594\u25cc","\u0594"],["\u0595\u25cc","\u0595"],["\u0596\u25cc","\u0596"],["\u0597\u25cc","\u0597"],["\u0598\u25cc","\u0598"],["\u0599\u25cc","\u0599"],["\u059a\u25cc","\u059a"],["\u059b\u25cc","\u059b"],["\u059c\u25cc","\u059c"],["\u059d\u25cc","\u059d"],["\u059e\u25cc","\u059e"],["\u059f\u25cc","\u059f"],["\u05a0\u25cc","\u05a0"],["\u05a1\u25cc","\u05a1"],["\u05a2\u25cc","\u05a2"],["\u05a3\u25cc","\u05a3"],["\u05a4\u25cc","\u05a4"],["\u05a5\u25cc","\u05a5"],["\u05a6\u25cc","\u05a6"],["\u05a7\u25cc","\u05a7"],["\u05a8\u25cc","\u05a8"],["\u05a9\u25cc","\u05a9"],["\u05aa\u25cc","\u05aa"],["\u05ab\u25cc","\u05ab"],["\u05ac\u25cc","\u05ac"],["\u05ad\u25cc","\u05ad"],["\u05ae\u25cc","\u05ae"],["\u05af\u25cc","\u05af"],["\u05bf\u25cc","\u05bf"],["\u05c0\u25cc","\u05c0"],["\u05c3\u25cc","\u05c3"]]},'bangla':{'labelMsg':'wikieditor-toolbar-characters-page-bangla','language':'bn','layout':'characters','characters':["\u0985","\u0986","\u0987","\u0988","\u0989","\u098a","\u098b","\u098f","\u0990","\u0993","\u0994","\u09be","\u09bf","\u09c0","\u09c1","\u09c2","\u09c3","\u09c7","\u09c8","\u09cb","\u09cc","\u0995","\u0996","\u0997","\u0998","\u0999","\u099a","\u099b","\u099c","\u099d","\u099e","\u099f","\u09a0","\u09a1","\u09a2","\u09a3","\u09a4","\u09a5","\u09a6","\u09a7","\u09a8","\u09aa","\u09ab","\u09ac","\u09ad","\u09ae","\u09af","\u09b0","\u09b2","\u09b6","\u09b7","\u09b8","\u09b9","\u09a1\u09bc","\u09a2\u09bc","\u09af\u09bc","\u09ce","\u0982","\u0983","\u0981","\u09cd","\u09e7","\u09e8","\u09e9","\u09ea","\u09eb","\u09ec","\u09ed","\u09ee","\u09ef","\u09e6"]},'telugu':{'labelMsg':'wikieditor-toolbar-characters-page-telugu','language':'te','layout':'characters','characters':["\u0c01","\u0c02","\u0c03","\u0c05","\u0c06","\u0c07","\u0c08","\u0c09","\u0c0a","\u0c0b","\u0c60","\u0c0c","\u0c61","\u0c0e","\u0c0f","\u0c10","\u0c12","\u0c13","\u0c14","\u0c15","\u0c16","\u0c17","\u0c18","\u0c19","\u0c1a","\u0c1b","\u0c1c","\u0c1d","\u0c1e","\u0c1f","\u0c20","\u0c21","\u0c22","\u0c23","\u0c24","\u0c25","\u0c26","\u0c27","\u0c28","\u0c2a","\u0c2b","\u0c2c","\u0c2d","\u0c2e","\u0c2f","\u0c30","\u0c31","\u0c32","\u0c33","\u0c35","\u0c36","\u0c37","\u0c38","\u0c39","\u0c3e","\u0c3f","\u0c40","\u0c41","\u0c42","\u0c43","\u0c44","\u0c46","\u0c47","\u0c48","\u0c4a","\u0c4b","\u0c4c","\u0c4d","\u0c62","\u0c63","\u0c58","\u0c59","\u0c66","\u0c67","\u0c68","\u0c69","\u0c6a","\u0c6b","\u0c6c","\u0c6d","\u0c6e","\u0c6f","\u0c3d","\u0c78","\u0c79","\u0c7a","\u0c7b","\u0c7c","\u0c7d","\u0c7e","\u0c7f"]},'sinhala':{'labelMsg':'wikieditor-toolbar-characters-page-sinhala','language':'si','layout':'characters','characters':["\u0d85","\u0d86","\u0d87","\u0d88","\u0d89","\u0d8a","\u0d8b","\u0d8c","\u0d8d","\u0d8e","\u0d8f","\u0d90","\u0d91","\u0d92","\u0d93","\u0d94","\u0d95","\u0d96","\u0d9a","\u0d9b","\u0d9c","\u0d9d","\u0d9e","\u0d9f","\u0da0","\u0da1","\u0da2","\u0da3","\u0da4","\u0da5","\u0da6","\u0da7","\u0da8","\u0da9","\u0daa","\u0dab","\u0dac","\u0dad","\u0dae","\u0daf","\u0db0","\u0db1","\u0db3","\u0db4","\u0db5","\u0db6","\u0db7","\u0db8","\u0db9","\u0dba","\u0dbb","\u0dbd","\u0dc0","\u0dc1","\u0dc2","\u0dc3","\u0dc4","\u0dc5","\u0dc6",["\u25cc\u0dcf","\u0dcf"],["\u25cc\u0dd0","\u0dd0"],["\u25cc\u0dd1","\u0dd1"],["\u25cc\u0dd2","\u0dd2"],["\u25cc\u0dd3","\u0dd3"],["\u25cc\u0dd4","\u0dd4"],["\u25cc\u0dd6","\u0dd6"],["\u25cc\u0dd8","\u0dd8"],["\u25cc\u0df2","\u0df2"],["\u25cc\u0ddf","\u0ddf"],["\u25cc\u0df3","\u0df3"],["\u25cc\u0dd9","\u0dd9"],["\u25cc\u0dda","\u0dda"],["\u25cc\u0ddc","\u0ddc"],["\u25cc\u0ddd","\u0ddd"],["\u25cc\u0dde","\u0dde"],["\u25cc\u0dca","\u0dca"]]},'gujarati':{'labelMsg':'wikieditor-toolbar-characters-page-gujarati','language':'gu','layout':'characters','characters':["\u0ad0","\u0a85","\u0a86","\u0a87","\u0a88","\u0a89","\u0a8a","\u0a8b","\u0ae0","\u0a8c","\u0ae1","\u0a8d","\u0a8f","\u0a90","\u0a91","\u0a93","\u0a94","\u0a95","\u0a96","\u0a97","\u0a98","\u0a99","\u0a9a","\u0a9b","\u0a9c","\u0a9d","\u0a9e","\u0a9f","\u0aa0","\u0aa1","\u0aa2","\u0aa3","\u0aa4","\u0aa5","\u0aa6","\u0aa7","\u0aa8","\u0aaa","\u0aab","\u0aac","\u0aad","\u0aae","\u0aaf","\u0ab0","\u0ab2","\u0ab5","\u0ab6","\u0ab7","\u0ab8","\u0ab9","\u0ab3","\u0abd",["\u25cc\u0abe","\u0abe"],["\u25cc\u0abf","\u0abf"],["\u25cc\u0ac0","\u0ac0"],["\u25cc\u0ac1","\u0ac1"],["\u25cc\u0ac2","\u0ac2"],["\u25cc\u0ac3","\u0ac3"],["\u25cc\u0ac4","\u0ac4"],["\u25cc\u0ae2","\u0ae2"],["\u25cc\u0ae3","\u0ae3"],["\u25cc\u0ac5","\u0ac5"],["\u25cc\u0ac7","\u0ac7"],["\u25cc\u0ac8","\u0ac8"],["\u25cc\u0ac9","\u0ac9"],["\u25cc\u0acb","\u0acb"],["\u25cc\u0acc","\u0acc"],["\u25cc\u0acd","\u0acd"]]}}},'help':{labelMsg:'wikieditor-toolbar-section-help',type:'booklet',deferLoad:true,pages:{'format':{labelMsg:'wikieditor-toolbar-help-page-format',layout:'table',headings:[{textMsg:'wikieditor-toolbar-help-heading-description'},{textMsg:'wikieditor-toolbar-help-heading-syntax'},{textMsg:'wikieditor-toolbar-help-heading-result'}],rows:[{'description':{htmlMsg:'wikieditor-toolbar-help-content-italic-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-italic-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-italic-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-bold-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-bold-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-bold-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-bolditalic-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-bolditalic-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-bolditalic-result'}}]},'link':{labelMsg:'wikieditor-toolbar-help-page-link',layout:'table',headings:[{textMsg:'wikieditor-toolbar-help-heading-description'},{textMsg:'wikieditor-toolbar-help-heading-syntax'},{textMsg:'wikieditor-toolbar-help-heading-result'}],rows:[{'description':{htmlMsg:'wikieditor-toolbar-help-content-ilink-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-ilink-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-ilink-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-xlink-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-xlink-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-xlink-result'}}]},'heading':{labelMsg:'wikieditor-toolbar-help-page-heading',layout:'table',headings:[{textMsg:'wikieditor-toolbar-help-heading-description'},{textMsg:'wikieditor-toolbar-help-heading-syntax'},{textMsg:'wikieditor-toolbar-help-heading-result'}],rows:[{'description':{htmlMsg:'wikieditor-toolbar-help-content-heading1-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-heading1-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-heading1-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-heading2-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-heading2-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-heading2-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-heading3-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-heading3-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-heading3-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-heading4-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-heading4-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-heading4-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-heading5-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-heading5-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-heading5-result'}}]},'list':{labelMsg:'wikieditor-toolbar-help-page-list',layout:'table',headings:[{textMsg:'wikieditor-toolbar-help-heading-description'},{textMsg:'wikieditor-toolbar-help-heading-syntax'},{textMsg:'wikieditor-toolbar-help-heading-result'}],rows:[{'description':{htmlMsg:'wikieditor-toolbar-help-content-ulist-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-ulist-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-ulist-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-olist-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-olist-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-olist-result'}}]},'file':{labelMsg:'wikieditor-toolbar-help-page-file',layout:'table',headings:[{textMsg:'wikieditor-toolbar-help-heading-description'},{textMsg:'wikieditor-toolbar-help-heading-syntax'},{textMsg:'wikieditor-toolbar-help-heading-result'}],rows:[{'description':{htmlMsg:'wikieditor-toolbar-help-content-file-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-file-syntax'},'result':{htmlMsg:['wikieditor-toolbar-help-content-file-result',stylepath]}}]},'reference':{labelMsg:'wikieditor-toolbar-help-page-reference',layout:'table',headings:[{textMsg:'wikieditor-toolbar-help-heading-description'},{textMsg:'wikieditor-toolbar-help-heading-syntax'},{textMsg:'wikieditor-toolbar-help-heading-result'}],rows:[{'description':{htmlMsg:'wikieditor-toolbar-help-content-reference-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-reference-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-reference-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-rereference-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-rereference-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-rereference-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-showreferences-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-showreferences-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-showreferences-result'}}]},'discussion':{labelMsg:'wikieditor-toolbar-help-page-discussion',layout:'table',headings:[{textMsg:'wikieditor-toolbar-help-heading-description'},{textMsg:'wikieditor-toolbar-help-heading-syntax'},{textMsg:'wikieditor-toolbar-help-heading-result'}],rows:[{'description':{htmlMsg:'wikieditor-toolbar-help-content-signaturetimestamp-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-signaturetimestamp-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-signaturetimestamp-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-signature-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-signature-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-signature-result'}},{'description':{htmlMsg:'wikieditor-toolbar-help-content-indent-description'},'syntax':{htmlMsg:'wikieditor-toolbar-help-content-indent-syntax'},'result':{htmlMsg:'wikieditor-toolbar-help-content-indent-result'}}]}}}},'dialogs':{'insert-link':{filters:['#wpTextbox1.toolbar-dialogs'],titleMsg:'wikieditor-toolbar-tool-link-title',id:'wikieditor-toolbar-link-dialog',html:'\ |
10 | 6 | <fieldset>\ |
— | — | @@ -190,7 +186,4 @@ |
191 | 187 | s=s.substr(index+match[i].length);var start=index+offset;var end=start+match[i].length;var newEnd=start+replaceStr.length;$textarea.textSelection('setSelection',{'start':start,'end':end}).textSelection('encapsulateSelection',{'peri':replaceStr,'replace':true}).textSelection('setSelection',{'start':start,'end':newEnd});offset=newEnd;} |
192 | 188 | $j('#wikieditor-toolbar-replace-success').text(u.getMsg('wikieditor-toolbar-tool-replace-success',match.length)).show();$j(this).data('offset',0);}else{var start=match.index+offset;var end=start+match[0].length;var newEnd=start+replaceStr.length;var context=$j(this).data('context');$textarea.textSelection('setSelection',{'start':start,'end':end});if(mode=='replace'){$textarea.textSelection('encapsulateSelection',{'peri':replaceStr,'replace':true}).textSelection('setSelection',{'start':start,'end':newEnd});} |
193 | 189 | $textarea.textSelection('scrollToCaretPosition');$textarea.textSelection('setSelection',{'start':start,'end':mode=='replace'?newEnd:end});$j(this).data('offset',mode=='replace'?newEnd:end);var textbox=typeof context.$iframe!='undefined'?context.$iframe[0].contentWindow:$textarea[0];textbox.focus();}});},dialog:{width:500,dialogClass:'wikiEditor-toolbar-dialog',buttons:{'wikieditor-toolbar-tool-replace-button-findnext':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'find');},'wikieditor-toolbar-tool-replace-button-replacenext':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'replace');},'wikieditor-toolbar-tool-replace-button-replaceall':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'replaceAll');},'wikieditor-toolbar-tool-replace-close':function(){$j(this).dialog('close');}},open:function(){$j(this).data('offset',0);$j('#wikieditor-toolbar-replace-search').focus();$j('#wikieditor-toolbar-replace-nomatch, #wikieditor-toolbar-replace-success, #wikieditor-toolbar-replace-emptysearch, #wikieditor-toolbar-replace-invalidregex').hide();if(!($j(this).data('onetimeonlystuff'))){$j(this).data('onetimeonlystuff',true);$j(this).closest('.ui-dialog').keypress(function(e){if((e.keyCode||e.which)==13){var button=$j(this).data('dialogaction')||$j(this).find('button:first');button.click();e.preventDefault();}});$j(this).closest('.ui-dialog').find('button').focus(function(){$j(this).closest('.ui-dialog').data('dialogaction',this);});} |
194 | | -var dialog=$j(this).closest('.ui-dialog');var that=this;var context=$j(this).data('context');var textbox=typeof context.$iframe!='undefined'?context.$iframe[0].contentWindow.document:context.$textarea;$j(textbox).bind('keypress.srdialog',function(e){if((e.keyCode||e.which)==13){var button=dialog.data('dialogaction')||dialog.find('button:first');button.click();e.preventDefault();}else if((e.keyCode||e.which)==27){$j(that).dialog('close');}});},close:function(){var context=$j(this).data('context');var textbox=typeof context.$iframe!='undefined'?context.$iframe[0].contentWindow.document:context.$textarea;$j(textbox).unbind('keypress.srdialog');$j(this).closest('.ui-dialog').data('dialogaction',false);}}}}});}});$j(document).ready(function(){if(!wgWikiEditorEnabledModules.templateEditor){return true;} |
195 | | -if(wgNamespaceNumber==10){return true;} |
196 | | -if($j.fn.wikiEditor){$j('textarea#wpTextbox1').wikiEditor('addModule','templateEditor');}});if(wgWikiEditorEnabledModules.addMediaWizard){if(typeof mwAddMediaConfig=='undefined'){mwAddMediaConfig={};} |
197 | | -mwAddMediaConfig['enabled_providers']=['wiki_commons','upload'];importScriptURI('http://prototype.wikimedia.org/s-2/js/mwEmbed/remotes/mediaWiki.js?&uselang='+wgUserLanguage);} |
\ No newline at end of file |
| 190 | +var dialog=$j(this).closest('.ui-dialog');var that=this;var context=$j(this).data('context');var textbox=typeof context.$iframe!='undefined'?context.$iframe[0].contentWindow.document:context.$textarea;$j(textbox).bind('keypress.srdialog',function(e){if((e.keyCode||e.which)==13){var button=dialog.data('dialogaction')||dialog.find('button:first');button.click();e.preventDefault();}else if((e.keyCode||e.which)==27){$j(that).dialog('close');}});},close:function(){var context=$j(this).data('context');var textbox=typeof context.$iframe!='undefined'?context.$iframe[0].contentWindow.document:context.$textarea;$j(textbox).unbind('keypress.srdialog');$j(this).closest('.ui-dialog').data('dialogaction',false);}}}}});}}); |
\ No newline at end of file |
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -562,1636 +562,6 @@ |
563 | 563 | }; |
564 | 564 | |
565 | 565 | })(jQuery);/* |
566 | | - * jQuery UI Datepicker 1.7.1 |
567 | | - * |
568 | | - * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) |
569 | | - * Dual licensed under the MIT (MIT-LICENSE.txt) |
570 | | - * and GPL (GPL-LICENSE.txt) licenses. |
571 | | - * |
572 | | - * http://docs.jquery.com/UI/Datepicker |
573 | | - * |
574 | | - * Depends: |
575 | | - * ui.core.js |
576 | | - */ |
577 | | - |
578 | | -(function($) { // hide the namespace |
579 | | - |
580 | | -$.extend($.ui, { datepicker: { version: "1.7.1" } }); |
581 | | - |
582 | | -var PROP_NAME = 'datepicker'; |
583 | | - |
584 | | -/* Date picker manager. |
585 | | - Use the singleton instance of this class, $.datepicker, to interact with the date picker. |
586 | | - Settings for (groups of) date pickers are maintained in an instance object, |
587 | | - allowing multiple different settings on the same page. */ |
588 | | - |
589 | | -function Datepicker() { |
590 | | - this.debug = false; // Change this to true to start debugging |
591 | | - this._curInst = null; // The current instance in use |
592 | | - this._keyEvent = false; // If the last event was a key event |
593 | | - this._disabledInputs = []; // List of date picker inputs that have been disabled |
594 | | - this._datepickerShowing = false; // True if the popup picker is showing , false if not |
595 | | - this._inDialog = false; // True if showing within a "dialog", false if not |
596 | | - this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division |
597 | | - this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class |
598 | | - this._appendClass = 'ui-datepicker-append'; // The name of the append marker class |
599 | | - this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class |
600 | | - this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class |
601 | | - this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class |
602 | | - this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class |
603 | | - this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class |
604 | | - this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class |
605 | | - this.regional = []; // Available regional settings, indexed by language code |
606 | | - this.regional[''] = { // Default regional settings |
607 | | - closeText: 'Done', // Display text for close link |
608 | | - prevText: 'Prev', // Display text for previous month link |
609 | | - nextText: 'Next', // Display text for next month link |
610 | | - currentText: 'Today', // Display text for current month link |
611 | | - monthNames: ['January','February','March','April','May','June', |
612 | | - 'July','August','September','October','November','December'], // Names of months for drop-down and formatting |
613 | | - monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting |
614 | | - dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting |
615 | | - dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting |
616 | | - dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday |
617 | | - dateFormat: 'mm/dd/yy', // See format options on parseDate |
618 | | - firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... |
619 | | - isRTL: false // True if right-to-left language, false if left-to-right |
620 | | - }; |
621 | | - this._defaults = { // Global defaults for all the date picker instances |
622 | | - showOn: 'focus', // 'focus' for popup on focus, |
623 | | - // 'button' for trigger button, or 'both' for either |
624 | | - showAnim: 'show', // Name of jQuery animation for popup |
625 | | - showOptions: {}, // Options for enhanced animations |
626 | | - defaultDate: null, // Used when field is blank: actual date, |
627 | | - // +/-number for offset from today, null for today |
628 | | - appendText: '', // Display text following the input box, e.g. showing the format |
629 | | - buttonText: '...', // Text for trigger button |
630 | | - buttonImage: '', // URL for trigger button image |
631 | | - buttonImageOnly: false, // True if the image appears alone, false if it appears on a button |
632 | | - hideIfNoPrevNext: false, // True to hide next/previous month links |
633 | | - // if not applicable, false to just disable them |
634 | | - navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links |
635 | | - gotoCurrent: false, // True if today link goes back to current selection instead |
636 | | - changeMonth: false, // True if month can be selected directly, false if only prev/next |
637 | | - changeYear: false, // True if year can be selected directly, false if only prev/next |
638 | | - showMonthAfterYear: false, // True if the year select precedes month, false for month then year |
639 | | - yearRange: '-10:+10', // Range of years to display in drop-down, |
640 | | - // either relative to current year (-nn:+nn) or absolute (nnnn:nnnn) |
641 | | - showOtherMonths: false, // True to show dates in other months, false to leave blank |
642 | | - calculateWeek: this.iso8601Week, // How to calculate the week of the year, |
643 | | - // takes a Date and returns the number of the week for it |
644 | | - shortYearCutoff: '+10', // Short year values < this are in the current century, |
645 | | - // > this are in the previous century, |
646 | | - // string value starting with '+' for current year + value |
647 | | - minDate: null, // The earliest selectable date, or null for no limit |
648 | | - maxDate: null, // The latest selectable date, or null for no limit |
649 | | - duration: 'normal', // Duration of display/closure |
650 | | - beforeShowDay: null, // Function that takes a date and returns an array with |
651 | | - // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '', |
652 | | - // [2] = cell title (optional), e.g. $.datepicker.noWeekends |
653 | | - beforeShow: null, // Function that takes an input field and |
654 | | - // returns a set of custom settings for the date picker |
655 | | - onSelect: null, // Define a callback function when a date is selected |
656 | | - onChangeMonthYear: null, // Define a callback function when the month or year is changed |
657 | | - onClose: null, // Define a callback function when the datepicker is closed |
658 | | - numberOfMonths: 1, // Number of months to show at a time |
659 | | - showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) |
660 | | - stepMonths: 1, // Number of months to step back/forward |
661 | | - stepBigMonths: 12, // Number of months to step back/forward for the big links |
662 | | - altField: '', // Selector for an alternate field to store selected dates into |
663 | | - altFormat: '', // The date format to use for the alternate field |
664 | | - constrainInput: true, // The input is constrained by the current date format |
665 | | - showButtonPanel: false // True to show button panel, false to not show it |
666 | | - }; |
667 | | - $.extend(this._defaults, this.regional['']); |
668 | | - this.dpDiv = $('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>'); |
669 | | -} |
670 | | - |
671 | | -$.extend(Datepicker.prototype, { |
672 | | - /* Class name added to elements to indicate already configured with a date picker. */ |
673 | | - markerClassName: 'hasDatepicker', |
674 | | - |
675 | | - /* Debug logging (if enabled). */ |
676 | | - log: function () { |
677 | | - if (this.debug) |
678 | | - console.log.apply('', arguments); |
679 | | - }, |
680 | | - |
681 | | - /* Override the default settings for all instances of the date picker. |
682 | | - @param settings object - the new settings to use as defaults (anonymous object) |
683 | | - @return the manager object */ |
684 | | - setDefaults: function(settings) { |
685 | | - extendRemove(this._defaults, settings || {}); |
686 | | - return this; |
687 | | - }, |
688 | | - |
689 | | - /* Attach the date picker to a jQuery selection. |
690 | | - @param target element - the target input field or division or span |
691 | | - @param settings object - the new settings to use for this date picker instance (anonymous) */ |
692 | | - _attachDatepicker: function(target, settings) { |
693 | | - // check for settings on the control itself - in namespace 'date:' |
694 | | - var inlineSettings = null; |
695 | | - for (var attrName in this._defaults) { |
696 | | - var attrValue = target.getAttribute('date:' + attrName); |
697 | | - if (attrValue) { |
698 | | - inlineSettings = inlineSettings || {}; |
699 | | - try { |
700 | | - inlineSettings[attrName] = eval(attrValue); |
701 | | - } catch (err) { |
702 | | - inlineSettings[attrName] = attrValue; |
703 | | - } |
704 | | - } |
705 | | - } |
706 | | - var nodeName = target.nodeName.toLowerCase(); |
707 | | - var inline = (nodeName == 'div' || nodeName == 'span'); |
708 | | - if (!target.id) |
709 | | - target.id = 'dp' + (++this.uuid); |
710 | | - var inst = this._newInst($(target), inline); |
711 | | - inst.settings = $.extend({}, settings || {}, inlineSettings || {}); |
712 | | - if (nodeName == 'input') { |
713 | | - this._connectDatepicker(target, inst); |
714 | | - } else if (inline) { |
715 | | - this._inlineDatepicker(target, inst); |
716 | | - } |
717 | | - }, |
718 | | - |
719 | | - /* Create a new instance object. */ |
720 | | - _newInst: function(target, inline) { |
721 | | - var id = target[0].id.replace(/([:\[\]\.])/g, '\\\\$1'); // escape jQuery meta chars |
722 | | - return {id: id, input: target, // associated target |
723 | | - selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection |
724 | | - drawMonth: 0, drawYear: 0, // month being drawn |
725 | | - inline: inline, // is datepicker inline or not |
726 | | - dpDiv: (!inline ? this.dpDiv : // presentation div |
727 | | - $('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}; |
728 | | - }, |
729 | | - |
730 | | - /* Attach the date picker to an input field. */ |
731 | | - _connectDatepicker: function(target, inst) { |
732 | | - var input = $(target); |
733 | | - inst.trigger = $([]); |
734 | | - if (input.hasClass(this.markerClassName)) |
735 | | - return; |
736 | | - var appendText = this._get(inst, 'appendText'); |
737 | | - var isRTL = this._get(inst, 'isRTL'); |
738 | | - if (appendText) |
739 | | - input[isRTL ? 'before' : 'after']('<span class="' + this._appendClass + '">' + appendText + '</span>'); |
740 | | - var showOn = this._get(inst, 'showOn'); |
741 | | - if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field |
742 | | - input.focus(this._showDatepicker); |
743 | | - if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked |
744 | | - var buttonText = this._get(inst, 'buttonText'); |
745 | | - var buttonImage = this._get(inst, 'buttonImage'); |
746 | | - inst.trigger = $(this._get(inst, 'buttonImageOnly') ? |
747 | | - $('<img/>').addClass(this._triggerClass). |
748 | | - attr({ src: buttonImage, alt: buttonText, title: buttonText }) : |
749 | | - $('<button type="button"></button>').addClass(this._triggerClass). |
750 | | - html(buttonImage == '' ? buttonText : $('<img/>').attr( |
751 | | - { src:buttonImage, alt:buttonText, title:buttonText }))); |
752 | | - input[isRTL ? 'before' : 'after'](inst.trigger); |
753 | | - inst.trigger.click(function() { |
754 | | - if ($.datepicker._datepickerShowing && $.datepicker._lastInput == target) |
755 | | - $.datepicker._hideDatepicker(); |
756 | | - else |
757 | | - $.datepicker._showDatepicker(target); |
758 | | - return false; |
759 | | - }); |
760 | | - } |
761 | | - input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress). |
762 | | - bind("setData.datepicker", function(event, key, value) { |
763 | | - inst.settings[key] = value; |
764 | | - }).bind("getData.datepicker", function(event, key) { |
765 | | - return this._get(inst, key); |
766 | | - }); |
767 | | - $.data(target, PROP_NAME, inst); |
768 | | - }, |
769 | | - |
770 | | - /* Attach an inline date picker to a div. */ |
771 | | - _inlineDatepicker: function(target, inst) { |
772 | | - var divSpan = $(target); |
773 | | - if (divSpan.hasClass(this.markerClassName)) |
774 | | - return; |
775 | | - divSpan.addClass(this.markerClassName).append(inst.dpDiv). |
776 | | - bind("setData.datepicker", function(event, key, value){ |
777 | | - inst.settings[key] = value; |
778 | | - }).bind("getData.datepicker", function(event, key){ |
779 | | - return this._get(inst, key); |
780 | | - }); |
781 | | - $.data(target, PROP_NAME, inst); |
782 | | - this._setDate(inst, this._getDefaultDate(inst)); |
783 | | - this._updateDatepicker(inst); |
784 | | - this._updateAlternate(inst); |
785 | | - }, |
786 | | - |
787 | | - /* Pop-up the date picker in a "dialog" box. |
788 | | - @param input element - ignored |
789 | | - @param dateText string - the initial date to display (in the current format) |
790 | | - @param onSelect function - the function(dateText) to call when a date is selected |
791 | | - @param settings object - update the dialog date picker instance's settings (anonymous object) |
792 | | - @param pos int[2] - coordinates for the dialog's position within the screen or |
793 | | - event - with x/y coordinates or |
794 | | - leave empty for default (screen centre) |
795 | | - @return the manager object */ |
796 | | - _dialogDatepicker: function(input, dateText, onSelect, settings, pos) { |
797 | | - var inst = this._dialogInst; // internal instance |
798 | | - if (!inst) { |
799 | | - var id = 'dp' + (++this.uuid); |
800 | | - this._dialogInput = $('<input type="text" id="' + id + |
801 | | - '" size="1" style="position: absolute; top: -100px;"/>'); |
802 | | - this._dialogInput.keydown(this._doKeyDown); |
803 | | - $('body').append(this._dialogInput); |
804 | | - inst = this._dialogInst = this._newInst(this._dialogInput, false); |
805 | | - inst.settings = {}; |
806 | | - $.data(this._dialogInput[0], PROP_NAME, inst); |
807 | | - } |
808 | | - extendRemove(inst.settings, settings || {}); |
809 | | - this._dialogInput.val(dateText); |
810 | | - |
811 | | - this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); |
812 | | - if (!this._pos) { |
813 | | - var browserWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; |
814 | | - var browserHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; |
815 | | - var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; |
816 | | - var scrollY = document.documentElement.scrollTop || document.body.scrollTop; |
817 | | - this._pos = // should use actual width/height below |
818 | | - [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]; |
819 | | - } |
820 | | - |
821 | | - // move input on screen for focus, but hidden behind dialog |
822 | | - this._dialogInput.css('left', this._pos[0] + 'px').css('top', this._pos[1] + 'px'); |
823 | | - inst.settings.onSelect = onSelect; |
824 | | - this._inDialog = true; |
825 | | - this.dpDiv.addClass(this._dialogClass); |
826 | | - this._showDatepicker(this._dialogInput[0]); |
827 | | - if ($.blockUI) |
828 | | - $.blockUI(this.dpDiv); |
829 | | - $.data(this._dialogInput[0], PROP_NAME, inst); |
830 | | - return this; |
831 | | - }, |
832 | | - |
833 | | - /* Detach a datepicker from its control. |
834 | | - @param target element - the target input field or division or span */ |
835 | | - _destroyDatepicker: function(target) { |
836 | | - var $target = $(target); |
837 | | - var inst = $.data(target, PROP_NAME); |
838 | | - if (!$target.hasClass(this.markerClassName)) { |
839 | | - return; |
840 | | - } |
841 | | - var nodeName = target.nodeName.toLowerCase(); |
842 | | - $.removeData(target, PROP_NAME); |
843 | | - if (nodeName == 'input') { |
844 | | - inst.trigger.remove(); |
845 | | - $target.siblings('.' + this._appendClass).remove().end(). |
846 | | - removeClass(this.markerClassName). |
847 | | - unbind('focus', this._showDatepicker). |
848 | | - unbind('keydown', this._doKeyDown). |
849 | | - unbind('keypress', this._doKeyPress); |
850 | | - } else if (nodeName == 'div' || nodeName == 'span') |
851 | | - $target.removeClass(this.markerClassName).empty(); |
852 | | - }, |
853 | | - |
854 | | - /* Enable the date picker to a jQuery selection. |
855 | | - @param target element - the target input field or division or span */ |
856 | | - _enableDatepicker: function(target) { |
857 | | - var $target = $(target); |
858 | | - var inst = $.data(target, PROP_NAME); |
859 | | - if (!$target.hasClass(this.markerClassName)) { |
860 | | - return; |
861 | | - } |
862 | | - var nodeName = target.nodeName.toLowerCase(); |
863 | | - if (nodeName == 'input') { |
864 | | - target.disabled = false; |
865 | | - inst.trigger.filter("button"). |
866 | | - each(function() { this.disabled = false; }).end(). |
867 | | - filter("img"). |
868 | | - css({opacity: '1.0', cursor: ''}); |
869 | | - } |
870 | | - else if (nodeName == 'div' || nodeName == 'span') { |
871 | | - var inline = $target.children('.' + this._inlineClass); |
872 | | - inline.children().removeClass('ui-state-disabled'); |
873 | | - } |
874 | | - this._disabledInputs = $.map(this._disabledInputs, |
875 | | - function(value) { return (value == target ? null : value); }); // delete entry |
876 | | - }, |
877 | | - |
878 | | - /* Disable the date picker to a jQuery selection. |
879 | | - @param target element - the target input field or division or span */ |
880 | | - _disableDatepicker: function(target) { |
881 | | - var $target = $(target); |
882 | | - var inst = $.data(target, PROP_NAME); |
883 | | - if (!$target.hasClass(this.markerClassName)) { |
884 | | - return; |
885 | | - } |
886 | | - var nodeName = target.nodeName.toLowerCase(); |
887 | | - if (nodeName == 'input') { |
888 | | - target.disabled = true; |
889 | | - inst.trigger.filter("button"). |
890 | | - each(function() { this.disabled = true; }).end(). |
891 | | - filter("img"). |
892 | | - css({opacity: '0.5', cursor: 'default'}); |
893 | | - } |
894 | | - else if (nodeName == 'div' || nodeName == 'span') { |
895 | | - var inline = $target.children('.' + this._inlineClass); |
896 | | - inline.children().addClass('ui-state-disabled'); |
897 | | - } |
898 | | - this._disabledInputs = $.map(this._disabledInputs, |
899 | | - function(value) { return (value == target ? null : value); }); // delete entry |
900 | | - this._disabledInputs[this._disabledInputs.length] = target; |
901 | | - }, |
902 | | - |
903 | | - /* Is the first field in a jQuery collection disabled as a datepicker? |
904 | | - @param target element - the target input field or division or span |
905 | | - @return boolean - true if disabled, false if enabled */ |
906 | | - _isDisabledDatepicker: function(target) { |
907 | | - if (!target) { |
908 | | - return false; |
909 | | - } |
910 | | - for (var i = 0; i < this._disabledInputs.length; i++) { |
911 | | - if (this._disabledInputs[i] == target) |
912 | | - return true; |
913 | | - } |
914 | | - return false; |
915 | | - }, |
916 | | - |
917 | | - /* Retrieve the instance data for the target control. |
918 | | - @param target element - the target input field or division or span |
919 | | - @return object - the associated instance data |
920 | | - @throws error if a jQuery problem getting data */ |
921 | | - _getInst: function(target) { |
922 | | - try { |
923 | | - return $.data(target, PROP_NAME); |
924 | | - } |
925 | | - catch (err) { |
926 | | - throw 'Missing instance data for this datepicker'; |
927 | | - } |
928 | | - }, |
929 | | - |
930 | | - /* Update the settings for a date picker attached to an input field or division. |
931 | | - @param target element - the target input field or division or span |
932 | | - @param name object - the new settings to update or |
933 | | - string - the name of the setting to change or |
934 | | - @param value any - the new value for the setting (omit if above is an object) */ |
935 | | - _optionDatepicker: function(target, name, value) { |
936 | | - var settings = name || {}; |
937 | | - if (typeof name == 'string') { |
938 | | - settings = {}; |
939 | | - settings[name] = value; |
940 | | - } |
941 | | - var inst = this._getInst(target); |
942 | | - if (inst) { |
943 | | - if (this._curInst == inst) { |
944 | | - this._hideDatepicker(null); |
945 | | - } |
946 | | - extendRemove(inst.settings, settings); |
947 | | - var date = new Date(); |
948 | | - extendRemove(inst, {rangeStart: null, // start of range |
949 | | - endDay: null, endMonth: null, endYear: null, // end of range |
950 | | - selectedDay: date.getDate(), selectedMonth: date.getMonth(), |
951 | | - selectedYear: date.getFullYear(), // starting point |
952 | | - currentDay: date.getDate(), currentMonth: date.getMonth(), |
953 | | - currentYear: date.getFullYear(), // current selection |
954 | | - drawMonth: date.getMonth(), drawYear: date.getFullYear()}); // month being drawn |
955 | | - this._updateDatepicker(inst); |
956 | | - } |
957 | | - }, |
958 | | - |
959 | | - // change method deprecated |
960 | | - _changeDatepicker: function(target, name, value) { |
961 | | - this._optionDatepicker(target, name, value); |
962 | | - }, |
963 | | - |
964 | | - /* Redraw the date picker attached to an input field or division. |
965 | | - @param target element - the target input field or division or span */ |
966 | | - _refreshDatepicker: function(target) { |
967 | | - var inst = this._getInst(target); |
968 | | - if (inst) { |
969 | | - this._updateDatepicker(inst); |
970 | | - } |
971 | | - }, |
972 | | - |
973 | | - /* Set the dates for a jQuery selection. |
974 | | - @param target element - the target input field or division or span |
975 | | - @param date Date - the new date |
976 | | - @param endDate Date - the new end date for a range (optional) */ |
977 | | - _setDateDatepicker: function(target, date, endDate) { |
978 | | - var inst = this._getInst(target); |
979 | | - if (inst) { |
980 | | - this._setDate(inst, date, endDate); |
981 | | - this._updateDatepicker(inst); |
982 | | - this._updateAlternate(inst); |
983 | | - } |
984 | | - }, |
985 | | - |
986 | | - /* Get the date(s) for the first entry in a jQuery selection. |
987 | | - @param target element - the target input field or division or span |
988 | | - @return Date - the current date or |
989 | | - Date[2] - the current dates for a range */ |
990 | | - _getDateDatepicker: function(target) { |
991 | | - var inst = this._getInst(target); |
992 | | - if (inst && !inst.inline) |
993 | | - this._setDateFromField(inst); |
994 | | - return (inst ? this._getDate(inst) : null); |
995 | | - }, |
996 | | - |
997 | | - /* Handle keystrokes. */ |
998 | | - _doKeyDown: function(event) { |
999 | | - var inst = $.datepicker._getInst(event.target); |
1000 | | - var handled = true; |
1001 | | - var isRTL = inst.dpDiv.is('.ui-datepicker-rtl'); |
1002 | | - inst._keyEvent = true; |
1003 | | - if ($.datepicker._datepickerShowing) |
1004 | | - switch (event.keyCode) { |
1005 | | - case 9: $.datepicker._hideDatepicker(null, ''); |
1006 | | - break; // hide on tab out |
1007 | | - case 13: var sel = $('td.' + $.datepicker._dayOverClass + |
1008 | | - ', td.' + $.datepicker._currentClass, inst.dpDiv); |
1009 | | - if (sel[0]) |
1010 | | - $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); |
1011 | | - else |
1012 | | - $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration')); |
1013 | | - return false; // don't submit the form |
1014 | | - break; // select the value on enter |
1015 | | - case 27: $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration')); |
1016 | | - break; // hide on escape |
1017 | | - case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ? |
1018 | | - -$.datepicker._get(inst, 'stepBigMonths') : |
1019 | | - -$.datepicker._get(inst, 'stepMonths')), 'M'); |
1020 | | - break; // previous month/year on page up/+ ctrl |
1021 | | - case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ? |
1022 | | - +$.datepicker._get(inst, 'stepBigMonths') : |
1023 | | - +$.datepicker._get(inst, 'stepMonths')), 'M'); |
1024 | | - break; // next month/year on page down/+ ctrl |
1025 | | - case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target); |
1026 | | - handled = event.ctrlKey || event.metaKey; |
1027 | | - break; // clear on ctrl or command +end |
1028 | | - case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target); |
1029 | | - handled = event.ctrlKey || event.metaKey; |
1030 | | - break; // current on ctrl or command +home |
1031 | | - case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D'); |
1032 | | - handled = event.ctrlKey || event.metaKey; |
1033 | | - // -1 day on ctrl or command +left |
1034 | | - if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ? |
1035 | | - -$.datepicker._get(inst, 'stepBigMonths') : |
1036 | | - -$.datepicker._get(inst, 'stepMonths')), 'M'); |
1037 | | - // next month/year on alt +left on Mac |
1038 | | - break; |
1039 | | - case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D'); |
1040 | | - handled = event.ctrlKey || event.metaKey; |
1041 | | - break; // -1 week on ctrl or command +up |
1042 | | - case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D'); |
1043 | | - handled = event.ctrlKey || event.metaKey; |
1044 | | - // +1 day on ctrl or command +right |
1045 | | - if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ? |
1046 | | - +$.datepicker._get(inst, 'stepBigMonths') : |
1047 | | - +$.datepicker._get(inst, 'stepMonths')), 'M'); |
1048 | | - // next month/year on alt +right |
1049 | | - break; |
1050 | | - case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D'); |
1051 | | - handled = event.ctrlKey || event.metaKey; |
1052 | | - break; // +1 week on ctrl or command +down |
1053 | | - default: handled = false; |
1054 | | - } |
1055 | | - else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home |
1056 | | - $.datepicker._showDatepicker(this); |
1057 | | - else { |
1058 | | - handled = false; |
1059 | | - } |
1060 | | - if (handled) { |
1061 | | - event.preventDefault(); |
1062 | | - event.stopPropagation(); |
1063 | | - } |
1064 | | - }, |
1065 | | - |
1066 | | - /* Filter entered characters - based on date format. */ |
1067 | | - _doKeyPress: function(event) { |
1068 | | - var inst = $.datepicker._getInst(event.target); |
1069 | | - if ($.datepicker._get(inst, 'constrainInput')) { |
1070 | | - var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')); |
1071 | | - var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode); |
1072 | | - return event.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1); |
1073 | | - } |
1074 | | - }, |
1075 | | - |
1076 | | - /* Pop-up the date picker for a given input field. |
1077 | | - @param input element - the input field attached to the date picker or |
1078 | | - event - if triggered by focus */ |
1079 | | - _showDatepicker: function(input) { |
1080 | | - input = input.target || input; |
1081 | | - if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger |
1082 | | - input = $('input', input.parentNode)[0]; |
1083 | | - if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here |
1084 | | - return; |
1085 | | - var inst = $.datepicker._getInst(input); |
1086 | | - var beforeShow = $.datepicker._get(inst, 'beforeShow'); |
1087 | | - extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {})); |
1088 | | - $.datepicker._hideDatepicker(null, ''); |
1089 | | - $.datepicker._lastInput = input; |
1090 | | - $.datepicker._setDateFromField(inst); |
1091 | | - if ($.datepicker._inDialog) // hide cursor |
1092 | | - input.value = ''; |
1093 | | - if (!$.datepicker._pos) { // position below input |
1094 | | - $.datepicker._pos = $.datepicker._findPos(input); |
1095 | | - $.datepicker._pos[1] += input.offsetHeight; // add the height |
1096 | | - } |
1097 | | - var isFixed = false; |
1098 | | - $(input).parents().each(function() { |
1099 | | - isFixed |= $(this).css('position') == 'fixed'; |
1100 | | - return !isFixed; |
1101 | | - }); |
1102 | | - if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled |
1103 | | - $.datepicker._pos[0] -= document.documentElement.scrollLeft; |
1104 | | - $.datepicker._pos[1] -= document.documentElement.scrollTop; |
1105 | | - } |
1106 | | - var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]}; |
1107 | | - $.datepicker._pos = null; |
1108 | | - inst.rangeStart = null; |
1109 | | - // determine sizing offscreen |
1110 | | - inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'}); |
1111 | | - $.datepicker._updateDatepicker(inst); |
1112 | | - // fix width for dynamic number of date pickers |
1113 | | - // and adjust position before showing |
1114 | | - offset = $.datepicker._checkOffset(inst, offset, isFixed); |
1115 | | - inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ? |
1116 | | - 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none', |
1117 | | - left: offset.left + 'px', top: offset.top + 'px'}); |
1118 | | - if (!inst.inline) { |
1119 | | - var showAnim = $.datepicker._get(inst, 'showAnim') || 'show'; |
1120 | | - var duration = $.datepicker._get(inst, 'duration'); |
1121 | | - var postProcess = function() { |
1122 | | - $.datepicker._datepickerShowing = true; |
1123 | | - if ($.browser.msie && parseInt($.browser.version,10) < 7) // fix IE < 7 select problems |
1124 | | - $('iframe.ui-datepicker-cover').css({width: inst.dpDiv.width() + 4, |
1125 | | - height: inst.dpDiv.height() + 4}); |
1126 | | - }; |
1127 | | - if ($.effects && $.effects[showAnim]) |
1128 | | - inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); |
1129 | | - else |
1130 | | - inst.dpDiv[showAnim](duration, postProcess); |
1131 | | - if (duration == '') |
1132 | | - postProcess(); |
1133 | | - if (inst.input[0].type != 'hidden') |
1134 | | - inst.input[0].focus(); |
1135 | | - $.datepicker._curInst = inst; |
1136 | | - } |
1137 | | - }, |
1138 | | - |
1139 | | - /* Generate the date picker content. */ |
1140 | | - _updateDatepicker: function(inst) { |
1141 | | - var dims = {width: inst.dpDiv.width() + 4, |
1142 | | - height: inst.dpDiv.height() + 4}; |
1143 | | - var self = this; |
1144 | | - inst.dpDiv.empty().append(this._generateHTML(inst)) |
1145 | | - .find('iframe.ui-datepicker-cover'). |
1146 | | - css({width: dims.width, height: dims.height}) |
1147 | | - .end() |
1148 | | - .find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a') |
1149 | | - .bind('mouseout', function(){ |
1150 | | - $(this).removeClass('ui-state-hover'); |
1151 | | - if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover'); |
1152 | | - if(this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover'); |
1153 | | - }) |
1154 | | - .bind('mouseover', function(){ |
1155 | | - if (!self._isDisabledDatepicker( inst.inline ? inst.dpDiv.parent()[0] : inst.input[0])) { |
1156 | | - $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover'); |
1157 | | - $(this).addClass('ui-state-hover'); |
1158 | | - if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover'); |
1159 | | - if(this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover'); |
1160 | | - } |
1161 | | - }) |
1162 | | - .end() |
1163 | | - .find('.' + this._dayOverClass + ' a') |
1164 | | - .trigger('mouseover') |
1165 | | - .end(); |
1166 | | - var numMonths = this._getNumberOfMonths(inst); |
1167 | | - var cols = numMonths[1]; |
1168 | | - var width = 17; |
1169 | | - if (cols > 1) { |
1170 | | - inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em'); |
1171 | | - } else { |
1172 | | - inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width(''); |
1173 | | - } |
1174 | | - inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') + |
1175 | | - 'Class']('ui-datepicker-multi'); |
1176 | | - inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') + |
1177 | | - 'Class']('ui-datepicker-rtl'); |
1178 | | - if (inst.input && inst.input[0].type != 'hidden' && inst == $.datepicker._curInst) |
1179 | | - $(inst.input[0]).focus(); |
1180 | | - }, |
1181 | | - |
1182 | | - /* Check positioning to remain on screen. */ |
1183 | | - _checkOffset: function(inst, offset, isFixed) { |
1184 | | - var dpWidth = inst.dpDiv.outerWidth(); |
1185 | | - var dpHeight = inst.dpDiv.outerHeight(); |
1186 | | - var inputWidth = inst.input ? inst.input.outerWidth() : 0; |
1187 | | - var inputHeight = inst.input ? inst.input.outerHeight() : 0; |
1188 | | - var viewWidth = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) + $(document).scrollLeft(); |
1189 | | - var viewHeight = (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight) + $(document).scrollTop(); |
1190 | | - |
1191 | | - offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0); |
1192 | | - offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0; |
1193 | | - offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; |
1194 | | - |
1195 | | - // now check if datepicker is showing outside window viewport - move to a better place if so. |
1196 | | - offset.left -= (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? Math.abs(offset.left + dpWidth - viewWidth) : 0; |
1197 | | - offset.top -= (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? Math.abs(offset.top + dpHeight + inputHeight*2 - viewHeight) : 0; |
1198 | | - |
1199 | | - return offset; |
1200 | | - }, |
1201 | | - |
1202 | | - /* Find an object's position on the screen. */ |
1203 | | - _findPos: function(obj) { |
1204 | | - while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) { |
1205 | | - obj = obj.nextSibling; |
1206 | | - } |
1207 | | - var position = $(obj).offset(); |
1208 | | - return [position.left, position.top]; |
1209 | | - }, |
1210 | | - |
1211 | | - /* Hide the date picker from view. |
1212 | | - @param input element - the input field attached to the date picker |
1213 | | - @param duration string - the duration over which to close the date picker */ |
1214 | | - _hideDatepicker: function(input, duration) { |
1215 | | - var inst = this._curInst; |
1216 | | - if (!inst || (input && inst != $.data(input, PROP_NAME))) |
1217 | | - return; |
1218 | | - if (inst.stayOpen) |
1219 | | - this._selectDate('#' + inst.id, this._formatDate(inst, |
1220 | | - inst.currentDay, inst.currentMonth, inst.currentYear)); |
1221 | | - inst.stayOpen = false; |
1222 | | - if (this._datepickerShowing) { |
1223 | | - duration = (duration != null ? duration : this._get(inst, 'duration')); |
1224 | | - var showAnim = this._get(inst, 'showAnim'); |
1225 | | - var postProcess = function() { |
1226 | | - $.datepicker._tidyDialog(inst); |
1227 | | - }; |
1228 | | - if (duration != '' && $.effects && $.effects[showAnim]) |
1229 | | - inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), |
1230 | | - duration, postProcess); |
1231 | | - else |
1232 | | - inst.dpDiv[(duration == '' ? 'hide' : (showAnim == 'slideDown' ? 'slideUp' : |
1233 | | - (showAnim == 'fadeIn' ? 'fadeOut' : 'hide')))](duration, postProcess); |
1234 | | - if (duration == '') |
1235 | | - this._tidyDialog(inst); |
1236 | | - var onClose = this._get(inst, 'onClose'); |
1237 | | - if (onClose) |
1238 | | - onClose.apply((inst.input ? inst.input[0] : null), |
1239 | | - [(inst.input ? inst.input.val() : ''), inst]); // trigger custom callback |
1240 | | - this._datepickerShowing = false; |
1241 | | - this._lastInput = null; |
1242 | | - if (this._inDialog) { |
1243 | | - this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' }); |
1244 | | - if ($.blockUI) { |
1245 | | - $.unblockUI(); |
1246 | | - $('body').append(this.dpDiv); |
1247 | | - } |
1248 | | - } |
1249 | | - this._inDialog = false; |
1250 | | - } |
1251 | | - this._curInst = null; |
1252 | | - }, |
1253 | | - |
1254 | | - /* Tidy up after a dialog display. */ |
1255 | | - _tidyDialog: function(inst) { |
1256 | | - inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar'); |
1257 | | - }, |
1258 | | - |
1259 | | - /* Close date picker if clicked elsewhere. */ |
1260 | | - _checkExternalClick: function(event) { |
1261 | | - if (!$.datepicker._curInst) |
1262 | | - return; |
1263 | | - var $target = $(event.target); |
1264 | | - if (($target.parents('#' + $.datepicker._mainDivId).length == 0) && |
1265 | | - !$target.hasClass($.datepicker.markerClassName) && |
1266 | | - !$target.hasClass($.datepicker._triggerClass) && |
1267 | | - $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI)) |
1268 | | - $.datepicker._hideDatepicker(null, ''); |
1269 | | - }, |
1270 | | - |
1271 | | - /* Adjust one of the date sub-fields. */ |
1272 | | - _adjustDate: function(id, offset, period) { |
1273 | | - var target = $(id); |
1274 | | - var inst = this._getInst(target[0]); |
1275 | | - if (this._isDisabledDatepicker(target[0])) { |
1276 | | - return; |
1277 | | - } |
1278 | | - this._adjustInstDate(inst, offset + |
1279 | | - (period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning |
1280 | | - period); |
1281 | | - this._updateDatepicker(inst); |
1282 | | - }, |
1283 | | - |
1284 | | - /* Action for current link. */ |
1285 | | - _gotoToday: function(id) { |
1286 | | - var target = $(id); |
1287 | | - var inst = this._getInst(target[0]); |
1288 | | - if (this._get(inst, 'gotoCurrent') && inst.currentDay) { |
1289 | | - inst.selectedDay = inst.currentDay; |
1290 | | - inst.drawMonth = inst.selectedMonth = inst.currentMonth; |
1291 | | - inst.drawYear = inst.selectedYear = inst.currentYear; |
1292 | | - } |
1293 | | - else { |
1294 | | - var date = new Date(); |
1295 | | - inst.selectedDay = date.getDate(); |
1296 | | - inst.drawMonth = inst.selectedMonth = date.getMonth(); |
1297 | | - inst.drawYear = inst.selectedYear = date.getFullYear(); |
1298 | | - } |
1299 | | - this._notifyChange(inst); |
1300 | | - this._adjustDate(target); |
1301 | | - }, |
1302 | | - |
1303 | | - /* Action for selecting a new month/year. */ |
1304 | | - _selectMonthYear: function(id, select, period) { |
1305 | | - var target = $(id); |
1306 | | - var inst = this._getInst(target[0]); |
1307 | | - inst._selectingMonthYear = false; |
1308 | | - inst['selected' + (period == 'M' ? 'Month' : 'Year')] = |
1309 | | - inst['draw' + (period == 'M' ? 'Month' : 'Year')] = |
1310 | | - parseInt(select.options[select.selectedIndex].value,10); |
1311 | | - this._notifyChange(inst); |
1312 | | - this._adjustDate(target); |
1313 | | - }, |
1314 | | - |
1315 | | - /* Restore input focus after not changing month/year. */ |
1316 | | - _clickMonthYear: function(id) { |
1317 | | - var target = $(id); |
1318 | | - var inst = this._getInst(target[0]); |
1319 | | - if (inst.input && inst._selectingMonthYear && !$.browser.msie) |
1320 | | - inst.input[0].focus(); |
1321 | | - inst._selectingMonthYear = !inst._selectingMonthYear; |
1322 | | - }, |
1323 | | - |
1324 | | - /* Action for selecting a day. */ |
1325 | | - _selectDay: function(id, month, year, td) { |
1326 | | - var target = $(id); |
1327 | | - if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) { |
1328 | | - return; |
1329 | | - } |
1330 | | - var inst = this._getInst(target[0]); |
1331 | | - inst.selectedDay = inst.currentDay = $('a', td).html(); |
1332 | | - inst.selectedMonth = inst.currentMonth = month; |
1333 | | - inst.selectedYear = inst.currentYear = year; |
1334 | | - if (inst.stayOpen) { |
1335 | | - inst.endDay = inst.endMonth = inst.endYear = null; |
1336 | | - } |
1337 | | - this._selectDate(id, this._formatDate(inst, |
1338 | | - inst.currentDay, inst.currentMonth, inst.currentYear)); |
1339 | | - if (inst.stayOpen) { |
1340 | | - inst.rangeStart = this._daylightSavingAdjust( |
1341 | | - new Date(inst.currentYear, inst.currentMonth, inst.currentDay)); |
1342 | | - this._updateDatepicker(inst); |
1343 | | - } |
1344 | | - }, |
1345 | | - |
1346 | | - /* Erase the input field and hide the date picker. */ |
1347 | | - _clearDate: function(id) { |
1348 | | - var target = $(id); |
1349 | | - var inst = this._getInst(target[0]); |
1350 | | - inst.stayOpen = false; |
1351 | | - inst.endDay = inst.endMonth = inst.endYear = inst.rangeStart = null; |
1352 | | - this._selectDate(target, ''); |
1353 | | - }, |
1354 | | - |
1355 | | - /* Update the input field with the selected date. */ |
1356 | | - _selectDate: function(id, dateStr) { |
1357 | | - var target = $(id); |
1358 | | - var inst = this._getInst(target[0]); |
1359 | | - dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); |
1360 | | - if (inst.input) |
1361 | | - inst.input.val(dateStr); |
1362 | | - this._updateAlternate(inst); |
1363 | | - var onSelect = this._get(inst, 'onSelect'); |
1364 | | - if (onSelect) |
1365 | | - onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback |
1366 | | - else if (inst.input) |
1367 | | - inst.input.trigger('change'); // fire the change event |
1368 | | - if (inst.inline) |
1369 | | - this._updateDatepicker(inst); |
1370 | | - else if (!inst.stayOpen) { |
1371 | | - this._hideDatepicker(null, this._get(inst, 'duration')); |
1372 | | - this._lastInput = inst.input[0]; |
1373 | | - if (typeof(inst.input[0]) != 'object') |
1374 | | - inst.input[0].focus(); // restore focus |
1375 | | - this._lastInput = null; |
1376 | | - } |
1377 | | - }, |
1378 | | - |
1379 | | - /* Update any alternate field to synchronise with the main field. */ |
1380 | | - _updateAlternate: function(inst) { |
1381 | | - var altField = this._get(inst, 'altField'); |
1382 | | - if (altField) { // update alternate field too |
1383 | | - var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat'); |
1384 | | - var date = this._getDate(inst); |
1385 | | - dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); |
1386 | | - $(altField).each(function() { $(this).val(dateStr); }); |
1387 | | - } |
1388 | | - }, |
1389 | | - |
1390 | | - /* Set as beforeShowDay function to prevent selection of weekends. |
1391 | | - @param date Date - the date to customise |
1392 | | - @return [boolean, string] - is this date selectable?, what is its CSS class? */ |
1393 | | - noWeekends: function(date) { |
1394 | | - var day = date.getDay(); |
1395 | | - return [(day > 0 && day < 6), '']; |
1396 | | - }, |
1397 | | - |
1398 | | - /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. |
1399 | | - @param date Date - the date to get the week for |
1400 | | - @return number - the number of the week within the year that contains this date */ |
1401 | | - iso8601Week: function(date) { |
1402 | | - var checkDate = new Date(date.getFullYear(), date.getMonth(), date.getDate()); |
1403 | | - var firstMon = new Date(checkDate.getFullYear(), 1 - 1, 4); // First week always contains 4 Jan |
1404 | | - var firstDay = firstMon.getDay() || 7; // Day of week: Mon = 1, ..., Sun = 7 |
1405 | | - firstMon.setDate(firstMon.getDate() + 1 - firstDay); // Preceding Monday |
1406 | | - if (firstDay < 4 && checkDate < firstMon) { // Adjust first three days in year if necessary |
1407 | | - checkDate.setDate(checkDate.getDate() - 3); // Generate for previous year |
1408 | | - return $.datepicker.iso8601Week(checkDate); |
1409 | | - } else if (checkDate > new Date(checkDate.getFullYear(), 12 - 1, 28)) { // Check last three days in year |
1410 | | - firstDay = new Date(checkDate.getFullYear() + 1, 1 - 1, 4).getDay() || 7; |
1411 | | - if (firstDay > 4 && (checkDate.getDay() || 7) < firstDay - 3) { // Adjust if necessary |
1412 | | - return 1; |
1413 | | - } |
1414 | | - } |
1415 | | - return Math.floor(((checkDate - firstMon) / 86400000) / 7) + 1; // Weeks to given date |
1416 | | - }, |
1417 | | - |
1418 | | - /* Parse a string value into a date object. |
1419 | | - See formatDate below for the possible formats. |
1420 | | - |
1421 | | - @param format string - the expected format of the date |
1422 | | - @param value string - the date in the above format |
1423 | | - @param settings Object - attributes include: |
1424 | | - shortYearCutoff number - the cutoff year for determining the century (optional) |
1425 | | - dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) |
1426 | | - dayNames string[7] - names of the days from Sunday (optional) |
1427 | | - monthNamesShort string[12] - abbreviated names of the months (optional) |
1428 | | - monthNames string[12] - names of the months (optional) |
1429 | | - @return Date - the extracted date value or null if value is blank */ |
1430 | | - parseDate: function (format, value, settings) { |
1431 | | - if (format == null || value == null) |
1432 | | - throw 'Invalid arguments'; |
1433 | | - value = (typeof value == 'object' ? value.toString() : value + ''); |
1434 | | - if (value == '') |
1435 | | - return null; |
1436 | | - var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff; |
1437 | | - var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; |
1438 | | - var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; |
1439 | | - var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; |
1440 | | - var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; |
1441 | | - var year = -1; |
1442 | | - var month = -1; |
1443 | | - var day = -1; |
1444 | | - var doy = -1; |
1445 | | - var literal = false; |
1446 | | - // Check whether a format character is doubled |
1447 | | - var lookAhead = function(match) { |
1448 | | - var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); |
1449 | | - if (matches) |
1450 | | - iFormat++; |
1451 | | - return matches; |
1452 | | - }; |
1453 | | - // Extract a number from the string value |
1454 | | - var getNumber = function(match) { |
1455 | | - lookAhead(match); |
1456 | | - var origSize = (match == '@' ? 14 : (match == 'y' ? 4 : (match == 'o' ? 3 : 2))); |
1457 | | - var size = origSize; |
1458 | | - var num = 0; |
1459 | | - while (size > 0 && iValue < value.length && |
1460 | | - value.charAt(iValue) >= '0' && value.charAt(iValue) <= '9') { |
1461 | | - num = num * 10 + parseInt(value.charAt(iValue++),10); |
1462 | | - size--; |
1463 | | - } |
1464 | | - if (size == origSize) |
1465 | | - throw 'Missing number at position ' + iValue; |
1466 | | - return num; |
1467 | | - }; |
1468 | | - // Extract a name from the string value and convert to an index |
1469 | | - var getName = function(match, shortNames, longNames) { |
1470 | | - var names = (lookAhead(match) ? longNames : shortNames); |
1471 | | - var size = 0; |
1472 | | - for (var j = 0; j < names.length; j++) |
1473 | | - size = Math.max(size, names[j].length); |
1474 | | - var name = ''; |
1475 | | - var iInit = iValue; |
1476 | | - while (size > 0 && iValue < value.length) { |
1477 | | - name += value.charAt(iValue++); |
1478 | | - for (var i = 0; i < names.length; i++) |
1479 | | - if (name == names[i]) |
1480 | | - return i + 1; |
1481 | | - size--; |
1482 | | - } |
1483 | | - throw 'Unknown name at position ' + iInit; |
1484 | | - }; |
1485 | | - // Confirm that a literal character matches the string value |
1486 | | - var checkLiteral = function() { |
1487 | | - if (value.charAt(iValue) != format.charAt(iFormat)) |
1488 | | - throw 'Unexpected literal at position ' + iValue; |
1489 | | - iValue++; |
1490 | | - }; |
1491 | | - var iValue = 0; |
1492 | | - for (var iFormat = 0; iFormat < format.length; iFormat++) { |
1493 | | - if (literal) |
1494 | | - if (format.charAt(iFormat) == "'" && !lookAhead("'")) |
1495 | | - literal = false; |
1496 | | - else |
1497 | | - checkLiteral(); |
1498 | | - else |
1499 | | - switch (format.charAt(iFormat)) { |
1500 | | - case 'd': |
1501 | | - day = getNumber('d'); |
1502 | | - break; |
1503 | | - case 'D': |
1504 | | - getName('D', dayNamesShort, dayNames); |
1505 | | - break; |
1506 | | - case 'o': |
1507 | | - doy = getNumber('o'); |
1508 | | - break; |
1509 | | - case 'm': |
1510 | | - month = getNumber('m'); |
1511 | | - break; |
1512 | | - case 'M': |
1513 | | - month = getName('M', monthNamesShort, monthNames); |
1514 | | - break; |
1515 | | - case 'y': |
1516 | | - year = getNumber('y'); |
1517 | | - break; |
1518 | | - case '@': |
1519 | | - var date = new Date(getNumber('@')); |
1520 | | - year = date.getFullYear(); |
1521 | | - month = date.getMonth() + 1; |
1522 | | - day = date.getDate(); |
1523 | | - break; |
1524 | | - case "'": |
1525 | | - if (lookAhead("'")) |
1526 | | - checkLiteral(); |
1527 | | - else |
1528 | | - literal = true; |
1529 | | - break; |
1530 | | - default: |
1531 | | - checkLiteral(); |
1532 | | - } |
1533 | | - } |
1534 | | - if (year == -1) |
1535 | | - year = new Date().getFullYear(); |
1536 | | - else if (year < 100) |
1537 | | - year += new Date().getFullYear() - new Date().getFullYear() % 100 + |
1538 | | - (year <= shortYearCutoff ? 0 : -100); |
1539 | | - if (doy > -1) { |
1540 | | - month = 1; |
1541 | | - day = doy; |
1542 | | - do { |
1543 | | - var dim = this._getDaysInMonth(year, month - 1); |
1544 | | - if (day <= dim) |
1545 | | - break; |
1546 | | - month++; |
1547 | | - day -= dim; |
1548 | | - } while (true); |
1549 | | - } |
1550 | | - var date = this._daylightSavingAdjust(new Date(year, month - 1, day)); |
1551 | | - if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day) |
1552 | | - throw 'Invalid date'; // E.g. 31/02/* |
1553 | | - return date; |
1554 | | - }, |
1555 | | - |
1556 | | - /* Standard date formats. */ |
1557 | | - ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601) |
1558 | | - COOKIE: 'D, dd M yy', |
1559 | | - ISO_8601: 'yy-mm-dd', |
1560 | | - RFC_822: 'D, d M y', |
1561 | | - RFC_850: 'DD, dd-M-y', |
1562 | | - RFC_1036: 'D, d M y', |
1563 | | - RFC_1123: 'D, d M yy', |
1564 | | - RFC_2822: 'D, d M yy', |
1565 | | - RSS: 'D, d M y', // RFC 822 |
1566 | | - TIMESTAMP: '@', |
1567 | | - W3C: 'yy-mm-dd', // ISO 8601 |
1568 | | - |
1569 | | - /* Format a date object into a string value. |
1570 | | - The format can be combinations of the following: |
1571 | | - d - day of month (no leading zero) |
1572 | | - dd - day of month (two digit) |
1573 | | - o - day of year (no leading zeros) |
1574 | | - oo - day of year (three digit) |
1575 | | - D - day name short |
1576 | | - DD - day name long |
1577 | | - m - month of year (no leading zero) |
1578 | | - mm - month of year (two digit) |
1579 | | - M - month name short |
1580 | | - MM - month name long |
1581 | | - y - year (two digit) |
1582 | | - yy - year (four digit) |
1583 | | - @ - Unix timestamp (ms since 01/01/1970) |
1584 | | - '...' - literal text |
1585 | | - '' - single quote |
1586 | | - |
1587 | | - @param format string - the desired format of the date |
1588 | | - @param date Date - the date value to format |
1589 | | - @param settings Object - attributes include: |
1590 | | - dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) |
1591 | | - dayNames string[7] - names of the days from Sunday (optional) |
1592 | | - monthNamesShort string[12] - abbreviated names of the months (optional) |
1593 | | - monthNames string[12] - names of the months (optional) |
1594 | | - @return string - the date in the above format */ |
1595 | | - formatDate: function (format, date, settings) { |
1596 | | - if (!date) |
1597 | | - return ''; |
1598 | | - var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; |
1599 | | - var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; |
1600 | | - var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; |
1601 | | - var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; |
1602 | | - // Check whether a format character is doubled |
1603 | | - var lookAhead = function(match) { |
1604 | | - var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); |
1605 | | - if (matches) |
1606 | | - iFormat++; |
1607 | | - return matches; |
1608 | | - }; |
1609 | | - // Format a number, with leading zero if necessary |
1610 | | - var formatNumber = function(match, value, len) { |
1611 | | - var num = '' + value; |
1612 | | - if (lookAhead(match)) |
1613 | | - while (num.length < len) |
1614 | | - num = '0' + num; |
1615 | | - return num; |
1616 | | - }; |
1617 | | - // Format a name, short or long as requested |
1618 | | - var formatName = function(match, value, shortNames, longNames) { |
1619 | | - return (lookAhead(match) ? longNames[value] : shortNames[value]); |
1620 | | - }; |
1621 | | - var output = ''; |
1622 | | - var literal = false; |
1623 | | - if (date) |
1624 | | - for (var iFormat = 0; iFormat < format.length; iFormat++) { |
1625 | | - if (literal) |
1626 | | - if (format.charAt(iFormat) == "'" && !lookAhead("'")) |
1627 | | - literal = false; |
1628 | | - else |
1629 | | - output += format.charAt(iFormat); |
1630 | | - else |
1631 | | - switch (format.charAt(iFormat)) { |
1632 | | - case 'd': |
1633 | | - output += formatNumber('d', date.getDate(), 2); |
1634 | | - break; |
1635 | | - case 'D': |
1636 | | - output += formatName('D', date.getDay(), dayNamesShort, dayNames); |
1637 | | - break; |
1638 | | - case 'o': |
1639 | | - var doy = date.getDate(); |
1640 | | - for (var m = date.getMonth() - 1; m >= 0; m--) |
1641 | | - doy += this._getDaysInMonth(date.getFullYear(), m); |
1642 | | - output += formatNumber('o', doy, 3); |
1643 | | - break; |
1644 | | - case 'm': |
1645 | | - output += formatNumber('m', date.getMonth() + 1, 2); |
1646 | | - break; |
1647 | | - case 'M': |
1648 | | - output += formatName('M', date.getMonth(), monthNamesShort, monthNames); |
1649 | | - break; |
1650 | | - case 'y': |
1651 | | - output += (lookAhead('y') ? date.getFullYear() : |
1652 | | - (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100); |
1653 | | - break; |
1654 | | - case '@': |
1655 | | - output += date.getTime(); |
1656 | | - break; |
1657 | | - case "'": |
1658 | | - if (lookAhead("'")) |
1659 | | - output += "'"; |
1660 | | - else |
1661 | | - literal = true; |
1662 | | - break; |
1663 | | - default: |
1664 | | - output += format.charAt(iFormat); |
1665 | | - } |
1666 | | - } |
1667 | | - return output; |
1668 | | - }, |
1669 | | - |
1670 | | - /* Extract all possible characters from the date format. */ |
1671 | | - _possibleChars: function (format) { |
1672 | | - var chars = ''; |
1673 | | - var literal = false; |
1674 | | - for (var iFormat = 0; iFormat < format.length; iFormat++) |
1675 | | - if (literal) |
1676 | | - if (format.charAt(iFormat) == "'" && !lookAhead("'")) |
1677 | | - literal = false; |
1678 | | - else |
1679 | | - chars += format.charAt(iFormat); |
1680 | | - else |
1681 | | - switch (format.charAt(iFormat)) { |
1682 | | - case 'd': case 'm': case 'y': case '@': |
1683 | | - chars += '0123456789'; |
1684 | | - break; |
1685 | | - case 'D': case 'M': |
1686 | | - return null; // Accept anything |
1687 | | - case "'": |
1688 | | - if (lookAhead("'")) |
1689 | | - chars += "'"; |
1690 | | - else |
1691 | | - literal = true; |
1692 | | - break; |
1693 | | - default: |
1694 | | - chars += format.charAt(iFormat); |
1695 | | - } |
1696 | | - return chars; |
1697 | | - }, |
1698 | | - |
1699 | | - /* Get a setting value, defaulting if necessary. */ |
1700 | | - _get: function(inst, name) { |
1701 | | - return inst.settings[name] !== undefined ? |
1702 | | - inst.settings[name] : this._defaults[name]; |
1703 | | - }, |
1704 | | - |
1705 | | - /* Parse existing date and initialise date picker. */ |
1706 | | - _setDateFromField: function(inst) { |
1707 | | - var dateFormat = this._get(inst, 'dateFormat'); |
1708 | | - var dates = inst.input ? inst.input.val() : null; |
1709 | | - inst.endDay = inst.endMonth = inst.endYear = null; |
1710 | | - var date = defaultDate = this._getDefaultDate(inst); |
1711 | | - var settings = this._getFormatConfig(inst); |
1712 | | - try { |
1713 | | - date = this.parseDate(dateFormat, dates, settings) || defaultDate; |
1714 | | - } catch (event) { |
1715 | | - this.log(event); |
1716 | | - date = defaultDate; |
1717 | | - } |
1718 | | - inst.selectedDay = date.getDate(); |
1719 | | - inst.drawMonth = inst.selectedMonth = date.getMonth(); |
1720 | | - inst.drawYear = inst.selectedYear = date.getFullYear(); |
1721 | | - inst.currentDay = (dates ? date.getDate() : 0); |
1722 | | - inst.currentMonth = (dates ? date.getMonth() : 0); |
1723 | | - inst.currentYear = (dates ? date.getFullYear() : 0); |
1724 | | - this._adjustInstDate(inst); |
1725 | | - }, |
1726 | | - |
1727 | | - /* Retrieve the default date shown on opening. */ |
1728 | | - _getDefaultDate: function(inst) { |
1729 | | - var date = this._determineDate(this._get(inst, 'defaultDate'), new Date()); |
1730 | | - var minDate = this._getMinMaxDate(inst, 'min', true); |
1731 | | - var maxDate = this._getMinMaxDate(inst, 'max'); |
1732 | | - date = (minDate && date < minDate ? minDate : date); |
1733 | | - date = (maxDate && date > maxDate ? maxDate : date); |
1734 | | - return date; |
1735 | | - }, |
1736 | | - |
1737 | | - /* A date may be specified as an exact value or a relative one. */ |
1738 | | - _determineDate: function(date, defaultDate) { |
1739 | | - var offsetNumeric = function(offset) { |
1740 | | - var date = new Date(); |
1741 | | - date.setDate(date.getDate() + offset); |
1742 | | - return date; |
1743 | | - }; |
1744 | | - var offsetString = function(offset, getDaysInMonth) { |
1745 | | - var date = new Date(); |
1746 | | - var year = date.getFullYear(); |
1747 | | - var month = date.getMonth(); |
1748 | | - var day = date.getDate(); |
1749 | | - var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g; |
1750 | | - var matches = pattern.exec(offset); |
1751 | | - while (matches) { |
1752 | | - switch (matches[2] || 'd') { |
1753 | | - case 'd' : case 'D' : |
1754 | | - day += parseInt(matches[1],10); break; |
1755 | | - case 'w' : case 'W' : |
1756 | | - day += parseInt(matches[1],10) * 7; break; |
1757 | | - case 'm' : case 'M' : |
1758 | | - month += parseInt(matches[1],10); |
1759 | | - day = Math.min(day, getDaysInMonth(year, month)); |
1760 | | - break; |
1761 | | - case 'y': case 'Y' : |
1762 | | - year += parseInt(matches[1],10); |
1763 | | - day = Math.min(day, getDaysInMonth(year, month)); |
1764 | | - break; |
1765 | | - } |
1766 | | - matches = pattern.exec(offset); |
1767 | | - } |
1768 | | - return new Date(year, month, day); |
1769 | | - }; |
1770 | | - date = (date == null ? defaultDate : |
1771 | | - (typeof date == 'string' ? offsetString(date, this._getDaysInMonth) : |
1772 | | - (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : date))); |
1773 | | - date = (date && date.toString() == 'Invalid Date' ? defaultDate : date); |
1774 | | - if (date) { |
1775 | | - date.setHours(0); |
1776 | | - date.setMinutes(0); |
1777 | | - date.setSeconds(0); |
1778 | | - date.setMilliseconds(0); |
1779 | | - } |
1780 | | - return this._daylightSavingAdjust(date); |
1781 | | - }, |
1782 | | - |
1783 | | - /* Handle switch to/from daylight saving. |
1784 | | - Hours may be non-zero on daylight saving cut-over: |
1785 | | - > 12 when midnight changeover, but then cannot generate |
1786 | | - midnight datetime, so jump to 1AM, otherwise reset. |
1787 | | - @param date (Date) the date to check |
1788 | | - @return (Date) the corrected date */ |
1789 | | - _daylightSavingAdjust: function(date) { |
1790 | | - if (!date) return null; |
1791 | | - date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); |
1792 | | - return date; |
1793 | | - }, |
1794 | | - |
1795 | | - /* Set the date(s) directly. */ |
1796 | | - _setDate: function(inst, date, endDate) { |
1797 | | - var clear = !(date); |
1798 | | - var origMonth = inst.selectedMonth; |
1799 | | - var origYear = inst.selectedYear; |
1800 | | - date = this._determineDate(date, new Date()); |
1801 | | - inst.selectedDay = inst.currentDay = date.getDate(); |
1802 | | - inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth(); |
1803 | | - inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear(); |
1804 | | - if (origMonth != inst.selectedMonth || origYear != inst.selectedYear) |
1805 | | - this._notifyChange(inst); |
1806 | | - this._adjustInstDate(inst); |
1807 | | - if (inst.input) { |
1808 | | - inst.input.val(clear ? '' : this._formatDate(inst)); |
1809 | | - } |
1810 | | - }, |
1811 | | - |
1812 | | - /* Retrieve the date(s) directly. */ |
1813 | | - _getDate: function(inst) { |
1814 | | - var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null : |
1815 | | - this._daylightSavingAdjust(new Date( |
1816 | | - inst.currentYear, inst.currentMonth, inst.currentDay))); |
1817 | | - return startDate; |
1818 | | - }, |
1819 | | - |
1820 | | - /* Generate the HTML for the current state of the date picker. */ |
1821 | | - _generateHTML: function(inst) { |
1822 | | - var today = new Date(); |
1823 | | - today = this._daylightSavingAdjust( |
1824 | | - new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time |
1825 | | - var isRTL = this._get(inst, 'isRTL'); |
1826 | | - var showButtonPanel = this._get(inst, 'showButtonPanel'); |
1827 | | - var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext'); |
1828 | | - var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat'); |
1829 | | - var numMonths = this._getNumberOfMonths(inst); |
1830 | | - var showCurrentAtPos = this._get(inst, 'showCurrentAtPos'); |
1831 | | - var stepMonths = this._get(inst, 'stepMonths'); |
1832 | | - var stepBigMonths = this._get(inst, 'stepBigMonths'); |
1833 | | - var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1); |
1834 | | - var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : |
1835 | | - new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); |
1836 | | - var minDate = this._getMinMaxDate(inst, 'min', true); |
1837 | | - var maxDate = this._getMinMaxDate(inst, 'max'); |
1838 | | - var drawMonth = inst.drawMonth - showCurrentAtPos; |
1839 | | - var drawYear = inst.drawYear; |
1840 | | - if (drawMonth < 0) { |
1841 | | - drawMonth += 12; |
1842 | | - drawYear--; |
1843 | | - } |
1844 | | - if (maxDate) { |
1845 | | - var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), |
1846 | | - maxDate.getMonth() - numMonths[1] + 1, maxDate.getDate())); |
1847 | | - maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); |
1848 | | - while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { |
1849 | | - drawMonth--; |
1850 | | - if (drawMonth < 0) { |
1851 | | - drawMonth = 11; |
1852 | | - drawYear--; |
1853 | | - } |
1854 | | - } |
1855 | | - } |
1856 | | - inst.drawMonth = drawMonth; |
1857 | | - inst.drawYear = drawYear; |
1858 | | - var prevText = this._get(inst, 'prevText'); |
1859 | | - prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, |
1860 | | - this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), |
1861 | | - this._getFormatConfig(inst))); |
1862 | | - var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? |
1863 | | - '<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' + |
1864 | | - ' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' : |
1865 | | - (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+ prevText +'"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>')); |
1866 | | - var nextText = this._get(inst, 'nextText'); |
1867 | | - nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, |
1868 | | - this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), |
1869 | | - this._getFormatConfig(inst))); |
1870 | | - var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? |
1871 | | - '<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' + |
1872 | | - ' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' : |
1873 | | - (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+ nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>')); |
1874 | | - var currentText = this._get(inst, 'currentText'); |
1875 | | - var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today); |
1876 | | - currentText = (!navigationAsDateFormat ? currentText : |
1877 | | - this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); |
1878 | | - var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery.datepicker._hideDatepicker();">' + this._get(inst, 'closeText') + '</button>' : ''); |
1879 | | - var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') + |
1880 | | - (this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery.datepicker._gotoToday(\'#' + inst.id + '\');"' + |
1881 | | - '>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : ''; |
1882 | | - var firstDay = parseInt(this._get(inst, 'firstDay'),10); |
1883 | | - firstDay = (isNaN(firstDay) ? 0 : firstDay); |
1884 | | - var dayNames = this._get(inst, 'dayNames'); |
1885 | | - var dayNamesShort = this._get(inst, 'dayNamesShort'); |
1886 | | - var dayNamesMin = this._get(inst, 'dayNamesMin'); |
1887 | | - var monthNames = this._get(inst, 'monthNames'); |
1888 | | - var monthNamesShort = this._get(inst, 'monthNamesShort'); |
1889 | | - var beforeShowDay = this._get(inst, 'beforeShowDay'); |
1890 | | - var showOtherMonths = this._get(inst, 'showOtherMonths'); |
1891 | | - var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week; |
1892 | | - var endDate = inst.endDay ? this._daylightSavingAdjust( |
1893 | | - new Date(inst.endYear, inst.endMonth, inst.endDay)) : currentDate; |
1894 | | - var defaultDate = this._getDefaultDate(inst); |
1895 | | - var html = ''; |
1896 | | - for (var row = 0; row < numMonths[0]; row++) { |
1897 | | - var group = ''; |
1898 | | - for (var col = 0; col < numMonths[1]; col++) { |
1899 | | - var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); |
1900 | | - var cornerClass = ' ui-corner-all'; |
1901 | | - var calender = ''; |
1902 | | - if (isMultiMonth) { |
1903 | | - calender += '<div class="ui-datepicker-group ui-datepicker-group-'; |
1904 | | - switch (col) { |
1905 | | - case 0: calender += 'first'; cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break; |
1906 | | - case numMonths[1]-1: calender += 'last'; cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break; |
1907 | | - default: calender += 'middle'; cornerClass = ''; break; |
1908 | | - } |
1909 | | - calender += '">'; |
1910 | | - } |
1911 | | - calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' + |
1912 | | - (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') + |
1913 | | - (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') + |
1914 | | - this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, |
1915 | | - selectedDate, row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers |
1916 | | - '</div><table class="ui-datepicker-calendar"><thead>' + |
1917 | | - '<tr>'; |
1918 | | - var thead = ''; |
1919 | | - for (var dow = 0; dow < 7; dow++) { // days of the week |
1920 | | - var day = (dow + firstDay) % 7; |
1921 | | - thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' + |
1922 | | - '<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>'; |
1923 | | - } |
1924 | | - calender += thead + '</tr></thead><tbody>'; |
1925 | | - var daysInMonth = this._getDaysInMonth(drawYear, drawMonth); |
1926 | | - if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth) |
1927 | | - inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); |
1928 | | - var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; |
1929 | | - var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate |
1930 | | - var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); |
1931 | | - for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows |
1932 | | - calender += '<tr>'; |
1933 | | - var tbody = ''; |
1934 | | - for (var dow = 0; dow < 7; dow++) { // create date picker days |
1935 | | - var daySettings = (beforeShowDay ? |
1936 | | - beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']); |
1937 | | - var otherMonth = (printDate.getMonth() != drawMonth); |
1938 | | - var unselectable = otherMonth || !daySettings[0] || |
1939 | | - (minDate && printDate < minDate) || (maxDate && printDate > maxDate); |
1940 | | - tbody += '<td class="' + |
1941 | | - ((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends |
1942 | | - (otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months |
1943 | | - ((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key |
1944 | | - (defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ? |
1945 | | - // or defaultDate is current printedDate and defaultDate is selectedDate |
1946 | | - ' ' + this._dayOverClass : '') + // highlight selected day |
1947 | | - (unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') + // highlight unselectable days |
1948 | | - (otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates |
1949 | | - (printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ? // in current range |
1950 | | - ' ' + this._currentClass : '') + // highlight selected day |
1951 | | - (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different) |
1952 | | - ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title |
1953 | | - (unselectable ? '' : ' onclick="DP_jQuery.datepicker._selectDay(\'#' + |
1954 | | - inst.id + '\',' + drawMonth + ',' + drawYear + ', this);return false;"') + '>' + // actions |
1955 | | - (otherMonth ? (showOtherMonths ? printDate.getDate() : ' ') : // display for other months |
1956 | | - (unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' + |
1957 | | - (printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') + |
1958 | | - (printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ? // in current range |
1959 | | - ' ui-state-active' : '') + // highlight selected day |
1960 | | - '" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display for this month |
1961 | | - printDate.setDate(printDate.getDate() + 1); |
1962 | | - printDate = this._daylightSavingAdjust(printDate); |
1963 | | - } |
1964 | | - calender += tbody + '</tr>'; |
1965 | | - } |
1966 | | - drawMonth++; |
1967 | | - if (drawMonth > 11) { |
1968 | | - drawMonth = 0; |
1969 | | - drawYear++; |
1970 | | - } |
1971 | | - calender += '</tbody></table>' + (isMultiMonth ? '</div>' + |
1972 | | - ((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : ''); |
1973 | | - group += calender; |
1974 | | - } |
1975 | | - html += group; |
1976 | | - } |
1977 | | - html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ? |
1978 | | - '<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : ''); |
1979 | | - inst._keyEvent = false; |
1980 | | - return html; |
1981 | | - }, |
1982 | | - |
1983 | | - /* Generate the month and year header. */ |
1984 | | - _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, |
1985 | | - selectedDate, secondary, monthNames, monthNamesShort) { |
1986 | | - minDate = (inst.rangeStart && minDate && selectedDate < minDate ? selectedDate : minDate); |
1987 | | - var changeMonth = this._get(inst, 'changeMonth'); |
1988 | | - var changeYear = this._get(inst, 'changeYear'); |
1989 | | - var showMonthAfterYear = this._get(inst, 'showMonthAfterYear'); |
1990 | | - var html = '<div class="ui-datepicker-title">'; |
1991 | | - var monthHtml = ''; |
1992 | | - // month selection |
1993 | | - if (secondary || !changeMonth) |
1994 | | - monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span> '; |
1995 | | - else { |
1996 | | - var inMinYear = (minDate && minDate.getFullYear() == drawYear); |
1997 | | - var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear); |
1998 | | - monthHtml += '<select class="ui-datepicker-month" ' + |
1999 | | - 'onchange="DP_jQuery.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' + |
2000 | | - 'onclick="DP_jQuery.datepicker._clickMonthYear(\'#' + inst.id + '\');"' + |
2001 | | - '>'; |
2002 | | - for (var month = 0; month < 12; month++) { |
2003 | | - if ((!inMinYear || month >= minDate.getMonth()) && |
2004 | | - (!inMaxYear || month <= maxDate.getMonth())) |
2005 | | - monthHtml += '<option value="' + month + '"' + |
2006 | | - (month == drawMonth ? ' selected="selected"' : '') + |
2007 | | - '>' + monthNamesShort[month] + '</option>'; |
2008 | | - } |
2009 | | - monthHtml += '</select>'; |
2010 | | - } |
2011 | | - if (!showMonthAfterYear) |
2012 | | - html += monthHtml + ((secondary || changeMonth || changeYear) && (!(changeMonth && changeYear)) ? ' ' : ''); |
2013 | | - // year selection |
2014 | | - if (secondary || !changeYear) |
2015 | | - html += '<span class="ui-datepicker-year">' + drawYear + '</span>'; |
2016 | | - else { |
2017 | | - // determine range of years to display |
2018 | | - var years = this._get(inst, 'yearRange').split(':'); |
2019 | | - var year = 0; |
2020 | | - var endYear = 0; |
2021 | | - if (years.length != 2) { |
2022 | | - year = drawYear - 10; |
2023 | | - endYear = drawYear + 10; |
2024 | | - } else if (years[0].charAt(0) == '+' || years[0].charAt(0) == '-') { |
2025 | | - year = drawYear + parseInt(years[0], 10); |
2026 | | - endYear = drawYear + parseInt(years[1], 10); |
2027 | | - } else { |
2028 | | - year = parseInt(years[0], 10); |
2029 | | - endYear = parseInt(years[1], 10); |
2030 | | - } |
2031 | | - year = (minDate ? Math.max(year, minDate.getFullYear()) : year); |
2032 | | - endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); |
2033 | | - html += '<select class="ui-datepicker-year" ' + |
2034 | | - 'onchange="DP_jQuery.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' + |
2035 | | - 'onclick="DP_jQuery.datepicker._clickMonthYear(\'#' + inst.id + '\');"' + |
2036 | | - '>'; |
2037 | | - for (; year <= endYear; year++) { |
2038 | | - html += '<option value="' + year + '"' + |
2039 | | - (year == drawYear ? ' selected="selected"' : '') + |
2040 | | - '>' + year + '</option>'; |
2041 | | - } |
2042 | | - html += '</select>'; |
2043 | | - } |
2044 | | - if (showMonthAfterYear) |
2045 | | - html += (secondary || changeMonth || changeYear ? ' ' : '') + monthHtml; |
2046 | | - html += '</div>'; // Close datepicker_header |
2047 | | - return html; |
2048 | | - }, |
2049 | | - |
2050 | | - /* Adjust one of the date sub-fields. */ |
2051 | | - _adjustInstDate: function(inst, offset, period) { |
2052 | | - var year = inst.drawYear + (period == 'Y' ? offset : 0); |
2053 | | - var month = inst.drawMonth + (period == 'M' ? offset : 0); |
2054 | | - var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + |
2055 | | - (period == 'D' ? offset : 0); |
2056 | | - var date = this._daylightSavingAdjust(new Date(year, month, day)); |
2057 | | - // ensure it is within the bounds set |
2058 | | - var minDate = this._getMinMaxDate(inst, 'min', true); |
2059 | | - var maxDate = this._getMinMaxDate(inst, 'max'); |
2060 | | - date = (minDate && date < minDate ? minDate : date); |
2061 | | - date = (maxDate && date > maxDate ? maxDate : date); |
2062 | | - inst.selectedDay = date.getDate(); |
2063 | | - inst.drawMonth = inst.selectedMonth = date.getMonth(); |
2064 | | - inst.drawYear = inst.selectedYear = date.getFullYear(); |
2065 | | - if (period == 'M' || period == 'Y') |
2066 | | - this._notifyChange(inst); |
2067 | | - }, |
2068 | | - |
2069 | | - /* Notify change of month/year. */ |
2070 | | - _notifyChange: function(inst) { |
2071 | | - var onChange = this._get(inst, 'onChangeMonthYear'); |
2072 | | - if (onChange) |
2073 | | - onChange.apply((inst.input ? inst.input[0] : null), |
2074 | | - [inst.selectedYear, inst.selectedMonth + 1, inst]); |
2075 | | - }, |
2076 | | - |
2077 | | - /* Determine the number of months to show. */ |
2078 | | - _getNumberOfMonths: function(inst) { |
2079 | | - var numMonths = this._get(inst, 'numberOfMonths'); |
2080 | | - return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths)); |
2081 | | - }, |
2082 | | - |
2083 | | - /* Determine the current maximum date - ensure no time components are set - may be overridden for a range. */ |
2084 | | - _getMinMaxDate: function(inst, minMax, checkRange) { |
2085 | | - var date = this._determineDate(this._get(inst, minMax + 'Date'), null); |
2086 | | - return (!checkRange || !inst.rangeStart ? date : |
2087 | | - (!date || inst.rangeStart > date ? inst.rangeStart : date)); |
2088 | | - }, |
2089 | | - |
2090 | | - /* Find the number of days in a given month. */ |
2091 | | - _getDaysInMonth: function(year, month) { |
2092 | | - return 32 - new Date(year, month, 32).getDate(); |
2093 | | - }, |
2094 | | - |
2095 | | - /* Find the day of the week of the first of a month. */ |
2096 | | - _getFirstDayOfMonth: function(year, month) { |
2097 | | - return new Date(year, month, 1).getDay(); |
2098 | | - }, |
2099 | | - |
2100 | | - /* Determines if we should allow a "next/prev" month display change. */ |
2101 | | - _canAdjustMonth: function(inst, offset, curYear, curMonth) { |
2102 | | - var numMonths = this._getNumberOfMonths(inst); |
2103 | | - var date = this._daylightSavingAdjust(new Date( |
2104 | | - curYear, curMonth + (offset < 0 ? offset : numMonths[1]), 1)); |
2105 | | - if (offset < 0) |
2106 | | - date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); |
2107 | | - return this._isInRange(inst, date); |
2108 | | - }, |
2109 | | - |
2110 | | - /* Is the given date in the accepted range? */ |
2111 | | - _isInRange: function(inst, date) { |
2112 | | - // during range selection, use minimum of selected date and range start |
2113 | | - var newMinDate = (!inst.rangeStart ? null : this._daylightSavingAdjust( |
2114 | | - new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay))); |
2115 | | - newMinDate = (newMinDate && inst.rangeStart < newMinDate ? inst.rangeStart : newMinDate); |
2116 | | - var minDate = newMinDate || this._getMinMaxDate(inst, 'min'); |
2117 | | - var maxDate = this._getMinMaxDate(inst, 'max'); |
2118 | | - return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate)); |
2119 | | - }, |
2120 | | - |
2121 | | - /* Provide the configuration settings for formatting/parsing. */ |
2122 | | - _getFormatConfig: function(inst) { |
2123 | | - var shortYearCutoff = this._get(inst, 'shortYearCutoff'); |
2124 | | - shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : |
2125 | | - new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); |
2126 | | - return {shortYearCutoff: shortYearCutoff, |
2127 | | - dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'), |
2128 | | - monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')}; |
2129 | | - }, |
2130 | | - |
2131 | | - /* Format the given date for display. */ |
2132 | | - _formatDate: function(inst, day, month, year) { |
2133 | | - if (!day) { |
2134 | | - inst.currentDay = inst.selectedDay; |
2135 | | - inst.currentMonth = inst.selectedMonth; |
2136 | | - inst.currentYear = inst.selectedYear; |
2137 | | - } |
2138 | | - var date = (day ? (typeof day == 'object' ? day : |
2139 | | - this._daylightSavingAdjust(new Date(year, month, day))) : |
2140 | | - this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); |
2141 | | - return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst)); |
2142 | | - } |
2143 | | -}); |
2144 | | - |
2145 | | -/* jQuery extend now ignores nulls! */ |
2146 | | -function extendRemove(target, props) { |
2147 | | - $.extend(target, props); |
2148 | | - for (var name in props) |
2149 | | - if (props[name] == null || props[name] == undefined) |
2150 | | - target[name] = props[name]; |
2151 | | - return target; |
2152 | | -}; |
2153 | | - |
2154 | | -/* Determine whether an object is an array. */ |
2155 | | -function isArray(a) { |
2156 | | - return (a && (($.browser.safari && typeof a == 'object' && a.length) || |
2157 | | - (a.constructor && a.constructor.toString().match(/\Array\(\)/)))); |
2158 | | -}; |
2159 | | - |
2160 | | -/* Invoke the datepicker functionality. |
2161 | | - @param options string - a command, optionally followed by additional parameters or |
2162 | | - Object - settings for attaching new datepicker functionality |
2163 | | - @return jQuery object */ |
2164 | | -$.fn.datepicker = function(options){ |
2165 | | - |
2166 | | - /* Initialise the date picker. */ |
2167 | | - if (!$.datepicker.initialized) { |
2168 | | - $(document).mousedown($.datepicker._checkExternalClick). |
2169 | | - find('body').append($.datepicker.dpDiv); |
2170 | | - $.datepicker.initialized = true; |
2171 | | - } |
2172 | | - |
2173 | | - var otherArgs = Array.prototype.slice.call(arguments, 1); |
2174 | | - if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate')) |
2175 | | - return $.datepicker['_' + options + 'Datepicker']. |
2176 | | - apply($.datepicker, [this[0]].concat(otherArgs)); |
2177 | | - return this.each(function() { |
2178 | | - typeof options == 'string' ? |
2179 | | - $.datepicker['_' + options + 'Datepicker']. |
2180 | | - apply($.datepicker, [this].concat(otherArgs)) : |
2181 | | - $.datepicker._attachDatepicker(this, options); |
2182 | | - }); |
2183 | | -}; |
2184 | | - |
2185 | | -$.datepicker = new Datepicker(); // singleton instance |
2186 | | -$.datepicker.initialized = false; |
2187 | | -$.datepicker.uuid = new Date().getTime(); |
2188 | | -$.datepicker.version = "1.7.1"; |
2189 | | - |
2190 | | -// Workaround for #4055 |
2191 | | -// Add another global to avoid noConflict issues with inline event handlers |
2192 | | -window.DP_jQuery = $; |
2193 | | - |
2194 | | -})(jQuery); |
2195 | | -/* |
2196 | 566 | * jQuery UI Dialog 1.7.1 |
2197 | 567 | * |
2198 | 568 | * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) |
— | — | @@ -4408,691 +2778,6 @@ |
4409 | 2779 | |
4410 | 2780 | })(jQuery); |
4411 | 2781 | /* |
4412 | | - * jQuery UI Tabs 1.7.1 |
4413 | | - * |
4414 | | - * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) |
4415 | | - * Dual licensed under the MIT (MIT-LICENSE.txt) |
4416 | | - * and GPL (GPL-LICENSE.txt) licenses. |
4417 | | - * |
4418 | | - * http://docs.jquery.com/UI/Tabs |
4419 | | - * |
4420 | | - * Depends: |
4421 | | - * ui.core.js |
4422 | | - */ |
4423 | | -(function($) { |
4424 | | - |
4425 | | -$.widget("ui.tabs", { |
4426 | | - |
4427 | | - _init: function() { |
4428 | | - if (this.options.deselectable !== undefined) { |
4429 | | - this.options.collapsible = this.options.deselectable; |
4430 | | - } |
4431 | | - this._tabify(true); |
4432 | | - }, |
4433 | | - |
4434 | | - _setData: function(key, value) { |
4435 | | - if (key == 'selected') { |
4436 | | - if (this.options.collapsible && value == this.options.selected) { |
4437 | | - return; |
4438 | | - } |
4439 | | - this.select(value); |
4440 | | - } |
4441 | | - else { |
4442 | | - this.options[key] = value; |
4443 | | - if (key == 'deselectable') { |
4444 | | - this.options.collapsible = value; |
4445 | | - } |
4446 | | - this._tabify(); |
4447 | | - } |
4448 | | - }, |
4449 | | - |
4450 | | - _tabId: function(a) { |
4451 | | - return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '') || |
4452 | | - this.options.idPrefix + $.data(a); |
4453 | | - }, |
4454 | | - |
4455 | | - _sanitizeSelector: function(hash) { |
4456 | | - return hash.replace(/:/g, '\\:'); // we need this because an id may contain a ":" |
4457 | | - }, |
4458 | | - |
4459 | | - _cookie: function() { |
4460 | | - var cookie = this.cookie || (this.cookie = this.options.cookie.name || 'ui-tabs-' + $.data(this.list[0])); |
4461 | | - return $.cookie.apply(null, [cookie].concat($.makeArray(arguments))); |
4462 | | - }, |
4463 | | - |
4464 | | - _ui: function(tab, panel) { |
4465 | | - return { |
4466 | | - tab: tab, |
4467 | | - panel: panel, |
4468 | | - index: this.anchors.index(tab) |
4469 | | - }; |
4470 | | - }, |
4471 | | - |
4472 | | - _cleanup: function() { |
4473 | | - // restore all former loading tabs labels |
4474 | | - this.lis.filter('.ui-state-processing').removeClass('ui-state-processing') |
4475 | | - .find('span:data(label.tabs)') |
4476 | | - .each(function() { |
4477 | | - var el = $(this); |
4478 | | - el.html(el.data('label.tabs')).removeData('label.tabs'); |
4479 | | - }); |
4480 | | - }, |
4481 | | - |
4482 | | - _tabify: function(init) { |
4483 | | - |
4484 | | - this.list = this.element.children('ul:first'); |
4485 | | - this.lis = $('li:has(a[href])', this.list); |
4486 | | - this.anchors = this.lis.map(function() { return $('a', this)[0]; }); |
4487 | | - this.panels = $([]); |
4488 | | - |
4489 | | - var self = this, o = this.options; |
4490 | | - |
4491 | | - var fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash |
4492 | | - this.anchors.each(function(i, a) { |
4493 | | - var href = $(a).attr('href'); |
4494 | | - |
4495 | | - // For dynamically created HTML that contains a hash as href IE < 8 expands |
4496 | | - // such href to the full page url with hash and then misinterprets tab as ajax. |
4497 | | - // Same consideration applies for an added tab with a fragment identifier |
4498 | | - // since a[href=#fragment-identifier] does unexpectedly not match. |
4499 | | - // Thus normalize href attribute... |
4500 | | - var hrefBase = href.split('#')[0], baseEl; |
4501 | | - if (hrefBase && (hrefBase === location.toString().split('#')[0] || |
4502 | | - (baseEl = $('base')[0]) && hrefBase === baseEl.href)) { |
4503 | | - href = a.hash; |
4504 | | - a.href = href; |
4505 | | - } |
4506 | | - |
4507 | | - // inline tab |
4508 | | - if (fragmentId.test(href)) { |
4509 | | - self.panels = self.panels.add(self._sanitizeSelector(href)); |
4510 | | - } |
4511 | | - |
4512 | | - // remote tab |
4513 | | - else if (href != '#') { // prevent loading the page itself if href is just "#" |
4514 | | - $.data(a, 'href.tabs', href); // required for restore on destroy |
4515 | | - |
4516 | | - // TODO until #3808 is fixed strip fragment identifier from url |
4517 | | - // (IE fails to load from such url) |
4518 | | - $.data(a, 'load.tabs', href.replace(/#.*$/, '')); // mutable data |
4519 | | - |
4520 | | - var id = self._tabId(a); |
4521 | | - a.href = '#' + id; |
4522 | | - var $panel = $('#' + id); |
4523 | | - if (!$panel.length) { |
4524 | | - $panel = $(o.panelTemplate).attr('id', id).addClass('ui-tabs-panel ui-widget-content ui-corner-bottom') |
4525 | | - .insertAfter(self.panels[i - 1] || self.list); |
4526 | | - $panel.data('destroy.tabs', true); |
4527 | | - } |
4528 | | - self.panels = self.panels.add($panel); |
4529 | | - } |
4530 | | - |
4531 | | - // invalid tab href |
4532 | | - else { |
4533 | | - o.disabled.push(i); |
4534 | | - } |
4535 | | - }); |
4536 | | - |
4537 | | - // initialization from scratch |
4538 | | - if (init) { |
4539 | | - |
4540 | | - // attach necessary classes for styling |
4541 | | - this.element.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all'); |
4542 | | - this.list.addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all'); |
4543 | | - this.lis.addClass('ui-state-default ui-corner-top'); |
4544 | | - this.panels.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom'); |
4545 | | - |
4546 | | - // Selected tab |
4547 | | - // use "selected" option or try to retrieve: |
4548 | | - // 1. from fragment identifier in url |
4549 | | - // 2. from cookie |
4550 | | - // 3. from selected class attribute on <li> |
4551 | | - if (o.selected === undefined) { |
4552 | | - if (location.hash) { |
4553 | | - this.anchors.each(function(i, a) { |
4554 | | - if (a.hash == location.hash) { |
4555 | | - o.selected = i; |
4556 | | - return false; // break |
4557 | | - } |
4558 | | - }); |
4559 | | - } |
4560 | | - if (typeof o.selected != 'number' && o.cookie) { |
4561 | | - o.selected = parseInt(self._cookie(), 10); |
4562 | | - } |
4563 | | - if (typeof o.selected != 'number' && this.lis.filter('.ui-tabs-selected').length) { |
4564 | | - o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected')); |
4565 | | - } |
4566 | | - o.selected = o.selected || 0; |
4567 | | - } |
4568 | | - else if (o.selected === null) { // usage of null is deprecated, TODO remove in next release |
4569 | | - o.selected = -1; |
4570 | | - } |
4571 | | - |
4572 | | - // sanity check - default to first tab... |
4573 | | - o.selected = ((o.selected >= 0 && this.anchors[o.selected]) || o.selected < 0) ? o.selected : 0; |
4574 | | - |
4575 | | - // Take disabling tabs via class attribute from HTML |
4576 | | - // into account and update option properly. |
4577 | | - // A selected tab cannot become disabled. |
4578 | | - o.disabled = $.unique(o.disabled.concat( |
4579 | | - $.map(this.lis.filter('.ui-state-disabled'), |
4580 | | - function(n, i) { return self.lis.index(n); } ) |
4581 | | - )).sort(); |
4582 | | - |
4583 | | - if ($.inArray(o.selected, o.disabled) != -1) { |
4584 | | - o.disabled.splice($.inArray(o.selected, o.disabled), 1); |
4585 | | - } |
4586 | | - |
4587 | | - // highlight selected tab |
4588 | | - this.panels.addClass('ui-tabs-hide'); |
4589 | | - this.lis.removeClass('ui-tabs-selected ui-state-active'); |
4590 | | - if (o.selected >= 0 && this.anchors.length) { // check for length avoids error when initializing empty list |
4591 | | - this.panels.eq(o.selected).removeClass('ui-tabs-hide'); |
4592 | | - this.lis.eq(o.selected).addClass('ui-tabs-selected ui-state-active'); |
4593 | | - |
4594 | | - // seems to be expected behavior that the show callback is fired |
4595 | | - self.element.queue("tabs", function() { |
4596 | | - self._trigger('show', null, self._ui(self.anchors[o.selected], self.panels[o.selected])); |
4597 | | - }); |
4598 | | - |
4599 | | - this.load(o.selected); |
4600 | | - } |
4601 | | - |
4602 | | - // clean up to avoid memory leaks in certain versions of IE 6 |
4603 | | - $(window).bind('unload', function() { |
4604 | | - self.lis.add(self.anchors).unbind('.tabs'); |
4605 | | - self.lis = self.anchors = self.panels = null; |
4606 | | - }); |
4607 | | - |
4608 | | - } |
4609 | | - // update selected after add/remove |
4610 | | - else { |
4611 | | - o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected')); |
4612 | | - } |
4613 | | - |
4614 | | - // update collapsible |
4615 | | - this.element[o.collapsible ? 'addClass' : 'removeClass']('ui-tabs-collapsible'); |
4616 | | - |
4617 | | - // set or update cookie after init and add/remove respectively |
4618 | | - if (o.cookie) { |
4619 | | - this._cookie(o.selected, o.cookie); |
4620 | | - } |
4621 | | - |
4622 | | - // disable tabs |
4623 | | - for (var i = 0, li; (li = this.lis[i]); i++) { |
4624 | | - $(li)[$.inArray(i, o.disabled) != -1 && |
4625 | | - !$(li).hasClass('ui-tabs-selected') ? 'addClass' : 'removeClass']('ui-state-disabled'); |
4626 | | - } |
4627 | | - |
4628 | | - // reset cache if switching from cached to not cached |
4629 | | - if (o.cache === false) { |
4630 | | - this.anchors.removeData('cache.tabs'); |
4631 | | - } |
4632 | | - |
4633 | | - // remove all handlers before, tabify may run on existing tabs after add or option change |
4634 | | - this.lis.add(this.anchors).unbind('.tabs'); |
4635 | | - |
4636 | | - if (o.event != 'mouseover') { |
4637 | | - var addState = function(state, el) { |
4638 | | - if (el.is(':not(.ui-state-disabled)')) { |
4639 | | - el.addClass('ui-state-' + state); |
4640 | | - } |
4641 | | - }; |
4642 | | - var removeState = function(state, el) { |
4643 | | - el.removeClass('ui-state-' + state); |
4644 | | - }; |
4645 | | - this.lis.bind('mouseover.tabs', function() { |
4646 | | - addState('hover', $(this)); |
4647 | | - }); |
4648 | | - this.lis.bind('mouseout.tabs', function() { |
4649 | | - removeState('hover', $(this)); |
4650 | | - }); |
4651 | | - this.anchors.bind('focus.tabs', function() { |
4652 | | - addState('focus', $(this).closest('li')); |
4653 | | - }); |
4654 | | - this.anchors.bind('blur.tabs', function() { |
4655 | | - removeState('focus', $(this).closest('li')); |
4656 | | - }); |
4657 | | - } |
4658 | | - |
4659 | | - // set up animations |
4660 | | - var hideFx, showFx; |
4661 | | - if (o.fx) { |
4662 | | - if ($.isArray(o.fx)) { |
4663 | | - hideFx = o.fx[0]; |
4664 | | - showFx = o.fx[1]; |
4665 | | - } |
4666 | | - else { |
4667 | | - hideFx = showFx = o.fx; |
4668 | | - } |
4669 | | - } |
4670 | | - |
4671 | | - // Reset certain styles left over from animation |
4672 | | - // and prevent IE's ClearType bug... |
4673 | | - function resetStyle($el, fx) { |
4674 | | - $el.css({ display: '' }); |
4675 | | - if ($.browser.msie && fx.opacity) { |
4676 | | - $el[0].style.removeAttribute('filter'); |
4677 | | - } |
4678 | | - } |
4679 | | - |
4680 | | - // Show a tab... |
4681 | | - var showTab = showFx ? |
4682 | | - function(clicked, $show) { |
4683 | | - $(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active'); |
4684 | | - $show.hide().removeClass('ui-tabs-hide') // avoid flicker that way |
4685 | | - .animate(showFx, showFx.duration || 'normal', function() { |
4686 | | - resetStyle($show, showFx); |
4687 | | - self._trigger('show', null, self._ui(clicked, $show[0])); |
4688 | | - }); |
4689 | | - } : |
4690 | | - function(clicked, $show) { |
4691 | | - $(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active'); |
4692 | | - $show.removeClass('ui-tabs-hide'); |
4693 | | - self._trigger('show', null, self._ui(clicked, $show[0])); |
4694 | | - }; |
4695 | | - |
4696 | | - // Hide a tab, $show is optional... |
4697 | | - var hideTab = hideFx ? |
4698 | | - function(clicked, $hide) { |
4699 | | - $hide.animate(hideFx, hideFx.duration || 'normal', function() { |
4700 | | - self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default'); |
4701 | | - $hide.addClass('ui-tabs-hide'); |
4702 | | - resetStyle($hide, hideFx); |
4703 | | - self.element.dequeue("tabs"); |
4704 | | - }); |
4705 | | - } : |
4706 | | - function(clicked, $hide, $show) { |
4707 | | - self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default'); |
4708 | | - $hide.addClass('ui-tabs-hide'); |
4709 | | - self.element.dequeue("tabs"); |
4710 | | - }; |
4711 | | - |
4712 | | - // attach tab event handler, unbind to avoid duplicates from former tabifying... |
4713 | | - this.anchors.bind(o.event + '.tabs', function() { |
4714 | | - var el = this, $li = $(this).closest('li'), $hide = self.panels.filter(':not(.ui-tabs-hide)'), |
4715 | | - $show = $(self._sanitizeSelector(this.hash)); |
4716 | | - |
4717 | | - // If tab is already selected and not collapsible or tab disabled or |
4718 | | - // or is already loading or click callback returns false stop here. |
4719 | | - // Check if click handler returns false last so that it is not executed |
4720 | | - // for a disabled or loading tab! |
4721 | | - if (($li.hasClass('ui-tabs-selected') && !o.collapsible) || |
4722 | | - $li.hasClass('ui-state-disabled') || |
4723 | | - $li.hasClass('ui-state-processing') || |
4724 | | - self._trigger('select', null, self._ui(this, $show[0])) === false) { |
4725 | | - this.blur(); |
4726 | | - return false; |
4727 | | - } |
4728 | | - |
4729 | | - o.selected = self.anchors.index(this); |
4730 | | - |
4731 | | - self.abort(); |
4732 | | - |
4733 | | - // if tab may be closed |
4734 | | - if (o.collapsible) { |
4735 | | - if ($li.hasClass('ui-tabs-selected')) { |
4736 | | - o.selected = -1; |
4737 | | - |
4738 | | - if (o.cookie) { |
4739 | | - self._cookie(o.selected, o.cookie); |
4740 | | - } |
4741 | | - |
4742 | | - self.element.queue("tabs", function() { |
4743 | | - hideTab(el, $hide); |
4744 | | - }).dequeue("tabs"); |
4745 | | - |
4746 | | - this.blur(); |
4747 | | - return false; |
4748 | | - } |
4749 | | - else if (!$hide.length) { |
4750 | | - if (o.cookie) { |
4751 | | - self._cookie(o.selected, o.cookie); |
4752 | | - } |
4753 | | - |
4754 | | - self.element.queue("tabs", function() { |
4755 | | - showTab(el, $show); |
4756 | | - }); |
4757 | | - |
4758 | | - self.load(self.anchors.index(this)); // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171 |
4759 | | - |
4760 | | - this.blur(); |
4761 | | - return false; |
4762 | | - } |
4763 | | - } |
4764 | | - |
4765 | | - if (o.cookie) { |
4766 | | - self._cookie(o.selected, o.cookie); |
4767 | | - } |
4768 | | - |
4769 | | - // show new tab |
4770 | | - if ($show.length) { |
4771 | | - if ($hide.length) { |
4772 | | - self.element.queue("tabs", function() { |
4773 | | - hideTab(el, $hide); |
4774 | | - }); |
4775 | | - } |
4776 | | - self.element.queue("tabs", function() { |
4777 | | - showTab(el, $show); |
4778 | | - }); |
4779 | | - |
4780 | | - self.load(self.anchors.index(this)); |
4781 | | - } |
4782 | | - else { |
4783 | | - throw 'jQuery UI Tabs: Mismatching fragment identifier.'; |
4784 | | - } |
4785 | | - |
4786 | | - // Prevent IE from keeping other link focussed when using the back button |
4787 | | - // and remove dotted border from clicked link. This is controlled via CSS |
4788 | | - // in modern browsers; blur() removes focus from address bar in Firefox |
4789 | | - // which can become a usability and annoying problem with tabs('rotate'). |
4790 | | - if ($.browser.msie) { |
4791 | | - this.blur(); |
4792 | | - } |
4793 | | - |
4794 | | - }); |
4795 | | - |
4796 | | - // disable click in any case |
4797 | | - this.anchors.bind('click.tabs', function(){return false;}); |
4798 | | - |
4799 | | - }, |
4800 | | - |
4801 | | - destroy: function() { |
4802 | | - var o = this.options; |
4803 | | - |
4804 | | - this.abort(); |
4805 | | - |
4806 | | - this.element.unbind('.tabs') |
4807 | | - .removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible') |
4808 | | - .removeData('tabs'); |
4809 | | - |
4810 | | - this.list.removeClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all'); |
4811 | | - |
4812 | | - this.anchors.each(function() { |
4813 | | - var href = $.data(this, 'href.tabs'); |
4814 | | - if (href) { |
4815 | | - this.href = href; |
4816 | | - } |
4817 | | - var $this = $(this).unbind('.tabs'); |
4818 | | - $.each(['href', 'load', 'cache'], function(i, prefix) { |
4819 | | - $this.removeData(prefix + '.tabs'); |
4820 | | - }); |
4821 | | - }); |
4822 | | - |
4823 | | - this.lis.unbind('.tabs').add(this.panels).each(function() { |
4824 | | - if ($.data(this, 'destroy.tabs')) { |
4825 | | - $(this).remove(); |
4826 | | - } |
4827 | | - else { |
4828 | | - $(this).removeClass([ |
4829 | | - 'ui-state-default', |
4830 | | - 'ui-corner-top', |
4831 | | - 'ui-tabs-selected', |
4832 | | - 'ui-state-active', |
4833 | | - 'ui-state-hover', |
4834 | | - 'ui-state-focus', |
4835 | | - 'ui-state-disabled', |
4836 | | - 'ui-tabs-panel', |
4837 | | - 'ui-widget-content', |
4838 | | - 'ui-corner-bottom', |
4839 | | - 'ui-tabs-hide' |
4840 | | - ].join(' ')); |
4841 | | - } |
4842 | | - }); |
4843 | | - |
4844 | | - if (o.cookie) { |
4845 | | - this._cookie(null, o.cookie); |
4846 | | - } |
4847 | | - }, |
4848 | | - |
4849 | | - add: function(url, label, index) { |
4850 | | - if (index === undefined) { |
4851 | | - index = this.anchors.length; // append by default |
4852 | | - } |
4853 | | - |
4854 | | - var self = this, o = this.options, |
4855 | | - $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label)), |
4856 | | - id = !url.indexOf('#') ? url.replace('#', '') : this._tabId($('a', $li)[0]); |
4857 | | - |
4858 | | - $li.addClass('ui-state-default ui-corner-top').data('destroy.tabs', true); |
4859 | | - |
4860 | | - // try to find an existing element before creating a new one |
4861 | | - var $panel = $('#' + id); |
4862 | | - if (!$panel.length) { |
4863 | | - $panel = $(o.panelTemplate).attr('id', id).data('destroy.tabs', true); |
4864 | | - } |
4865 | | - $panel.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide'); |
4866 | | - |
4867 | | - if (index >= this.lis.length) { |
4868 | | - $li.appendTo(this.list); |
4869 | | - $panel.appendTo(this.list[0].parentNode); |
4870 | | - } |
4871 | | - else { |
4872 | | - $li.insertBefore(this.lis[index]); |
4873 | | - $panel.insertBefore(this.panels[index]); |
4874 | | - } |
4875 | | - |
4876 | | - o.disabled = $.map(o.disabled, |
4877 | | - function(n, i) { return n >= index ? ++n : n; }); |
4878 | | - |
4879 | | - this._tabify(); |
4880 | | - |
4881 | | - if (this.anchors.length == 1) { // after tabify |
4882 | | - $li.addClass('ui-tabs-selected ui-state-active'); |
4883 | | - $panel.removeClass('ui-tabs-hide'); |
4884 | | - this.element.queue("tabs", function() { |
4885 | | - self._trigger('show', null, self._ui(self.anchors[0], self.panels[0])); |
4886 | | - }); |
4887 | | - |
4888 | | - this.load(0); |
4889 | | - } |
4890 | | - |
4891 | | - // callback |
4892 | | - this._trigger('add', null, this._ui(this.anchors[index], this.panels[index])); |
4893 | | - }, |
4894 | | - |
4895 | | - remove: function(index) { |
4896 | | - var o = this.options, $li = this.lis.eq(index).remove(), |
4897 | | - $panel = this.panels.eq(index).remove(); |
4898 | | - |
4899 | | - // If selected tab was removed focus tab to the right or |
4900 | | - // in case the last tab was removed the tab to the left. |
4901 | | - if ($li.hasClass('ui-tabs-selected') && this.anchors.length > 1) { |
4902 | | - this.select(index + (index + 1 < this.anchors.length ? 1 : -1)); |
4903 | | - } |
4904 | | - |
4905 | | - o.disabled = $.map($.grep(o.disabled, function(n, i) { return n != index; }), |
4906 | | - function(n, i) { return n >= index ? --n : n; }); |
4907 | | - |
4908 | | - this._tabify(); |
4909 | | - |
4910 | | - // callback |
4911 | | - this._trigger('remove', null, this._ui($li.find('a')[0], $panel[0])); |
4912 | | - }, |
4913 | | - |
4914 | | - enable: function(index) { |
4915 | | - var o = this.options; |
4916 | | - if ($.inArray(index, o.disabled) == -1) { |
4917 | | - return; |
4918 | | - } |
4919 | | - |
4920 | | - this.lis.eq(index).removeClass('ui-state-disabled'); |
4921 | | - o.disabled = $.grep(o.disabled, function(n, i) { return n != index; }); |
4922 | | - |
4923 | | - // callback |
4924 | | - this._trigger('enable', null, this._ui(this.anchors[index], this.panels[index])); |
4925 | | - }, |
4926 | | - |
4927 | | - disable: function(index) { |
4928 | | - var self = this, o = this.options; |
4929 | | - if (index != o.selected) { // cannot disable already selected tab |
4930 | | - this.lis.eq(index).addClass('ui-state-disabled'); |
4931 | | - |
4932 | | - o.disabled.push(index); |
4933 | | - o.disabled.sort(); |
4934 | | - |
4935 | | - // callback |
4936 | | - this._trigger('disable', null, this._ui(this.anchors[index], this.panels[index])); |
4937 | | - } |
4938 | | - }, |
4939 | | - |
4940 | | - select: function(index) { |
4941 | | - if (typeof index == 'string') { |
4942 | | - index = this.anchors.index(this.anchors.filter('[href$=' + index + ']')); |
4943 | | - } |
4944 | | - else if (index === null) { // usage of null is deprecated, TODO remove in next release |
4945 | | - index = -1; |
4946 | | - } |
4947 | | - if (index == -1 && this.options.collapsible) { |
4948 | | - index = this.options.selected; |
4949 | | - } |
4950 | | - |
4951 | | - this.anchors.eq(index).trigger(this.options.event + '.tabs'); |
4952 | | - }, |
4953 | | - |
4954 | | - load: function(index) { |
4955 | | - var self = this, o = this.options, a = this.anchors.eq(index)[0], url = $.data(a, 'load.tabs'); |
4956 | | - |
4957 | | - this.abort(); |
4958 | | - |
4959 | | - // not remote or from cache |
4960 | | - if (!url || this.element.queue("tabs").length !== 0 && $.data(a, 'cache.tabs')) { |
4961 | | - this.element.dequeue("tabs"); |
4962 | | - return; |
4963 | | - } |
4964 | | - |
4965 | | - // load remote from here on |
4966 | | - this.lis.eq(index).addClass('ui-state-processing'); |
4967 | | - |
4968 | | - if (o.spinner) { |
4969 | | - var span = $('span', a); |
4970 | | - span.data('label.tabs', span.html()).html(o.spinner); |
4971 | | - } |
4972 | | - |
4973 | | - this.xhr = $.ajax($.extend({}, o.ajaxOptions, { |
4974 | | - url: url, |
4975 | | - success: function(r, s) { |
4976 | | - $(self._sanitizeSelector(a.hash)).html(r); |
4977 | | - |
4978 | | - // take care of tab labels |
4979 | | - self._cleanup(); |
4980 | | - |
4981 | | - if (o.cache) { |
4982 | | - $.data(a, 'cache.tabs', true); // if loaded once do not load them again |
4983 | | - } |
4984 | | - |
4985 | | - // callbacks |
4986 | | - self._trigger('load', null, self._ui(self.anchors[index], self.panels[index])); |
4987 | | - try { |
4988 | | - o.ajaxOptions.success(r, s); |
4989 | | - } |
4990 | | - catch (e) {} |
4991 | | - |
4992 | | - // last, so that load event is fired before show... |
4993 | | - self.element.dequeue("tabs"); |
4994 | | - } |
4995 | | - })); |
4996 | | - }, |
4997 | | - |
4998 | | - abort: function() { |
4999 | | - // stop possibly running animations |
5000 | | - this.element.queue([]); |
5001 | | - this.panels.stop(false, true); |
5002 | | - |
5003 | | - // terminate pending requests from other tabs |
5004 | | - if (this.xhr) { |
5005 | | - this.xhr.abort(); |
5006 | | - delete this.xhr; |
5007 | | - } |
5008 | | - |
5009 | | - // take care of tab labels |
5010 | | - this._cleanup(); |
5011 | | - |
5012 | | - }, |
5013 | | - |
5014 | | - url: function(index, url) { |
5015 | | - this.anchors.eq(index).removeData('cache.tabs').data('load.tabs', url); |
5016 | | - }, |
5017 | | - |
5018 | | - length: function() { |
5019 | | - return this.anchors.length; |
5020 | | - } |
5021 | | - |
5022 | | -}); |
5023 | | - |
5024 | | -$.extend($.ui.tabs, { |
5025 | | - version: '1.7.1', |
5026 | | - getter: 'length', |
5027 | | - defaults: { |
5028 | | - ajaxOptions: null, |
5029 | | - cache: false, |
5030 | | - cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true } |
5031 | | - collapsible: false, |
5032 | | - disabled: [], |
5033 | | - event: 'click', |
5034 | | - fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 } |
5035 | | - idPrefix: 'ui-tabs-', |
5036 | | - panelTemplate: '<div></div>', |
5037 | | - spinner: '<em>Loading…</em>', |
5038 | | - tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>' |
5039 | | - } |
5040 | | -}); |
5041 | | - |
5042 | | -/* |
5043 | | - * Tabs Extensions |
5044 | | - */ |
5045 | | - |
5046 | | -/* |
5047 | | - * Rotate |
5048 | | - */ |
5049 | | -$.extend($.ui.tabs.prototype, { |
5050 | | - rotation: null, |
5051 | | - rotate: function(ms, continuing) { |
5052 | | - |
5053 | | - var self = this, o = this.options; |
5054 | | - |
5055 | | - var rotate = self._rotate || (self._rotate = function(e) { |
5056 | | - clearTimeout(self.rotation); |
5057 | | - self.rotation = setTimeout(function() { |
5058 | | - var t = o.selected; |
5059 | | - self.select( ++t < self.anchors.length ? t : 0 ); |
5060 | | - }, ms); |
5061 | | - |
5062 | | - if (e) { |
5063 | | - e.stopPropagation(); |
5064 | | - } |
5065 | | - }); |
5066 | | - |
5067 | | - var stop = self._unrotate || (self._unrotate = !continuing ? |
5068 | | - function(e) { |
5069 | | - if (e.clientX) { // in case of a true click |
5070 | | - self.rotate(null); |
5071 | | - } |
5072 | | - } : |
5073 | | - function(e) { |
5074 | | - t = o.selected; |
5075 | | - rotate(); |
5076 | | - }); |
5077 | | - |
5078 | | - // start rotation |
5079 | | - if (ms) { |
5080 | | - this.element.bind('tabsshow', rotate); |
5081 | | - this.anchors.bind(o.event + '.tabs', stop); |
5082 | | - rotate(); |
5083 | | - } |
5084 | | - // stop rotation |
5085 | | - else { |
5086 | | - clearTimeout(self.rotation); |
5087 | | - this.element.unbind('tabsshow', rotate); |
5088 | | - this.anchors.unbind(o.event + '.tabs', stop); |
5089 | | - delete this._rotate; |
5090 | | - delete this._unrotate; |
5091 | | - } |
5092 | | - } |
5093 | | -}); |
5094 | | - |
5095 | | -})(jQuery); |
5096 | | -/* |
5097 | 2782 | * jQuery Asynchronous Plugin 1.0 |
5098 | 2783 | * |
5099 | 2784 | * Copyright (c) 2008 Vincent Robert (genezys.net) |
— | — | @@ -5759,133 +3444,6 @@ |
5760 | 3445 | } ); |
5761 | 3446 | } )( jQuery ); |
5762 | 3447 | /** |
5763 | | - * This plugin provides functionallity to expand a text box on focus to double it's current width |
5764 | | - * |
5765 | | - * Usage: |
5766 | | - * |
5767 | | - * Set options: |
5768 | | - * $('#textbox').expandableField( { option1: value1, option2: value2 } ); |
5769 | | - * $('#textbox').expandableField( option, value ); |
5770 | | - * Get option: |
5771 | | - * value = $('#textbox').expandableField( option ); |
5772 | | - * Initialize: |
5773 | | - * $('#textbox').expandableField(); |
5774 | | - * |
5775 | | - * Options: |
5776 | | - * |
5777 | | - */ |
5778 | | -( function( $ ) { |
5779 | | - |
5780 | | -$.expandableField = { |
5781 | | - /** |
5782 | | - * Expand the field, make the callback |
5783 | | - */ |
5784 | | - expandField: function( e, context ) { |
5785 | | - context.config.beforeExpand.call( context.data.$field, context ); |
5786 | | - context.data.$field |
5787 | | - .animate( { 'width': context.data.expandedWidth }, 'fast', function() { |
5788 | | - context.config.afterExpand.call( this, context ); |
5789 | | - } ); |
5790 | | - }, |
5791 | | - /** |
5792 | | - * Condense the field, make the callback |
5793 | | - */ |
5794 | | - condenseField: function( e, context ) { |
5795 | | - context.config.beforeCondense.call( context.data.$field, context ); |
5796 | | - context.data.$field |
5797 | | - .animate( { 'width': context.data.condensedWidth }, 'fast', function() { |
5798 | | - context.config.afterCondense.call( this, context ); |
5799 | | - } ); |
5800 | | - }, |
5801 | | - /** |
5802 | | - * Sets the value of a property, and updates the widget accordingly |
5803 | | - * @param {String} property Name of property |
5804 | | - * @param {Mixed} value Value to set property with |
5805 | | - */ |
5806 | | - configure: function( context, property, value ) { |
5807 | | - // Validate creation using fallback values |
5808 | | - switch( property ) { |
5809 | | - default: |
5810 | | - context.config[property] = value; |
5811 | | - break; |
5812 | | - } |
5813 | | - } |
5814 | | - |
5815 | | -}; |
5816 | | -$.fn.expandableField = function() { |
5817 | | - |
5818 | | - // Multi-context fields |
5819 | | - var returnValue = null; |
5820 | | - var args = arguments; |
5821 | | - |
5822 | | - $( this ).each( function() { |
5823 | | - |
5824 | | - /* Construction / Loading */ |
5825 | | - |
5826 | | - var context = $( this ).data( 'expandableField-context' ); |
5827 | | - if ( context == null ) { |
5828 | | - context = { |
5829 | | - config: { |
5830 | | - // callback function for before collapse |
5831 | | - 'beforeCondense': function( context ) {}, |
5832 | | - // callback function for before expand |
5833 | | - 'beforeExpand': function( context ) {}, |
5834 | | - // callback function for after collapse |
5835 | | - 'afterCondense': function( context ) {}, |
5836 | | - // callback function for after expand |
5837 | | - 'afterExpand': function( context ) {} |
5838 | | - } |
5839 | | - }; |
5840 | | - } |
5841 | | - |
5842 | | - /* API */ |
5843 | | - // Handle various calling styles |
5844 | | - if ( args.length > 0 ) { |
5845 | | - if ( typeof args[0] == 'object' ) { |
5846 | | - // Apply set of properties |
5847 | | - for ( var key in args[0] ) { |
5848 | | - $.expandableField.configure( context, key, args[0][key] ); |
5849 | | - } |
5850 | | - } else if ( typeof args[0] == 'string' ) { |
5851 | | - if ( args.length > 1 ) { |
5852 | | - // Set property values |
5853 | | - $.expandableField.configure( context, args[0], args[1] ); |
5854 | | - } else if ( returnValue == null ) { |
5855 | | - // Get property values, but don't give access to internal data - returns only the first |
5856 | | - returnValue = ( args[0] in context.config ? undefined : context.config[args[0]] ); |
5857 | | - } |
5858 | | - } |
5859 | | - } |
5860 | | - |
5861 | | - /* Initialization */ |
5862 | | - |
5863 | | - if ( typeof context.data == 'undefined' ) { |
5864 | | - context.data = { |
5865 | | - // The width of the field in it's condensed state |
5866 | | - 'condensedWidth': $( this ).width(), |
5867 | | - // The width of the field in it's expanded state |
5868 | | - 'expandedWidth': $( this ).width() * 2, |
5869 | | - // Reference to the field |
5870 | | - '$field': $( this ) |
5871 | | - }; |
5872 | | - |
5873 | | - $( this ) |
5874 | | - .addClass( 'expandableField' ) |
5875 | | - .focus( function( e ) { |
5876 | | - $.expandableField.expandField( e, context ); |
5877 | | - } ) |
5878 | | - .delayedBind( 250, 'blur', function( e ) { |
5879 | | - $.expandableField.condenseField( e, context ); |
5880 | | - } ); |
5881 | | - } |
5882 | | - // Store the context for next time |
5883 | | - $( this ).data( 'expandableField-context', context ); |
5884 | | - } ); |
5885 | | - return returnValue !== null ? returnValue : $(this); |
5886 | | -}; |
5887 | | - |
5888 | | -} )( jQuery ); |
5889 | | -/** |
5890 | 3448 | * This plugin provides a generic way to add suggestions to a text box. |
5891 | 3449 | * |
5892 | 3450 | * Usage: |
— | — | @@ -8894,2202 +6452,7 @@ |
8895 | 6453 | } |
8896 | 6454 | |
8897 | 6455 | }; } ) ( jQuery ); |
8898 | | -/* Highlight module for wikiEditor */ |
8899 | | - |
8900 | | -( function( $ ) { $.wikiEditor.modules.highlight = { |
8901 | | - |
8902 | 6456 | /** |
8903 | | - * Core Requirements |
8904 | | - */ |
8905 | | -'req': [ 'iframe' ], |
8906 | | -'name': 'highlight', |
8907 | | -/** |
8908 | | - * Configuration |
8909 | | - */ |
8910 | | -'cfg': { |
8911 | | - 'styleVersion': 3 |
8912 | | -}, |
8913 | | -/** |
8914 | | - * Internally used event handlers |
8915 | | - */ |
8916 | | -'evt': { |
8917 | | - 'delayedChange': function( context, event ) { |
8918 | | - if ( event.data.scope == 'realchange' ) { |
8919 | | - $.wikiEditor.modules.highlight.fn.scan( context ); |
8920 | | - $.wikiEditor.modules.highlight.fn.mark( context, event.data.scope ); |
8921 | | - } |
8922 | | - }, |
8923 | | - 'ready': function( context, event ) { |
8924 | | - $.wikiEditor.modules.highlight.fn.scan( context ); |
8925 | | - $.wikiEditor.modules.highlight.fn.mark( context, 'ready' ); |
8926 | | - } |
8927 | | -}, |
8928 | | -/** |
8929 | | - * Internally used functions |
8930 | | - */ |
8931 | | -'fn': { |
8932 | | - /** |
8933 | | - * Creates a highlight module within a wikiEditor |
8934 | | - * |
8935 | | - * @param config Configuration object to create module from |
8936 | | - */ |
8937 | | - 'create': function( context, config ) { |
8938 | | - context.modules.highlight.markersStr = ''; |
8939 | | - }, |
8940 | | - /** |
8941 | | - * Scans text division for tokens |
8942 | | - * |
8943 | | - * @param division |
8944 | | - */ |
8945 | | - 'scan': function( context, division ) { |
8946 | | - // Remove all existing tokens |
8947 | | - var tokenArray = context.modules.highlight.tokenArray = []; |
8948 | | - // Scan text for new tokens |
8949 | | - var text = context.fn.getContents(); |
8950 | | - // Perform a scan for each module which provides any expressions to scan for |
8951 | | - // FIXME: This traverses the entire string once for every regex. Investigate |
8952 | | - // whether |-concatenating regexes then traversing once is faster. |
8953 | | - for ( var module in context.modules ) { |
8954 | | - if ( module in $.wikiEditor.modules && 'exp' in $.wikiEditor.modules[module] ) { |
8955 | | - for ( var exp in $.wikiEditor.modules[module].exp ) { |
8956 | | - // Prepare configuration |
8957 | | - var regex = $.wikiEditor.modules[module].exp[exp].regex; |
8958 | | - var label = $.wikiEditor.modules[module].exp[exp].label; |
8959 | | - var markAfter = $.wikiEditor.modules[module].exp[exp].markAfter || false; |
8960 | | - // Search for tokens |
8961 | | - var offset = 0, left, right, match; |
8962 | | - while ( ( match = text.substr( offset ).match( regex ) ) != null ) { |
8963 | | - right = ( left = offset + match.index ) + match[0].length; |
8964 | | - tokenArray[tokenArray.length] = { |
8965 | | - 'offset': markAfter ? right : left, |
8966 | | - 'label': label, |
8967 | | - 'tokenStart': left, |
8968 | | - 'match': match |
8969 | | - }; |
8970 | | - // Move to the right of this match |
8971 | | - offset = right; |
8972 | | - } |
8973 | | - } |
8974 | | - } |
8975 | | - } |
8976 | | - // Sort by start |
8977 | | - tokenArray.sort( function( a, b ) { return a.tokenStart - b.tokenStart; } ); |
8978 | | - // Let the world know, a scan just happened! |
8979 | | - context.fn.trigger( 'scan' ); |
8980 | | - }, |
8981 | | - /** |
8982 | | - * Marks up text with HTML |
8983 | | - * |
8984 | | - * @param division |
8985 | | - * @param tokens |
8986 | | - */ |
8987 | | - // FIXME: What do division and tokens do? |
8988 | | - // TODO: Document the scan() and mark() APIs somewhere |
8989 | | - 'mark': function( context, division, tokens ) { |
8990 | | - // Reset markers |
8991 | | - var markers = []; |
8992 | | - |
8993 | | - // Recycle markers that will be skipped in this run |
8994 | | - if ( context.modules.highlight.markers && division != '' ) { |
8995 | | - for ( var i = 0; i < context.modules.highlight.markers.length; i++ ) { |
8996 | | - if ( context.modules.highlight.markers[i].skipDivision == division ) { |
8997 | | - markers.push( context.modules.highlight.markers[i] ); |
8998 | | - } |
8999 | | - } |
9000 | | - } |
9001 | | - context.modules.highlight.markers = markers; |
9002 | | - |
9003 | | - // Get all markers |
9004 | | - context.fn.trigger( 'mark' ); |
9005 | | - markers.sort( function( a, b ) { return a.start - b.start || a.end - b.end; } ); |
9006 | | - |
9007 | | - // Serialize the markers array to a string and compare it with the one stored in the previous run - if they're |
9008 | | - // equal, there's no markers to change |
9009 | | - var markersStr = ''; |
9010 | | - for ( var i = 0; i < markers.length; i++ ) { |
9011 | | - markersStr += markers[i].start + ',' + markers[i].end + ',' + markers[i].type + ','; |
9012 | | - } |
9013 | | - if ( context.modules.highlight.markersStr == markersStr ) { |
9014 | | - // No change, bail out |
9015 | | - return; |
9016 | | - } |
9017 | | - context.modules.highlight.markersStr = markersStr; |
9018 | | - |
9019 | | - // Traverse the iframe DOM, inserting markers where they're needed - store visited markers here so we know which |
9020 | | - // markers should be removed |
9021 | | - var visited = [], v = 0; |
9022 | | - for ( var i = 0; i < markers.length; i++ ) { |
9023 | | - if ( typeof markers[i].skipDivision !== 'undefined' && ( division == markers[i].skipDivision ) ) { |
9024 | | - continue; |
9025 | | - } |
9026 | | - |
9027 | | - // We want to isolate each marker, so we may need to split textNodes if a marker starts or ends halfway one. |
9028 | | - var start = markers[i].start; |
9029 | | - var s = context.fn.getOffset( start ); |
9030 | | - if ( !s ) { |
9031 | | - // This shouldn't happen |
9032 | | - continue; |
9033 | | - } |
9034 | | - var startNode = s.node; |
9035 | | - |
9036 | | - // Don't wrap leading BRs, produces undesirable results |
9037 | | - // FIXME: It's also possible that the offset is a bit high because getOffset() has incremented .length to |
9038 | | - // fake the newline caused by startNode being in a P. In this case, prevent the textnode splitting below |
9039 | | - // from making startNode an empty textnode, IE barfs on that |
9040 | | - while ( startNode.nodeName == 'BR' || s.offset == startNode.nodeValue.length ) { |
9041 | | - start++; |
9042 | | - s = context.fn.getOffset( start ); |
9043 | | - startNode = s.node; |
9044 | | - } |
9045 | | - |
9046 | | - // The next marker starts somewhere in this textNode or at this BR |
9047 | | - if ( s.offset > 0 && s.node.nodeName == '#text' ) { |
9048 | | - // Split off the prefix - this leaves the prefix in the current node and puts the rest in a new node |
9049 | | - // which is our start node |
9050 | | - var newStartNode = startNode.splitText( s.offset < s.node.nodeValue.length ? |
9051 | | - s.offset : s.node.nodeValue.length - 1 |
9052 | | - ); |
9053 | | - var oldStartNode = startNode; |
9054 | | - startNode = newStartNode; |
9055 | | - // Update offset objects. We don't need purgeOffsets(), simply manipulating the existing offset objects |
9056 | | - // will suffice |
9057 | | - // FIXME: This manipulates context.offsets directly, which is ugly, but the performance improvement vs. |
9058 | | - // purgeOffsets() is worth it - this code doesn't set lastTextNode to newStartNode for offset objects |
9059 | | - // with lastTextNode == oldStartNode, but that doesn't really matter |
9060 | | - var subtracted = s.offset; |
9061 | | - var oldLength = s.length; |
9062 | | - |
9063 | | - var j, o; |
9064 | | - // Update offset objects referring to oldStartNode |
9065 | | - for ( j = start - subtracted; j < start; j++ ) { |
9066 | | - if ( j in context.offsets ) { |
9067 | | - o = context.offsets[j]; |
9068 | | - o.node = oldStartNode; |
9069 | | - o.length = subtracted; |
9070 | | - } |
9071 | | - } |
9072 | | - // Update offset objects referring to newStartNode |
9073 | | - for ( j = start; j < start - subtracted + oldLength; j++ ) { |
9074 | | - if ( j in context.offsets ) { |
9075 | | - o = context.offsets[j]; |
9076 | | - o.node = newStartNode; |
9077 | | - o.offset -= subtracted; |
9078 | | - o.length -= subtracted; |
9079 | | - o.lastTextNode = oldStartNode; |
9080 | | - } |
9081 | | - } |
9082 | | - } |
9083 | | - var end = markers[i].end; |
9084 | | - // To avoid ending up at the first char of the next node, we grab the offset for end - 1 and add one to the |
9085 | | - // offset |
9086 | | - var e = context.fn.getOffset( end - 1 ); |
9087 | | - if ( !e ) { |
9088 | | - // This shouldn't happen |
9089 | | - continue; |
9090 | | - } |
9091 | | - var endNode = e.node; |
9092 | | - if ( e.offset + 1 < e.length - 1 && endNode.nodeName == '#text' ) { |
9093 | | - // Split off the suffix. This puts the suffix in a new node and leaves the rest in endNode |
9094 | | - var oldEndNode = endNode; |
9095 | | - var newEndNode = endNode.splitText( e.offset + 1 ); |
9096 | | - // Update offset objects |
9097 | | - var subtracted = e.offset + 1; |
9098 | | - var oldLength = e.length; |
9099 | | - var j, o; |
9100 | | - // Update offset objects referring to oldEndNode |
9101 | | - for ( j = end - subtracted; j < end; j++ ) { |
9102 | | - if ( j in context.offsets ) { |
9103 | | - o = context.offsets[j]; |
9104 | | - o.node = oldEndNode; |
9105 | | - o.length = subtracted; |
9106 | | - } |
9107 | | - } |
9108 | | - // We have to insert this one, as it might not exist: we didn't call getOffset( end ) |
9109 | | - context.offsets[end] = { |
9110 | | - 'node': newEndNode, |
9111 | | - 'offset': 0, |
9112 | | - 'length': oldLength - subtracted, |
9113 | | - 'lastTextNode': oldEndNode |
9114 | | - }; |
9115 | | - // Update offset objects referring to newEndNode |
9116 | | - for ( j = end + 1; j < end - subtracted + oldLength; j++ ) { |
9117 | | - if ( j in context.offsets ) { |
9118 | | - o = context.offsets[j]; |
9119 | | - o.node = newEndNode; |
9120 | | - o.offset -= subtracted; |
9121 | | - o.length -= subtracted; |
9122 | | - o.lastTextNode = oldEndNode; |
9123 | | - } |
9124 | | - } |
9125 | | - } |
9126 | | - // Don't wrap trailing BRs, doing that causes weird issues |
9127 | | - if ( endNode.nodeName == 'BR' ) { |
9128 | | - endNode = e.lastTextNode; |
9129 | | - } |
9130 | | - // If startNode and endNode have different parents, we need to pull endNode and all textnodes in between |
9131 | | - // into startNode's parent and replace </p><p> with <br> |
9132 | | - if ( startNode.parentNode != endNode.parentNode ) { |
9133 | | - var startP = $( startNode ).closest( 'p' ).get( 0 ); |
9134 | | - var t = new context.fn.rawTraverser( startNode, startP, context.$content.get( 0 ), false ); |
9135 | | - var afterStart = startNode.nextSibling; |
9136 | | - var lastP = startP; |
9137 | | - var nextT = t.next(); |
9138 | | - while ( nextT && t.node != endNode ) { |
9139 | | - t = nextT; |
9140 | | - nextT = t.next(); |
9141 | | - // If t.node has a different parent, merge t.node.parentNode with startNode.parentNode |
9142 | | - if ( t.node.parentNode != startNode.parentNode ) { |
9143 | | - var oldParent = t.node.parentNode; |
9144 | | - if ( afterStart ) { |
9145 | | - if ( lastP != t.inP ) { |
9146 | | - // We're entering a new <p>, insert a <br> |
9147 | | - startNode.parentNode.insertBefore( |
9148 | | - startNode.ownerDocument.createElement( 'br' ), |
9149 | | - afterStart |
9150 | | - ); |
9151 | | - } |
9152 | | - // A <p> with just a <br> in it is an empty line, so let's not bother with unwrapping it |
9153 | | - if ( !( oldParent.childNodes.length == 1 && oldParent.firstChild.nodeName == 'BR' ) ) { |
9154 | | - // Move all children of oldParent into startNode's parent |
9155 | | - while ( oldParent.firstChild ) { |
9156 | | - startNode.parentNode.insertBefore( oldParent.firstChild, afterStart ); |
9157 | | - } |
9158 | | - } |
9159 | | - } else { |
9160 | | - if ( lastP != t.inP ) { |
9161 | | - // We're entering a new <p>, insert a <br> |
9162 | | - startNode.parentNode.appendChild( |
9163 | | - startNode.ownerDocument.createElement( 'br' ) |
9164 | | - ); |
9165 | | - } |
9166 | | - // A <p> with just a <br> in it is an empty line, so let's not bother with unwrapping it |
9167 | | - if ( !( oldParent.childNodes.length == 1 && oldParent.firstChild.nodeName == 'BR' ) ) { |
9168 | | - // Move all children of oldParent into startNode's parent |
9169 | | - while ( oldParent.firstChild ) { |
9170 | | - startNode.parentNode.appendChild( oldParent.firstChild ); |
9171 | | - } |
9172 | | - } |
9173 | | - } |
9174 | | - // Remove oldParent, which is now empty |
9175 | | - oldParent.parentNode.removeChild( oldParent ); |
9176 | | - } |
9177 | | - lastP = t.inP; |
9178 | | - } |
9179 | | - // Moving nodes around like this invalidates offset objects |
9180 | | - // TODO: Update offset objects ourselves for performance. Requires rewriting this code block to be |
9181 | | - // offset-based rather than traverser-based |
9182 | | - } |
9183 | | - // Now wrap everything between startNode and endNode (may be equal). |
9184 | | - var ca1 = startNode, ca2 = endNode; |
9185 | | - if ( ca1 && ca2 && ca1.parentNode ) { |
9186 | | - var anchor = markers[i].getAnchor( ca1, ca2 ); |
9187 | | - if ( !anchor ) { |
9188 | | - var commonAncestor = ca1.parentNode; |
9189 | | - if ( markers[i].anchor == 'wrap') { |
9190 | | - // We have to store things like .parentNode and .nextSibling because appendChild() changes these |
9191 | | - var newNode = ca1.ownerDocument.createElement( 'span' ); |
9192 | | - var nextNode = ca2.nextSibling; |
9193 | | - // Append all nodes between ca1 and ca2 (inclusive) to newNode |
9194 | | - var n = ca1; |
9195 | | - while ( n != nextNode ) { |
9196 | | - var ns = n.nextSibling; |
9197 | | - newNode.appendChild( n ); |
9198 | | - n = ns; |
9199 | | - } |
9200 | | - // Insert newNode in the right place |
9201 | | - if ( nextNode ) { |
9202 | | - commonAncestor.insertBefore( newNode, nextNode ); |
9203 | | - } else { |
9204 | | - commonAncestor.appendChild( newNode ); |
9205 | | - } |
9206 | | - anchor = newNode; |
9207 | | - } else if ( markers[i].anchor == 'tag' ) { |
9208 | | - anchor = commonAncestor; |
9209 | | - } |
9210 | | - $( anchor ).data( 'marker', markers[i] ).addClass( 'wikiEditor-highlight' ); |
9211 | | - // Allow the module adding this marker to manipulate it |
9212 | | - markers[i].afterWrap( anchor, markers[i] ); |
9213 | | - |
9214 | | - } else { |
9215 | | - // Update the marker object |
9216 | | - $( anchor ).data( 'marker', markers[i] ); |
9217 | | - if ( typeof markers[i].onSkip == 'function' ) { |
9218 | | - markers[i].onSkip( anchor ); |
9219 | | - } |
9220 | | - } |
9221 | | - visited[v++] = anchor; |
9222 | | - } |
9223 | | - } |
9224 | | - // Remove markers that were previously inserted but weren't passed to this function - visited[] contains the |
9225 | | - // visited elements in order and find() and each() preserve order |
9226 | | - var j = 0; |
9227 | | - context.$content.find( '.wikiEditor-highlight' ).each( function() { |
9228 | | - if ( visited[j] == this ) { |
9229 | | - // This marker is legit, leave it in |
9230 | | - j++; |
9231 | | - return true; |
9232 | | - } |
9233 | | - // Remove this marker |
9234 | | - var marker = $(this).data( 'marker' ); |
9235 | | - if ( marker && typeof marker.skipDivision != 'undefined' && ( division == marker.skipDivision ) ) { |
9236 | | - // Don't remove these either |
9237 | | - return true; |
9238 | | - } |
9239 | | - if ( marker && typeof marker.beforeUnwrap == 'function' ) |
9240 | | - marker.beforeUnwrap( this ); |
9241 | | - if ( ( marker && marker.anchor == 'tag' ) || $(this).is( 'p' ) ) { |
9242 | | - // Remove all classes |
9243 | | - $(this).removeAttr( 'class' ); |
9244 | | - } else { |
9245 | | - // Assume anchor == 'wrap' |
9246 | | - $(this).replaceWith( this.childNodes ); |
9247 | | - } |
9248 | | - context.fn.purgeOffsets(); |
9249 | | - }); |
9250 | | - |
9251 | | - } |
9252 | | -} |
9253 | | - |
9254 | | -}; })( jQuery ); |
9255 | | - |
9256 | | -/* Preview module for wikiEditor */ |
9257 | | -( function( $ ) { $.wikiEditor.modules.preview = { |
9258 | | - |
9259 | | -/** |
9260 | | - * Compatability map |
9261 | | - */ |
9262 | | -'browsers': { |
9263 | | - // Left-to-right languages |
9264 | | - 'ltr': { |
9265 | | - 'msie': [['>=', 7]], |
9266 | | - 'firefox': [['>=', 3]], |
9267 | | - 'opera': [['>=', 9.6]], |
9268 | | - 'safari': [['>=', 4]] |
9269 | | - }, |
9270 | | - // Right-to-left languages |
9271 | | - 'rtl': { |
9272 | | - 'msie': [['>=', 8]], |
9273 | | - 'firefox': [['>=', 3]], |
9274 | | - 'opera': [['>=', 9.6]], |
9275 | | - 'safari': [['>=', 4]] |
9276 | | - } |
9277 | | -}, |
9278 | | -/** |
9279 | | - * Internally used functions |
9280 | | - */ |
9281 | | -fn: { |
9282 | | - /** |
9283 | | - * Creates a preview module within a wikiEditor |
9284 | | - * @param context Context object of editor to create module in |
9285 | | - * @param config Configuration object to create module from |
9286 | | - */ |
9287 | | - create: function( context, config ) { |
9288 | | - if ( 'initialized' in context.modules.preview ) { |
9289 | | - return; |
9290 | | - } |
9291 | | - context.modules.preview = { |
9292 | | - 'initialized': true, |
9293 | | - 'previewText': null, |
9294 | | - 'changesText': null |
9295 | | - }; |
9296 | | - context.modules.preview.$preview = context.fn.addView( { |
9297 | | - 'name': 'preview', |
9298 | | - 'titleMsg': 'wikieditor-preview-tab', |
9299 | | - 'init': function( context ) { |
9300 | | - // Gets the latest copy of the wikitext |
9301 | | - var wikitext = context.fn.getContents(); |
9302 | | - // Aborts when nothing has changed since the last preview |
9303 | | - if ( context.modules.preview.previewText == wikitext ) { |
9304 | | - return; |
9305 | | - } |
9306 | | - context.modules.preview.$preview.find( '.wikiEditor-preview-contents' ).empty(); |
9307 | | - context.modules.preview.$preview.find( '.wikiEditor-preview-loading' ).show(); |
9308 | | - $.post( |
9309 | | - wgScriptPath + '/api.php', |
9310 | | - { |
9311 | | - 'action': 'parse', |
9312 | | - 'title': wgPageName, |
9313 | | - 'text': wikitext, |
9314 | | - 'prop': 'text', |
9315 | | - 'pst': '', |
9316 | | - 'format': 'json' |
9317 | | - }, |
9318 | | - function( data ) { |
9319 | | - if ( |
9320 | | - typeof data.parse == 'undefined' || |
9321 | | - typeof data.parse.text == 'undefined' || |
9322 | | - typeof data.parse.text['*'] == 'undefined' |
9323 | | - ) { |
9324 | | - return; |
9325 | | - } |
9326 | | - context.modules.preview.previewText = wikitext; |
9327 | | - context.modules.preview.$preview.find( '.wikiEditor-preview-loading' ).hide(); |
9328 | | - context.modules.preview.$preview.find( '.wikiEditor-preview-contents' ) |
9329 | | - .html( data.parse.text['*'] ) |
9330 | | - .find( 'a:not([href^=#])' ).click( function() { return false; } ); |
9331 | | - }, |
9332 | | - 'json' |
9333 | | - ); |
9334 | | - } |
9335 | | - } ); |
9336 | | - |
9337 | | - context.$changesTab = context.fn.addView( { |
9338 | | - 'name': 'changes', |
9339 | | - 'titleMsg': 'wikieditor-preview-changes-tab', |
9340 | | - 'init': function( context ) { |
9341 | | - // Gets the latest copy of the wikitext |
9342 | | - var wikitext = context.fn.getContents(); |
9343 | | - // Aborts when nothing has changed since the last time |
9344 | | - if ( context.modules.preview.changesText == wikitext ) { |
9345 | | - return; |
9346 | | - } |
9347 | | - context.$changesTab.find( 'table.diff tbody' ).empty(); |
9348 | | - context.$changesTab.find( '.wikiEditor-preview-loading' ).show(); |
9349 | | - |
9350 | | - // Call the API. First PST the input, then diff it |
9351 | | - var postdata = { |
9352 | | - 'action': 'parse', |
9353 | | - 'onlypst': '', |
9354 | | - 'text': wikitext, |
9355 | | - 'format': 'json' |
9356 | | - }; |
9357 | | - |
9358 | | - $.post( wgScriptPath + '/api.php', postdata, function( data ) { |
9359 | | - try { |
9360 | | - var postdata2 = { |
9361 | | - 'action': 'query', |
9362 | | - 'indexpageids': '', |
9363 | | - 'prop': 'revisions', |
9364 | | - 'titles': wgPageName, |
9365 | | - 'rvdifftotext': data.parse.text['*'], |
9366 | | - 'rvprop': '', |
9367 | | - 'format': 'json' |
9368 | | - }; |
9369 | | - var section = $( '[name=wpSection]' ).val(); |
9370 | | - if ( section != '' ) |
9371 | | - postdata['rvsection'] = section; |
9372 | | - |
9373 | | - $.post( wgScriptPath + '/api.php', postdata2, function( data ) { |
9374 | | - // Add diff CSS |
9375 | | - if ( $( 'link[href=' + stylepath + '/common/diff.css]' ).size() == 0 ) { |
9376 | | - $( 'head' ).append( $( '<link />' ).attr( { |
9377 | | - 'rel': 'stylesheet', |
9378 | | - 'type': 'text/css', |
9379 | | - 'href': stylepath + '/common/diff.css' |
9380 | | - } ) ); |
9381 | | - } |
9382 | | - try { |
9383 | | - var diff = data.query.pages[data.query.pageids[0]] |
9384 | | - .revisions[0].diff['*']; |
9385 | | - context.$changesTab.find( 'table.diff tbody' ) |
9386 | | - .html( diff ); |
9387 | | - context.$changesTab |
9388 | | - .find( '.wikiEditor-preview-loading' ).hide(); |
9389 | | - context.modules.preview.changesText = wikitext; |
9390 | | - } catch ( e ) { } // "blah is undefined" error, ignore |
9391 | | - }, 'json' |
9392 | | - ); |
9393 | | - } catch( e ) { } // "blah is undefined" error, ignore |
9394 | | - }, 'json' ); |
9395 | | - } |
9396 | | - } ); |
9397 | | - |
9398 | | - var loadingMsg = mw.usability.getMsg( 'wikieditor-preview-loading' ); |
9399 | | - context.modules.preview.$preview |
9400 | | - .add( context.$changesTab ) |
9401 | | - .append( $( '<div />' ) |
9402 | | - .addClass( 'wikiEditor-preview-loading' ) |
9403 | | - .append( $( '<img />' ) |
9404 | | - .addClass( 'wikiEditor-preview-spinner' ) |
9405 | | - .attr( { |
9406 | | - 'src': $.wikiEditor.imgPath + 'dialogs/loading.gif', |
9407 | | - 'valign': 'absmiddle', |
9408 | | - 'alt': loadingMsg, |
9409 | | - 'title': loadingMsg |
9410 | | - } ) |
9411 | | - ) |
9412 | | - .append( |
9413 | | - $( '<span></span>' ).text( loadingMsg ) |
9414 | | - ) |
9415 | | - ) |
9416 | | - .append( $( '<div />' ) |
9417 | | - .addClass( 'wikiEditor-preview-contents' ) |
9418 | | - ); |
9419 | | - context.$changesTab.find( '.wikiEditor-preview-contents' ) |
9420 | | - .html( '<table class="diff"><col class="diff-marker" /><col class="diff-content" />' + |
9421 | | - '<col class="diff-marker" /><col class="diff-content" /><tbody /></table>' ); |
9422 | | - } |
9423 | | -} |
9424 | | - |
9425 | | -}; } )( jQuery ); |
9426 | | -/* Publish module for wikiEditor */ |
9427 | | -( function( $ ) { $.wikiEditor.modules.publish = { |
9428 | | - |
9429 | | -/** |
9430 | | - * Compatability map |
9431 | | - */ |
9432 | | -'browsers': { |
9433 | | - // Left-to-right languages |
9434 | | - 'ltr': { |
9435 | | - 'msie': [['>=', 7]], |
9436 | | - 'firefox': [['>=', 3]], |
9437 | | - 'opera': [['>=', 9.6]], |
9438 | | - 'safari': [['>=', 4]] |
9439 | | - }, |
9440 | | - // Right-to-left languages |
9441 | | - 'rtl': { |
9442 | | - 'msie': [['>=', 8]], |
9443 | | - 'firefox': [['>=', 3]], |
9444 | | - 'opera': [['>=', 9.6]], |
9445 | | - 'safari': [['>=', 4]] |
9446 | | - } |
9447 | | -}, |
9448 | | -/** |
9449 | | - * Internally used functions |
9450 | | - */ |
9451 | | -fn: { |
9452 | | - /** |
9453 | | - * Creates a publish module within a wikiEditor |
9454 | | - * @param context Context object of editor to create module in |
9455 | | - * @param config Configuration object to create module from |
9456 | | - */ |
9457 | | - create: function( context, config ) { |
9458 | | - // Build the dialog behind the Publish button |
9459 | | - var dialogID = 'wikiEditor-' + context.instance + '-dialog'; |
9460 | | - $.wikiEditor.modules.dialogs.fn.create( |
9461 | | - context, |
9462 | | - { |
9463 | | - previewsave: { |
9464 | | - id: dialogID, |
9465 | | - titleMsg: 'wikieditor-publish-dialog-title', |
9466 | | - html: '\ |
9467 | | - <div class="wikiEditor-publish-dialog-copywarn"></div>\ |
9468 | | - <div class="wikiEditor-publish-dialog-editoptions">\ |
9469 | | - <form id="wikieditor-' + context.instance + '-publish-dialog-form">\ |
9470 | | - <div class="wikiEditor-publish-dialog-summary">\ |
9471 | | - <label for="wikiEditor-' + context.instance + '-dialog-summary"\ |
9472 | | - rel="wikieditor-publish-dialog-summary"></label>\ |
9473 | | - <br />\ |
9474 | | - <input type="text" id="wikiEditor-' + context.instance + '-dialog-summary"\ |
9475 | | - style="width: 100%;" />\ |
9476 | | - </div>\ |
9477 | | - <div class="wikiEditor-publish-dialog-options">\ |
9478 | | - <input type="checkbox"\ |
9479 | | - id="wikiEditor-' + context.instance + '-dialog-minor" />\ |
9480 | | - <label for="wikiEditor-' + context.instance + '-dialog-minor"\ |
9481 | | - rel="wikieditor-publish-dialog-minor"></label>\ |
9482 | | - <input type="checkbox"\ |
9483 | | - id="wikiEditor-' + context.instance + '-dialog-watch" />\ |
9484 | | - <label for="wikiEditor-' + context.instance + '-dialog-watch"\ |
9485 | | - rel="wikieditor-publish-dialog-watch"></label>\ |
9486 | | - </div>\ |
9487 | | - </form>\ |
9488 | | - </div>', |
9489 | | - init: function() { |
9490 | | - $(this).find( '[rel]' ).each( function() { |
9491 | | - $(this).text( mw.usability.getMsg( $(this).attr( 'rel' ) ) ); |
9492 | | - }); |
9493 | | - |
9494 | | - /* REALLY DIRTY HACK! */ |
9495 | | - // Reformat the copyright warning stuff |
9496 | | - var copyWarnHTML = $( '#editpage-copywarn p' ).html(); |
9497 | | - // TODO: internationalize by splitting on other characters that end statements |
9498 | | - var copyWarnStatements = copyWarnHTML.split( '. ' ); |
9499 | | - var newCopyWarnHTML = '<ul>'; |
9500 | | - for ( var i = 0; i < copyWarnStatements.length; i++ ) { |
9501 | | - if ( copyWarnStatements[i] != '' ) { |
9502 | | - var copyWarnStatement = $j.trim( copyWarnStatements[i] ).replace( /\.*$/, '' ); |
9503 | | - newCopyWarnHTML += '<li>' + copyWarnStatement + '.</li>'; |
9504 | | - } |
9505 | | - } |
9506 | | - newCopyWarnHTML += '</ul>'; |
9507 | | - // No list if there's only one element |
9508 | | - $(this).find( '.wikiEditor-publish-dialog-copywarn' ).html( |
9509 | | - copyWarnStatements.length > 1 ? newCopyWarnHTML : copyWarnHTML |
9510 | | - ); |
9511 | | - /* END OF REALLY DIRTY HACK */ |
9512 | | - |
9513 | | - if ( $( '#wpMinoredit' ).size() == 0 ) |
9514 | | - $( '#wikiEditor-' + context.instance + '-dialog-minor' ).hide(); |
9515 | | - else if ( $( '#wpMinoredit' ).is( ':checked' ) ) |
9516 | | - $( '#wikiEditor-' + context.instance + '-dialog-minor' ) |
9517 | | - .attr( 'checked', 'checked' ); |
9518 | | - if ( $( '#wpWatchthis' ).size() == 0 ) |
9519 | | - $( '#wikiEditor-' + context.instance + '-dialog-watch' ).hide(); |
9520 | | - else if ( $( '#wpWatchthis' ).is( ':checked' ) ) |
9521 | | - $( '#wikiEditor-' + context.instance + '-dialog-watch' ) |
9522 | | - .attr( 'checked', 'checked' ); |
9523 | | - |
9524 | | - $(this).find( 'form' ).submit( function( e ) { |
9525 | | - $(this).closest( '.ui-dialog' ).find( 'button:first' ).click(); |
9526 | | - e.preventDefault(); |
9527 | | - }); |
9528 | | - }, |
9529 | | - dialog: { |
9530 | | - buttons: { |
9531 | | - 'wikieditor-publish-dialog-publish': function() { |
9532 | | - var minorChecked = $( '#wikiEditor-' + context.instance + |
9533 | | - '-dialog-minor' ).is( ':checked' ) ? |
9534 | | - 'checked' : ''; |
9535 | | - var watchChecked = $( '#wikiEditor-' + context.instance + |
9536 | | - '-dialog-watch' ).is( ':checked' ) ? |
9537 | | - 'checked' : ''; |
9538 | | - $( '#wpMinoredit' ).attr( 'checked', minorChecked ); |
9539 | | - $( '#wpWatchthis' ).attr( 'checked', watchChecked ); |
9540 | | - $( '#wpSummary' ).val( $j( '#wikiEditor-' + context.instance + |
9541 | | - '-dialog-summary' ).val() ); |
9542 | | - $( '#editform' ).submit(); |
9543 | | - }, |
9544 | | - 'wikieditor-publish-dialog-goback': function() { |
9545 | | - $(this).dialog( 'close' ); |
9546 | | - } |
9547 | | - }, |
9548 | | - open: function() { |
9549 | | - $( '#wikiEditor-' + context.instance + '-dialog-summary' ).focus(); |
9550 | | - }, |
9551 | | - width: 500 |
9552 | | - }, |
9553 | | - resizeme: false |
9554 | | - } |
9555 | | - } |
9556 | | - ); |
9557 | | - context.fn.addButton( { |
9558 | | - 'captionMsg': 'wikieditor-publish-button-publish', |
9559 | | - 'action': function() { |
9560 | | - $( '#' + dialogID ).dialog( 'open' ); |
9561 | | - return false; |
9562 | | - } |
9563 | | - } ); |
9564 | | - context.fn.addButton( { |
9565 | | - 'captionMsg': 'wikieditor-publish-button-cancel', |
9566 | | - 'action': function() { } |
9567 | | - } ); |
9568 | | - } |
9569 | | -} |
9570 | | - |
9571 | | -}; } )( jQuery ); |
9572 | | -/* TemplateEditor module for wikiEditor */ |
9573 | | -( function( $ ) { $.wikiEditor.modules.templateEditor = { |
9574 | | -/** |
9575 | | - * Name mappings, dirty hack which will be removed once "TemplateInfo" extension is more fully supported |
9576 | | - */ |
9577 | | -'nameMappings': { //keep these all lowercase to navigate web of redirects |
9578 | | - "infobox skyscraper": "building_name", |
9579 | | - "infobox settlement": "official_name" |
9580 | | -}, |
9581 | | - |
9582 | | - |
9583 | | -/** |
9584 | | - * Compatability map |
9585 | | - */ |
9586 | | -'browsers': { |
9587 | | - // Left-to-right languages |
9588 | | - 'ltr': { |
9589 | | - 'msie': [['>=', 8]], |
9590 | | - 'firefox': [['>=', 3]], |
9591 | | - 'opera': [['>=', 10]], |
9592 | | - 'safari': [['>=', 4]] |
9593 | | - }, |
9594 | | - // Right-to-left languages |
9595 | | - 'rtl': { |
9596 | | - 'msie': false, |
9597 | | - 'firefox': [['>=', 3]], |
9598 | | - 'opera': [['>=', 10]], |
9599 | | - 'safari': [['>=', 4]] |
9600 | | - } |
9601 | | -}, |
9602 | | -/** |
9603 | | - * Core Requirements |
9604 | | - */ |
9605 | | -'req': [ 'iframe' ], |
9606 | | -/** |
9607 | | - * Event handlers |
9608 | | - */ |
9609 | | -evt: { |
9610 | | - |
9611 | | - mark: function( context, event ) { |
9612 | | - // The markers returned by this function are skipped on realchange, so don't regenerate them in that case |
9613 | | - if ( context.modules.highlight.currentScope == 'realchange' ) { |
9614 | | - return; |
9615 | | - } |
9616 | | - |
9617 | | - // Get references to the markers and tokens from the current context |
9618 | | - var markers = context.modules.highlight.markers; |
9619 | | - var tokenArray = context.modules.highlight.tokenArray; |
9620 | | - // Collect matching level 0 template call boundaries from the tokenArray |
9621 | | - var level = 0; |
9622 | | - var tokenIndex = 0; |
9623 | | - while ( tokenIndex < tokenArray.length ){ |
9624 | | - while ( tokenIndex < tokenArray.length && tokenArray[tokenIndex].label != 'TEMPLATE_BEGIN' ) { |
9625 | | - tokenIndex++; |
9626 | | - } |
9627 | | - //open template |
9628 | | - if ( tokenIndex < tokenArray.length ) { |
9629 | | - var beginIndex = tokenIndex; |
9630 | | - var endIndex = -1; //no match found |
9631 | | - var openTemplates = 1; |
9632 | | - var templatesMatched = false; |
9633 | | - while ( tokenIndex < tokenArray.length - 1 && endIndex == -1 ) { |
9634 | | - tokenIndex++; |
9635 | | - if ( tokenArray[tokenIndex].label == 'TEMPLATE_BEGIN' ) { |
9636 | | - openTemplates++; |
9637 | | - } else if ( tokenArray[tokenIndex].label == 'TEMPLATE_END' ) { |
9638 | | - openTemplates--; |
9639 | | - if ( openTemplates == 0 ) { |
9640 | | - endIndex = tokenIndex; |
9641 | | - } //we can stop looping |
9642 | | - } |
9643 | | - }//while finding template ending |
9644 | | - if ( endIndex != -1 ) { |
9645 | | - markers.push( { |
9646 | | - start: tokenArray[beginIndex].offset, |
9647 | | - end: tokenArray[endIndex].offset, |
9648 | | - type: 'template', |
9649 | | - anchor: 'wrap', |
9650 | | - afterWrap: function( node ) { |
9651 | | - // Generate model |
9652 | | - var model = $.wikiEditor.modules.templateEditor.fn.updateModel( $( node ) ); |
9653 | | - if ( model.isCollapsible() ) { |
9654 | | - $.wikiEditor.modules.templateEditor.fn.wrapTemplate( $( node ) ); |
9655 | | - $.wikiEditor.modules.templateEditor.fn.bindTemplateEvents( $( node ) ); |
9656 | | - } else { |
9657 | | - $( node ).addClass( 'wikiEditor-template-text' ); |
9658 | | - } |
9659 | | - }, |
9660 | | - beforeUnwrap: function( node ) { |
9661 | | - if ( $( node ).parent().hasClass( 'wikiEditor-template' ) ) { |
9662 | | - $.wikiEditor.modules.templateEditor.fn.unwrapTemplate( $( node ) ); |
9663 | | - } |
9664 | | - }, |
9665 | | - onSkip: function( node ) { |
9666 | | - if ( $( node ).html() == $( node ).data( 'oldHTML' ) ) { |
9667 | | - // No change |
9668 | | - return; |
9669 | | - } |
9670 | | - |
9671 | | - // Text changed, regenerate model |
9672 | | - var model = $.wikiEditor.modules.templateEditor.fn.updateModel( $( node ) ); |
9673 | | - |
9674 | | - // Update template name if needed |
9675 | | - if ( $( node ).parent().hasClass( 'wikiEditor-template' ) ) { |
9676 | | - var $label = $( node ).parent().find( '.wikiEditor-template-label' ); |
9677 | | - var displayName = $.wikiEditor.modules.templateEditor.fn.getTemplateDisplayName( model ); |
9678 | | - if ( $label.text() != displayName ) { |
9679 | | - $label.text( displayName ); |
9680 | | - } |
9681 | | - } |
9682 | | - |
9683 | | - // Wrap or unwrap the template if needed |
9684 | | - if ( $( node ).parent().hasClass( 'wikiEditor-template' ) && |
9685 | | - !model.isCollapsible() ) { |
9686 | | - $.wikiEditor.modules.templateEditor.fn.unwrapTemplate( $( node ) ); |
9687 | | - } else if ( !$( node ).parent().hasClass( 'wikiEditor-template' ) && |
9688 | | - model.isCollapsible() ) { |
9689 | | - $.wikiEditor.modules.templateEditor.fn.wrapTemplate( $( node ) ); |
9690 | | - $.wikiEditor.modules.templateEditor.fn.bindTemplateEvents( $( node ) ); |
9691 | | - } |
9692 | | - }, |
9693 | | - getAnchor: function( ca1, ca2 ) { |
9694 | | - return $( ca1.parentNode ).is( 'span.wikiEditor-template-text' ) ? |
9695 | | - ca1.parentNode : null; |
9696 | | - }, |
9697 | | - context: context, |
9698 | | - skipDivision: 'realchange' |
9699 | | - } ); |
9700 | | - } else { //else this was an unmatched opening |
9701 | | - tokenArray[beginIndex].label = 'TEMPLATE_FALSE_BEGIN'; |
9702 | | - tokenIndex = beginIndex; |
9703 | | - } |
9704 | | - }//if opentemplates |
9705 | | - } |
9706 | | - }, //mark |
9707 | | - |
9708 | | - keydown: function( context, event ) { |
9709 | | - // Reset our ignoreKeypress variable if it's set to true |
9710 | | - if ( context.$iframe.data( 'ignoreKeypress' ) ) { |
9711 | | - context.$iframe.data( 'ignoreKeypress', false ); |
9712 | | - } |
9713 | | - var $evtElem = event.jQueryNode; |
9714 | | - if ( $evtElem.hasClass( 'wikiEditor-template-label' ) ) { |
9715 | | - // Allow anything if the command or control key are depressed |
9716 | | - if ( event.ctrlKey || event.metaKey ) return true; |
9717 | | - switch ( event.which ) { |
9718 | | - case 13: // Enter |
9719 | | - $evtElem.click(); |
9720 | | - event.preventDefault(); |
9721 | | - return false; |
9722 | | - case 32: // Space |
9723 | | - $evtElem.parent().siblings( '.wikiEditor-template-expand' ).click(); |
9724 | | - event.preventDefault(); |
9725 | | - return false; |
9726 | | - case 37:// Left |
9727 | | - case 38:// Up |
9728 | | - case 39:// Right |
9729 | | - case 40: //Down |
9730 | | - return true; |
9731 | | - default: |
9732 | | - // Set the ignroreKeypress variable so we don't allow typing if the key is held |
9733 | | - context.$iframe.data( 'ignoreKeypress', true ); |
9734 | | - // Can't type in a template name |
9735 | | - event.preventDefault(); |
9736 | | - return false; |
9737 | | - } |
9738 | | - } else if ( $evtElem.hasClass( 'wikiEditor-template-text' ) ) { |
9739 | | - switch ( event.which ) { |
9740 | | - case 13: // Enter |
9741 | | - // Ensure that the user can't break this by holding in the enter key |
9742 | | - context.$iframe.data( 'ignoreKeypress', true ); |
9743 | | - // FIXME: May be a more elegant way to do this, but this works too |
9744 | | - context.fn.encapsulateSelection( { 'pre': '\n', 'peri': '', 'post': '' } ); |
9745 | | - event.preventDefault(); |
9746 | | - return false; |
9747 | | - default: return true; |
9748 | | - } |
9749 | | - } |
9750 | | - }, |
9751 | | - keyup: function( context, event ) { |
9752 | | - // Rest our ignoreKeypress variable if it's set to true |
9753 | | - if ( context.$iframe.data( 'ignoreKeypress' ) ) { |
9754 | | - context.$iframe.data( 'ignoreKeypress', false ); |
9755 | | - } |
9756 | | - return true; |
9757 | | - }, |
9758 | | - keypress: function( context, event ) { |
9759 | | - // If this event is from a keydown event which we want to block, ignore it |
9760 | | - return ( context.$iframe.data( 'ignoreKeypress' ) ? false : true ); |
9761 | | - } |
9762 | | -}, |
9763 | | -/** |
9764 | | - * Regular expressions that produce tokens |
9765 | | - */ |
9766 | | -exp: [ |
9767 | | - { 'regex': /{{/, 'label': "TEMPLATE_BEGIN" }, |
9768 | | - { 'regex': /}}/, 'label': "TEMPLATE_END", 'markAfter': true } |
9769 | | -], |
9770 | | -/** |
9771 | | - * Configuration |
9772 | | - */ |
9773 | | -cfg: { |
9774 | | -}, |
9775 | | -/** |
9776 | | - * Internally used functions |
9777 | | - */ |
9778 | | -fn: { |
9779 | | - /** |
9780 | | - * Creates template form module within wikieditor |
9781 | | - * @param context Context object of editor to create module in |
9782 | | - * @param config Configuration object to create module from |
9783 | | - */ |
9784 | | - create: function( context, config ) { |
9785 | | - // Initialize module within the context |
9786 | | - context.modules.templateEditor = {}; |
9787 | | - }, |
9788 | | - /** |
9789 | | - * Turns a simple template wrapper (really just a <span>) into a complex one |
9790 | | - * @param $wrapper Wrapping <span> |
9791 | | - */ |
9792 | | - wrapTemplate: function( $wrapper ) { |
9793 | | - var model = $wrapper.data( 'model' ); |
9794 | | - var context = $wrapper.data( 'marker' ).context; |
9795 | | - var $template = $wrapper |
9796 | | - .wrap( '<span class="wikiEditor-template"></span>' ) |
9797 | | - .addClass( 'wikiEditor-template-text wikiEditor-template-text-shrunken' ) |
9798 | | - .parent() |
9799 | | - .addClass( 'wikiEditor-template-collapsed' ) |
9800 | | - .prepend( |
9801 | | - '<span class="wikiEditor-template-expand wikiEditor-noinclude"></span>' + |
9802 | | - '<span class="wikiEditor-template-name wikiEditor-noinclude">' + |
9803 | | - '<span class="wikiEditor-template-label wikiEditor-noinclude">' + |
9804 | | - $.wikiEditor.modules.templateEditor.fn.getTemplateDisplayName( model ) + '</span>' + |
9805 | | - '<span class="wikiEditor-template-dialog wikiEditor-noinclude"></span>' + |
9806 | | - '</span>' |
9807 | | - ); |
9808 | | - }, |
9809 | | - /** |
9810 | | - * Turn a complex template wrapper back into a simple one |
9811 | | - * @param $wrapper Wrapping <span> |
9812 | | - */ |
9813 | | - unwrapTemplate: function( $wrapper ) { |
9814 | | - $wrapper.parent().replaceWith( $wrapper ); |
9815 | | - }, |
9816 | | - /** |
9817 | | - * Bind events to a template |
9818 | | - * @param $wrapper Original wrapper for the template to bind events to |
9819 | | - */ |
9820 | | - bindTemplateEvents: function( $wrapper ) { |
9821 | | - var $template = $wrapper.parent( '.wikiEditor-template' ); |
9822 | | - |
9823 | | - if ( typeof ( opera ) == "undefined" ) { |
9824 | | - $template.parent().attr('contentEditable', 'false'); |
9825 | | - } |
9826 | | - |
9827 | | - $template.click( function(event) {event.preventDefault(); return false;} ) |
9828 | | - |
9829 | | - $template.find( '.wikiEditor-template-name' ) |
9830 | | - .click( function( event ) { |
9831 | | - $.wikiEditor.modules.templateEditor.fn.createDialog( $wrapper ); |
9832 | | - event.stopPropagation(); |
9833 | | - return false; |
9834 | | - } ) |
9835 | | - .mousedown( function( event ) { event.stopPropagation(); return false; } ); |
9836 | | - $template.find( '.wikiEditor-template-expand' ) |
9837 | | - .click( function( event ) { |
9838 | | - $.wikiEditor.modules.templateEditor.fn.toggleWikiTextEditor( $wrapper ); |
9839 | | - event.stopPropagation(); |
9840 | | - return false; |
9841 | | - } ) |
9842 | | - .mousedown( function( event ) { event.stopPropagation(); return false; } ); |
9843 | | - }, |
9844 | | - /** |
9845 | | - * Toggle the visisbilty of the wikitext for a given template |
9846 | | - * @param $wrapper The origianl wrapper we want expand/collapse |
9847 | | - */ |
9848 | | - toggleWikiTextEditor: function( $wrapper ) { |
9849 | | - var context = $wrapper.data( 'marker' ).context; |
9850 | | - var $template = $wrapper.parent( '.wikiEditor-template' ); |
9851 | | - context.fn.purgeOffsets(); |
9852 | | - $template |
9853 | | - .toggleClass( 'wikiEditor-template-expanded' ) |
9854 | | - .toggleClass( 'wikiEditor-template-collapsed' ) ; |
9855 | | - |
9856 | | - var $templateText = $template.find( '.wikiEditor-template-text' ); |
9857 | | - $templateText.toggleClass( 'wikiEditor-template-text-shrunken' ); |
9858 | | - $templateText.toggleClass( 'wikiEditor-template-text-visible' ); |
9859 | | - if( $templateText.hasClass('wikiEditor-template-text-shrunken') ){ |
9860 | | - //we just closed the template |
9861 | | - |
9862 | | - // Update the model if we need to |
9863 | | - if ( $templateText.html() != $templateText.data( 'oldHTML' ) ) { |
9864 | | - var templateModel = $.wikiEditor.modules.templateEditor.fn.updateModel( $templateText ); |
9865 | | - |
9866 | | - //this is the only place the template name can be changed; keep the template name in sync |
9867 | | - var $tLabel = $template.find( '.wikiEditor-template-label' ); |
9868 | | - $tLabel.text( $.wikiEditor.modules.templateEditor.fn.getTemplateDisplayName( templateModel ) ); |
9869 | | - } |
9870 | | - |
9871 | | - } |
9872 | | - }, |
9873 | | - /** |
9874 | | - * Create a dialog for editing a given template and open it |
9875 | | - * @param $wrapper The origianl wrapper for which to create the dialog |
9876 | | - */ |
9877 | | - createDialog: function( $wrapper ) { |
9878 | | - var context = $wrapper.data( 'marker' ).context; |
9879 | | - var $template = $wrapper.parent( '.wikiEditor-template' ); |
9880 | | - var dialog = { |
9881 | | - 'titleMsg': 'wikieditor-template-editor-dialog-title', |
9882 | | - 'id': 'wikiEditor-template-dialog', |
9883 | | - 'html': '\ |
9884 | | - <fieldset>\ |
9885 | | - <div class="wikiEditor-template-dialog-title" />\ |
9886 | | - <div class="wikiEditor-template-dialog-fields" />\ |
9887 | | - </fieldset>', |
9888 | | - init: function() { |
9889 | | - $(this).find( '[rel]' ).each( function() { |
9890 | | - $(this).text( mw.usability.getMsg( $(this).attr( 'rel' ) ) ); |
9891 | | - } ); |
9892 | | - }, |
9893 | | - dialog: { |
9894 | | - width: 600, |
9895 | | - height: 400, |
9896 | | - dialogClass: 'wikiEditor-toolbar-dialog', |
9897 | | - buttons: { |
9898 | | - 'wikieditor-template-editor-dialog-submit': function() { |
9899 | | - // More user feedback |
9900 | | - var $templateDiv = $( this ).data( 'templateDiv' ); |
9901 | | - context.fn.highlightLine( $templateDiv ); |
9902 | | - |
9903 | | - var $templateText = $templateDiv.children( '.wikiEditor-template-text' ); |
9904 | | - var templateModel = $templateText.data( 'model' ); |
9905 | | - $( this ).find( '.wikiEditor-template-dialog-field-wrapper textarea' ).each( function() { |
9906 | | - // Update the value |
9907 | | - templateModel.setValue( $( this ).data( 'name' ), $( this ).val() ); |
9908 | | - }); |
9909 | | - //keep text consistent |
9910 | | - $.wikiEditor.modules.templateEditor.fn.updateModel( $templateText, templateModel ); |
9911 | | - |
9912 | | - $( this ).dialog( 'close' ); |
9913 | | - }, |
9914 | | - 'wikieditor-template-editor-dialog-cancel': function() { |
9915 | | - $(this).dialog( 'close' ); |
9916 | | - } |
9917 | | - }, |
9918 | | - open: function() { |
9919 | | - var $templateDiv = $( this ).data( 'templateDiv' ); |
9920 | | - var $templateText = $templateDiv.children( '.wikiEditor-template-text' ); |
9921 | | - var templateModel = $templateText.data( 'model' ); |
9922 | | - // Update the model if we need to |
9923 | | - if ( $templateText.html() != $templateText.data( 'oldHTML' ) ) { |
9924 | | - templateModel = $.wikiEditor.modules.templateEditor.fn.updateModel( $templateText ); |
9925 | | - } |
9926 | | - |
9927 | | - // Build the table |
9928 | | - // TODO: Be smart and recycle existing table |
9929 | | - var params = templateModel.getAllInitialParams(); |
9930 | | - var $fields = $( this ).find( '.wikiEditor-template-dialog-fields' ); |
9931 | | - // Do some bookkeeping so we can recycle existing rows |
9932 | | - var $rows = $fields.find( '.wikiEditor-template-dialog-field-wrapper' ); |
9933 | | - for ( var paramIndex in params ) { |
9934 | | - var param = params[paramIndex]; |
9935 | | - if ( typeof param.name == 'undefined' ) { |
9936 | | - // param is the template name, skip it |
9937 | | - continue; |
9938 | | - } |
9939 | | - var paramText = typeof param == 'string' ? |
9940 | | - param.name.replace( /[\_\-]/g, ' ' ) : |
9941 | | - param.name; |
9942 | | - var paramVal = templateModel.getValue( param.name ); |
9943 | | - if ( $rows.length > 0 ) { |
9944 | | - // We have another row to recycle |
9945 | | - var $row = $rows.eq( 0 ); |
9946 | | - $row.children( 'label' ).text( paramText ); |
9947 | | - $row.children( 'textarea' ) |
9948 | | - .data( 'name', param.name ) |
9949 | | - .val( paramVal ) |
9950 | | - .each( function() { |
9951 | | - $(this).css( 'height', $(this).val().length > 24 ? '4.5em' : '1.5em' ); |
9952 | | - } ) |
9953 | | - $rows = $rows.not( $row ); |
9954 | | - } else { |
9955 | | - // Create a new row |
9956 | | - var $paramRow = $( '<div />' ) |
9957 | | - .addClass( 'wikiEditor-template-dialog-field-wrapper' ); |
9958 | | - $( '<label />' ) |
9959 | | - .text( paramText ) |
9960 | | - .appendTo( $paramRow ); |
9961 | | - $( '<textarea />' ) |
9962 | | - .data( 'name', param.name ) |
9963 | | - .val( paramVal ) |
9964 | | - .each( function() { |
9965 | | - $(this).css( 'height', $(this).val().length > 24 ? '4.5em' : '1.5em' ); |
9966 | | - } ) |
9967 | | - .data( 'expanded', false ) |
9968 | | - .bind( 'cut paste keypress click change', function( e ) { |
9969 | | - // If this was fired by a tab keypress, let it go |
9970 | | - if ( e.keyCode == '9' ) return true; |
9971 | | - var $this = $( this ); |
9972 | | - setTimeout( function() { |
9973 | | - var expanded = $this.data( 'expanded' ); |
9974 | | - if ( $this.val().indexOf( '\n' ) != -1 || $this.val().length > 24 ) { |
9975 | | - if ( !expanded ) { |
9976 | | - $this.animate( { 'height': '4.5em' }, 'fast' ); |
9977 | | - $this.data( 'expanded', true ); |
9978 | | - } |
9979 | | - } else { |
9980 | | - if ( expanded ) { |
9981 | | - $this.animate( { 'height': '1.5em' }, 'fast' ); |
9982 | | - $this.data( 'expanded', false ); |
9983 | | - } |
9984 | | - } |
9985 | | - }, 0 ); |
9986 | | - } ) |
9987 | | - .appendTo( $paramRow ); |
9988 | | - $paramRow |
9989 | | - .append( '<div style="clear:both"></div>' ) |
9990 | | - .appendTo( $fields ); |
9991 | | - } |
9992 | | - } |
9993 | | - |
9994 | | - // Remove any leftover rows |
9995 | | - $rows.remove(); |
9996 | | - $fields.find( 'label' ).autoEllipsis(); |
9997 | | - // Ensure our close button doesn't recieve the ui-state-focus class |
9998 | | - $( this ).parent( '.ui-dialog' ).find( '.ui-dialog-titlebar-close' ) |
9999 | | - .removeClass( 'ui-state-focus' ); |
10000 | | - |
10001 | | - // Set tabindexes on form fields if needed |
10002 | | - // First unset the tabindexes on the buttons and existing form fields |
10003 | | - // so the order doesn't get messed up |
10004 | | - var $needTabindex = $( this ).closest( '.ui-dialog' ).find( 'button, textarea' ); |
10005 | | - if ( $needTabindex.not( '[tabindex]' ).length ) { |
10006 | | - // Only do this if there actually are elements missing a tabindex |
10007 | | - $needTabindex.removeAttr( 'tabindex' ); |
10008 | | - $.wikiEditor.modules.dialogs.fn.setTabindexes( $needTabindex ); |
10009 | | - } |
10010 | | - } |
10011 | | - } |
10012 | | - }; |
10013 | | - // Lazy-create the dialog at this time |
10014 | | - context.$textarea.wikiEditor( 'addDialog', { 'templateEditor': dialog } ); |
10015 | | - $( '#' + dialog.id ) |
10016 | | - .data( 'templateDiv', $template ) |
10017 | | - .dialog( 'open' ); |
10018 | | - }, |
10019 | | - /** |
10020 | | - * Update a template's model and HTML |
10021 | | - * @param $templateText Wrapper <span> containing the template text |
10022 | | - * @param model Template model to use, will be generated if not set |
10023 | | - * @return model object |
10024 | | - */ |
10025 | | - updateModel: function( $templateText, model ) { |
10026 | | - var context = $templateText.data( 'marker' ).context; |
10027 | | - var text; |
10028 | | - if ( typeof model == 'undefined' ) { |
10029 | | - text = context.fn.htmlToText( $templateText.html() ); |
10030 | | - } else { |
10031 | | - text = model.getText(); |
10032 | | - } |
10033 | | - // To keep stuff simple but not break it, we need to do encode newlines as <br>s |
10034 | | - $templateText.text( text ); |
10035 | | - $templateText.html( $templateText.html().replace( /\n/g, '<br />' ) ); |
10036 | | - $templateText.data( 'oldHTML', $templateText.html() ); |
10037 | | - if ( typeof model == 'undefined' ) { |
10038 | | - model = new $.wikiEditor.modules.templateEditor.fn.model( text ); |
10039 | | - $templateText.data( 'model', model ); |
10040 | | - } |
10041 | | - return model; |
10042 | | - }, |
10043 | | - |
10044 | | - /** |
10045 | | - * Gets template display name |
10046 | | - */ |
10047 | | - getTemplateDisplayName: function ( model ) { |
10048 | | - var tName = model.getName(); |
10049 | | - if( model.getValue( 'name' ) != '' ) { |
10050 | | - return tName + ': ' + model.getValue( 'name' ); |
10051 | | - } else if( model.getValue( 'Name' ) != '' ) { |
10052 | | - return tName + ': ' + model.getValue( 'Name' ); |
10053 | | - } else if( tName.toLowerCase() in $.wikiEditor.modules.templateEditor.nameMappings ) { |
10054 | | - return tName + ': ' + model.getValue( $.wikiEditor.modules.templateEditor.nameMappings[tName.toLowerCase()] ); |
10055 | | - } |
10056 | | - return tName; |
10057 | | - }, |
10058 | | - |
10059 | | - /** |
10060 | | - * Builds a template model from given wikitext representation, allowing object-oriented manipulation of the contents |
10061 | | - * of the template while preserving whitespace and formatting. |
10062 | | - * |
10063 | | - * @param wikitext String of wikitext content |
10064 | | - */ |
10065 | | - model: function( wikitext ) { |
10066 | | - |
10067 | | - /* Private members */ |
10068 | | - |
10069 | | - var collapsible = true; |
10070 | | - |
10071 | | - /* Private Functions */ |
10072 | | - |
10073 | | - /** |
10074 | | - * Builds a Param object. |
10075 | | - * |
10076 | | - * @param name |
10077 | | - * @param value |
10078 | | - * @param number |
10079 | | - * @param nameIndex |
10080 | | - * @param equalsIndex |
10081 | | - * @param valueIndex |
10082 | | - */ |
10083 | | - function Param( name, value, number, nameIndex, equalsIndex, valueIndex ) { |
10084 | | - this.name = name; |
10085 | | - this.value = value; |
10086 | | - this.number = number; |
10087 | | - this.nameIndex = nameIndex; |
10088 | | - this.equalsIndex = equalsIndex; |
10089 | | - this.valueIndex = valueIndex; |
10090 | | - } |
10091 | | - /** |
10092 | | - * Builds a Range object. |
10093 | | - * |
10094 | | - * @param begin |
10095 | | - * @param end |
10096 | | - */ |
10097 | | - function Range( begin, end ) { |
10098 | | - this.begin = begin; |
10099 | | - this.end = end; |
10100 | | - } |
10101 | | - /** |
10102 | | - * Set 'original' to true if you want the original value irrespective of whether the model's been changed |
10103 | | - * |
10104 | | - * @param name |
10105 | | - * @param value |
10106 | | - * @param original |
10107 | | - */ |
10108 | | - function getSetValue( name, value, original ) { |
10109 | | - var valueRange; |
10110 | | - var rangeIndex; |
10111 | | - var retVal; |
10112 | | - if ( isNaN( name ) ) { |
10113 | | - // It's a string! |
10114 | | - if ( typeof paramsByName[name] == 'undefined' ) { |
10115 | | - // Does not exist |
10116 | | - return ""; |
10117 | | - } |
10118 | | - rangeIndex = paramsByName[name]; |
10119 | | - } else { |
10120 | | - // It's a number! |
10121 | | - rangeIndex = parseInt( name ); |
10122 | | - } |
10123 | | - if ( typeof params[rangeIndex] == 'undefined' ) { |
10124 | | - // Does not exist |
10125 | | - return ""; |
10126 | | - } |
10127 | | - valueRange = ranges[params[rangeIndex].valueIndex]; |
10128 | | - if ( typeof valueRange.newVal == 'undefined' || original ) { |
10129 | | - // Value unchanged, return original wikitext |
10130 | | - retVal = wikitext.substring( valueRange.begin, valueRange.end ); |
10131 | | - } else { |
10132 | | - // New value exists, return new value |
10133 | | - retVal = valueRange.newVal; |
10134 | | - } |
10135 | | - if ( value != null ) { |
10136 | | - ranges[params[rangeIndex].valueIndex].newVal = value; |
10137 | | - } |
10138 | | - return retVal; |
10139 | | - }; |
10140 | | - |
10141 | | - /* Public Functions */ |
10142 | | - |
10143 | | - /** |
10144 | | - * Get template name |
10145 | | - */ |
10146 | | - this.getName = function() { |
10147 | | - if( typeof ranges[templateNameIndex].newVal == 'undefined' ) { |
10148 | | - return wikitext.substring( ranges[templateNameIndex].begin, ranges[templateNameIndex].end ); |
10149 | | - } else { |
10150 | | - return ranges[templateNameIndex].newVal; |
10151 | | - } |
10152 | | - }; |
10153 | | - /** |
10154 | | - * Set template name (if we want to support this) |
10155 | | - * |
10156 | | - * @param name |
10157 | | - */ |
10158 | | - this.setName = function( name ) { |
10159 | | - ranges[templateNameIndex].newVal = name; |
10160 | | - }; |
10161 | | - /** |
10162 | | - * Set value for a given param name / number |
10163 | | - * |
10164 | | - * @param name |
10165 | | - * @param value |
10166 | | - */ |
10167 | | - this.setValue = function( name, value ) { |
10168 | | - return getSetValue( name, value, false ); |
10169 | | - }; |
10170 | | - /** |
10171 | | - * Get value for a given param name / number |
10172 | | - * |
10173 | | - * @param name |
10174 | | - */ |
10175 | | - this.getValue = function( name ) { |
10176 | | - return getSetValue( name, null, false ); |
10177 | | - }; |
10178 | | - /** |
10179 | | - * Get original value of a param |
10180 | | - * |
10181 | | - * @param name |
10182 | | - */ |
10183 | | - this.getOriginalValue = function( name ) { |
10184 | | - return getSetValue( name, null, true ); |
10185 | | - }; |
10186 | | - /** |
10187 | | - * Get a list of all param names (numbers for the anonymous ones) |
10188 | | - */ |
10189 | | - this.getAllParamNames = function() { |
10190 | | - return paramsByName; |
10191 | | - }; |
10192 | | - /** |
10193 | | - * Get the initial params |
10194 | | - */ |
10195 | | - this.getAllInitialParams = function(){ |
10196 | | - return params; |
10197 | | - } |
10198 | | - /** |
10199 | | - * Get original template text |
10200 | | - */ |
10201 | | - this.getOriginalText = function() { |
10202 | | - return wikitext; |
10203 | | - }; |
10204 | | - /** |
10205 | | - * Get modified template text |
10206 | | - */ |
10207 | | - this.getText = function() { |
10208 | | - newText = ""; |
10209 | | - for ( i = 0 ; i < ranges.length; i++ ) { |
10210 | | - if( typeof ranges[i].newVal == 'undefined' ) { |
10211 | | - newText += wikitext.substring( ranges[i].begin, ranges[i].end ); |
10212 | | - } else { |
10213 | | - newText += ranges[i].newVal; |
10214 | | - } |
10215 | | - } |
10216 | | - return newText; |
10217 | | - }; |
10218 | | - |
10219 | | - this.isCollapsible = function() { |
10220 | | - return collapsible; |
10221 | | - } |
10222 | | - |
10223 | | - /** |
10224 | | - * Update ranges if there's been a change in one or more 'segments' of the template. |
10225 | | - * Removes adjustment function so adjustment is only made once ever. |
10226 | | - */ |
10227 | | - |
10228 | | - this.updateRanges = function() { |
10229 | | - var adjustment = 0; |
10230 | | - for (var i = 0 ; i < ranges.length; i++ ) { |
10231 | | - ranges[i].begin += adjustment; |
10232 | | - if( typeof ranges[i].adjust != 'undefined' ) { |
10233 | | - adjustment += ranges[i].adjust(); |
10234 | | - // NOTE: adjust should be a function that has the information necessary to calculate the length of |
10235 | | - // this 'segment' |
10236 | | - delete ranges[i].adjust; |
10237 | | - } |
10238 | | - ranges[i].end += adjustment; |
10239 | | - } |
10240 | | - }; |
10241 | | - |
10242 | | - // Whitespace* {{ whitespace* nonwhitespace: |
10243 | | - if ( wikitext.match( /\s*{{\s*[^\s|]*:/ ) ) { |
10244 | | - collapsible = false; // is a parser function |
10245 | | - } |
10246 | | - /* |
10247 | | - * Take all template-specific characters that are not particular to the template we're looking at, namely {|=}, |
10248 | | - * and convert them into something harmless, in this case 'X' |
10249 | | - */ |
10250 | | - // Get rid of first {{ with whitespace |
10251 | | - var sanatizedStr = wikitext.replace( /{{/, " " ); |
10252 | | - // Replace end |
10253 | | - endBraces = sanatizedStr.match( /}}\s*$/ ); |
10254 | | - if ( endBraces ) { |
10255 | | - sanatizedStr = sanatizedStr.substring( 0, endBraces.index ) + " " + |
10256 | | - sanatizedStr.substring( endBraces.index + 2 ); |
10257 | | - } |
10258 | | - |
10259 | | - |
10260 | | - //treat HTML comments like whitespace |
10261 | | - while ( sanatizedStr.indexOf( '<!' ) != -1 ) { |
10262 | | - startIndex = sanatizedStr.indexOf( '<!' ); |
10263 | | - endIndex = sanatizedStr.indexOf('-->') + 3; |
10264 | | - if( endIndex < 3 ){ |
10265 | | - break; |
10266 | | - } |
10267 | | - sanatizedSegment = sanatizedStr.substring( startIndex,endIndex ).replace( /\S/g , ' ' ); |
10268 | | - sanatizedStr = |
10269 | | - sanatizedStr.substring( 0, startIndex ) + sanatizedSegment + sanatizedStr.substring( endIndex ); |
10270 | | - } |
10271 | | - |
10272 | | - // Match the open braces we just found with equivalent closing braces note, works for any level of braces |
10273 | | - while ( sanatizedStr.indexOf( '{{' ) != -1 ) { |
10274 | | - startIndex = sanatizedStr.indexOf( '{{' ) + 1; |
10275 | | - openBraces = 2; |
10276 | | - endIndex = startIndex; |
10277 | | - while ( (openBraces > 0) && (endIndex < sanatizedStr.length) ) { |
10278 | | - var brace = sanatizedStr[++endIndex]; |
10279 | | - openBraces += brace == '}' ? -1 : brace == '{' ? 1 : 0; |
10280 | | - } |
10281 | | - sanatizedSegment = sanatizedStr.substring( startIndex,endIndex ).replace( /[{}|=]/g , 'X' ); |
10282 | | - sanatizedStr = |
10283 | | - sanatizedStr.substring( 0, startIndex ) + sanatizedSegment + sanatizedStr.substring( endIndex ); |
10284 | | - } |
10285 | | - //links, images, etc, which also can nest |
10286 | | - while ( sanatizedStr.indexOf( '[[' ) != -1 ) { |
10287 | | - startIndex = sanatizedStr.indexOf( '[[' ) + 1; |
10288 | | - openBraces = 2; |
10289 | | - endIndex = startIndex; |
10290 | | - while ( (openBraces > 0) && (endIndex < sanatizedStr.length) ) { |
10291 | | - var brace = sanatizedStr[++endIndex]; |
10292 | | - openBraces += brace == ']' ? -1 : brace == '[' ? 1 : 0; |
10293 | | - } |
10294 | | - sanatizedSegment = sanatizedStr.substring( startIndex,endIndex ).replace( /[\[\]|=]/g , 'X' ); |
10295 | | - sanatizedStr = |
10296 | | - sanatizedStr.substring( 0, startIndex ) + sanatizedSegment + sanatizedStr.substring( endIndex ); |
10297 | | - } |
10298 | | - |
10299 | | - /* |
10300 | | - * Parse 1 param at a time |
10301 | | - */ |
10302 | | - var ranges = []; |
10303 | | - var params = []; |
10304 | | - var templateNameIndex = 0; |
10305 | | - var doneParsing = false; |
10306 | | - oldDivider = 0; |
10307 | | - divider = sanatizedStr.indexOf( '|', oldDivider ); |
10308 | | - if ( divider == -1 ) { |
10309 | | - divider = sanatizedStr.length; |
10310 | | - doneParsing = true; |
10311 | | - collapsible = false; //zero params |
10312 | | - } |
10313 | | - nameMatch = sanatizedStr.substring( 0, divider ).match( /[^\s]/ ); |
10314 | | - if ( nameMatch != null ) { |
10315 | | - ranges.push( new Range( 0 ,nameMatch.index ) ); //whitespace and squiggles upto the name |
10316 | | - nameEndMatch = sanatizedStr.substring( 0 , divider ).match( /[^\s]\s*$/ ); //last nonwhitespace character |
10317 | | - templateNameIndex = ranges.push( new Range( nameMatch.index, |
10318 | | - nameEndMatch.index + 1 ) ); |
10319 | | - templateNameIndex--; //push returns 1 less than the array |
10320 | | - ranges[templateNameIndex].old = wikitext.substring( ranges[templateNameIndex].begin, |
10321 | | - ranges[templateNameIndex].end ); |
10322 | | - } else { |
10323 | | - ranges.push(new Range(0,0)); |
10324 | | - ranges[templateNameIndex].old = ""; |
10325 | | - } |
10326 | | - params.push( ranges[templateNameIndex].old ); //put something in params (0) |
10327 | | - /* |
10328 | | - * Start looping over params |
10329 | | - */ |
10330 | | - var currentParamNumber = 0; |
10331 | | - var valueEndIndex = ranges[templateNameIndex].end; |
10332 | | - var paramsByName = []; |
10333 | | - while ( !doneParsing ) { |
10334 | | - currentParamNumber++; |
10335 | | - oldDivider = divider; |
10336 | | - divider = sanatizedStr.indexOf( '|', oldDivider + 1 ); |
10337 | | - if ( divider == -1 ) { |
10338 | | - divider = sanatizedStr.length; |
10339 | | - doneParsing = true; |
10340 | | - } |
10341 | | - currentField = sanatizedStr.substring( oldDivider+1, divider ); |
10342 | | - if ( currentField.indexOf( '=' ) == -1 ) { |
10343 | | - // anonymous field, gets a number |
10344 | | - |
10345 | | - //default values, since we'll allow empty values |
10346 | | - valueBeginIndex = oldDivider + 1; |
10347 | | - valueEndIndex = oldDivider + 1; |
10348 | | - |
10349 | | - valueBegin = currentField.match( /\S+/ ); //first nonwhitespace character |
10350 | | - if( valueBegin != null ){ |
10351 | | - valueBeginIndex = valueBegin.index + oldDivider+1; |
10352 | | - valueEnd = currentField.match( /[^\s]\s*$/ ); //last nonwhitespace character |
10353 | | - if( valueEnd == null ){ //ie |
10354 | | - continue; |
10355 | | - } |
10356 | | - valueEndIndex = valueEnd.index + oldDivider + 2; |
10357 | | - } |
10358 | | - ranges.push( new Range( ranges[ranges.length-1].end, |
10359 | | - valueBeginIndex ) ); //all the chars upto now |
10360 | | - nameIndex = ranges.push( new Range( valueBeginIndex, valueBeginIndex ) ) - 1; |
10361 | | - equalsIndex = ranges.push( new Range( valueBeginIndex, valueBeginIndex ) ) - 1; |
10362 | | - valueIndex = ranges.push( new Range( valueBeginIndex, valueEndIndex ) ) - 1; |
10363 | | - params.push( new Param( |
10364 | | - currentParamNumber, |
10365 | | - wikitext.substring( ranges[valueIndex].begin, ranges[valueIndex].end ), |
10366 | | - currentParamNumber, |
10367 | | - nameIndex, |
10368 | | - equalsIndex, |
10369 | | - valueIndex |
10370 | | - ) ); |
10371 | | - paramsByName[currentParamNumber] = currentParamNumber; |
10372 | | - } else { |
10373 | | - // There's an equals, could be comment or a value pair |
10374 | | - currentName = currentField.substring( 0, currentField.indexOf( '=' ) ); |
10375 | | - // Still offset by oldDivider - first nonwhitespace character |
10376 | | - nameBegin = currentName.match( /\S+/ ); |
10377 | | - if ( nameBegin == null ) { |
10378 | | - // This is a comment inside a template call / parser abuse. let's not encourage it |
10379 | | - currentParamNumber--; |
10380 | | - continue; |
10381 | | - } |
10382 | | - nameBeginIndex = nameBegin.index + oldDivider + 1; |
10383 | | - // Last nonwhitespace and non } character |
10384 | | - nameEnd = currentName.match( /[^\s]\s*$/ ); |
10385 | | - if( nameEnd == null ){ //ie |
10386 | | - continue; |
10387 | | - } |
10388 | | - nameEndIndex = nameEnd.index + oldDivider + 2; |
10389 | | - // All the chars upto now |
10390 | | - ranges.push( new Range( ranges[ranges.length-1].end, nameBeginIndex ) ); |
10391 | | - nameIndex = ranges.push( new Range( nameBeginIndex, nameEndIndex ) ) - 1; |
10392 | | - currentValue = currentField.substring( currentField.indexOf( '=' ) + 1); |
10393 | | - oldDivider += currentField.indexOf( '=' ) + 1; |
10394 | | - |
10395 | | - //default values, since we'll allow empty values |
10396 | | - valueBeginIndex = oldDivider + 1; |
10397 | | - valueEndIndex = oldDivider + 1; |
10398 | | - |
10399 | | - // First nonwhitespace character |
10400 | | - valueBegin = currentValue.match( /\S+/ ); |
10401 | | - if( valueBegin != null ){ |
10402 | | - valueBeginIndex = valueBegin.index + oldDivider + 1; |
10403 | | - // Last nonwhitespace and non } character |
10404 | | - valueEnd = currentValue.match( /[^\s]\s*$/ ); |
10405 | | - if( valueEnd == null ){ //ie |
10406 | | - continue; |
10407 | | - } |
10408 | | - valueEndIndex = valueEnd.index + oldDivider + 2; |
10409 | | - } |
10410 | | - // All the chars upto now |
10411 | | - equalsIndex = ranges.push( new Range( ranges[ranges.length-1].end, valueBeginIndex) ) - 1; |
10412 | | - valueIndex = ranges.push( new Range( valueBeginIndex, valueEndIndex ) ) - 1; |
10413 | | - params.push( new Param( |
10414 | | - wikitext.substring( nameBeginIndex, nameEndIndex ), |
10415 | | - wikitext.substring( valueBeginIndex, valueEndIndex ), |
10416 | | - currentParamNumber, |
10417 | | - nameIndex, |
10418 | | - equalsIndex, |
10419 | | - valueIndex |
10420 | | - ) ); |
10421 | | - paramsByName[wikitext.substring( nameBeginIndex, nameEndIndex )] = currentParamNumber; |
10422 | | - } |
10423 | | - } |
10424 | | - // The rest of the string |
10425 | | - ranges.push( new Range( valueEndIndex, wikitext.length ) ); |
10426 | | - |
10427 | | - // Save vars |
10428 | | - this.ranges = ranges; |
10429 | | - this.wikitext = wikitext; |
10430 | | - this.params = params; |
10431 | | - this.paramsByName = paramsByName; |
10432 | | - this.templateNameIndex = templateNameIndex; |
10433 | | - } //model |
10434 | | -} |
10435 | | -}; } )( jQuery ); |
10436 | | -/* TOC Module for wikiEditor */ |
10437 | | -( function( $ ) { $.wikiEditor.modules.toc = { |
10438 | | - |
10439 | | -/** |
10440 | | - * Compatability map |
10441 | | - */ |
10442 | | -'browsers': { |
10443 | | - // Left-to-right languages |
10444 | | - 'ltr': { |
10445 | | - 'msie': [['>=', 7]], |
10446 | | - 'firefox': [['>=', 3]], |
10447 | | - 'opera': [['>=', 10]], |
10448 | | - 'safari': [['>=', 4]], |
10449 | | - 'chrome': [['>=', 4]] |
10450 | | - }, |
10451 | | - // Right-to-left languages |
10452 | | - 'rtl': { |
10453 | | - 'msie': [['>=', 8]], |
10454 | | - 'firefox': [['>=', 3]], |
10455 | | - 'opera': [['>=', 10]], |
10456 | | - 'safari': [['>=', 4]], |
10457 | | - 'chrome': [['>=', 4]] |
10458 | | - } |
10459 | | -}, |
10460 | | -/** |
10461 | | - * Core Requirements |
10462 | | - */ |
10463 | | -'req': [ 'iframe' ], |
10464 | | -'name': 'toc', |
10465 | | -/** |
10466 | | - * Configuration |
10467 | | - */ |
10468 | | -cfg: { |
10469 | | - // Default width of table of contents |
10470 | | - defaultWidth: '166px', |
10471 | | - // Minimum width to allow resizing to before collapsing the table of contents - used when resizing and collapsing |
10472 | | - minimumWidth: '70px', |
10473 | | - // Minimum width of the wikiText area |
10474 | | - textMinimumWidth: '450px', |
10475 | | - // The style property to be used for positioning the flexible module in regular mode |
10476 | | - flexProperty: 'marginRight', |
10477 | | - // Boolean var indicating text direction |
10478 | | - rtl: false |
10479 | | -}, |
10480 | | -/** |
10481 | | - * API accessible functions |
10482 | | - */ |
10483 | | -api: { |
10484 | | - // |
10485 | | -}, |
10486 | | -/** |
10487 | | - * Event handlers |
10488 | | - */ |
10489 | | -evt: { |
10490 | | - change: function( context, event ) { |
10491 | | - $.wikiEditor.modules.toc.fn.update( context ); |
10492 | | - }, |
10493 | | - ready: function( context, event ) { |
10494 | | - // Add the TOC to the document |
10495 | | - $.wikiEditor.modules.toc.fn.build( context ); |
10496 | | - context.$content.parent() |
10497 | | - .blur( function() { |
10498 | | - var context = event.data.context; |
10499 | | - $.wikiEditor.modules.toc.fn.unhighlight( context ); |
10500 | | - }); |
10501 | | - $.wikiEditor.modules.toc.evt.resize( context ); |
10502 | | - }, |
10503 | | - resize: function( context, event ) { |
10504 | | - var availableWidth = context.$wikitext.width() - parseFloat( $.wikiEditor.modules.toc.cfg.textMinimumWidth ), |
10505 | | - totalMinWidth = parseFloat( $.wikiEditor.modules.toc.cfg.minimumWidth ) + |
10506 | | - parseFloat( $.wikiEditor.modules.toc.cfg.textMinimumWidth ); |
10507 | | - context.$ui.find( '.wikiEditor-ui-right' ) |
10508 | | - .resizable( 'option', 'maxWidth', availableWidth ); |
10509 | | - if ( context.modules.toc.$toc.data( 'positionMode' ) != 'disabled' && |
10510 | | - context.$wikitext.width() < totalMinWidth ) { |
10511 | | - $.wikiEditor.modules.toc.fn.disable( context ); |
10512 | | - } else if ( context.modules.toc.$toc.data( 'positionMode' ) == 'disabled' && |
10513 | | - context.$wikitext.width() > totalMinWidth ) { |
10514 | | - $.wikiEditor.modules.toc.fn.enable( context ); |
10515 | | - } else if ( context.modules.toc.$toc.data( 'positionMode' ) == 'regular' && |
10516 | | - context.$ui.find( '.wikiEditor-ui-right' ).width() > availableWidth ) { |
10517 | | - //switch mode |
10518 | | - $.wikiEditor.modules.toc.fn.switchLayout( context ); |
10519 | | - } else if ( context.modules.toc.$toc.data( 'positionMode' ) == 'goofy' && |
10520 | | - context.modules.toc.$toc.data( 'previousWidth' ) < context.$wikitext.width() ) { |
10521 | | - //switch mode |
10522 | | - $.wikiEditor.modules.toc.fn.switchLayout( context ); |
10523 | | - } |
10524 | | - if ( context.modules.toc.$toc.data( 'positionMode' ) == 'goofy' ) { |
10525 | | - context.modules.toc.$toc.find( 'div' ).autoEllipsis( |
10526 | | - { 'position': 'right', 'tooltip': true, 'restoreText': true } |
10527 | | - ); |
10528 | | - } |
10529 | | - // reset the height of the TOC |
10530 | | - if ( !context.modules.toc.$toc.data( 'collapsed' ) ){ |
10531 | | - context.modules.toc.$toc.height( |
10532 | | - context.$ui.find( '.wikiEditor-ui-left' ).height() - |
10533 | | - context.$ui.find( '.tab-toc' ).outerHeight() |
10534 | | - ); |
10535 | | - } |
10536 | | - |
10537 | | - // store the width of the view for comparison on next resize |
10538 | | - context.modules.toc.$toc.data( 'previousWidth', context.$wikitext.width() ); |
10539 | | - }, |
10540 | | - mark: function( context, event ) { |
10541 | | - var hash = ''; |
10542 | | - var markers = context.modules.highlight.markers; |
10543 | | - var tokenArray = context.modules.highlight.tokenArray; |
10544 | | - var outline = context.data.outline = []; |
10545 | | - var h = 0; |
10546 | | - for ( var i = 0; i < tokenArray.length; i++ ) { |
10547 | | - if ( tokenArray[i].label != 'TOC_HEADER' ) { |
10548 | | - continue; |
10549 | | - } |
10550 | | - h++; |
10551 | | - markers.push( { |
10552 | | - index: h, |
10553 | | - start: tokenArray[i].tokenStart, |
10554 | | - end: tokenArray[i].offset, |
10555 | | - type: 'toc', |
10556 | | - anchor: 'tag', |
10557 | | - afterWrap: function( node ) { |
10558 | | - var marker = $( node ).data( 'marker' ); |
10559 | | - $( node ).addClass( 'wikiEditor-toc-header' ) |
10560 | | - .addClass( 'wikiEditor-toc-section-' + marker.index ) |
10561 | | - .data( 'section', marker.index ); |
10562 | | - }, |
10563 | | - beforeUnwrap: function( node ) { |
10564 | | - $( node ).removeClass( 'wikiEditor-toc-header' ) |
10565 | | - .removeClass( 'wikiEditor-toc-section-' + $( node ).data( 'section' ) ); |
10566 | | - }, |
10567 | | - onSkip: function( node ) { |
10568 | | - var marker = $( node ).data( 'marker' ); |
10569 | | - if ( $( node ).data( 'section' ) != marker.index ) { |
10570 | | - $( node ) |
10571 | | - .removeClass( 'wikiEditor-toc-section-' + $( node ).data( 'section' ) ) |
10572 | | - .addClass( 'wikiEditor-toc-section-' + marker.index ) |
10573 | | - .data( 'section', marker.index ); |
10574 | | - } |
10575 | | - }, |
10576 | | - getAnchor: function( ca1, ca2 ) { |
10577 | | - return $( ca1.parentNode ).is( '.wikiEditor-toc-header' ) ? |
10578 | | - ca1.parentNode : null; |
10579 | | - } |
10580 | | - } ); |
10581 | | - hash += tokenArray[i].match[2] + '\n'; |
10582 | | - outline.push ( { |
10583 | | - 'text': tokenArray[i].match[2], |
10584 | | - 'level': tokenArray[i].match[1].length, |
10585 | | - 'index': h |
10586 | | - } ); |
10587 | | - } |
10588 | | - // Only update the TOC if it's been changed - we do this by comparing a hash of the headings this time to last |
10589 | | - if ( typeof context.modules.toc.lastHash == 'undefined' || context.modules.toc.lastHash !== hash ) { |
10590 | | - $.wikiEditor.modules.toc.fn.build( context ); |
10591 | | - $.wikiEditor.modules.toc.fn.update( context ); |
10592 | | - // Remember the changed version |
10593 | | - context.modules.toc.lastHash = hash; |
10594 | | - } |
10595 | | - } |
10596 | | -}, |
10597 | | -exp: [ |
10598 | | - { 'regex': /^(={1,6})([^\r\n]+?)\1\s*$/m, 'label': 'TOC_HEADER', 'markAfter': true } |
10599 | | -], |
10600 | | -/** |
10601 | | - * Internally used functions |
10602 | | - */ |
10603 | | -fn: { |
10604 | | - /** |
10605 | | - * Creates a table of contents module within a wikiEditor |
10606 | | - * |
10607 | | - * @param {Object} context Context object of editor to create module in |
10608 | | - * @param {Object} config Configuration object to create module from |
10609 | | - */ |
10610 | | - create: function( context, config ) { |
10611 | | - if ( '$toc' in context.modules.toc ) { |
10612 | | - return; |
10613 | | - } |
10614 | | - $.wikiEditor.modules.toc.cfg.rtl = config.rtl; |
10615 | | - $.wikiEditor.modules.toc.cfg.flexProperty = config.rtl ? 'marginLeft' : 'marginRight'; |
10616 | | - var height = context.$ui.find( '.wikiEditor-ui-left' ).height(); |
10617 | | - context.modules.toc.$toc = $( '<div />' ) |
10618 | | - .addClass( 'wikiEditor-ui-toc' ) |
10619 | | - .data( 'context', context ) |
10620 | | - .data( 'positionMode', 'regular' ) |
10621 | | - .data( 'collapsed', false ); |
10622 | | - context.$ui.find( '.wikiEditor-ui-right' ) |
10623 | | - .append( context.modules.toc.$toc ); |
10624 | | - context.modules.toc.$toc.height( |
10625 | | - context.$ui.find( '.wikiEditor-ui-left' ).height() |
10626 | | - ); |
10627 | | - $.wikiEditor.modules.toc.fn.redraw( context, $.wikiEditor.modules.toc.cfg.defaultWidth ); |
10628 | | - }, |
10629 | | - |
10630 | | - |
10631 | | - redraw: function( context, fixedWidth ) { |
10632 | | - var fixedWidth = parseFloat( fixedWidth ); |
10633 | | - if( context.modules.toc.$toc.data( 'positionMode' ) == 'regular' ) { |
10634 | | - context.$ui.find( '.wikiEditor-ui-right' ) |
10635 | | - .css( 'width', fixedWidth + 'px' ); |
10636 | | - context.$ui.find( '.wikiEditor-ui-left' ) |
10637 | | - .css( $.wikiEditor.modules.toc.cfg.flexProperty, ( -1 * fixedWidth ) + 'px' ) |
10638 | | - .children() |
10639 | | - .css( $.wikiEditor.modules.toc.cfg.flexProperty, fixedWidth + 'px' ); |
10640 | | - } else if( context.modules.toc.$toc.data( 'positionMode' ) == 'goofy' ) { |
10641 | | - context.$ui.find( '.wikiEditor-ui-left' ) |
10642 | | - .css( 'width', fixedWidth ); |
10643 | | - context.$ui.find( '.wikiEditor-ui-right' ) |
10644 | | - .css( $.wikiEditor.modules.toc.cfg.rtl ? 'right': 'left', fixedWidth ); |
10645 | | - context.$wikitext.css( 'height', context.$ui.find( '.wikiEditor-ui-right' ).height() ); |
10646 | | - } |
10647 | | - }, |
10648 | | - switchLayout: function( context ) { |
10649 | | - var width, |
10650 | | - height = context.$ui.find( '.wikiEditor-ui-right' ).height(); |
10651 | | - if( context.modules.toc.$toc.data( 'positionMode' ) == 'regular' |
10652 | | - && !context.modules.toc.$toc.data( 'collapsed' ) ) { |
10653 | | - // store position mode |
10654 | | - context.modules.toc.$toc.data( 'positionMode', 'goofy' ); |
10655 | | - // store the width of the TOC, to ensure we dont allow it to be larger than this when switching back |
10656 | | - context.modules.toc.$toc.data( 'positionModeChangeAt', |
10657 | | - context.$ui.find( '.wikiEditor-ui-right' ).width() ); |
10658 | | - width = $.wikiEditor.modules.toc.cfg.textMinimumWidth; |
10659 | | - // set our styles for goofy mode |
10660 | | - context.$ui.find( '.wikiEditor-ui-left' ) |
10661 | | - .css( $.wikiEditor.modules.toc.cfg.flexProperty, '') |
10662 | | - .css( { 'position': 'absolute', 'float': 'none', |
10663 | | - 'left': $.wikiEditor.modules.toc.cfg.rtl ? 'auto': 0, |
10664 | | - 'right' : $.wikiEditor.modules.toc.cfg.rtl ? 0 : 'auto' } ) |
10665 | | - .children() |
10666 | | - .css( $.wikiEditor.modules.toc.cfg.flexProperty, '' ); |
10667 | | - context.$ui.find( '.wikiEditor-ui-right' ) |
10668 | | - .css( { 'width': 'auto', 'position': 'absolute', 'float': 'none', |
10669 | | - 'right': $.wikiEditor.modules.toc.cfg.rtl ? 'auto': 0, |
10670 | | - 'left' : $.wikiEditor.modules.toc.cfg.rtl ? 0 : 'auto' } ); |
10671 | | - context.$wikitext |
10672 | | - .css( 'position', 'relative' ); |
10673 | | - } else if ( context.modules.toc.$toc.data( 'positionMode' ) == 'goofy' ) { |
10674 | | - // store position mode |
10675 | | - context.modules.toc.$toc.data( 'positionMode', 'regular' ); |
10676 | | - // set width |
10677 | | - width = context.$wikitext.width() - context.$ui.find( '.wikiEditor-ui-left' ).width(); |
10678 | | - if ( width > context.modules.toc.$toc.data( 'positionModeChangeAt' ) ) { |
10679 | | - width = context.modules.toc.$toc.data( 'positionModeChangeAt' ); |
10680 | | - } |
10681 | | - // set our styles for regular mode |
10682 | | - context.$wikitext |
10683 | | - .css( { 'position': '', 'height': '' } ); |
10684 | | - context.$ui.find( '.wikiEditor-ui-right' ) |
10685 | | - .css( $.wikiEditor.modules.toc.cfg.flexProperty, '' ) |
10686 | | - .css( { 'position': '', 'left': '', 'right': '', 'float': '', 'top': '', 'height': '' } ); |
10687 | | - context.$ui.find( '.wikiEditor-ui-left' ) |
10688 | | - .css( { 'width': '', 'position': '', 'left': '', 'float': '', 'right': '' } ); |
10689 | | - } |
10690 | | - $.wikiEditor.modules.toc.fn.redraw( context, width ); |
10691 | | - }, |
10692 | | - disable: function( context ) { |
10693 | | - if ( context.modules.toc.$toc.data( 'collapsed' ) ) { |
10694 | | - context.$ui.find( '.wikiEditor-ui-toc-expandControl' ).hide(); |
10695 | | - } else { |
10696 | | - if( context.modules.toc.$toc.data( 'positionMode' ) == 'goofy' ) { |
10697 | | - $.wikiEditor.modules.toc.fn.switchLayout( context ); |
10698 | | - } |
10699 | | - context.$ui.find( '.wikiEditor-ui-right' ).hide(); |
10700 | | - context.$ui.find( '.wikiEditor-ui-left' ) |
10701 | | - .css( $.wikiEditor.modules.toc.cfg.flexProperty, '' ) |
10702 | | - .children() |
10703 | | - .css( $.wikiEditor.modules.toc.cfg.flexProperty, '' ); |
10704 | | - } |
10705 | | - context.modules.toc.$toc.data( 'positionMode', 'disabled' ); |
10706 | | - }, |
10707 | | - enable: function( context ) { |
10708 | | - context.modules.toc.$toc.data( 'positionMode', 'regular' ); |
10709 | | - if ( context.modules.toc.$toc.data( 'collapsed' ) ) { |
10710 | | - context.$ui.find( '.wikiEditor-ui-toc-expandControl' ).show(); |
10711 | | - } else { |
10712 | | - context.$ui.find( '.wikiEditor-ui-right' ).show(); |
10713 | | - $.wikiEditor.modules.toc.fn.redraw( context, $.wikiEditor.modules.toc.cfg.minimumWidth ); |
10714 | | - context.modules.toc.$toc.find( 'div' ).autoEllipsis( |
10715 | | - { 'position': 'right', 'tooltip': true, 'restoreText': true } |
10716 | | - ); |
10717 | | - } |
10718 | | - }, |
10719 | | - unhighlight: function( context ) { |
10720 | | - // FIXME: For some reason, IE calls this function twice, the first time with context undefined |
10721 | | - // Investigate this when you have time please! In the meantime, the user interaction is working just |
10722 | | - // fine because the second call is valid |
10723 | | - if ( context ) { |
10724 | | - context.modules.toc.$toc.find( 'div' ).removeClass( 'current' ); |
10725 | | - } |
10726 | | - }, |
10727 | | - /** |
10728 | | - * Highlight the section the cursor is currently within |
10729 | | - * |
10730 | | - * @param {Object} context |
10731 | | - */ |
10732 | | - update: function( context ) { |
10733 | | - var div = context.fn.beforeSelection( 'wikiEditor-toc-header' ); |
10734 | | - if ( div === null ) { |
10735 | | - // beforeSelection couldn't figure it out, keep the old highlight state |
10736 | | - return; |
10737 | | - } |
10738 | | - |
10739 | | - $.wikiEditor.modules.toc.fn.unhighlight( context ); |
10740 | | - var section = div.data( 'section' ) || 0; |
10741 | | - if ( context.data.outline.length > 0 ) { |
10742 | | - var sectionLink = context.modules.toc.$toc.find( 'div.section-' + section ); |
10743 | | - sectionLink.addClass( 'current' ); |
10744 | | - |
10745 | | - // Scroll the highlighted link into view if necessary |
10746 | | - var relTop = sectionLink.offset().top - context.modules.toc.$toc.offset().top; |
10747 | | - var scrollTop = context.modules.toc.$toc.scrollTop(); |
10748 | | - var divHeight = context.modules.toc.$toc.height(); |
10749 | | - var sectionHeight = sectionLink.height(); |
10750 | | - if ( relTop < 0 ) |
10751 | | - // Scroll up |
10752 | | - context.modules.toc.$toc.scrollTop( scrollTop + relTop ); |
10753 | | - else if ( relTop + sectionHeight > divHeight ) |
10754 | | - // Scroll down |
10755 | | - context.modules.toc.$toc.scrollTop( scrollTop + relTop + sectionHeight - divHeight ); |
10756 | | - } |
10757 | | - }, |
10758 | | - |
10759 | | - /** |
10760 | | - * Collapse the contents module |
10761 | | - * |
10762 | | - * @param {Object} event Event object with context as data |
10763 | | - */ |
10764 | | - collapse: function( event ) { |
10765 | | - var $this = $( this ), |
10766 | | - context = $this.data( 'context' ); |
10767 | | - if( context.modules.toc.$toc.data( 'positionMode' ) == 'goofy' ) { |
10768 | | - $.wikiEditor.modules.toc.fn.switchLayout( context ); |
10769 | | - } |
10770 | | - var pT = $this.parent().position().top - 1; |
10771 | | - context.modules.toc.$toc.data( 'collapsed', true ); |
10772 | | - var leftParam = {}, leftChildParam = {}; |
10773 | | - leftParam[ $.wikiEditor.modules.toc.cfg.flexProperty ] = '-1px'; |
10774 | | - leftChildParam[ $.wikiEditor.modules.toc.cfg.flexProperty ] = '1px'; |
10775 | | - context.$ui.find( '.wikiEditor-ui-left' ) |
10776 | | - .animate( leftParam, 'fast', function() { |
10777 | | - $( this ).css( $.wikiEditor.modules.toc.cfg.flexProperty, 0 ); |
10778 | | - } ) |
10779 | | - .children() |
10780 | | - .animate( leftChildParam, 'fast', function() { |
10781 | | - $( this ).css( $.wikiEditor.modules.toc.cfg.flexProperty, 0 ); |
10782 | | - } ); |
10783 | | - context.$ui.find( '.wikiEditor-ui-right' ) |
10784 | | - .css( { |
10785 | | - 'marginTop' : '1px', |
10786 | | - 'position' : 'absolute', |
10787 | | - 'left' : $.wikiEditor.modules.toc.cfg.rtl ? 0 : 'auto', |
10788 | | - 'right' : $.wikiEditor.modules.toc.cfg.rtl ? 'auto' : 0, |
10789 | | - 'top' : pT } ) |
10790 | | - .fadeOut( 'fast', function() { |
10791 | | - $( this ).hide() |
10792 | | - .css( { 'marginTop': '0', 'width': '1px' } ); |
10793 | | - context.$ui.find( '.wikiEditor-ui-toc-expandControl' ).fadeIn( 'fast' ); |
10794 | | - // Let the UI know things have moved around |
10795 | | - context.fn.trigger( 'tocCollapse' ); |
10796 | | - context.fn.trigger( 'resize' ); |
10797 | | - } ); |
10798 | | - |
10799 | | - $.cookie( 'wikiEditor-' + context.instance + '-toc-width', 0 ); |
10800 | | - return false; |
10801 | | - }, |
10802 | | - |
10803 | | - /** |
10804 | | - * Expand the contents module |
10805 | | - * |
10806 | | - * @param {Object} event Event object with context as data |
10807 | | - */ |
10808 | | - expand: function( event ) { |
10809 | | - var $this = $( this ), |
10810 | | - context = $this.data( 'context' ), |
10811 | | - openWidth = parseFloat( context.modules.toc.$toc.data( 'openWidth' ) ), |
10812 | | - availableSpace = context.$wikitext.width() - parseFloat( $.wikiEditor.modules.toc.cfg.textMinimumWidth ); |
10813 | | - if ( availableSpace < $.wikiEditor.modules.toc.cfg.textMinmumWidth ) return false; |
10814 | | - context.modules.toc.$toc.data( 'collapsed', false ); |
10815 | | - // check if we've got enough room to open to our stored width |
10816 | | - if ( availableSpace < openWidth ) openWidth = availableSpace; |
10817 | | - context.$ui.find( '.wikiEditor-ui-toc-expandControl' ).hide(); |
10818 | | - var leftParam = {}, leftChildParam = {}; |
10819 | | - leftParam[ $.wikiEditor.modules.toc.cfg.flexProperty ] = parseFloat( openWidth ) * -1; |
10820 | | - leftChildParam[ $.wikiEditor.modules.toc.cfg.flexProperty ] = openWidth; |
10821 | | - context.$ui.find( '.wikiEditor-ui-left' ) |
10822 | | - .animate( leftParam, 'fast' ) |
10823 | | - .children() |
10824 | | - .animate( leftChildParam, 'fast' ); |
10825 | | - context.$ui.find( '.wikiEditor-ui-right' ) |
10826 | | - .show() |
10827 | | - .css( 'marginTop', '1px' ) |
10828 | | - .animate( { 'width' : openWidth }, 'fast', function() { |
10829 | | - context.$content.trigger( 'mouseup' ); |
10830 | | - $( this ).css( { |
10831 | | - 'marginTop' : '0', |
10832 | | - 'position' : 'relative', |
10833 | | - 'right' : 'auto', |
10834 | | - 'left' : 'auto', |
10835 | | - 'top': 'auto' } ); |
10836 | | - context.fn.trigger( 'tocExpand' ); |
10837 | | - context.fn.trigger( 'resize' ); |
10838 | | - } ); |
10839 | | - $.cookie( 'wikiEditor-' + context.instance + '-toc-width', |
10840 | | - context.modules.toc.$toc.data( 'openWidth' ) ); |
10841 | | - return false; |
10842 | | - }, |
10843 | | - /** |
10844 | | - * Builds table of contents |
10845 | | - * |
10846 | | - * @param {Object} context |
10847 | | - */ |
10848 | | - build: function( context ) { |
10849 | | - /** |
10850 | | - * Builds a structured outline from flat outline |
10851 | | - * |
10852 | | - * @param {Object} outline Array of objects with level fields |
10853 | | - */ |
10854 | | - function buildStructure( outline, offset, level ) { |
10855 | | - if ( offset == undefined ) offset = 0; |
10856 | | - if ( level == undefined ) level = 1; |
10857 | | - var sections = []; |
10858 | | - for ( var i = offset; i < outline.length; i++ ) { |
10859 | | - if ( outline[i].nLevel == level ) { |
10860 | | - var sub = buildStructure( outline, i + 1, level + 1 ); |
10861 | | - if ( sub.length ) { |
10862 | | - outline[i].sections = sub; |
10863 | | - } |
10864 | | - sections[sections.length] = outline[i]; |
10865 | | - } else if ( outline[i].nLevel < level ) { |
10866 | | - break; |
10867 | | - } |
10868 | | - } |
10869 | | - return sections; |
10870 | | - } |
10871 | | - /** |
10872 | | - * Builds unordered list HTML object from structured outline |
10873 | | - * |
10874 | | - * @param {Object} structure Structured outline |
10875 | | - */ |
10876 | | - function buildList( structure ) { |
10877 | | - var list = $( '<ul />' ); |
10878 | | - for ( i in structure ) { |
10879 | | - var div = $( '<div />' ) |
10880 | | - .addClass( 'section-' + structure[i].index ) |
10881 | | - .data( 'index', structure[i].index ) |
10882 | | - .mousedown( function() { |
10883 | | - // No dragging! |
10884 | | - return false; |
10885 | | - } ) |
10886 | | - .click( function( event ) { |
10887 | | - var wrapper = context.$content.find( |
10888 | | - '.wikiEditor-toc-section-' + $( this ).data( 'index' ) ); |
10889 | | - if ( wrapper.size() == 0 ) |
10890 | | - wrapper = context.$content; |
10891 | | - context.fn.scrollToTop( wrapper, true ); |
10892 | | - context.$textarea.textSelection( 'setSelection', { |
10893 | | - 'start': 0, |
10894 | | - 'startContainer': wrapper |
10895 | | - } ); |
10896 | | - // Bring user's eyes to the point we've now jumped to |
10897 | | - context.fn.highlightLine( $( wrapper ) ); |
10898 | | - // Highlight the clicked link |
10899 | | - $.wikiEditor.modules.toc.fn.unhighlight( context ); |
10900 | | - $( this ).addClass( 'current' ); |
10901 | | - |
10902 | | - if ( typeof $.trackAction != 'undefined' ) |
10903 | | - $.trackAction( 'ntoc.heading' ); |
10904 | | - event.preventDefault(); |
10905 | | - } ) |
10906 | | - .text( structure[i].text ); |
10907 | | - if ( structure[i].text == '' ) |
10908 | | - div.html( ' ' ); |
10909 | | - var item = $( '<li />' ).append( div ); |
10910 | | - if ( structure[i].sections !== undefined ) { |
10911 | | - item.append( buildList( structure[i].sections ) ); |
10912 | | - } |
10913 | | - list.append( item ); |
10914 | | - } |
10915 | | - return list; |
10916 | | - } |
10917 | | - /** |
10918 | | - * Builds controls for collapsing and expanding the TOC |
10919 | | - * |
10920 | | - */ |
10921 | | - function buildCollapseControls( ) { |
10922 | | - var $collapseControl = $( '<div />' ), $expandControl = $( '<div />' ); |
10923 | | - $collapseControl |
10924 | | - .addClass( 'tab' ) |
10925 | | - .addClass( 'tab-toc' ) |
10926 | | - .append( '<a href="#" />' ) |
10927 | | - .mousedown( function( e ) { |
10928 | | - // No dragging! |
10929 | | - e.preventDefault(); |
10930 | | - return false; |
10931 | | - } ) |
10932 | | - .bind( 'click.wikiEditor-toc', function( e ) { |
10933 | | - context.modules.toc.$toc.trigger( 'collapse.wikiEditor-toc' ); |
10934 | | - // No dragging! |
10935 | | - e.preventDefault(); |
10936 | | - return false; |
10937 | | - } ) |
10938 | | - .find( 'a' ) |
10939 | | - .text( mw.usability.getMsg( 'wikieditor-toc-hide' ) ); |
10940 | | - $expandControl |
10941 | | - .addClass( 'wikiEditor-ui-toc-expandControl' ) |
10942 | | - .append( '<a href="#" />' ) |
10943 | | - .mousedown( function( e ) { |
10944 | | - // No dragging! |
10945 | | - e.preventDefault(); |
10946 | | - return false; |
10947 | | - } ) |
10948 | | - .bind( 'click.wikiEditor-toc', function( e ) { |
10949 | | - context.modules.toc.$toc.trigger( 'expand.wikiEditor-toc' ); |
10950 | | - // No dragging! |
10951 | | - e.preventDefault(); |
10952 | | - return false; |
10953 | | - } ) |
10954 | | - .hide() |
10955 | | - .find( 'a' ) |
10956 | | - .text( mw.usability.getMsg( 'wikieditor-toc-show' ) ); |
10957 | | - $collapseControl.insertBefore( context.modules.toc.$toc ); |
10958 | | - context.$ui.find( '.wikiEditor-ui-left .wikiEditor-ui-top' ).append( $expandControl ); |
10959 | | - } |
10960 | | - /** |
10961 | | - * Initializes resizing controls on the TOC and sets the width of |
10962 | | - * the TOC based on it's previous state |
10963 | | - * |
10964 | | - */ |
10965 | | - function buildResizeControls( ) { |
10966 | | - context.$ui |
10967 | | - .data( 'resizableDone', true ) |
10968 | | - .find( '.wikiEditor-ui-right' ) |
10969 | | - .data( 'wikiEditor-ui-left', context.$ui.find( '.wikiEditor-ui-left' ) ) |
10970 | | - .resizable( { handles: 'w,e', preventPositionLeftChange: true, |
10971 | | - minWidth: parseFloat( $.wikiEditor.modules.toc.cfg.minimumWidth ), |
10972 | | - start: function( e, ui ) { |
10973 | | - var $this = $( this ); |
10974 | | - // Toss a transparent cover over our iframe |
10975 | | - $( '<div />' ) |
10976 | | - .addClass( 'wikiEditor-ui-resize-mask' ) |
10977 | | - .css( { |
10978 | | - 'position': 'absolute', |
10979 | | - 'z-index': 2, |
10980 | | - 'left': 0, |
10981 | | - 'top': 0, |
10982 | | - 'bottom': 0, |
10983 | | - 'right': 0 |
10984 | | - } ) |
10985 | | - .appendTo( context.$ui.find( '.wikiEditor-ui-left' ) ); |
10986 | | - $this.resizable( 'option', 'maxWidth', $this.parent().width() - |
10987 | | - parseFloat( $.wikiEditor.modules.toc.cfg.textMinimumWidth ) ); |
10988 | | - if(context.modules.toc.$toc.data( 'positionMode' ) == 'goofy' ) { |
10989 | | - $.wikiEditor.modules.toc.fn.switchLayout( context ); |
10990 | | - } |
10991 | | - }, |
10992 | | - resize: function( e, ui ) { |
10993 | | - // for some odd reason, ui.size.width seems a step ahead of what the *actual* width of |
10994 | | - // the resizable is |
10995 | | - $( this ).css( { 'width': ui.size.width, 'top': 'auto', 'height': 'auto' } ) |
10996 | | - .data( 'wikiEditor-ui-left' ) |
10997 | | - .css( $.wikiEditor.modules.toc.cfg.flexProperty, ( -1 * ui.size.width ) ) |
10998 | | - .children().css( $.wikiEditor.modules.toc.cfg.flexProperty, ui.size.width ); |
10999 | | - // Let the UI know things have moved around |
11000 | | - context.fn.trigger( 'resize' ); |
11001 | | - }, |
11002 | | - stop: function ( e, ui ) { |
11003 | | - context.$ui.find( '.wikiEditor-ui-resize-mask' ).remove(); |
11004 | | - context.$content.trigger( 'mouseup' ); |
11005 | | - if( ui.size.width <= parseFloat( $.wikiEditor.modules.toc.cfg.minimumWidth ) ) { |
11006 | | - context.modules.toc.$toc.trigger( 'collapse.wikiEditor-toc' ); |
11007 | | - } else { |
11008 | | - context.modules.toc.$toc.find( 'div' ).autoEllipsis( |
11009 | | - { 'position': 'right', 'tooltip': true, 'restoreText': true } |
11010 | | - ); |
11011 | | - context.modules.toc.$toc.data( 'openWidth', ui.size.width ); |
11012 | | - $.cookie( 'wikiEditor-' + context.instance + '-toc-width', ui.size.width ); |
11013 | | - } |
11014 | | - // Let the UI know things have moved around |
11015 | | - context.fn.trigger( 'resize' ); |
11016 | | - } |
11017 | | - }); |
11018 | | - // Convert our east resize handle into a secondary west resize handle |
11019 | | - var handle = $.wikiEditor.modules.toc.cfg.rtl ? 'w' : 'e'; |
11020 | | - context.$ui.find( '.ui-resizable-' + handle ) |
11021 | | - .removeClass( 'ui-resizable-' + handle ) |
11022 | | - .addClass( 'ui-resizable-' + ( handle == 'w' ? 'e' : 'w' ) ) |
11023 | | - .addClass( 'wikiEditor-ui-toc-resize-grip' ); |
11024 | | - // Bind collapse and expand event handlers to the TOC |
11025 | | - context.modules.toc.$toc |
11026 | | - .bind( 'collapse.wikiEditor-toc', $.wikiEditor.modules.toc.fn.collapse ) |
11027 | | - .bind( 'expand.wikiEditor-toc', $.wikiEditor.modules.toc.fn.expand ); |
11028 | | - context.modules.toc.$toc.data( 'openWidth', $.wikiEditor.modules.toc.cfg.defaultWidth ); |
11029 | | - // If the toc-width cookie is set, reset the widths based upon that |
11030 | | - if ( $.cookie( 'wikiEditor-' + context.instance + '-toc-width' ) == 0 ) { |
11031 | | - context.modules.toc.$toc.trigger( 'collapse.wikiEditor-toc', { data: context } ); |
11032 | | - } else if ( $.cookie( 'wikiEditor-' + context.instance + '-toc-width' ) > 0 ) { |
11033 | | - var initialWidth = $.cookie( 'wikiEditor-' + context.instance + '-toc-width' ); |
11034 | | - if( initialWidth < parseFloat( $.wikiEditor.modules.toc.cfg.minimumWidth ) ) |
11035 | | - initialWidth = parseFloat( $.wikiEditor.modules.toc.cfg.minimumWidth ) + 1; |
11036 | | - context.modules.toc.$toc.data( 'openWidth', initialWidth + 'px' ); |
11037 | | - $.wikiEditor.modules.toc.fn.redraw( context, initialWidth ); |
11038 | | - } |
11039 | | - } |
11040 | | - |
11041 | | - // Normalize heading levels for list creation |
11042 | | - // This is based on Linker::generateTOC(), so it should behave like the |
11043 | | - // TOC on rendered articles does - which is considdered to be correct |
11044 | | - // at this point in time. |
11045 | | - if ( context.data.outline ) { |
11046 | | - var outline = context.data.outline; |
11047 | | - var lastLevel = 0; |
11048 | | - var nLevel = 0; |
11049 | | - for ( var i = 0; i < outline.length; i++ ) { |
11050 | | - if ( outline[i].level > lastLevel ) { |
11051 | | - nLevel++; |
11052 | | - } |
11053 | | - else if ( outline[i].level < lastLevel ) { |
11054 | | - nLevel -= Math.max( 1, lastLevel - outline[i].level ); |
11055 | | - } |
11056 | | - if ( nLevel <= 0 ) { |
11057 | | - nLevel = 1; |
11058 | | - } |
11059 | | - outline[i].nLevel = nLevel; |
11060 | | - lastLevel = outline[i].level; |
11061 | | - } |
11062 | | - // Recursively build the structure and add special item for |
11063 | | - // section 0, if needed |
11064 | | - var structure = buildStructure( outline ); |
11065 | | - if ( $( 'input[name=wpSection]' ).val() == '' ) { |
11066 | | - structure.unshift( { 'text': wgPageName.replace( /_/g, ' ' ), 'level': 1, 'index': 0 } ); |
11067 | | - } |
11068 | | - context.modules.toc.$toc.html( buildList( structure ) ); |
11069 | | - |
11070 | | - if ( wgNavigableTOCResizable && !context.$ui.data( 'resizableDone' ) ) { |
11071 | | - buildResizeControls(); |
11072 | | - buildCollapseControls(); |
11073 | | - } |
11074 | | - context.modules.toc.$toc.find( 'div' ).autoEllipsis( |
11075 | | - { 'position': 'right', 'tooltip': true, 'restoreText': true } |
11076 | | - ); |
11077 | | - } |
11078 | | - } |
11079 | | -} |
11080 | | - |
11081 | | -}; |
11082 | | - |
11083 | | -/* |
11084 | | - * Extending resizable to allow west resizing without altering the left position attribute |
11085 | | - */ |
11086 | | -$.ui.plugin.add( "resizable", "preventPositionLeftChange", { |
11087 | | - resize: function( event, ui ) { |
11088 | | - $( this ).data( "resizable" ).position.left = 0; |
11089 | | - } |
11090 | | -} ); |
11091 | | - |
11092 | | -} ) ( jQuery ); |
11093 | | -/** |
11094 | 6457 | * Toolbar module for wikiEditor |
11095 | 6458 | */ |
11096 | 6459 | ( function( $ ) { $.wikiEditor.modules.toolbar = { |
— | — | @@ -11847,426 +7210,3 @@ |
11848 | 7211 | } |
11849 | 7212 | |
11850 | 7213 | }; } )( jQuery ); |
11851 | | -// THIS FILE HAS BEEN MODIFIED for use with the mediawiki wikiEditor |
11852 | | -// It no longer requires etherpad.collab.ace.easysync2.Changeset |
11853 | | -// THIS FILE WAS ORIGINALLY AN APPJET MODULE: etherpad.collab.ace.contentcollector |
11854 | | - |
11855 | | -/** |
11856 | | - * Copyright 2009 Google Inc. |
11857 | | - * |
11858 | | - * Licensed under the Apache License, Version 2.0 (the "License"); you may not |
11859 | | - * use this file except in compliance with the License. You may obtain a copy of |
11860 | | - * the License at |
11861 | | - * |
11862 | | - * http://www.apache.org/licenses/LICENSE-2.0 |
11863 | | - * |
11864 | | - * Unless required by applicable law or agreed to in writing, software |
11865 | | - * distributed under the License is distributed on an "AS-IS" BASIS, WITHOUT |
11866 | | - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
11867 | | - * License for the specific language governing permissions and limitations under |
11868 | | - * the License. |
11869 | | - */ |
11870 | | - |
11871 | | -var _MAX_LIST_LEVEL = 8; |
11872 | | - |
11873 | | -function sanitizeUnicode(s) { |
11874 | | - return s.replace(/[\uffff\ufffe\ufeff\ufdd0-\ufdef\ud800-\udfff]/g, '?'); |
11875 | | -} |
11876 | | - |
11877 | | -function makeContentCollector( browser, domInterface ) { |
11878 | | - browser = browser || {}; |
11879 | | - |
11880 | | - var dom = domInterface || { |
11881 | | - isNodeText : function(n) { |
11882 | | - return (n.nodeType == 3); |
11883 | | - }, |
11884 | | - nodeTagName : function(n) { |
11885 | | - return n.tagName; |
11886 | | - }, |
11887 | | - nodeValue : function(n) { |
11888 | | - return n.nodeValue; |
11889 | | - }, |
11890 | | - nodeNumChildren : function(n) { |
11891 | | - return n.childNodes.length; |
11892 | | - }, |
11893 | | - nodeChild : function(n, i) { |
11894 | | - return n.childNodes.item(i); |
11895 | | - }, |
11896 | | - nodeProp : function(n, p) { |
11897 | | - return n[p]; |
11898 | | - }, |
11899 | | - nodeAttr : function(n, a) { |
11900 | | - return n.getAttribute(a); |
11901 | | - }, |
11902 | | - optNodeInnerHTML : function(n) { |
11903 | | - return n.innerHTML; |
11904 | | - } |
11905 | | - }; |
11906 | | - |
11907 | | - var _blockElems = { |
11908 | | - "div" : 1, |
11909 | | - "p" : 1, |
11910 | | - "pre" : 1, |
11911 | | - "li" : 1 |
11912 | | - }; |
11913 | | - function isBlockElement(n) { |
11914 | | - return !!_blockElems[(dom.nodeTagName(n) || "").toLowerCase()]; |
11915 | | - } |
11916 | | - function textify(str) { |
11917 | | - return sanitizeUnicode(str.replace(/[\n\r ]/g, ' ').replace(/\xa0/g, |
11918 | | - ' ').replace(/\t/g, ' ')); |
11919 | | - } |
11920 | | - function getAssoc(node, name) { |
11921 | | - return dom.nodeProp(node, "_magicdom_" + name); |
11922 | | - } |
11923 | | - |
11924 | | - var lines = (function() { |
11925 | | - var textArray = []; |
11926 | | - var self = { |
11927 | | - length : function() { |
11928 | | - return textArray.length; |
11929 | | - }, |
11930 | | - atColumnZero : function() { |
11931 | | - return textArray[textArray.length - 1] === ""; |
11932 | | - }, |
11933 | | - startNew : function() { |
11934 | | - textArray.push(""); |
11935 | | - self.flush(true); |
11936 | | - }, |
11937 | | - textOfLine : function(i) { |
11938 | | - return textArray[i]; |
11939 | | - }, |
11940 | | - appendText : function(txt, attrString) { |
11941 | | - textArray[textArray.length - 1] += txt; |
11942 | | - // dmesg(txt+" / "+attrString); |
11943 | | - }, |
11944 | | - textLines : function() { |
11945 | | - return textArray.slice(); |
11946 | | - }, |
11947 | | - // call flush only when you're done |
11948 | | - flush : function(withNewline) { |
11949 | | - |
11950 | | - } |
11951 | | - }; |
11952 | | - self.startNew(); |
11953 | | - return self; |
11954 | | - }()); |
11955 | | - var cc = {}; |
11956 | | - function _ensureColumnZero(state) { |
11957 | | - if (!lines.atColumnZero()) { |
11958 | | - _startNewLine(state); |
11959 | | - } |
11960 | | - } |
11961 | | - var selection, startPoint, endPoint; |
11962 | | - var selStart = [ -1, -1 ], selEnd = [ -1, -1 ]; |
11963 | | - var blockElems = { |
11964 | | - "div" : 1, |
11965 | | - "p" : 1, |
11966 | | - "pre" : 1 |
11967 | | - }; |
11968 | | - function _isEmpty(node, state) { |
11969 | | - // consider clean blank lines pasted in IE to be empty |
11970 | | - if (dom.nodeNumChildren(node) == 0) |
11971 | | - return true; |
11972 | | - if (dom.nodeNumChildren(node) == 1 && getAssoc(node, "shouldBeEmpty") |
11973 | | - && dom.optNodeInnerHTML(node) == " " |
11974 | | - && !getAssoc(node, "unpasted")) { |
11975 | | - if (state) { |
11976 | | - var child = dom.nodeChild(node, 0); |
11977 | | - _reachPoint(child, 0, state); |
11978 | | - _reachPoint(child, 1, state); |
11979 | | - } |
11980 | | - return true; |
11981 | | - } |
11982 | | - return false; |
11983 | | - } |
11984 | | - function _pointHere(charsAfter, state) { |
11985 | | - var ln = lines.length() - 1; |
11986 | | - var chr = lines.textOfLine(ln).length; |
11987 | | - if (chr == 0 && state.listType && state.listType != 'none') { |
11988 | | - chr += 1; // listMarker |
11989 | | - } |
11990 | | - chr += charsAfter; |
11991 | | - return [ ln, chr ]; |
11992 | | - } |
11993 | | - function _reachBlockPoint(nd, idx, state) { |
11994 | | - if (!dom.isNodeText(nd)) |
11995 | | - _reachPoint(nd, idx, state); |
11996 | | - } |
11997 | | - function _reachPoint(nd, idx, state) { |
11998 | | - if (startPoint && nd == startPoint.node && startPoint.index == idx) { |
11999 | | - selStart = _pointHere(0, state); |
12000 | | - } |
12001 | | - if (endPoint && nd == endPoint.node && endPoint.index == idx) { |
12002 | | - selEnd = _pointHere(0, state); |
12003 | | - } |
12004 | | - } |
12005 | | - function _incrementFlag(state, flagName) { |
12006 | | - state.flags[flagName] = (state.flags[flagName] || 0) + 1; |
12007 | | - } |
12008 | | - function _decrementFlag(state, flagName) { |
12009 | | - state.flags[flagName]--; |
12010 | | - } |
12011 | | - function _enterList(state, listType) { |
12012 | | - var oldListType = state.listType; |
12013 | | - state.listLevel = (state.listLevel || 0) + 1; |
12014 | | - if (listType != 'none') { |
12015 | | - state.listNesting = (state.listNesting || 0) + 1; |
12016 | | - } |
12017 | | - state.listType = listType; |
12018 | | - return oldListType; |
12019 | | - } |
12020 | | - function _exitList(state, oldListType) { |
12021 | | - state.listLevel--; |
12022 | | - if (state.listType != 'none') { |
12023 | | - state.listNesting--; |
12024 | | - } |
12025 | | - state.listType = oldListType; |
12026 | | - } |
12027 | | - function _produceListMarker(state) { |
12028 | | - |
12029 | | - } |
12030 | | - function _startNewLine(state) { |
12031 | | - if (state) { |
12032 | | - var atBeginningOfLine = lines.textOfLine(lines.length() - 1).length == 0; |
12033 | | - if (atBeginningOfLine && state.listType && state.listType != 'none') { |
12034 | | - _produceListMarker(state); |
12035 | | - } |
12036 | | - } |
12037 | | - lines.startNew(); |
12038 | | - } |
12039 | | - cc.notifySelection = function(sel) { |
12040 | | - if (sel) { |
12041 | | - selection = sel; |
12042 | | - startPoint = selection.startPoint; |
12043 | | - endPoint = selection.endPoint; |
12044 | | - } |
12045 | | - }; |
12046 | | - cc.collectContent = function(node, state) { |
12047 | | - if (!state) { |
12048 | | - state = { |
12049 | | - flags : {/* name -> nesting counter */} |
12050 | | - }; |
12051 | | - } |
12052 | | - var isBlock = isBlockElement(node); |
12053 | | - var isEmpty = _isEmpty(node, state); |
12054 | | - if (isBlock) |
12055 | | - _ensureColumnZero(state); |
12056 | | - var startLine = lines.length() - 1; |
12057 | | - _reachBlockPoint(node, 0, state); |
12058 | | - if (dom.isNodeText(node)) { |
12059 | | - var txt = dom.nodeValue(node); |
12060 | | - var rest = ''; |
12061 | | - var x = 0; // offset into original text |
12062 | | - if (txt.length == 0) { |
12063 | | - if (startPoint && node == startPoint.node) { |
12064 | | - selStart = _pointHere(0, state); |
12065 | | - } |
12066 | | - if (endPoint && node == endPoint.node) { |
12067 | | - selEnd = _pointHere(0, state); |
12068 | | - } |
12069 | | - } |
12070 | | - while (txt.length > 0) { |
12071 | | - var consumed = 0; |
12072 | | - if (!browser.firefox || state.flags.preMode) { |
12073 | | - var firstLine = txt.split('\n', 1)[0]; |
12074 | | - consumed = firstLine.length + 1; |
12075 | | - rest = txt.substring(consumed); |
12076 | | - txt = firstLine; |
12077 | | - } else { /* will only run this loop body once */ |
12078 | | - } |
12079 | | - if (startPoint && node == startPoint.node |
12080 | | - && startPoint.index - x <= txt.length) { |
12081 | | - selStart = _pointHere(startPoint.index - x, state); |
12082 | | - } |
12083 | | - if (endPoint && node == endPoint.node |
12084 | | - && endPoint.index - x <= txt.length) { |
12085 | | - selEnd = _pointHere(endPoint.index - x, state); |
12086 | | - } |
12087 | | - var txt2 = txt; |
12088 | | - if ((!state.flags.preMode) && /^[\r\n]*$/.exec(txt)) { |
12089 | | - // prevents textnodes containing just "\n" from being |
12090 | | - // significant |
12091 | | - // in safari when pasting text, now that we convert them to |
12092 | | - // spaces instead of removing them, because in other cases |
12093 | | - // removing "\n" from pasted HTML will collapse words |
12094 | | - // together. |
12095 | | - txt2 = ""; |
12096 | | - } |
12097 | | - var atBeginningOfLine = lines.textOfLine(lines.length() - 1).length == 0; |
12098 | | - if (atBeginningOfLine) { |
12099 | | - // newlines in the source mustn't become spaces at beginning |
12100 | | - // of line box |
12101 | | - txt2 = txt2.replace(/^\n*/, ''); |
12102 | | - } |
12103 | | - if (atBeginningOfLine && state.listType |
12104 | | - && state.listType != 'none') { |
12105 | | - _produceListMarker(state); |
12106 | | - } |
12107 | | - lines.appendText(textify(txt2)); |
12108 | | - |
12109 | | - x += consumed; |
12110 | | - txt = rest; |
12111 | | - if (txt.length > 0) { |
12112 | | - _startNewLine(state); |
12113 | | - } |
12114 | | - } |
12115 | | - |
12116 | | - } else { |
12117 | | - var tname = (dom.nodeTagName(node) || "").toLowerCase(); |
12118 | | - if (tname == "br") { |
12119 | | - _startNewLine(state); |
12120 | | - } else if (tname == "script" || tname == "style") { |
12121 | | - // ignore |
12122 | | - } else if (!isEmpty) { |
12123 | | - var styl = dom.nodeAttr(node, "style"); |
12124 | | - var cls = dom.nodeProp(node, "className"); |
12125 | | - |
12126 | | - var isPre = (tname == "pre"); |
12127 | | - if ((!isPre) && browser.safari) { |
12128 | | - isPre = (styl && /\bwhite-space:\s*pre\b/i.exec(styl)); |
12129 | | - } |
12130 | | - if (isPre) |
12131 | | - _incrementFlag(state, 'preMode'); |
12132 | | - var oldListTypeOrNull = null; |
12133 | | - |
12134 | | - var nc = dom.nodeNumChildren(node); |
12135 | | - for ( var i = 0; i < nc; i++) { |
12136 | | - var c = dom.nodeChild(node, i); |
12137 | | - cc.collectContent(c, state); |
12138 | | - } |
12139 | | - |
12140 | | - if (isPre) |
12141 | | - _decrementFlag(state, 'preMode'); |
12142 | | - |
12143 | | - if (oldListTypeOrNull) { |
12144 | | - _exitList(state, oldListTypeOrNull); |
12145 | | - } |
12146 | | - } |
12147 | | - } |
12148 | | - if (!browser.msie) { |
12149 | | - _reachBlockPoint(node, 1, state); |
12150 | | - } |
12151 | | - if (isBlock) { |
12152 | | - if (lines.length() - 1 == startLine) { |
12153 | | - _startNewLine(state); |
12154 | | - } else { |
12155 | | - _ensureColumnZero(state); |
12156 | | - } |
12157 | | - } |
12158 | | - |
12159 | | - if (browser.msie) { |
12160 | | - // in IE, a point immediately after a DIV appears on the next line |
12161 | | - //_reachBlockPoint(node, 1, state); |
12162 | | - } |
12163 | | - }; |
12164 | | - // can pass a falsy value for end of doc |
12165 | | - cc.notifyNextNode = function(node) { |
12166 | | - // an "empty block" won't end a line; this addresses an issue in IE with |
12167 | | - // typing into a blank line at the end of the document. typed text |
12168 | | - // goes into the body, and the empty line div still looks clean. |
12169 | | - // it is incorporated as dirty by the rule that a dirty region has |
12170 | | - // to end a line. |
12171 | | - if ((!node) || (isBlockElement(node) && !_isEmpty(node))) { |
12172 | | - _ensureColumnZero(null); |
12173 | | - } |
12174 | | - }; |
12175 | | - // each returns [line, char] or [-1,-1] |
12176 | | - var getSelectionStart = function() { |
12177 | | - return selStart; |
12178 | | - }; |
12179 | | - var getSelectionEnd = function() { |
12180 | | - return selEnd; |
12181 | | - }; |
12182 | | - |
12183 | | - // returns array of strings for lines found, last entry will be "" if |
12184 | | - // last line is complete (i.e. if a following span should be on a new line). |
12185 | | - // can be called at any point |
12186 | | - cc.getLines = function() { |
12187 | | - return lines.textLines(); |
12188 | | - }; |
12189 | | - |
12190 | | - // cc.applyHints = function(hints) { |
12191 | | - // if (hints.pastedLines) { |
12192 | | - // |
12193 | | - // } |
12194 | | - // } |
12195 | | - |
12196 | | - cc.finish = function() { |
12197 | | - lines.flush(); |
12198 | | - var lineStrings = cc.getLines(); |
12199 | | - |
12200 | | - lineStrings.length--; |
12201 | | - |
12202 | | - var ss = getSelectionStart(); |
12203 | | - var se = getSelectionEnd(); |
12204 | | - |
12205 | | - function fixLongLines() { |
12206 | | - // design mode does not deal with with really long lines! |
12207 | | - var lineLimit = 2000; // chars |
12208 | | - var buffer = 10; // chars allowed over before wrapping |
12209 | | - var linesWrapped = 0; |
12210 | | - var numLinesAfter = 0; |
12211 | | - for ( var i = lineStrings.length - 1; i >= 0; i--) { |
12212 | | - var oldString = lineStrings[i]; |
12213 | | - if (oldString.length > lineLimit + buffer) { |
12214 | | - var newStrings = []; |
12215 | | - while (oldString.length > lineLimit) { |
12216 | | - // var semiloc = oldString.lastIndexOf(';', |
12217 | | - // lineLimit-1); |
12218 | | - // var lengthToTake = (semiloc >= 0 ? (semiloc+1) : |
12219 | | - // lineLimit); |
12220 | | - lengthToTake = lineLimit; |
12221 | | - newStrings.push(oldString.substring(0, lengthToTake)); |
12222 | | - oldString = oldString.substring(lengthToTake); |
12223 | | - |
12224 | | - } |
12225 | | - if (oldString.length > 0) { |
12226 | | - newStrings.push(oldString); |
12227 | | - } |
12228 | | - function fixLineNumber(lineChar) { |
12229 | | - if (lineChar[0] < 0) |
12230 | | - return; |
12231 | | - var n = lineChar[0]; |
12232 | | - var c = lineChar[1]; |
12233 | | - if (n > i) { |
12234 | | - n += (newStrings.length - 1); |
12235 | | - } else if (n == i) { |
12236 | | - var a = 0; |
12237 | | - while (c > newStrings[a].length) { |
12238 | | - c -= newStrings[a].length; |
12239 | | - a++; |
12240 | | - } |
12241 | | - n += a; |
12242 | | - } |
12243 | | - lineChar[0] = n; |
12244 | | - lineChar[1] = c; |
12245 | | - } |
12246 | | - fixLineNumber(ss); |
12247 | | - fixLineNumber(se); |
12248 | | - linesWrapped++; |
12249 | | - numLinesAfter += newStrings.length; |
12250 | | - |
12251 | | - newStrings.unshift(i, 1); |
12252 | | - lineStrings.splice.apply(lineStrings, newStrings); |
12253 | | - |
12254 | | - } |
12255 | | - } |
12256 | | - return { |
12257 | | - linesWrapped : linesWrapped, |
12258 | | - numLinesAfter : numLinesAfter |
12259 | | - }; |
12260 | | - } |
12261 | | - var wrapData = fixLongLines(); |
12262 | | - |
12263 | | - return { |
12264 | | - selStart : ss, |
12265 | | - selEnd : se, |
12266 | | - linesWrapped : wrapData.linesWrapped, |
12267 | | - numLinesAfter : wrapData.numLinesAfter, |
12268 | | - lines : lineStrings |
12269 | | - }; |
12270 | | - } |
12271 | | - |
12272 | | - return cc; |
12273 | | -} |
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -27,177 +27,7 @@ |
28 | 28 | if(this._mouseStarted){this._mouseDrag(event);return event.preventDefault();} |
29 | 29 | if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,event)!==false);(this._mouseStarted?this._mouseDrag(event):this._mouseUp(event));} |
30 | 30 | return!this._mouseStarted;},_mouseUp:function(event){$(document).unbind('mousemove.'+this.widgetName,this._mouseMoveDelegate).unbind('mouseup.'+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(event.target==this._mouseDownEvent.target);this._mouseStop(event);} |
31 | | -return false;},_mouseDistanceMet:function(event){return(Math.max(Math.abs(this._mouseDownEvent.pageX-event.pageX),Math.abs(this._mouseDownEvent.pageY-event.pageY))>=this.options.distance);},_mouseDelayMet:function(event){return this.mouseDelayMet;},_mouseStart:function(event){},_mouseDrag:function(event){},_mouseStop:function(event){},_mouseCapture:function(event){return true;}};$.ui.mouse.defaults={cancel:null,distance:1,delay:0};})(jQuery);(function($){$.extend($.ui,{datepicker:{version:"1.7.1"}});var PROP_NAME='datepicker';function Datepicker(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId='ui-datepicker-div';this._inlineClass='ui-datepicker-inline';this._appendClass='ui-datepicker-append';this._triggerClass='ui-datepicker-trigger';this._dialogClass='ui-datepicker-dialog';this._disableClass='ui-datepicker-disabled';this._unselectableClass='ui-datepicker-unselectable';this._currentClass='ui-datepicker-current-day';this._dayOverClass='ui-datepicker-days-cell-over';this.regional=[];this.regional['']={closeText:'Done',prevText:'Prev',nextText:'Next',currentText:'Today',monthNames:['January','February','March','April','May','June','July','August','September','October','November','December'],monthNamesShort:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],dayNames:['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],dayNamesShort:['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],dayNamesMin:['Su','Mo','Tu','We','Th','Fr','Sa'],dateFormat:'mm/dd/yy',firstDay:0,isRTL:false};this._defaults={showOn:'focus',showAnim:'show',showOptions:{},defaultDate:null,appendText:'',buttonText:'...',buttonImage:'',buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,showMonthAfterYear:false,yearRange:'-10:+10',showOtherMonths:false,calculateWeek:this.iso8601Week,shortYearCutoff:'+10',minDate:null,maxDate:null,duration:'normal',beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:'',altFormat:'',constrainInput:true,showButtonPanel:false};$.extend(this._defaults,this.regional['']);this.dpDiv=$('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>');} |
32 | | -$.extend(Datepicker.prototype,{markerClassName:'hasDatepicker',log:function(){if(this.debug) |
33 | | -console.log.apply('',arguments);},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this;},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute('date:'+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue);}catch(err){inlineSettings[attrName]=attrValue;}}} |
34 | | -var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=='div'||nodeName=='span');if(!target.id) |
35 | | -target.id='dp'+(++this.uuid);var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=='input'){this._connectDatepicker(target,inst);}else if(inline){this._inlineDatepicker(target,inst);}},_newInst:function(target,inline){var id=target[0].id.replace(/([:\[\]\.])/g,'\\\\$1');return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:$('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))};},_connectDatepicker:function(target,inst){var input=$(target);inst.trigger=$([]);if(input.hasClass(this.markerClassName)) |
36 | | -return;var appendText=this._get(inst,'appendText');var isRTL=this._get(inst,'isRTL');if(appendText) |
37 | | -input[isRTL?'before':'after']('<span class="'+this._appendClass+'">'+appendText+'</span>');var showOn=this._get(inst,'showOn');if(showOn=='focus'||showOn=='both') |
38 | | -input.focus(this._showDatepicker);if(showOn=='button'||showOn=='both'){var buttonText=this._get(inst,'buttonText');var buttonImage=this._get(inst,'buttonImage');inst.trigger=$(this._get(inst,'buttonImageOnly')?$('<img/>').addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage==''?buttonText:$('<img/>').attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?'before':'after'](inst.trigger);inst.trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==target) |
39 | | -$.datepicker._hideDatepicker();else |
40 | | -$.datepicker._showDatepicker(target);return false;});} |
41 | | -input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value;}).bind("getData.datepicker",function(event,key){return this._get(inst,key);});$.data(target,PROP_NAME,inst);},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)) |
42 | | -return;divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value;}).bind("getData.datepicker",function(event,key){return this._get(inst,key);});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst));this._updateDatepicker(inst);this._updateAlternate(inst);},_dialogDatepicker:function(input,dateText,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){var id='dp'+(++this.uuid);this._dialogInput=$('<input type="text" id="'+id+'" size="1" style="position: absolute; top: -100px;"/>');this._dialogInput.keydown(this._doKeyDown);$('body').append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst);} |
43 | | -extendRemove(inst.settings,settings||{});this._dialogInput.val(dateText);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY];} |
44 | | -this._dialogInput.css('left',this._pos[0]+'px').css('top',this._pos[1]+'px');inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI) |
45 | | -$.blockUI(this.dpDiv);$.data(this._dialogInput[0],PROP_NAME,inst);return this;},_destroyDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return;} |
46 | | -var nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName=='input'){inst.trigger.remove();$target.siblings('.'+this._appendClass).remove().end().removeClass(this.markerClassName).unbind('focus',this._showDatepicker).unbind('keydown',this._doKeyDown).unbind('keypress',this._doKeyPress);}else if(nodeName=='div'||nodeName=='span') |
47 | | -$target.removeClass(this.markerClassName).empty();},_enableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return;} |
48 | | -var nodeName=target.nodeName.toLowerCase();if(nodeName=='input'){target.disabled=false;inst.trigger.filter("button").each(function(){this.disabled=false;}).end().filter("img").css({opacity:'1.0',cursor:''});} |
49 | | -else if(nodeName=='div'||nodeName=='span'){var inline=$target.children('.'+this._inlineClass);inline.children().removeClass('ui-state-disabled');} |
50 | | -this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value);});},_disableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return;} |
51 | | -var nodeName=target.nodeName.toLowerCase();if(nodeName=='input'){target.disabled=true;inst.trigger.filter("button").each(function(){this.disabled=true;}).end().filter("img").css({opacity:'0.5',cursor:'default'});} |
52 | | -else if(nodeName=='div'||nodeName=='span'){var inline=$target.children('.'+this._inlineClass);inline.children().addClass('ui-state-disabled');} |
53 | | -this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value);});this._disabledInputs[this._disabledInputs.length]=target;},_isDisabledDatepicker:function(target){if(!target){return false;} |
54 | | -for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]==target) |
55 | | -return true;} |
56 | | -return false;},_getInst:function(target){try{return $.data(target,PROP_NAME);} |
57 | | -catch(err){throw'Missing instance data for this datepicker';}},_optionDatepicker:function(target,name,value){var settings=name||{};if(typeof name=='string'){settings={};settings[name]=value;} |
58 | | -var inst=this._getInst(target);if(inst){if(this._curInst==inst){this._hideDatepicker(null);} |
59 | | -extendRemove(inst.settings,settings);var date=new Date();extendRemove(inst,{rangeStart:null,endDay:null,endMonth:null,endYear:null,selectedDay:date.getDate(),selectedMonth:date.getMonth(),selectedYear:date.getFullYear(),currentDay:date.getDate(),currentMonth:date.getMonth(),currentYear:date.getFullYear(),drawMonth:date.getMonth(),drawYear:date.getFullYear()});this._updateDatepicker(inst);}},_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value);},_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst);}},_setDateDatepicker:function(target,date,endDate){var inst=this._getInst(target);if(inst){this._setDate(inst,date,endDate);this._updateDatepicker(inst);this._updateAlternate(inst);}},_getDateDatepicker:function(target){var inst=this._getInst(target);if(inst&&!inst.inline) |
60 | | -this._setDateFromField(inst);return(inst?this._getDate(inst):null);},_doKeyDown:function(event){var inst=$.datepicker._getInst(event.target);var handled=true;var isRTL=inst.dpDiv.is('.ui-datepicker-rtl');inst._keyEvent=true;if($.datepicker._datepickerShowing) |
61 | | -switch(event.keyCode){case 9:$.datepicker._hideDatepicker(null,'');break;case 13:var sel=$('td.'+$.datepicker._dayOverClass+', td.'+$.datepicker._currentClass,inst.dpDiv);if(sel[0]) |
62 | | -$.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0]);else |
63 | | -$.datepicker._hideDatepicker(null,$.datepicker._get(inst,'duration'));return false;break;case 27:$.datepicker._hideDatepicker(null,$.datepicker._get(inst,'duration'));break;case 33:$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,'stepBigMonths'):-$.datepicker._get(inst,'stepMonths')),'M');break;case 34:$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,'stepBigMonths'):+$.datepicker._get(inst,'stepMonths')),'M');break;case 35:if(event.ctrlKey||event.metaKey)$.datepicker._clearDate(event.target);handled=event.ctrlKey||event.metaKey;break;case 36:if(event.ctrlKey||event.metaKey)$.datepicker._gotoToday(event.target);handled=event.ctrlKey||event.metaKey;break;case 37:if(event.ctrlKey||event.metaKey)$.datepicker._adjustDate(event.target,(isRTL?+1:-1),'D');handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey)$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,'stepBigMonths'):-$.datepicker._get(inst,'stepMonths')),'M');break;case 38:if(event.ctrlKey||event.metaKey)$.datepicker._adjustDate(event.target,-7,'D');handled=event.ctrlKey||event.metaKey;break;case 39:if(event.ctrlKey||event.metaKey)$.datepicker._adjustDate(event.target,(isRTL?-1:+1),'D');handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey)$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,'stepBigMonths'):+$.datepicker._get(inst,'stepMonths')),'M');break;case 40:if(event.ctrlKey||event.metaKey)$.datepicker._adjustDate(event.target,+7,'D');handled=event.ctrlKey||event.metaKey;break;default:handled=false;} |
64 | | -else if(event.keyCode==36&&event.ctrlKey) |
65 | | -$.datepicker._showDatepicker(this);else{handled=false;} |
66 | | -if(handled){event.preventDefault();event.stopPropagation();}},_doKeyPress:function(event){var inst=$.datepicker._getInst(event.target);if($.datepicker._get(inst,'constrainInput')){var chars=$.datepicker._possibleChars($.datepicker._get(inst,'dateFormat'));var chr=String.fromCharCode(event.charCode==undefined?event.keyCode:event.charCode);return event.ctrlKey||(chr<' '||!chars||chars.indexOf(chr)>-1);}},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!='input') |
67 | | -input=$('input',input.parentNode)[0];if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input) |
68 | | -return;var inst=$.datepicker._getInst(input);var beforeShow=$.datepicker._get(inst,'beforeShow');extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));$.datepicker._hideDatepicker(null,'');$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog) |
69 | | -input.value='';if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight;} |
70 | | -var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css('position')=='fixed';return!isFixed;});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop;} |
71 | | -var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.rangeStart=null;inst.dpDiv.css({position:'absolute',display:'block',top:'-1000px'});$.datepicker._updateDatepicker(inst);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?'static':(isFixed?'fixed':'absolute')),display:'none',left:offset.left+'px',top:offset.top+'px'});if(!inst.inline){var showAnim=$.datepicker._get(inst,'showAnim')||'show';var duration=$.datepicker._get(inst,'duration');var postProcess=function(){$.datepicker._datepickerShowing=true;if($.browser.msie&&parseInt($.browser.version,10)<7) |
72 | | -$('iframe.ui-datepicker-cover').css({width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4});};if($.effects&&$.effects[showAnim]) |
73 | | -inst.dpDiv.show(showAnim,$.datepicker._get(inst,'showOptions'),duration,postProcess);else |
74 | | -inst.dpDiv[showAnim](duration,postProcess);if(duration=='') |
75 | | -postProcess();if(inst.input[0].type!='hidden') |
76 | | -inst.input[0].focus();$.datepicker._curInst=inst;}},_updateDatepicker:function(inst){var dims={width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4};var self=this;inst.dpDiv.empty().append(this._generateHTML(inst)).find('iframe.ui-datepicker-cover').css({width:dims.width,height:dims.height}).end().find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a').bind('mouseout',function(){$(this).removeClass('ui-state-hover');if(this.className.indexOf('ui-datepicker-prev')!=-1)$(this).removeClass('ui-datepicker-prev-hover');if(this.className.indexOf('ui-datepicker-next')!=-1)$(this).removeClass('ui-datepicker-next-hover');}).bind('mouseover',function(){if(!self._isDisabledDatepicker(inst.inline?inst.dpDiv.parent()[0]:inst.input[0])){$(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');$(this).addClass('ui-state-hover');if(this.className.indexOf('ui-datepicker-prev')!=-1)$(this).addClass('ui-datepicker-prev-hover');if(this.className.indexOf('ui-datepicker-next')!=-1)$(this).addClass('ui-datepicker-next-hover');}}).end().find('.'+this._dayOverClass+' a').trigger('mouseover').end();var numMonths=this._getNumberOfMonths(inst);var cols=numMonths[1];var width=17;if(cols>1){inst.dpDiv.addClass('ui-datepicker-multi-'+cols).css('width',(width*cols)+'em');}else{inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');} |
77 | | -inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?'add':'remove')+'Class']('ui-datepicker-multi');inst.dpDiv[(this._get(inst,'isRTL')?'add':'remove')+'Class']('ui-datepicker-rtl');if(inst.input&&inst.input[0].type!='hidden'&&inst==$.datepicker._curInst) |
78 | | -$(inst.input[0]).focus();},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth();var dpHeight=inst.dpDiv.outerHeight();var inputWidth=inst.input?inst.input.outerWidth():0;var inputHeight=inst.input?inst.input.outerHeight():0;var viewWidth=(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)+$(document).scrollLeft();var viewHeight=(window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)+$(document).scrollTop();offset.left-=(this._get(inst,'isRTL')?(dpWidth-inputWidth):0);offset.left-=(isFixed&&offset.left==inst.input.offset().left)?$(document).scrollLeft():0;offset.top-=(isFixed&&offset.top==(inst.input.offset().top+inputHeight))?$(document).scrollTop():0;offset.left-=(offset.left+dpWidth>viewWidth&&viewWidth>dpWidth)?Math.abs(offset.left+dpWidth-viewWidth):0;offset.top-=(offset.top+dpHeight>viewHeight&&viewHeight>dpHeight)?Math.abs(offset.top+dpHeight+inputHeight*2-viewHeight):0;return offset;},_findPos:function(obj){while(obj&&(obj.type=='hidden'||obj.nodeType!=1)){obj=obj.nextSibling;} |
79 | | -var position=$(obj).offset();return[position.left,position.top];},_hideDatepicker:function(input,duration){var inst=this._curInst;if(!inst||(input&&inst!=$.data(input,PROP_NAME))) |
80 | | -return;if(inst.stayOpen) |
81 | | -this._selectDate('#'+inst.id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));inst.stayOpen=false;if(this._datepickerShowing){duration=(duration!=null?duration:this._get(inst,'duration'));var showAnim=this._get(inst,'showAnim');var postProcess=function(){$.datepicker._tidyDialog(inst);};if(duration!=''&&$.effects&&$.effects[showAnim]) |
82 | | -inst.dpDiv.hide(showAnim,$.datepicker._get(inst,'showOptions'),duration,postProcess);else |
83 | | -inst.dpDiv[(duration==''?'hide':(showAnim=='slideDown'?'slideUp':(showAnim=='fadeIn'?'fadeOut':'hide')))](duration,postProcess);if(duration=='') |
84 | | -this._tidyDialog(inst);var onClose=this._get(inst,'onClose');if(onClose) |
85 | | -onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():''),inst]);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:'absolute',left:'0',top:'-100px'});if($.blockUI){$.unblockUI();$('body').append(this.dpDiv);}} |
86 | | -this._inDialog=false;} |
87 | | -this._curInst=null;},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');},_checkExternalClick:function(event){if(!$.datepicker._curInst) |
88 | | -return;var $target=$(event.target);if(($target.parents('#'+$.datepicker._mainDivId).length==0)&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)) |
89 | | -$.datepicker._hideDatepicker(null,'');},_adjustDate:function(id,offset,period){var target=$(id);var inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return;} |
90 | | -this._adjustInstDate(inst,offset+ |
91 | | -(period=='M'?this._get(inst,'showCurrentAtPos'):0),period);this._updateDatepicker(inst);},_gotoToday:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,'gotoCurrent')&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear;} |
92 | | -else{var date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();} |
93 | | -this._notifyChange(inst);this._adjustDate(target);},_selectMonthYear:function(id,select,period){var target=$(id);var inst=this._getInst(target[0]);inst._selectingMonthYear=false;inst['selected'+(period=='M'?'Month':'Year')]=inst['draw'+(period=='M'?'Month':'Year')]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target);},_clickMonthYear:function(id){var target=$(id);var inst=this._getInst(target[0]);if(inst.input&&inst._selectingMonthYear&&!$.browser.msie) |
94 | | -inst.input[0].focus();inst._selectingMonthYear=!inst._selectingMonthYear;},_selectDay:function(id,month,year,td){var target=$(id);if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return;} |
95 | | -var inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=$('a',td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;if(inst.stayOpen){inst.endDay=inst.endMonth=inst.endYear=null;} |
96 | | -this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));if(inst.stayOpen){inst.rangeStart=this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));this._updateDatepicker(inst);}},_clearDate:function(id){var target=$(id);var inst=this._getInst(target[0]);inst.stayOpen=false;inst.endDay=inst.endMonth=inst.endYear=inst.rangeStart=null;this._selectDate(target,'');},_selectDate:function(id,dateStr){var target=$(id);var inst=this._getInst(target[0]);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(inst.input) |
97 | | -inst.input.val(dateStr);this._updateAlternate(inst);var onSelect=this._get(inst,'onSelect');if(onSelect) |
98 | | -onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst]);else if(inst.input) |
99 | | -inst.input.trigger('change');if(inst.inline) |
100 | | -this._updateDatepicker(inst);else if(!inst.stayOpen){this._hideDatepicker(null,this._get(inst,'duration'));this._lastInput=inst.input[0];if(typeof(inst.input[0])!='object') |
101 | | -inst.input[0].focus();this._lastInput=null;}},_updateAlternate:function(inst){var altField=this._get(inst,'altField');if(altField){var altFormat=this._get(inst,'altFormat')||this._get(inst,'dateFormat');var date=this._getDate(inst);dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));$(altField).each(function(){$(this).val(dateStr);});}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),''];},iso8601Week:function(date){var checkDate=new Date(date.getFullYear(),date.getMonth(),date.getDate());var firstMon=new Date(checkDate.getFullYear(),1-1,4);var firstDay=firstMon.getDay()||7;firstMon.setDate(firstMon.getDate()+1-firstDay);if(firstDay<4&&checkDate<firstMon){checkDate.setDate(checkDate.getDate()-3);return $.datepicker.iso8601Week(checkDate);}else if(checkDate>new Date(checkDate.getFullYear(),12-1,28)){firstDay=new Date(checkDate.getFullYear()+1,1-1,4).getDay()||7;if(firstDay>4&&(checkDate.getDay()||7)<firstDay-3){return 1;}} |
102 | | -return Math.floor(((checkDate-firstMon)/86400000)/7)+1;},parseDate:function(format,value,settings){if(format==null||value==null) |
103 | | -throw'Invalid arguments';value=(typeof value=='object'?value.toString():value+'');if(value=='') |
104 | | -return null;var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var doy=-1;var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches) |
105 | | -iFormat++;return matches;};var getNumber=function(match){lookAhead(match);var origSize=(match=='@'?14:(match=='y'?4:(match=='o'?3:2)));var size=origSize;var num=0;while(size>0&&iValue<value.length&&value.charAt(iValue)>='0'&&value.charAt(iValue)<='9'){num=num*10+parseInt(value.charAt(iValue++),10);size--;} |
106 | | -if(size==origSize) |
107 | | -throw'Missing number at position '+iValue;return num;};var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);var size=0;for(var j=0;j<names.length;j++) |
108 | | -size=Math.max(size,names[j].length);var name='';var iInit=iValue;while(size>0&&iValue<value.length){name+=value.charAt(iValue++);for(var i=0;i<names.length;i++) |
109 | | -if(name==names[i]) |
110 | | -return i+1;size--;} |
111 | | -throw'Unknown name at position '+iInit;};var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat)) |
112 | | -throw'Unexpected literal at position '+iValue;iValue++;};var iValue=0;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal) |
113 | | -if(format.charAt(iFormat)=="'"&&!lookAhead("'")) |
114 | | -literal=false;else |
115 | | -checkLiteral();else |
116 | | -switch(format.charAt(iFormat)){case'd':day=getNumber('d');break;case'D':getName('D',dayNamesShort,dayNames);break;case'o':doy=getNumber('o');break;case'm':month=getNumber('m');break;case'M':month=getName('M',monthNamesShort,monthNames);break;case'y':year=getNumber('y');break;case'@':var date=new Date(getNumber('@'));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")) |
117 | | -checkLiteral();else |
118 | | -literal=true;break;default:checkLiteral();}} |
119 | | -if(year==-1) |
120 | | -year=new Date().getFullYear();else if(year<100) |
121 | | -year+=new Date().getFullYear()-new Date().getFullYear()%100+ |
122 | | -(year<=shortYearCutoff?0:-100);if(doy>-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim) |
123 | | -break;month++;day-=dim;}while(true);} |
124 | | -var date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day) |
125 | | -throw'Invalid date';return date;},ATOM:'yy-mm-dd',COOKIE:'D, dd M yy',ISO_8601:'yy-mm-dd',RFC_822:'D, d M y',RFC_850:'DD, dd-M-y',RFC_1036:'D, d M y',RFC_1123:'D, d M yy',RFC_2822:'D, d M yy',RSS:'D, d M y',TIMESTAMP:'@',W3C:'yy-mm-dd',formatDate:function(format,date,settings){if(!date) |
126 | | -return'';var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches) |
127 | | -iFormat++;return matches;};var formatNumber=function(match,value,len){var num=''+value;if(lookAhead(match)) |
128 | | -while(num.length<len) |
129 | | -num='0'+num;return num;};var formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value]);};var output='';var literal=false;if(date) |
130 | | -for(var iFormat=0;iFormat<format.length;iFormat++){if(literal) |
131 | | -if(format.charAt(iFormat)=="'"&&!lookAhead("'")) |
132 | | -literal=false;else |
133 | | -output+=format.charAt(iFormat);else |
134 | | -switch(format.charAt(iFormat)){case'd':output+=formatNumber('d',date.getDate(),2);break;case'D':output+=formatName('D',date.getDay(),dayNamesShort,dayNames);break;case'o':var doy=date.getDate();for(var m=date.getMonth()-1;m>=0;m--) |
135 | | -doy+=this._getDaysInMonth(date.getFullYear(),m);output+=formatNumber('o',doy,3);break;case'm':output+=formatNumber('m',date.getMonth()+1,2);break;case'M':output+=formatName('M',date.getMonth(),monthNamesShort,monthNames);break;case'y':output+=(lookAhead('y')?date.getFullYear():(date.getYear()%100<10?'0':'')+date.getYear()%100);break;case'@':output+=date.getTime();break;case"'":if(lookAhead("'")) |
136 | | -output+="'";else |
137 | | -literal=true;break;default:output+=format.charAt(iFormat);}} |
138 | | -return output;},_possibleChars:function(format){var chars='';var literal=false;for(var iFormat=0;iFormat<format.length;iFormat++) |
139 | | -if(literal) |
140 | | -if(format.charAt(iFormat)=="'"&&!lookAhead("'")) |
141 | | -literal=false;else |
142 | | -chars+=format.charAt(iFormat);else |
143 | | -switch(format.charAt(iFormat)){case'd':case'm':case'y':case'@':chars+='0123456789';break;case'D':case'M':return null;case"'":if(lookAhead("'")) |
144 | | -chars+="'";else |
145 | | -literal=true;break;default:chars+=format.charAt(iFormat);} |
146 | | -return chars;},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name];},_setDateFromField:function(inst){var dateFormat=this._get(inst,'dateFormat');var dates=inst.input?inst.input.val():null;inst.endDay=inst.endMonth=inst.endYear=null;var date=defaultDate=this._getDefaultDate(inst);var settings=this._getFormatConfig(inst);try{date=this.parseDate(dateFormat,dates,settings)||defaultDate;}catch(event){this.log(event);date=defaultDate;} |
147 | | -inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=(dates?date.getDate():0);inst.currentMonth=(dates?date.getMonth():0);inst.currentYear=(dates?date.getFullYear():0);this._adjustInstDate(inst);},_getDefaultDate:function(inst){var date=this._determineDate(this._get(inst,'defaultDate'),new Date());var minDate=this._getMinMaxDate(inst,'min',true);var maxDate=this._getMinMaxDate(inst,'max');date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);return date;},_determineDate:function(date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setDate(date.getDate()+offset);return date;};var offsetString=function(offset,getDaysInMonth){var date=new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||'d'){case'd':case'D':day+=parseInt(matches[1],10);break;case'w':case'W':day+=parseInt(matches[1],10)*7;break;case'm':case'M':month+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break;case'y':case'Y':year+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break;} |
148 | | -matches=pattern.exec(offset);} |
149 | | -return new Date(year,month,day);};date=(date==null?defaultDate:(typeof date=='string'?offsetString(date,this._getDaysInMonth):(typeof date=='number'?(isNaN(date)?defaultDate:offsetNumeric(date)):date)));date=(date&&date.toString()=='Invalid Date'?defaultDate:date);if(date){date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0);} |
150 | | -return this._daylightSavingAdjust(date);},_daylightSavingAdjust:function(date){if(!date)return null;date.setHours(date.getHours()>12?date.getHours()+2:0);return date;},_setDate:function(inst,date,endDate){var clear=!(date);var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;date=this._determineDate(date,new Date());inst.selectedDay=inst.currentDay=date.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=date.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=date.getFullYear();if(origMonth!=inst.selectedMonth||origYear!=inst.selectedYear) |
151 | | -this._notifyChange(inst);this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?'':this._formatDate(inst));}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=='')?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return startDate;},_generateHTML:function(inst){var today=new Date();today=this._daylightSavingAdjust(new Date(today.getFullYear(),today.getMonth(),today.getDate()));var isRTL=this._get(inst,'isRTL');var showButtonPanel=this._get(inst,'showButtonPanel');var hideIfNoPrevNext=this._get(inst,'hideIfNoPrevNext');var navigationAsDateFormat=this._get(inst,'navigationAsDateFormat');var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,'showCurrentAtPos');var stepMonths=this._get(inst,'stepMonths');var stepBigMonths=this._get(inst,'stepBigMonths');var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));var minDate=this._getMinMaxDate(inst,'min',true);var maxDate=this._getMinMaxDate(inst,'max');var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--;} |
152 | | -if(maxDate){var maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[1]+1,maxDate.getDate()));maxDraw=(minDate&&maxDraw<minDate?minDate:maxDraw);while(this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--;}}} |
153 | | -inst.drawMonth=drawMonth;inst.drawYear=drawYear;var prevText=this._get(inst,'prevText');prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));var prev=(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#'+inst.id+'\', -'+stepMonths+', \'M\');"'+' title="'+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?'e':'w')+'">'+prevText+'</span></a>':(hideIfNoPrevNext?'':'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?'e':'w')+'">'+prevText+'</span></a>'));var nextText=this._get(inst,'nextText');nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));var next=(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#'+inst.id+'\', +'+stepMonths+', \'M\');"'+' title="'+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?'w':'e')+'">'+nextText+'</span></a>':(hideIfNoPrevNext?'':'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?'w':'e')+'">'+nextText+'</span></a>'));var currentText=this._get(inst,'currentText');var gotoDate=(this._get(inst,'gotoCurrent')&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));var controls=(!inst.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery.datepicker._hideDatepicker();">'+this._get(inst,'closeText')+'</button>':'');var buttonPanel=(showButtonPanel)?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(isRTL?controls:'')+ |
154 | | -(this._isInRange(inst,gotoDate)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery.datepicker._gotoToday(\'#'+inst.id+'\');"'+'>'+currentText+'</button>':'')+(isRTL?'':controls)+'</div>':'';var firstDay=parseInt(this._get(inst,'firstDay'),10);firstDay=(isNaN(firstDay)?0:firstDay);var dayNames=this._get(inst,'dayNames');var dayNamesShort=this._get(inst,'dayNamesShort');var dayNamesMin=this._get(inst,'dayNamesMin');var monthNames=this._get(inst,'monthNames');var monthNamesShort=this._get(inst,'monthNamesShort');var beforeShowDay=this._get(inst,'beforeShowDay');var showOtherMonths=this._get(inst,'showOtherMonths');var calculateWeek=this._get(inst,'calculateWeek')||this.iso8601Week;var endDate=inst.endDay?this._daylightSavingAdjust(new Date(inst.endYear,inst.endMonth,inst.endDay)):currentDate;var defaultDate=this._getDefaultDate(inst);var html='';for(var row=0;row<numMonths[0];row++){var group='';for(var col=0;col<numMonths[1];col++){var selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay));var cornerClass=' ui-corner-all';var calender='';if(isMultiMonth){calender+='<div class="ui-datepicker-group ui-datepicker-group-';switch(col){case 0:calender+='first';cornerClass=' ui-corner-'+(isRTL?'right':'left');break;case numMonths[1]-1:calender+='last';cornerClass=' ui-corner-'+(isRTL?'left':'right');break;default:calender+='middle';cornerClass='';break;} |
155 | | -calender+='">';} |
156 | | -calender+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+cornerClass+'">'+ |
157 | | -(/all|left/.test(cornerClass)&&row==0?(isRTL?next:prev):'')+ |
158 | | -(/all|right/.test(cornerClass)&&row==0?(isRTL?prev:next):'')+ |
159 | | -this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,row>0||col>0,monthNames,monthNamesShort)+'</div><table class="ui-datepicker-calendar"><thead>'+'<tr>';var thead='';for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;thead+='<th'+((dow+firstDay+6)%7>=5?' class="ui-datepicker-week-end"':'')+'>'+'<span title="'+dayNames[day]+'">'+dayNamesMin[day]+'</span></th>';} |
160 | | -calender+=thead+'</tr></thead><tbody>';var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth) |
161 | | -inst.selectedDay=Math.min(inst.selectedDay,daysInMonth);var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));var printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(var dRow=0;dRow<numRows;dRow++){calender+='<tr>';var tbody='';for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,'']);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=otherMonth||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);tbody+='<td class="'+ |
162 | | -((dow+firstDay+6)%7>=5?' ui-datepicker-week-end':'')+ |
163 | | -(otherMonth?' ui-datepicker-other-month':'')+ |
164 | | -((printDate.getTime()==selectedDate.getTime()&&drawMonth==inst.selectedMonth&&inst._keyEvent)||(defaultDate.getTime()==printDate.getTime()&&defaultDate.getTime()==selectedDate.getTime())?' '+this._dayOverClass:'')+ |
165 | | -(unselectable?' '+this._unselectableClass+' ui-state-disabled':'')+ |
166 | | -(otherMonth&&!showOtherMonths?'':' '+daySettings[1]+ |
167 | | -(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?' '+this._currentClass:'')+ |
168 | | -(printDate.getTime()==today.getTime()?' ui-datepicker-today':''))+'"'+ |
169 | | -((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':'')+ |
170 | | -(unselectable?'':' onclick="DP_jQuery.datepicker._selectDay(\'#'+ |
171 | | -inst.id+'\','+drawMonth+','+drawYear+', this);return false;"')+'>'+ |
172 | | -(otherMonth?(showOtherMonths?printDate.getDate():' '):(unselectable?'<span class="ui-state-default">'+printDate.getDate()+'</span>':'<a class="ui-state-default'+ |
173 | | -(printDate.getTime()==today.getTime()?' ui-state-highlight':'')+ |
174 | | -(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?' ui-state-active':'')+'" href="#">'+printDate.getDate()+'</a>'))+'</td>';printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate);} |
175 | | -calender+=tbody+'</tr>';} |
176 | | -drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++;} |
177 | | -calender+='</tbody></table>'+(isMultiMonth?'</div>'+ |
178 | | -((numMonths[0]>0&&col==numMonths[1]-1)?'<div class="ui-datepicker-row-break"></div>':''):'');group+=calender;} |
179 | | -html+=group;} |
180 | | -html+=buttonPanel+($.browser.msie&&parseInt($.browser.version,10)<7&&!inst.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':'');inst._keyEvent=false;return html;},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,secondary,monthNames,monthNamesShort){minDate=(inst.rangeStart&&minDate&&selectedDate<minDate?selectedDate:minDate);var changeMonth=this._get(inst,'changeMonth');var changeYear=this._get(inst,'changeYear');var showMonthAfterYear=this._get(inst,'showMonthAfterYear');var html='<div class="ui-datepicker-title">';var monthHtml='';if(secondary||!changeMonth) |
181 | | -monthHtml+='<span class="ui-datepicker-month">'+monthNames[drawMonth]+'</span> ';else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='<select class="ui-datepicker-month" '+'onchange="DP_jQuery.datepicker._selectMonthYear(\'#'+inst.id+'\', this, \'M\');" '+'onclick="DP_jQuery.datepicker._clickMonthYear(\'#'+inst.id+'\');"'+'>';for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())) |
182 | | -monthHtml+='<option value="'+month+'"'+ |
183 | | -(month==drawMonth?' selected="selected"':'')+'>'+monthNamesShort[month]+'</option>';} |
184 | | -monthHtml+='</select>';} |
185 | | -if(!showMonthAfterYear) |
186 | | -html+=monthHtml+((secondary||changeMonth||changeYear)&&(!(changeMonth&&changeYear))?' ':'');if(secondary||!changeYear) |
187 | | -html+='<span class="ui-datepicker-year">'+drawYear+'</span>';else{var years=this._get(inst,'yearRange').split(':');var year=0;var endYear=0;if(years.length!=2){year=drawYear-10;endYear=drawYear+10;}else if(years[0].charAt(0)=='+'||years[0].charAt(0)=='-'){year=drawYear+parseInt(years[0],10);endYear=drawYear+parseInt(years[1],10);}else{year=parseInt(years[0],10);endYear=parseInt(years[1],10);} |
188 | | -year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);html+='<select class="ui-datepicker-year" '+'onchange="DP_jQuery.datepicker._selectMonthYear(\'#'+inst.id+'\', this, \'Y\');" '+'onclick="DP_jQuery.datepicker._clickMonthYear(\'#'+inst.id+'\');"'+'>';for(;year<=endYear;year++){html+='<option value="'+year+'"'+ |
189 | | -(year==drawYear?' selected="selected"':'')+'>'+year+'</option>';} |
190 | | -html+='</select>';} |
191 | | -if(showMonthAfterYear) |
192 | | -html+=(secondary||changeMonth||changeYear?' ':'')+monthHtml;html+='</div>';return html;},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=='Y'?offset:0);var month=inst.drawMonth+(period=='M'?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+ |
193 | | -(period=='D'?offset:0);var date=this._daylightSavingAdjust(new Date(year,month,day));var minDate=this._getMinMaxDate(inst,'min',true);var maxDate=this._getMinMaxDate(inst,'max');date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=='M'||period=='Y') |
194 | | -this._notifyChange(inst);},_notifyChange:function(inst){var onChange=this._get(inst,'onChangeMonthYear');if(onChange) |
195 | | -onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst]);},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,'numberOfMonths');return(numMonths==null?[1,1]:(typeof numMonths=='number'?[1,numMonths]:numMonths));},_getMinMaxDate:function(inst,minMax,checkRange){var date=this._determineDate(this._get(inst,minMax+'Date'),null);return(!checkRange||!inst.rangeStart?date:(!date||inst.rangeStart>date?inst.rangeStart:date));},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate();},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay();},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[1]),1));if(offset<0) |
196 | | -date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()));return this._isInRange(inst,date);},_isInRange:function(inst,date){var newMinDate=(!inst.rangeStart?null:this._daylightSavingAdjust(new Date(inst.selectedYear,inst.selectedMonth,inst.selectedDay)));newMinDate=(newMinDate&&inst.rangeStart<newMinDate?inst.rangeStart:newMinDate);var minDate=newMinDate||this._getMinMaxDate(inst,'min');var maxDate=this._getMinMaxDate(inst,'max');return((!minDate||date>=minDate)&&(!maxDate||date<=maxDate));},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,'shortYearCutoff');shortYearCutoff=(typeof shortYearCutoff!='string'?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,'dayNamesShort'),dayNames:this._get(inst,'dayNames'),monthNamesShort:this._get(inst,'monthNamesShort'),monthNames:this._get(inst,'monthNames')};},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear;} |
197 | | -var date=(day?(typeof day=='object'?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,'dateFormat'),date,this._getFormatConfig(inst));}});function extendRemove(target,props){$.extend(target,props);for(var name in props) |
198 | | -if(props[name]==null||props[name]==undefined) |
199 | | -target[name]=props[name];return target;};function isArray(a){return(a&&(($.browser.safari&&typeof a=='object'&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))));};$.fn.datepicker=function(options){if(!$.datepicker.initialized){$(document).mousedown($.datepicker._checkExternalClick).find('body').append($.datepicker.dpDiv);$.datepicker.initialized=true;} |
200 | | -var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=='string'&&(options=='isDisabled'||options=='getDate')) |
201 | | -return $.datepicker['_'+options+'Datepicker'].apply($.datepicker,[this[0]].concat(otherArgs));return this.each(function(){typeof options=='string'?$.datepicker['_'+options+'Datepicker'].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options);});};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime();$.datepicker.version="1.7.1";window.DP_jQuery=$;})(jQuery);(function($){var setDataSwitch={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"},uiDialogClasses='ui-dialog '+'ui-widget '+'ui-widget-content '+'ui-corner-all ';$.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr('title');var self=this,options=this.options,title=options.title||this.originalTitle||' ',titleId=$.ui.dialog.getTitleId(this.element),uiDialog=(this.uiDialog=$('<div/>')).appendTo(document.body).hide().addClass(uiDialogClasses+options.dialogClass).css({position:'absolute',overflow:'hidden',zIndex:options.zIndex}).attr('tabIndex',-1).css('outline',0).keydown(function(event){(options.closeOnEscape&&event.keyCode&&event.keyCode==$.ui.keyCode.ESCAPE&&self.close(event));}).attr({role:'dialog','aria-labelledby':titleId}).mousedown(function(event){self.moveToTop(false,event);}),uiDialogContent=this.element.show().removeAttr('title').addClass('ui-dialog-content '+'ui-widget-content').appendTo(uiDialog),uiDialogTitlebar=(this.uiDialogTitlebar=$('<div></div>')).addClass('ui-dialog-titlebar '+'ui-widget-header '+'ui-corner-all '+'ui-helper-clearfix').prependTo(uiDialog),uiDialogTitlebarClose=$('<a href="#"/>').addClass('ui-dialog-titlebar-close '+'ui-corner-all').attr('role','button').hover(function(){uiDialogTitlebarClose.addClass('ui-state-hover');},function(){uiDialogTitlebarClose.removeClass('ui-state-hover');}).focus(function(){uiDialogTitlebarClose.addClass('ui-state-focus');}).blur(function(){uiDialogTitlebarClose.removeClass('ui-state-focus');}).mousedown(function(ev){ev.stopPropagation();}).click(function(event){self.close(event);return false;}).appendTo(uiDialogTitlebar),uiDialogTitlebarCloseText=(this.uiDialogTitlebarCloseText=$('<span/>')).addClass('ui-icon '+'ui-icon-closethick').text(options.closeText).appendTo(uiDialogTitlebarClose),uiDialogTitle=$('<span/>').addClass('ui-dialog-title').attr('id',titleId).html(title).prependTo(uiDialogTitlebar);uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();(options.draggable&&$.fn.draggable&&this._makeDraggable());(options.resizable&&$.fn.resizable&&this._makeResizable());this._createButtons(options.buttons);this._isOpen=false;(options.bgiframe&&$.fn.bgiframe&&uiDialog.bgiframe());(options.autoOpen&&this.open());},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind('.dialog').removeData('dialog').removeClass('ui-dialog-content ui-widget-content').hide().appendTo('body');this.uiDialog.remove();(this.originalTitle&&this.element.attr('title',this.originalTitle));},close:function(event){var self=this;if(false===self._trigger('beforeclose',event)){return;} |
| 31 | +return false;},_mouseDistanceMet:function(event){return(Math.max(Math.abs(this._mouseDownEvent.pageX-event.pageX),Math.abs(this._mouseDownEvent.pageY-event.pageY))>=this.options.distance);},_mouseDelayMet:function(event){return this.mouseDelayMet;},_mouseStart:function(event){},_mouseDrag:function(event){},_mouseStop:function(event){},_mouseCapture:function(event){return true;}};$.ui.mouse.defaults={cancel:null,distance:1,delay:0};})(jQuery);(function($){var setDataSwitch={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"},uiDialogClasses='ui-dialog '+'ui-widget '+'ui-widget-content '+'ui-corner-all ';$.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr('title');var self=this,options=this.options,title=options.title||this.originalTitle||' ',titleId=$.ui.dialog.getTitleId(this.element),uiDialog=(this.uiDialog=$('<div/>')).appendTo(document.body).hide().addClass(uiDialogClasses+options.dialogClass).css({position:'absolute',overflow:'hidden',zIndex:options.zIndex}).attr('tabIndex',-1).css('outline',0).keydown(function(event){(options.closeOnEscape&&event.keyCode&&event.keyCode==$.ui.keyCode.ESCAPE&&self.close(event));}).attr({role:'dialog','aria-labelledby':titleId}).mousedown(function(event){self.moveToTop(false,event);}),uiDialogContent=this.element.show().removeAttr('title').addClass('ui-dialog-content '+'ui-widget-content').appendTo(uiDialog),uiDialogTitlebar=(this.uiDialogTitlebar=$('<div></div>')).addClass('ui-dialog-titlebar '+'ui-widget-header '+'ui-corner-all '+'ui-helper-clearfix').prependTo(uiDialog),uiDialogTitlebarClose=$('<a href="#"/>').addClass('ui-dialog-titlebar-close '+'ui-corner-all').attr('role','button').hover(function(){uiDialogTitlebarClose.addClass('ui-state-hover');},function(){uiDialogTitlebarClose.removeClass('ui-state-hover');}).focus(function(){uiDialogTitlebarClose.addClass('ui-state-focus');}).blur(function(){uiDialogTitlebarClose.removeClass('ui-state-focus');}).mousedown(function(ev){ev.stopPropagation();}).click(function(event){self.close(event);return false;}).appendTo(uiDialogTitlebar),uiDialogTitlebarCloseText=(this.uiDialogTitlebarCloseText=$('<span/>')).addClass('ui-icon '+'ui-icon-closethick').text(options.closeText).appendTo(uiDialogTitlebarClose),uiDialogTitle=$('<span/>').addClass('ui-dialog-title').attr('id',titleId).html(title).prependTo(uiDialogTitlebar);uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();(options.draggable&&$.fn.draggable&&this._makeDraggable());(options.resizable&&$.fn.resizable&&this._makeResizable());this._createButtons(options.buttons);this._isOpen=false;(options.bgiframe&&$.fn.bgiframe&&uiDialog.bgiframe());(options.autoOpen&&this.open());},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind('.dialog').removeData('dialog').removeClass('ui-dialog-content ui-widget-content').hide().appendTo('body');this.uiDialog.remove();(this.originalTitle&&this.element.attr('title',this.originalTitle));},close:function(event){var self=this;if(false===self._trigger('beforeclose',event)){return;} |
202 | 32 | (self.overlay&&self.overlay.destroy());self.uiDialog.unbind('keypress.ui-dialog');(self.options.hide?self.uiDialog.hide(self.options.hide,function(){self._trigger('close',event);}):self.uiDialog.hide()&&self._trigger('close',event));$.ui.dialog.overlay.resize();self._isOpen=false;},isOpen:function(){return this._isOpen;},moveToTop:function(force,event){if((this.options.modal&&!force)||(!this.options.stack&&!this.options.modal)){return this._trigger('focus',event);} |
203 | 33 | if(this.options.zIndex>$.ui.dialog.maxZ){$.ui.dialog.maxZ=this.options.zIndex;} |
204 | 34 | (this.overlay&&this.overlay.$el.css('z-index',$.ui.dialog.overlay.maxZ=++$.ui.dialog.maxZ));var saveScroll={scrollTop:this.element.attr('scrollTop'),scrollLeft:this.element.attr('scrollLeft')};this.uiDialog.css('z-index',++$.ui.dialog.maxZ);this.element.attr(saveScroll);this._trigger('focus',event);},open:function(){if(this._isOpen){return;} |
— | — | @@ -295,59 +125,7 @@ |
296 | 126 | $(this).css({left:ho.left-cop.left-co.left,width:w,height:h});}});$.ui.plugin.add("resizable","ghost",{start:function(event,ui){var self=$(this).data("resizable"),o=self.options,cs=self.size;self.ghost=self.originalElement.clone();self.ghost.css({opacity:.25,display:'block',position:'relative',height:cs.height,width:cs.width,margin:0,left:0,top:0}).addClass('ui-resizable-ghost').addClass(typeof o.ghost=='string'?o.ghost:'');self.ghost.appendTo(self.helper);},resize:function(event,ui){var self=$(this).data("resizable"),o=self.options;if(self.ghost)self.ghost.css({position:'relative',height:self.size.height,width:self.size.width});},stop:function(event,ui){var self=$(this).data("resizable"),o=self.options;if(self.ghost&&self.helper)self.helper.get(0).removeChild(self.ghost.get(0));}});$.ui.plugin.add("resizable","grid",{resize:function(event,ui){var self=$(this).data("resizable"),o=self.options,cs=self.size,os=self.originalSize,op=self.originalPosition,a=self.axis,ratio=o._aspectRatio||event.shiftKey;o.grid=typeof o.grid=="number"?[o.grid,o.grid]:o.grid;var ox=Math.round((cs.width-os.width)/(o.grid[0]||1))*(o.grid[0]||1),oy=Math.round((cs.height-os.height)/(o.grid[1]||1))*(o.grid[1]||1);if(/^(se|s|e)$/.test(a)){self.size.width=os.width+ox;self.size.height=os.height+oy;} |
297 | 127 | else if(/^(ne)$/.test(a)){self.size.width=os.width+ox;self.size.height=os.height+oy;self.position.top=op.top-oy;} |
298 | 128 | else if(/^(sw)$/.test(a)){self.size.width=os.width+ox;self.size.height=os.height+oy;self.position.left=op.left-ox;} |
299 | | -else{self.size.width=os.width+ox;self.size.height=os.height+oy;self.position.top=op.top-oy;self.position.left=op.left-ox;}}});var num=function(v){return parseInt(v,10)||0;};var isNumber=function(value){return!isNaN(parseInt(value,10));};})(jQuery);(function($){$.widget("ui.tabs",{_init:function(){if(this.options.deselectable!==undefined){this.options.collapsible=this.options.deselectable;} |
300 | | -this._tabify(true);},_setData:function(key,value){if(key=='selected'){if(this.options.collapsible&&value==this.options.selected){return;} |
301 | | -this.select(value);} |
302 | | -else{this.options[key]=value;if(key=='deselectable'){this.options.collapsible=value;} |
303 | | -this._tabify();}},_tabId:function(a){return a.title&&a.title.replace(/\s/g,'_').replace(/[^A-Za-z0-9\-_:\.]/g,'')||this.options.idPrefix+$.data(a);},_sanitizeSelector:function(hash){return hash.replace(/:/g,'\\:');},_cookie:function(){var cookie=this.cookie||(this.cookie=this.options.cookie.name||'ui-tabs-'+$.data(this.list[0]));return $.cookie.apply(null,[cookie].concat($.makeArray(arguments)));},_ui:function(tab,panel){return{tab:tab,panel:panel,index:this.anchors.index(tab)};},_cleanup:function(){this.lis.filter('.ui-state-processing').removeClass('ui-state-processing').find('span:data(label.tabs)').each(function(){var el=$(this);el.html(el.data('label.tabs')).removeData('label.tabs');});},_tabify:function(init){this.list=this.element.children('ul:first');this.lis=$('li:has(a[href])',this.list);this.anchors=this.lis.map(function(){return $('a',this)[0];});this.panels=$([]);var self=this,o=this.options;var fragmentId=/^#.+/;this.anchors.each(function(i,a){var href=$(a).attr('href');var hrefBase=href.split('#')[0],baseEl;if(hrefBase&&(hrefBase===location.toString().split('#')[0]||(baseEl=$('base')[0])&&hrefBase===baseEl.href)){href=a.hash;a.href=href;} |
304 | | -if(fragmentId.test(href)){self.panels=self.panels.add(self._sanitizeSelector(href));} |
305 | | -else if(href!='#'){$.data(a,'href.tabs',href);$.data(a,'load.tabs',href.replace(/#.*$/,''));var id=self._tabId(a);a.href='#'+id;var $panel=$('#'+id);if(!$panel.length){$panel=$(o.panelTemplate).attr('id',id).addClass('ui-tabs-panel ui-widget-content ui-corner-bottom').insertAfter(self.panels[i-1]||self.list);$panel.data('destroy.tabs',true);} |
306 | | -self.panels=self.panels.add($panel);} |
307 | | -else{o.disabled.push(i);}});if(init){this.element.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all');this.list.addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');this.lis.addClass('ui-state-default ui-corner-top');this.panels.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom');if(o.selected===undefined){if(location.hash){this.anchors.each(function(i,a){if(a.hash==location.hash){o.selected=i;return false;}});} |
308 | | -if(typeof o.selected!='number'&&o.cookie){o.selected=parseInt(self._cookie(),10);} |
309 | | -if(typeof o.selected!='number'&&this.lis.filter('.ui-tabs-selected').length){o.selected=this.lis.index(this.lis.filter('.ui-tabs-selected'));} |
310 | | -o.selected=o.selected||0;} |
311 | | -else if(o.selected===null){o.selected=-1;} |
312 | | -o.selected=((o.selected>=0&&this.anchors[o.selected])||o.selected<0)?o.selected:0;o.disabled=$.unique(o.disabled.concat($.map(this.lis.filter('.ui-state-disabled'),function(n,i){return self.lis.index(n);}))).sort();if($.inArray(o.selected,o.disabled)!=-1){o.disabled.splice($.inArray(o.selected,o.disabled),1);} |
313 | | -this.panels.addClass('ui-tabs-hide');this.lis.removeClass('ui-tabs-selected ui-state-active');if(o.selected>=0&&this.anchors.length){this.panels.eq(o.selected).removeClass('ui-tabs-hide');this.lis.eq(o.selected).addClass('ui-tabs-selected ui-state-active');self.element.queue("tabs",function(){self._trigger('show',null,self._ui(self.anchors[o.selected],self.panels[o.selected]));});this.load(o.selected);} |
314 | | -$(window).bind('unload',function(){self.lis.add(self.anchors).unbind('.tabs');self.lis=self.anchors=self.panels=null;});} |
315 | | -else{o.selected=this.lis.index(this.lis.filter('.ui-tabs-selected'));} |
316 | | -this.element[o.collapsible?'addClass':'removeClass']('ui-tabs-collapsible');if(o.cookie){this._cookie(o.selected,o.cookie);} |
317 | | -for(var i=0,li;(li=this.lis[i]);i++){$(li)[$.inArray(i,o.disabled)!=-1&&!$(li).hasClass('ui-tabs-selected')?'addClass':'removeClass']('ui-state-disabled');} |
318 | | -if(o.cache===false){this.anchors.removeData('cache.tabs');} |
319 | | -this.lis.add(this.anchors).unbind('.tabs');if(o.event!='mouseover'){var addState=function(state,el){if(el.is(':not(.ui-state-disabled)')){el.addClass('ui-state-'+state);}};var removeState=function(state,el){el.removeClass('ui-state-'+state);};this.lis.bind('mouseover.tabs',function(){addState('hover',$(this));});this.lis.bind('mouseout.tabs',function(){removeState('hover',$(this));});this.anchors.bind('focus.tabs',function(){addState('focus',$(this).closest('li'));});this.anchors.bind('blur.tabs',function(){removeState('focus',$(this).closest('li'));});} |
320 | | -var hideFx,showFx;if(o.fx){if($.isArray(o.fx)){hideFx=o.fx[0];showFx=o.fx[1];} |
321 | | -else{hideFx=showFx=o.fx;}} |
322 | | -function resetStyle($el,fx){$el.css({display:''});if($.browser.msie&&fx.opacity){$el[0].style.removeAttribute('filter');}} |
323 | | -var showTab=showFx?function(clicked,$show){$(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active');$show.hide().removeClass('ui-tabs-hide').animate(showFx,showFx.duration||'normal',function(){resetStyle($show,showFx);self._trigger('show',null,self._ui(clicked,$show[0]));});}:function(clicked,$show){$(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active');$show.removeClass('ui-tabs-hide');self._trigger('show',null,self._ui(clicked,$show[0]));};var hideTab=hideFx?function(clicked,$hide){$hide.animate(hideFx,hideFx.duration||'normal',function(){self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default');$hide.addClass('ui-tabs-hide');resetStyle($hide,hideFx);self.element.dequeue("tabs");});}:function(clicked,$hide,$show){self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default');$hide.addClass('ui-tabs-hide');self.element.dequeue("tabs");};this.anchors.bind(o.event+'.tabs',function(){var el=this,$li=$(this).closest('li'),$hide=self.panels.filter(':not(.ui-tabs-hide)'),$show=$(self._sanitizeSelector(this.hash));if(($li.hasClass('ui-tabs-selected')&&!o.collapsible)||$li.hasClass('ui-state-disabled')||$li.hasClass('ui-state-processing')||self._trigger('select',null,self._ui(this,$show[0]))===false){this.blur();return false;} |
324 | | -o.selected=self.anchors.index(this);self.abort();if(o.collapsible){if($li.hasClass('ui-tabs-selected')){o.selected=-1;if(o.cookie){self._cookie(o.selected,o.cookie);} |
325 | | -self.element.queue("tabs",function(){hideTab(el,$hide);}).dequeue("tabs");this.blur();return false;} |
326 | | -else if(!$hide.length){if(o.cookie){self._cookie(o.selected,o.cookie);} |
327 | | -self.element.queue("tabs",function(){showTab(el,$show);});self.load(self.anchors.index(this));this.blur();return false;}} |
328 | | -if(o.cookie){self._cookie(o.selected,o.cookie);} |
329 | | -if($show.length){if($hide.length){self.element.queue("tabs",function(){hideTab(el,$hide);});} |
330 | | -self.element.queue("tabs",function(){showTab(el,$show);});self.load(self.anchors.index(this));} |
331 | | -else{throw'jQuery UI Tabs: Mismatching fragment identifier.';} |
332 | | -if($.browser.msie){this.blur();}});this.anchors.bind('click.tabs',function(){return false;});},destroy:function(){var o=this.options;this.abort();this.element.unbind('.tabs').removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible').removeData('tabs');this.list.removeClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');this.anchors.each(function(){var href=$.data(this,'href.tabs');if(href){this.href=href;} |
333 | | -var $this=$(this).unbind('.tabs');$.each(['href','load','cache'],function(i,prefix){$this.removeData(prefix+'.tabs');});});this.lis.unbind('.tabs').add(this.panels).each(function(){if($.data(this,'destroy.tabs')){$(this).remove();} |
334 | | -else{$(this).removeClass(['ui-state-default','ui-corner-top','ui-tabs-selected','ui-state-active','ui-state-hover','ui-state-focus','ui-state-disabled','ui-tabs-panel','ui-widget-content','ui-corner-bottom','ui-tabs-hide'].join(' '));}});if(o.cookie){this._cookie(null,o.cookie);}},add:function(url,label,index){if(index===undefined){index=this.anchors.length;} |
335 | | -var self=this,o=this.options,$li=$(o.tabTemplate.replace(/#\{href\}/g,url).replace(/#\{label\}/g,label)),id=!url.indexOf('#')?url.replace('#',''):this._tabId($('a',$li)[0]);$li.addClass('ui-state-default ui-corner-top').data('destroy.tabs',true);var $panel=$('#'+id);if(!$panel.length){$panel=$(o.panelTemplate).attr('id',id).data('destroy.tabs',true);} |
336 | | -$panel.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide');if(index>=this.lis.length){$li.appendTo(this.list);$panel.appendTo(this.list[0].parentNode);} |
337 | | -else{$li.insertBefore(this.lis[index]);$panel.insertBefore(this.panels[index]);} |
338 | | -o.disabled=$.map(o.disabled,function(n,i){return n>=index?++n:n;});this._tabify();if(this.anchors.length==1){$li.addClass('ui-tabs-selected ui-state-active');$panel.removeClass('ui-tabs-hide');this.element.queue("tabs",function(){self._trigger('show',null,self._ui(self.anchors[0],self.panels[0]));});this.load(0);} |
339 | | -this._trigger('add',null,this._ui(this.anchors[index],this.panels[index]));},remove:function(index){var o=this.options,$li=this.lis.eq(index).remove(),$panel=this.panels.eq(index).remove();if($li.hasClass('ui-tabs-selected')&&this.anchors.length>1){this.select(index+(index+1<this.anchors.length?1:-1));} |
340 | | -o.disabled=$.map($.grep(o.disabled,function(n,i){return n!=index;}),function(n,i){return n>=index?--n:n;});this._tabify();this._trigger('remove',null,this._ui($li.find('a')[0],$panel[0]));},enable:function(index){var o=this.options;if($.inArray(index,o.disabled)==-1){return;} |
341 | | -this.lis.eq(index).removeClass('ui-state-disabled');o.disabled=$.grep(o.disabled,function(n,i){return n!=index;});this._trigger('enable',null,this._ui(this.anchors[index],this.panels[index]));},disable:function(index){var self=this,o=this.options;if(index!=o.selected){this.lis.eq(index).addClass('ui-state-disabled');o.disabled.push(index);o.disabled.sort();this._trigger('disable',null,this._ui(this.anchors[index],this.panels[index]));}},select:function(index){if(typeof index=='string'){index=this.anchors.index(this.anchors.filter('[href$='+index+']'));} |
342 | | -else if(index===null){index=-1;} |
343 | | -if(index==-1&&this.options.collapsible){index=this.options.selected;} |
344 | | -this.anchors.eq(index).trigger(this.options.event+'.tabs');},load:function(index){var self=this,o=this.options,a=this.anchors.eq(index)[0],url=$.data(a,'load.tabs');this.abort();if(!url||this.element.queue("tabs").length!==0&&$.data(a,'cache.tabs')){this.element.dequeue("tabs");return;} |
345 | | -this.lis.eq(index).addClass('ui-state-processing');if(o.spinner){var span=$('span',a);span.data('label.tabs',span.html()).html(o.spinner);} |
346 | | -this.xhr=$.ajax($.extend({},o.ajaxOptions,{url:url,success:function(r,s){$(self._sanitizeSelector(a.hash)).html(r);self._cleanup();if(o.cache){$.data(a,'cache.tabs',true);} |
347 | | -self._trigger('load',null,self._ui(self.anchors[index],self.panels[index]));try{o.ajaxOptions.success(r,s);} |
348 | | -catch(e){} |
349 | | -self.element.dequeue("tabs");}}));},abort:function(){this.element.queue([]);this.panels.stop(false,true);if(this.xhr){this.xhr.abort();delete this.xhr;} |
350 | | -this._cleanup();},url:function(index,url){this.anchors.eq(index).removeData('cache.tabs').data('load.tabs',url);},length:function(){return this.anchors.length;}});$.extend($.ui.tabs,{version:'1.7.1',getter:'length',defaults:{ajaxOptions:null,cache:false,cookie:null,collapsible:false,disabled:[],event:'click',fx:null,idPrefix:'ui-tabs-',panelTemplate:'<div></div>',spinner:'<em>Loading…</em>',tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>'}});$.extend($.ui.tabs.prototype,{rotation:null,rotate:function(ms,continuing){var self=this,o=this.options;var rotate=self._rotate||(self._rotate=function(e){clearTimeout(self.rotation);self.rotation=setTimeout(function(){var t=o.selected;self.select(++t<self.anchors.length?t:0);},ms);if(e){e.stopPropagation();}});var stop=self._unrotate||(self._unrotate=!continuing?function(e){if(e.clientX){self.rotate(null);}}:function(e){t=o.selected;rotate();});if(ms){this.element.bind('tabsshow',rotate);this.anchors.bind(o.event+'.tabs',stop);rotate();} |
351 | | -else{clearTimeout(self.rotation);this.element.unbind('tabsshow',rotate);this.anchors.unbind(o.event+'.tabs',stop);delete this._rotate;delete this._unrotate;}}});})(jQuery);(function($){$.whileAsync=function(opts) |
| 129 | +else{self.size.width=os.width+ox;self.size.height=os.height+oy;self.position.top=op.top-oy;self.position.left=op.left-ox;}}});var num=function(v){return parseInt(v,10)||0;};var isNumber=function(value){return!isNaN(parseInt(value,10));};})(jQuery);(function($){$.whileAsync=function(opts) |
352 | 130 | {var delay=Math.abs(opts.delay)||10,bulk=isNaN(opts.bulk)?500:Math.abs(opts.bulk),test=opts.test||function(){return true;},loop=opts.loop||function(){},end=opts.end||function(){};(function(){var t=false,begin=new Date();while(t=test()) |
353 | 131 | {loop();if(bulk===0||(new Date()-begin)>bulk) |
354 | 132 | {break;}} |
— | — | @@ -391,10 +169,7 @@ |
392 | 170 | $.fn.extend({delayedBind:function(timeout,event,data,callback){var encEvent=encodeEvent(event);return this.each(function(){var that=this;if(!($(this).data('_delayedBindBound-'+encEvent+'-'+timeout))){$(this).data('_delayedBindBound-'+encEvent+'-'+timeout,true);$(this).bind(event,function(){var timerID=$(this).data('_delayedBindTimerID-'+encEvent+'-'+timeout);if(typeof timerID!='undefined') |
393 | 171 | clearTimeout(timerID);timerID=setTimeout(function(){$(that).trigger('_delayedBind-'+encEvent+'-'+timeout);},timeout);$(this).data('_delayedBindTimerID-'+encEvent+'-'+timeout,timerID);});} |
394 | 172 | $(this).bind('_delayedBind-'+encEvent+'-'+timeout,data,callback);});},delayedBindCancel:function(timeout,event){var encEvent=encodeEvent(event);return this.each(function(){var timerID=$(this).data('_delayedBindTimerID-'+encEvent+'-'+timeout);if(typeof timerID!='undefined') |
395 | | -clearTimeout(timerID);});},delayedBindUnbind:function(timeout,event,callback){var encEvent=encodeEvent(event);return this.each(function(){$(this).unbind('_delayedBind-'+encEvent+'-'+timeout,callback);});}});})(jQuery);(function($){$.expandableField={expandField:function(e,context){context.config.beforeExpand.call(context.data.$field,context);context.data.$field.animate({'width':context.data.expandedWidth},'fast',function(){context.config.afterExpand.call(this,context);});},condenseField:function(e,context){context.config.beforeCondense.call(context.data.$field,context);context.data.$field.animate({'width':context.data.condensedWidth},'fast',function(){context.config.afterCondense.call(this,context);});},configure:function(context,property,value){switch(property){default:context.config[property]=value;break;}}};$.fn.expandableField=function(){var returnValue=null;var args=arguments;$(this).each(function(){var context=$(this).data('expandableField-context');if(context==null){context={config:{'beforeCondense':function(context){},'beforeExpand':function(context){},'afterCondense':function(context){},'afterExpand':function(context){}}};} |
396 | | -if(args.length>0){if(typeof args[0]=='object'){for(var key in args[0]){$.expandableField.configure(context,key,args[0][key]);}}else if(typeof args[0]=='string'){if(args.length>1){$.expandableField.configure(context,args[0],args[1]);}else if(returnValue==null){returnValue=(args[0]in context.config?undefined:context.config[args[0]]);}}} |
397 | | -if(typeof context.data=='undefined'){context.data={'condensedWidth':$(this).width(),'expandedWidth':$(this).width()*2,'$field':$(this)};$(this).addClass('expandableField').focus(function(e){$.expandableField.expandField(e,context);}).delayedBind(250,'blur',function(e){$.expandableField.condenseField(e,context);});} |
398 | | -$(this).data('expandableField-context',context);});return returnValue!==null?returnValue:$(this);};})(jQuery);(function($){$.suggestions={cancel:function(context){if(context.data.timerID!=null){clearTimeout(context.data.timerID);} |
| 173 | +clearTimeout(timerID);});},delayedBindUnbind:function(timeout,event,callback){var encEvent=encodeEvent(event);return this.each(function(){$(this).unbind('_delayedBind-'+encEvent+'-'+timeout,callback);});}});})(jQuery);(function($){$.suggestions={cancel:function(context){if(context.data.timerID!=null){clearTimeout(context.data.timerID);} |
399 | 174 | if(typeof context.config.cancel=='function'){context.config.cancel.call(context.data.$textbox);}},restore:function(context){context.data.$textbox.val(context.data.prevText);},update:function(context,delayed){function maybeFetch(){if(context.data.$textbox.val()!==context.data.prevText){context.data.prevText=context.data.$textbox.val();if(typeof context.config.fetch=='function'){context.config.fetch.call(context.data.$textbox,context.data.$textbox.val());}}} |
400 | 175 | if(context.data.timerID!=null){clearTimeout(context.data.timerID);} |
401 | 176 | if(delayed){context.data.timerID=setTimeout(maybeFetch,context.config.delay);}else{maybeFetch();} |
— | — | @@ -605,154 +380,7 @@ |
606 | 381 | configuration.newButtons[mw.usability.getMsg(msg)]=configuration.buttons[msg];configuration.buttons=configuration.newButtons;var dialogDiv=$('<div />').attr('id',module.id).html(module.html).data('context',context).appendTo($('body')).each(module.init).dialog(configuration);$.wikiEditor.modules.dialogs.fn.setTabindexes(dialogDiv.closest('.ui-dialog').find('button').not('[tabindex]'));if(!('resizeme'in module)||module.resizeme){dialogDiv.bind('dialogopen',$.wikiEditor.modules.dialogs.fn.resize).find('.ui-tabs').bind('tabsshow',function(){$(this).closest('.ui-dialog-content').each($.wikiEditor.modules.dialogs.fn.resize);});} |
607 | 382 | dialogDiv.bind('dialogclose',function(){context.fn.restoreSelection();});context.$textarea.trigger('wikiEditor-dialogs-loaded-'+mod);});},resize:function(){var wrapper=$(this).closest('.ui-dialog');var oldWidth=wrapper.width();var oldHidden=$(this).find('*').not(':visible');oldHidden.each(function(){$(this).data('oldstyle',$(this).attr('style'));});oldHidden.show();var oldWS=$(this).css('white-space');$(this).css('white-space','nowrap');if(wrapper.width()<=$(this).get(0).scrollWidth){var thisWidth=$(this).data('thisWidth')?$(this).data('thisWidth'):0;thisWidth=Math.max($(this).get(0).scrollWidth,thisWidth);$(this).width(thisWidth);$(this).data('thisWidth',thisWidth);var wrapperWidth=$(this).data('wrapperWidth')?$(this).data('wrapperWidth'):0;wrapperWidth=Math.max(wrapper.get(0).scrollWidth,wrapperWidth);wrapper.width(wrapperWidth);$(this).data('wrapperWidth',wrapperWidth);$(this).dialog({'width':wrapper.width()});wrapper.css('left',parseInt(wrapper.css('left'))-(wrapper.width()-oldWidth)/2);} |
608 | 383 | $(this).css('white-space',oldWS);oldHidden.each(function(){$(this).attr('style',$(this).data('oldstyle'));});},setTabindexes:function($elements){var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI) |
609 | | -maxTI=ti;});var tabIndex=maxTI+1;$elements.each(function(){$j(this).attr('tabindex',tabIndex++);});}},modules:{},quickDialog:function(body,settings){$('<div />').text(body).appendTo($('body')).dialog($.extend({bgiframe:true,modal:true},settings)).dialog('open');}};})(jQuery);(function($){$.wikiEditor.modules.highlight={'req':['iframe'],'name':'highlight','cfg':{'styleVersion':3},'evt':{'delayedChange':function(context,event){if(event.data.scope=='realchange'){$.wikiEditor.modules.highlight.fn.scan(context);$.wikiEditor.modules.highlight.fn.mark(context,event.data.scope);}},'ready':function(context,event){$.wikiEditor.modules.highlight.fn.scan(context);$.wikiEditor.modules.highlight.fn.mark(context,'ready');}},'fn':{'create':function(context,config){context.modules.highlight.markersStr='';},'scan':function(context,division){var tokenArray=context.modules.highlight.tokenArray=[];var text=context.fn.getContents();for(var module in context.modules){if(module in $.wikiEditor.modules&&'exp'in $.wikiEditor.modules[module]){for(var exp in $.wikiEditor.modules[module].exp){var regex=$.wikiEditor.modules[module].exp[exp].regex;var label=$.wikiEditor.modules[module].exp[exp].label;var markAfter=$.wikiEditor.modules[module].exp[exp].markAfter||false;var offset=0,left,right,match;while((match=text.substr(offset).match(regex))!=null){right=(left=offset+match.index)+match[0].length;tokenArray[tokenArray.length]={'offset':markAfter?right:left,'label':label,'tokenStart':left,'match':match};offset=right;}}}} |
610 | | -tokenArray.sort(function(a,b){return a.tokenStart-b.tokenStart;});context.fn.trigger('scan');},'mark':function(context,division,tokens){var markers=[];if(context.modules.highlight.markers&&division!=''){for(var i=0;i<context.modules.highlight.markers.length;i++){if(context.modules.highlight.markers[i].skipDivision==division){markers.push(context.modules.highlight.markers[i]);}}} |
611 | | -context.modules.highlight.markers=markers;context.fn.trigger('mark');markers.sort(function(a,b){return a.start-b.start||a.end-b.end;});var markersStr='';for(var i=0;i<markers.length;i++){markersStr+=markers[i].start+','+markers[i].end+','+markers[i].type+',';} |
612 | | -if(context.modules.highlight.markersStr==markersStr){return;} |
613 | | -context.modules.highlight.markersStr=markersStr;var visited=[],v=0;for(var i=0;i<markers.length;i++){if(typeof markers[i].skipDivision!=='undefined'&&(division==markers[i].skipDivision)){continue;} |
614 | | -var start=markers[i].start;var s=context.fn.getOffset(start);if(!s){continue;} |
615 | | -var startNode=s.node;while(startNode.nodeName=='BR'||s.offset==startNode.nodeValue.length){start++;s=context.fn.getOffset(start);startNode=s.node;} |
616 | | -if(s.offset>0&&s.node.nodeName=='#text'){var newStartNode=startNode.splitText(s.offset<s.node.nodeValue.length?s.offset:s.node.nodeValue.length-1);var oldStartNode=startNode;startNode=newStartNode;var subtracted=s.offset;var oldLength=s.length;var j,o;for(j=start-subtracted;j<start;j++){if(j in context.offsets){o=context.offsets[j];o.node=oldStartNode;o.length=subtracted;}} |
617 | | -for(j=start;j<start-subtracted+oldLength;j++){if(j in context.offsets){o=context.offsets[j];o.node=newStartNode;o.offset-=subtracted;o.length-=subtracted;o.lastTextNode=oldStartNode;}}} |
618 | | -var end=markers[i].end;var e=context.fn.getOffset(end-1);if(!e){continue;} |
619 | | -var endNode=e.node;if(e.offset+1<e.length-1&&endNode.nodeName=='#text'){var oldEndNode=endNode;var newEndNode=endNode.splitText(e.offset+1);var subtracted=e.offset+1;var oldLength=e.length;var j,o;for(j=end-subtracted;j<end;j++){if(j in context.offsets){o=context.offsets[j];o.node=oldEndNode;o.length=subtracted;}} |
620 | | -context.offsets[end]={'node':newEndNode,'offset':0,'length':oldLength-subtracted,'lastTextNode':oldEndNode};for(j=end+1;j<end-subtracted+oldLength;j++){if(j in context.offsets){o=context.offsets[j];o.node=newEndNode;o.offset-=subtracted;o.length-=subtracted;o.lastTextNode=oldEndNode;}}} |
621 | | -if(endNode.nodeName=='BR'){endNode=e.lastTextNode;} |
622 | | -if(startNode.parentNode!=endNode.parentNode){var startP=$(startNode).closest('p').get(0);var t=new context.fn.rawTraverser(startNode,startP,context.$content.get(0),false);var afterStart=startNode.nextSibling;var lastP=startP;var nextT=t.next();while(nextT&&t.node!=endNode){t=nextT;nextT=t.next();if(t.node.parentNode!=startNode.parentNode){var oldParent=t.node.parentNode;if(afterStart){if(lastP!=t.inP){startNode.parentNode.insertBefore(startNode.ownerDocument.createElement('br'),afterStart);} |
623 | | -if(!(oldParent.childNodes.length==1&&oldParent.firstChild.nodeName=='BR')){while(oldParent.firstChild){startNode.parentNode.insertBefore(oldParent.firstChild,afterStart);}}}else{if(lastP!=t.inP){startNode.parentNode.appendChild(startNode.ownerDocument.createElement('br'));} |
624 | | -if(!(oldParent.childNodes.length==1&&oldParent.firstChild.nodeName=='BR')){while(oldParent.firstChild){startNode.parentNode.appendChild(oldParent.firstChild);}}} |
625 | | -oldParent.parentNode.removeChild(oldParent);} |
626 | | -lastP=t.inP;}} |
627 | | -var ca1=startNode,ca2=endNode;if(ca1&&ca2&&ca1.parentNode){var anchor=markers[i].getAnchor(ca1,ca2);if(!anchor){var commonAncestor=ca1.parentNode;if(markers[i].anchor=='wrap'){var newNode=ca1.ownerDocument.createElement('span');var nextNode=ca2.nextSibling;var n=ca1;while(n!=nextNode){var ns=n.nextSibling;newNode.appendChild(n);n=ns;} |
628 | | -if(nextNode){commonAncestor.insertBefore(newNode,nextNode);}else{commonAncestor.appendChild(newNode);} |
629 | | -anchor=newNode;}else if(markers[i].anchor=='tag'){anchor=commonAncestor;} |
630 | | -$(anchor).data('marker',markers[i]).addClass('wikiEditor-highlight');markers[i].afterWrap(anchor,markers[i]);}else{$(anchor).data('marker',markers[i]);if(typeof markers[i].onSkip=='function'){markers[i].onSkip(anchor);}} |
631 | | -visited[v++]=anchor;}} |
632 | | -var j=0;context.$content.find('.wikiEditor-highlight').each(function(){if(visited[j]==this){j++;return true;} |
633 | | -var marker=$(this).data('marker');if(marker&&typeof marker.skipDivision!='undefined'&&(division==marker.skipDivision)){return true;} |
634 | | -if(marker&&typeof marker.beforeUnwrap=='function') |
635 | | -marker.beforeUnwrap(this);if((marker&&marker.anchor=='tag')||$(this).is('p')){$(this).removeAttr('class');}else{$(this).replaceWith(this.childNodes);} |
636 | | -context.fn.purgeOffsets();});}}};})(jQuery);(function($){$.wikiEditor.modules.preview={'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',3]],'opera':[['>=',9.6]],'safari':[['>=',4]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',3]],'opera':[['>=',9.6]],'safari':[['>=',4]]}},fn:{create:function(context,config){if('initialized'in context.modules.preview){return;} |
637 | | -context.modules.preview={'initialized':true,'previewText':null,'changesText':null};context.modules.preview.$preview=context.fn.addView({'name':'preview','titleMsg':'wikieditor-preview-tab','init':function(context){var wikitext=context.fn.getContents();if(context.modules.preview.previewText==wikitext){return;} |
638 | | -context.modules.preview.$preview.find('.wikiEditor-preview-contents').empty();context.modules.preview.$preview.find('.wikiEditor-preview-loading').show();$.post(wgScriptPath+'/api.php',{'action':'parse','title':wgPageName,'text':wikitext,'prop':'text','pst':'','format':'json'},function(data){if(typeof data.parse=='undefined'||typeof data.parse.text=='undefined'||typeof data.parse.text['*']=='undefined'){return;} |
639 | | -context.modules.preview.previewText=wikitext;context.modules.preview.$preview.find('.wikiEditor-preview-loading').hide();context.modules.preview.$preview.find('.wikiEditor-preview-contents').html(data.parse.text['*']).find('a:not([href^=#])').click(function(){return false;});},'json');}});context.$changesTab=context.fn.addView({'name':'changes','titleMsg':'wikieditor-preview-changes-tab','init':function(context){var wikitext=context.fn.getContents();if(context.modules.preview.changesText==wikitext){return;} |
640 | | -context.$changesTab.find('table.diff tbody').empty();context.$changesTab.find('.wikiEditor-preview-loading').show();var postdata={'action':'parse','onlypst':'','text':wikitext,'format':'json'};$.post(wgScriptPath+'/api.php',postdata,function(data){try{var postdata2={'action':'query','indexpageids':'','prop':'revisions','titles':wgPageName,'rvdifftotext':data.parse.text['*'],'rvprop':'','format':'json'};var section=$('[name=wpSection]').val();if(section!='') |
641 | | -postdata['rvsection']=section;$.post(wgScriptPath+'/api.php',postdata2,function(data){if($('link[href='+stylepath+'/common/diff.css]').size()==0){$('head').append($('<link />').attr({'rel':'stylesheet','type':'text/css','href':stylepath+'/common/diff.css'}));} |
642 | | -try{var diff=data.query.pages[data.query.pageids[0]].revisions[0].diff['*'];context.$changesTab.find('table.diff tbody').html(diff);context.$changesTab.find('.wikiEditor-preview-loading').hide();context.modules.preview.changesText=wikitext;}catch(e){}},'json');}catch(e){}},'json');}});var loadingMsg=mw.usability.getMsg('wikieditor-preview-loading');context.modules.preview.$preview.add(context.$changesTab).append($('<div />').addClass('wikiEditor-preview-loading').append($('<img />').addClass('wikiEditor-preview-spinner').attr({'src':$.wikiEditor.imgPath+'dialogs/loading.gif','valign':'absmiddle','alt':loadingMsg,'title':loadingMsg})).append($('<span></span>').text(loadingMsg))).append($('<div />').addClass('wikiEditor-preview-contents'));context.$changesTab.find('.wikiEditor-preview-contents').html('<table class="diff"><col class="diff-marker" /><col class="diff-content" />'+'<col class="diff-marker" /><col class="diff-content" /><tbody /></table>');}}};})(jQuery);(function($){$.wikiEditor.modules.publish={'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',3]],'opera':[['>=',9.6]],'safari':[['>=',4]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',3]],'opera':[['>=',9.6]],'safari':[['>=',4]]}},fn:{create:function(context,config){var dialogID='wikiEditor-'+context.instance+'-dialog';$.wikiEditor.modules.dialogs.fn.create(context,{previewsave:{id:dialogID,titleMsg:'wikieditor-publish-dialog-title',html:'\ |
643 | | - <div class="wikiEditor-publish-dialog-copywarn"></div>\ |
644 | | - <div class="wikiEditor-publish-dialog-editoptions">\ |
645 | | - <form id="wikieditor-'+context.instance+'-publish-dialog-form">\ |
646 | | - <div class="wikiEditor-publish-dialog-summary">\ |
647 | | - <label for="wikiEditor-'+context.instance+'-dialog-summary"\ |
648 | | - rel="wikieditor-publish-dialog-summary"></label>\ |
649 | | - <br />\ |
650 | | - <input type="text" id="wikiEditor-'+context.instance+'-dialog-summary"\ |
651 | | - style="width: 100%;" />\ |
652 | | - </div>\ |
653 | | - <div class="wikiEditor-publish-dialog-options">\ |
654 | | - <input type="checkbox"\ |
655 | | - id="wikiEditor-'+context.instance+'-dialog-minor" />\ |
656 | | - <label for="wikiEditor-'+context.instance+'-dialog-minor"\ |
657 | | - rel="wikieditor-publish-dialog-minor"></label>\ |
658 | | - <input type="checkbox"\ |
659 | | - id="wikiEditor-'+context.instance+'-dialog-watch" />\ |
660 | | - <label for="wikiEditor-'+context.instance+'-dialog-watch"\ |
661 | | - rel="wikieditor-publish-dialog-watch"></label>\ |
662 | | - </div>\ |
663 | | - </form>\ |
664 | | - </div>',init:function(){$(this).find('[rel]').each(function(){$(this).text(mw.usability.getMsg($(this).attr('rel')));});var copyWarnHTML=$('#editpage-copywarn p').html();var copyWarnStatements=copyWarnHTML.split('. ');var newCopyWarnHTML='<ul>';for(var i=0;i<copyWarnStatements.length;i++){if(copyWarnStatements[i]!=''){var copyWarnStatement=$j.trim(copyWarnStatements[i]).replace(/\.*$/,'');newCopyWarnHTML+='<li>'+copyWarnStatement+'.</li>';}} |
665 | | -newCopyWarnHTML+='</ul>';$(this).find('.wikiEditor-publish-dialog-copywarn').html(copyWarnStatements.length>1?newCopyWarnHTML:copyWarnHTML);if($('#wpMinoredit').size()==0) |
666 | | -$('#wikiEditor-'+context.instance+'-dialog-minor').hide();else if($('#wpMinoredit').is(':checked')) |
667 | | -$('#wikiEditor-'+context.instance+'-dialog-minor').attr('checked','checked');if($('#wpWatchthis').size()==0) |
668 | | -$('#wikiEditor-'+context.instance+'-dialog-watch').hide();else if($('#wpWatchthis').is(':checked')) |
669 | | -$('#wikiEditor-'+context.instance+'-dialog-watch').attr('checked','checked');$(this).find('form').submit(function(e){$(this).closest('.ui-dialog').find('button:first').click();e.preventDefault();});},dialog:{buttons:{'wikieditor-publish-dialog-publish':function(){var minorChecked=$('#wikiEditor-'+context.instance+'-dialog-minor').is(':checked')?'checked':'';var watchChecked=$('#wikiEditor-'+context.instance+'-dialog-watch').is(':checked')?'checked':'';$('#wpMinoredit').attr('checked',minorChecked);$('#wpWatchthis').attr('checked',watchChecked);$('#wpSummary').val($j('#wikiEditor-'+context.instance+'-dialog-summary').val());$('#editform').submit();},'wikieditor-publish-dialog-goback':function(){$(this).dialog('close');}},open:function(){$('#wikiEditor-'+context.instance+'-dialog-summary').focus();},width:500},resizeme:false}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-publish','action':function(){$('#'+dialogID).dialog('open');return false;}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-cancel','action':function(){}});}}};})(jQuery);(function($){$.wikiEditor.modules.templateEditor={'nameMappings':{"infobox skyscraper":"building_name","infobox settlement":"official_name"},'browsers':{'ltr':{'msie':[['>=',8]],'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]]},'rtl':{'msie':false,'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]]}},'req':['iframe'],evt:{mark:function(context,event){if(context.modules.highlight.currentScope=='realchange'){return;} |
670 | | -var markers=context.modules.highlight.markers;var tokenArray=context.modules.highlight.tokenArray;var level=0;var tokenIndex=0;while(tokenIndex<tokenArray.length){while(tokenIndex<tokenArray.length&&tokenArray[tokenIndex].label!='TEMPLATE_BEGIN'){tokenIndex++;} |
671 | | -if(tokenIndex<tokenArray.length){var beginIndex=tokenIndex;var endIndex=-1;var openTemplates=1;var templatesMatched=false;while(tokenIndex<tokenArray.length-1&&endIndex==-1){tokenIndex++;if(tokenArray[tokenIndex].label=='TEMPLATE_BEGIN'){openTemplates++;}else if(tokenArray[tokenIndex].label=='TEMPLATE_END'){openTemplates--;if(openTemplates==0){endIndex=tokenIndex;}}} |
672 | | -if(endIndex!=-1){markers.push({start:tokenArray[beginIndex].offset,end:tokenArray[endIndex].offset,type:'template',anchor:'wrap',afterWrap:function(node){var model=$.wikiEditor.modules.templateEditor.fn.updateModel($(node));if(model.isCollapsible()){$.wikiEditor.modules.templateEditor.fn.wrapTemplate($(node));$.wikiEditor.modules.templateEditor.fn.bindTemplateEvents($(node));}else{$(node).addClass('wikiEditor-template-text');}},beforeUnwrap:function(node){if($(node).parent().hasClass('wikiEditor-template')){$.wikiEditor.modules.templateEditor.fn.unwrapTemplate($(node));}},onSkip:function(node){if($(node).html()==$(node).data('oldHTML')){return;} |
673 | | -var model=$.wikiEditor.modules.templateEditor.fn.updateModel($(node));if($(node).parent().hasClass('wikiEditor-template')){var $label=$(node).parent().find('.wikiEditor-template-label');var displayName=$.wikiEditor.modules.templateEditor.fn.getTemplateDisplayName(model);if($label.text()!=displayName){$label.text(displayName);}} |
674 | | -if($(node).parent().hasClass('wikiEditor-template')&&!model.isCollapsible()){$.wikiEditor.modules.templateEditor.fn.unwrapTemplate($(node));}else if(!$(node).parent().hasClass('wikiEditor-template')&&model.isCollapsible()){$.wikiEditor.modules.templateEditor.fn.wrapTemplate($(node));$.wikiEditor.modules.templateEditor.fn.bindTemplateEvents($(node));}},getAnchor:function(ca1,ca2){return $(ca1.parentNode).is('span.wikiEditor-template-text')?ca1.parentNode:null;},context:context,skipDivision:'realchange'});}else{tokenArray[beginIndex].label='TEMPLATE_FALSE_BEGIN';tokenIndex=beginIndex;}}}},keydown:function(context,event){if(context.$iframe.data('ignoreKeypress')){context.$iframe.data('ignoreKeypress',false);} |
675 | | -var $evtElem=event.jQueryNode;if($evtElem.hasClass('wikiEditor-template-label')){if(event.ctrlKey||event.metaKey)return true;switch(event.which){case 13:$evtElem.click();event.preventDefault();return false;case 32:$evtElem.parent().siblings('.wikiEditor-template-expand').click();event.preventDefault();return false;case 37:case 38:case 39:case 40:return true;default:context.$iframe.data('ignoreKeypress',true);event.preventDefault();return false;}}else if($evtElem.hasClass('wikiEditor-template-text')){switch(event.which){case 13:context.$iframe.data('ignoreKeypress',true);context.fn.encapsulateSelection({'pre':'\n','peri':'','post':''});event.preventDefault();return false;default:return true;}}},keyup:function(context,event){if(context.$iframe.data('ignoreKeypress')){context.$iframe.data('ignoreKeypress',false);} |
676 | | -return true;},keypress:function(context,event){return(context.$iframe.data('ignoreKeypress')?false:true);}},exp:[{'regex':/{{/,'label':"TEMPLATE_BEGIN"},{'regex':/}}/,'label':"TEMPLATE_END",'markAfter':true}],cfg:{},fn:{create:function(context,config){context.modules.templateEditor={};},wrapTemplate:function($wrapper){var model=$wrapper.data('model');var context=$wrapper.data('marker').context;var $template=$wrapper.wrap('<span class="wikiEditor-template"></span>').addClass('wikiEditor-template-text wikiEditor-template-text-shrunken').parent().addClass('wikiEditor-template-collapsed').prepend('<span class="wikiEditor-template-expand wikiEditor-noinclude"></span>'+'<span class="wikiEditor-template-name wikiEditor-noinclude">'+'<span class="wikiEditor-template-label wikiEditor-noinclude">'+ |
677 | | -$.wikiEditor.modules.templateEditor.fn.getTemplateDisplayName(model)+'</span>'+'<span class="wikiEditor-template-dialog wikiEditor-noinclude"></span>'+'</span>');},unwrapTemplate:function($wrapper){$wrapper.parent().replaceWith($wrapper);},bindTemplateEvents:function($wrapper){var $template=$wrapper.parent('.wikiEditor-template');if(typeof(opera)=="undefined"){$template.parent().attr('contentEditable','false');} |
678 | | -$template.click(function(event){event.preventDefault();return false;}) |
679 | | -$template.find('.wikiEditor-template-name').click(function(event){$.wikiEditor.modules.templateEditor.fn.createDialog($wrapper);event.stopPropagation();return false;}).mousedown(function(event){event.stopPropagation();return false;});$template.find('.wikiEditor-template-expand').click(function(event){$.wikiEditor.modules.templateEditor.fn.toggleWikiTextEditor($wrapper);event.stopPropagation();return false;}).mousedown(function(event){event.stopPropagation();return false;});},toggleWikiTextEditor:function($wrapper){var context=$wrapper.data('marker').context;var $template=$wrapper.parent('.wikiEditor-template');context.fn.purgeOffsets();$template.toggleClass('wikiEditor-template-expanded').toggleClass('wikiEditor-template-collapsed');var $templateText=$template.find('.wikiEditor-template-text');$templateText.toggleClass('wikiEditor-template-text-shrunken');$templateText.toggleClass('wikiEditor-template-text-visible');if($templateText.hasClass('wikiEditor-template-text-shrunken')){if($templateText.html()!=$templateText.data('oldHTML')){var templateModel=$.wikiEditor.modules.templateEditor.fn.updateModel($templateText);var $tLabel=$template.find('.wikiEditor-template-label');$tLabel.text($.wikiEditor.modules.templateEditor.fn.getTemplateDisplayName(templateModel));}}},createDialog:function($wrapper){var context=$wrapper.data('marker').context;var $template=$wrapper.parent('.wikiEditor-template');var dialog={'titleMsg':'wikieditor-template-editor-dialog-title','id':'wikiEditor-template-dialog','html':'\ |
680 | | - <fieldset>\ |
681 | | - <div class="wikiEditor-template-dialog-title" />\ |
682 | | - <div class="wikiEditor-template-dialog-fields" />\ |
683 | | - </fieldset>',init:function(){$(this).find('[rel]').each(function(){$(this).text(mw.usability.getMsg($(this).attr('rel')));});},dialog:{width:600,height:400,dialogClass:'wikiEditor-toolbar-dialog',buttons:{'wikieditor-template-editor-dialog-submit':function(){var $templateDiv=$(this).data('templateDiv');context.fn.highlightLine($templateDiv);var $templateText=$templateDiv.children('.wikiEditor-template-text');var templateModel=$templateText.data('model');$(this).find('.wikiEditor-template-dialog-field-wrapper textarea').each(function(){templateModel.setValue($(this).data('name'),$(this).val());});$.wikiEditor.modules.templateEditor.fn.updateModel($templateText,templateModel);$(this).dialog('close');},'wikieditor-template-editor-dialog-cancel':function(){$(this).dialog('close');}},open:function(){var $templateDiv=$(this).data('templateDiv');var $templateText=$templateDiv.children('.wikiEditor-template-text');var templateModel=$templateText.data('model');if($templateText.html()!=$templateText.data('oldHTML')){templateModel=$.wikiEditor.modules.templateEditor.fn.updateModel($templateText);} |
684 | | -var params=templateModel.getAllInitialParams();var $fields=$(this).find('.wikiEditor-template-dialog-fields');var $rows=$fields.find('.wikiEditor-template-dialog-field-wrapper');for(var paramIndex in params){var param=params[paramIndex];if(typeof param.name=='undefined'){continue;} |
685 | | -var paramText=typeof param=='string'?param.name.replace(/[\_\-]/g,' '):param.name;var paramVal=templateModel.getValue(param.name);if($rows.length>0){var $row=$rows.eq(0);$row.children('label').text(paramText);$row.children('textarea').data('name',param.name).val(paramVal).each(function(){$(this).css('height',$(this).val().length>24?'4.5em':'1.5em');}) |
686 | | -$rows=$rows.not($row);}else{var $paramRow=$('<div />').addClass('wikiEditor-template-dialog-field-wrapper');$('<label />').text(paramText).appendTo($paramRow);$('<textarea />').data('name',param.name).val(paramVal).each(function(){$(this).css('height',$(this).val().length>24?'4.5em':'1.5em');}).data('expanded',false).bind('cut paste keypress click change',function(e){if(e.keyCode=='9')return true;var $this=$(this);setTimeout(function(){var expanded=$this.data('expanded');if($this.val().indexOf('\n')!=-1||$this.val().length>24){if(!expanded){$this.animate({'height':'4.5em'},'fast');$this.data('expanded',true);}}else{if(expanded){$this.animate({'height':'1.5em'},'fast');$this.data('expanded',false);}}},0);}).appendTo($paramRow);$paramRow.append('<div style="clear:both"></div>').appendTo($fields);}} |
687 | | -$rows.remove();$fields.find('label').autoEllipsis();$(this).parent('.ui-dialog').find('.ui-dialog-titlebar-close').removeClass('ui-state-focus');var $needTabindex=$(this).closest('.ui-dialog').find('button, textarea');if($needTabindex.not('[tabindex]').length){$needTabindex.removeAttr('tabindex');$.wikiEditor.modules.dialogs.fn.setTabindexes($needTabindex);}}}};context.$textarea.wikiEditor('addDialog',{'templateEditor':dialog});$('#'+dialog.id).data('templateDiv',$template).dialog('open');},updateModel:function($templateText,model){var context=$templateText.data('marker').context;var text;if(typeof model=='undefined'){text=context.fn.htmlToText($templateText.html());}else{text=model.getText();} |
688 | | -$templateText.text(text);$templateText.html($templateText.html().replace(/\n/g,'<br />'));$templateText.data('oldHTML',$templateText.html());if(typeof model=='undefined'){model=new $.wikiEditor.modules.templateEditor.fn.model(text);$templateText.data('model',model);} |
689 | | -return model;},getTemplateDisplayName:function(model){var tName=model.getName();if(model.getValue('name')!=''){return tName+': '+model.getValue('name');}else if(model.getValue('Name')!=''){return tName+': '+model.getValue('Name');}else if(tName.toLowerCase()in $.wikiEditor.modules.templateEditor.nameMappings){return tName+': '+model.getValue($.wikiEditor.modules.templateEditor.nameMappings[tName.toLowerCase()]);} |
690 | | -return tName;},model:function(wikitext){var collapsible=true;function Param(name,value,number,nameIndex,equalsIndex,valueIndex){this.name=name;this.value=value;this.number=number;this.nameIndex=nameIndex;this.equalsIndex=equalsIndex;this.valueIndex=valueIndex;} |
691 | | -function Range(begin,end){this.begin=begin;this.end=end;} |
692 | | -function getSetValue(name,value,original){var valueRange;var rangeIndex;var retVal;if(isNaN(name)){if(typeof paramsByName[name]=='undefined'){return"";} |
693 | | -rangeIndex=paramsByName[name];}else{rangeIndex=parseInt(name);} |
694 | | -if(typeof params[rangeIndex]=='undefined'){return"";} |
695 | | -valueRange=ranges[params[rangeIndex].valueIndex];if(typeof valueRange.newVal=='undefined'||original){retVal=wikitext.substring(valueRange.begin,valueRange.end);}else{retVal=valueRange.newVal;} |
696 | | -if(value!=null){ranges[params[rangeIndex].valueIndex].newVal=value;} |
697 | | -return retVal;};this.getName=function(){if(typeof ranges[templateNameIndex].newVal=='undefined'){return wikitext.substring(ranges[templateNameIndex].begin,ranges[templateNameIndex].end);}else{return ranges[templateNameIndex].newVal;}};this.setName=function(name){ranges[templateNameIndex].newVal=name;};this.setValue=function(name,value){return getSetValue(name,value,false);};this.getValue=function(name){return getSetValue(name,null,false);};this.getOriginalValue=function(name){return getSetValue(name,null,true);};this.getAllParamNames=function(){return paramsByName;};this.getAllInitialParams=function(){return params;} |
698 | | -this.getOriginalText=function(){return wikitext;};this.getText=function(){newText="";for(i=0;i<ranges.length;i++){if(typeof ranges[i].newVal=='undefined'){newText+=wikitext.substring(ranges[i].begin,ranges[i].end);}else{newText+=ranges[i].newVal;}} |
699 | | -return newText;};this.isCollapsible=function(){return collapsible;} |
700 | | -this.updateRanges=function(){var adjustment=0;for(var i=0;i<ranges.length;i++){ranges[i].begin+=adjustment;if(typeof ranges[i].adjust!='undefined'){adjustment+=ranges[i].adjust();delete ranges[i].adjust;} |
701 | | -ranges[i].end+=adjustment;}};if(wikitext.match(/\s*{{\s*[^\s|]*:/)){collapsible=false;} |
702 | | -var sanatizedStr=wikitext.replace(/{{/," ");endBraces=sanatizedStr.match(/}}\s*$/);if(endBraces){sanatizedStr=sanatizedStr.substring(0,endBraces.index)+" "+ |
703 | | -sanatizedStr.substring(endBraces.index+2);} |
704 | | -while(sanatizedStr.indexOf('<!')!=-1){startIndex=sanatizedStr.indexOf('<!');endIndex=sanatizedStr.indexOf('-->')+3;if(endIndex<3){break;} |
705 | | -sanatizedSegment=sanatizedStr.substring(startIndex,endIndex).replace(/\S/g,' ');sanatizedStr=sanatizedStr.substring(0,startIndex)+sanatizedSegment+sanatizedStr.substring(endIndex);} |
706 | | -while(sanatizedStr.indexOf('{{')!=-1){startIndex=sanatizedStr.indexOf('{{')+1;openBraces=2;endIndex=startIndex;while((openBraces>0)&&(endIndex<sanatizedStr.length)){var brace=sanatizedStr[++endIndex];openBraces+=brace=='}'?-1:brace=='{'?1:0;} |
707 | | -sanatizedSegment=sanatizedStr.substring(startIndex,endIndex).replace(/[{}|=]/g,'X');sanatizedStr=sanatizedStr.substring(0,startIndex)+sanatizedSegment+sanatizedStr.substring(endIndex);} |
708 | | -while(sanatizedStr.indexOf('[[')!=-1){startIndex=sanatizedStr.indexOf('[[')+1;openBraces=2;endIndex=startIndex;while((openBraces>0)&&(endIndex<sanatizedStr.length)){var brace=sanatizedStr[++endIndex];openBraces+=brace==']'?-1:brace=='['?1:0;} |
709 | | -sanatizedSegment=sanatizedStr.substring(startIndex,endIndex).replace(/[\[\]|=]/g,'X');sanatizedStr=sanatizedStr.substring(0,startIndex)+sanatizedSegment+sanatizedStr.substring(endIndex);} |
710 | | -var ranges=[];var params=[];var templateNameIndex=0;var doneParsing=false;oldDivider=0;divider=sanatizedStr.indexOf('|',oldDivider);if(divider==-1){divider=sanatizedStr.length;doneParsing=true;collapsible=false;} |
711 | | -nameMatch=sanatizedStr.substring(0,divider).match(/[^\s]/);if(nameMatch!=null){ranges.push(new Range(0,nameMatch.index));nameEndMatch=sanatizedStr.substring(0,divider).match(/[^\s]\s*$/);templateNameIndex=ranges.push(new Range(nameMatch.index,nameEndMatch.index+1));templateNameIndex--;ranges[templateNameIndex].old=wikitext.substring(ranges[templateNameIndex].begin,ranges[templateNameIndex].end);}else{ranges.push(new Range(0,0));ranges[templateNameIndex].old="";} |
712 | | -params.push(ranges[templateNameIndex].old);var currentParamNumber=0;var valueEndIndex=ranges[templateNameIndex].end;var paramsByName=[];while(!doneParsing){currentParamNumber++;oldDivider=divider;divider=sanatizedStr.indexOf('|',oldDivider+1);if(divider==-1){divider=sanatizedStr.length;doneParsing=true;} |
713 | | -currentField=sanatizedStr.substring(oldDivider+1,divider);if(currentField.indexOf('=')==-1){valueBeginIndex=oldDivider+1;valueEndIndex=oldDivider+1;valueBegin=currentField.match(/\S+/);if(valueBegin!=null){valueBeginIndex=valueBegin.index+oldDivider+1;valueEnd=currentField.match(/[^\s]\s*$/);if(valueEnd==null){continue;} |
714 | | -valueEndIndex=valueEnd.index+oldDivider+2;} |
715 | | -ranges.push(new Range(ranges[ranges.length-1].end,valueBeginIndex));nameIndex=ranges.push(new Range(valueBeginIndex,valueBeginIndex))-1;equalsIndex=ranges.push(new Range(valueBeginIndex,valueBeginIndex))-1;valueIndex=ranges.push(new Range(valueBeginIndex,valueEndIndex))-1;params.push(new Param(currentParamNumber,wikitext.substring(ranges[valueIndex].begin,ranges[valueIndex].end),currentParamNumber,nameIndex,equalsIndex,valueIndex));paramsByName[currentParamNumber]=currentParamNumber;}else{currentName=currentField.substring(0,currentField.indexOf('='));nameBegin=currentName.match(/\S+/);if(nameBegin==null){currentParamNumber--;continue;} |
716 | | -nameBeginIndex=nameBegin.index+oldDivider+1;nameEnd=currentName.match(/[^\s]\s*$/);if(nameEnd==null){continue;} |
717 | | -nameEndIndex=nameEnd.index+oldDivider+2;ranges.push(new Range(ranges[ranges.length-1].end,nameBeginIndex));nameIndex=ranges.push(new Range(nameBeginIndex,nameEndIndex))-1;currentValue=currentField.substring(currentField.indexOf('=')+1);oldDivider+=currentField.indexOf('=')+1;valueBeginIndex=oldDivider+1;valueEndIndex=oldDivider+1;valueBegin=currentValue.match(/\S+/);if(valueBegin!=null){valueBeginIndex=valueBegin.index+oldDivider+1;valueEnd=currentValue.match(/[^\s]\s*$/);if(valueEnd==null){continue;} |
718 | | -valueEndIndex=valueEnd.index+oldDivider+2;} |
719 | | -equalsIndex=ranges.push(new Range(ranges[ranges.length-1].end,valueBeginIndex))-1;valueIndex=ranges.push(new Range(valueBeginIndex,valueEndIndex))-1;params.push(new Param(wikitext.substring(nameBeginIndex,nameEndIndex),wikitext.substring(valueBeginIndex,valueEndIndex),currentParamNumber,nameIndex,equalsIndex,valueIndex));paramsByName[wikitext.substring(nameBeginIndex,nameEndIndex)]=currentParamNumber;}} |
720 | | -ranges.push(new Range(valueEndIndex,wikitext.length));this.ranges=ranges;this.wikitext=wikitext;this.params=params;this.paramsByName=paramsByName;this.templateNameIndex=templateNameIndex;}}};})(jQuery);(function($){$.wikiEditor.modules.toc={'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]],'chrome':[['>=',4]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]],'chrome':[['>=',4]]}},'req':['iframe'],'name':'toc',cfg:{defaultWidth:'166px',minimumWidth:'70px',textMinimumWidth:'450px',flexProperty:'marginRight',rtl:false},api:{},evt:{change:function(context,event){$.wikiEditor.modules.toc.fn.update(context);},ready:function(context,event){$.wikiEditor.modules.toc.fn.build(context);context.$content.parent().blur(function(){var context=event.data.context;$.wikiEditor.modules.toc.fn.unhighlight(context);});$.wikiEditor.modules.toc.evt.resize(context);},resize:function(context,event){var availableWidth=context.$wikitext.width()-parseFloat($.wikiEditor.modules.toc.cfg.textMinimumWidth),totalMinWidth=parseFloat($.wikiEditor.modules.toc.cfg.minimumWidth)+ |
721 | | -parseFloat($.wikiEditor.modules.toc.cfg.textMinimumWidth);context.$ui.find('.wikiEditor-ui-right').resizable('option','maxWidth',availableWidth);if(context.modules.toc.$toc.data('positionMode')!='disabled'&&context.$wikitext.width()<totalMinWidth){$.wikiEditor.modules.toc.fn.disable(context);}else if(context.modules.toc.$toc.data('positionMode')=='disabled'&&context.$wikitext.width()>totalMinWidth){$.wikiEditor.modules.toc.fn.enable(context);}else if(context.modules.toc.$toc.data('positionMode')=='regular'&&context.$ui.find('.wikiEditor-ui-right').width()>availableWidth){$.wikiEditor.modules.toc.fn.switchLayout(context);}else if(context.modules.toc.$toc.data('positionMode')=='goofy'&&context.modules.toc.$toc.data('previousWidth')<context.$wikitext.width()){$.wikiEditor.modules.toc.fn.switchLayout(context);} |
722 | | -if(context.modules.toc.$toc.data('positionMode')=='goofy'){context.modules.toc.$toc.find('div').autoEllipsis({'position':'right','tooltip':true,'restoreText':true});} |
723 | | -if(!context.modules.toc.$toc.data('collapsed')){context.modules.toc.$toc.height(context.$ui.find('.wikiEditor-ui-left').height()- |
724 | | -context.$ui.find('.tab-toc').outerHeight());} |
725 | | -context.modules.toc.$toc.data('previousWidth',context.$wikitext.width());},mark:function(context,event){var hash='';var markers=context.modules.highlight.markers;var tokenArray=context.modules.highlight.tokenArray;var outline=context.data.outline=[];var h=0;for(var i=0;i<tokenArray.length;i++){if(tokenArray[i].label!='TOC_HEADER'){continue;} |
726 | | -h++;markers.push({index:h,start:tokenArray[i].tokenStart,end:tokenArray[i].offset,type:'toc',anchor:'tag',afterWrap:function(node){var marker=$(node).data('marker');$(node).addClass('wikiEditor-toc-header').addClass('wikiEditor-toc-section-'+marker.index).data('section',marker.index);},beforeUnwrap:function(node){$(node).removeClass('wikiEditor-toc-header').removeClass('wikiEditor-toc-section-'+$(node).data('section'));},onSkip:function(node){var marker=$(node).data('marker');if($(node).data('section')!=marker.index){$(node).removeClass('wikiEditor-toc-section-'+$(node).data('section')).addClass('wikiEditor-toc-section-'+marker.index).data('section',marker.index);}},getAnchor:function(ca1,ca2){return $(ca1.parentNode).is('.wikiEditor-toc-header')?ca1.parentNode:null;}});hash+=tokenArray[i].match[2]+'\n';outline.push({'text':tokenArray[i].match[2],'level':tokenArray[i].match[1].length,'index':h});} |
727 | | -if(typeof context.modules.toc.lastHash=='undefined'||context.modules.toc.lastHash!==hash){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);context.modules.toc.lastHash=hash;}}},exp:[{'regex':/^(={1,6})([^\r\n]+?)\1\s*$/m,'label':'TOC_HEADER','markAfter':true}],fn:{create:function(context,config){if('$toc'in context.modules.toc){return;} |
728 | | -$.wikiEditor.modules.toc.cfg.rtl=config.rtl;$.wikiEditor.modules.toc.cfg.flexProperty=config.rtl?'marginLeft':'marginRight';var height=context.$ui.find('.wikiEditor-ui-left').height();context.modules.toc.$toc=$('<div />').addClass('wikiEditor-ui-toc').data('context',context).data('positionMode','regular').data('collapsed',false);context.$ui.find('.wikiEditor-ui-right').append(context.modules.toc.$toc);context.modules.toc.$toc.height(context.$ui.find('.wikiEditor-ui-left').height());$.wikiEditor.modules.toc.fn.redraw(context,$.wikiEditor.modules.toc.cfg.defaultWidth);},redraw:function(context,fixedWidth){var fixedWidth=parseFloat(fixedWidth);if(context.modules.toc.$toc.data('positionMode')=='regular'){context.$ui.find('.wikiEditor-ui-right').css('width',fixedWidth+'px');context.$ui.find('.wikiEditor-ui-left').css($.wikiEditor.modules.toc.cfg.flexProperty,(-1*fixedWidth)+'px').children().css($.wikiEditor.modules.toc.cfg.flexProperty,fixedWidth+'px');}else if(context.modules.toc.$toc.data('positionMode')=='goofy'){context.$ui.find('.wikiEditor-ui-left').css('width',fixedWidth);context.$ui.find('.wikiEditor-ui-right').css($.wikiEditor.modules.toc.cfg.rtl?'right':'left',fixedWidth);context.$wikitext.css('height',context.$ui.find('.wikiEditor-ui-right').height());}},switchLayout:function(context){var width,height=context.$ui.find('.wikiEditor-ui-right').height();if(context.modules.toc.$toc.data('positionMode')=='regular'&&!context.modules.toc.$toc.data('collapsed')){context.modules.toc.$toc.data('positionMode','goofy');context.modules.toc.$toc.data('positionModeChangeAt',context.$ui.find('.wikiEditor-ui-right').width());width=$.wikiEditor.modules.toc.cfg.textMinimumWidth;context.$ui.find('.wikiEditor-ui-left').css($.wikiEditor.modules.toc.cfg.flexProperty,'').css({'position':'absolute','float':'none','left':$.wikiEditor.modules.toc.cfg.rtl?'auto':0,'right':$.wikiEditor.modules.toc.cfg.rtl?0:'auto'}).children().css($.wikiEditor.modules.toc.cfg.flexProperty,'');context.$ui.find('.wikiEditor-ui-right').css({'width':'auto','position':'absolute','float':'none','right':$.wikiEditor.modules.toc.cfg.rtl?'auto':0,'left':$.wikiEditor.modules.toc.cfg.rtl?0:'auto'});context.$wikitext.css('position','relative');}else if(context.modules.toc.$toc.data('positionMode')=='goofy'){context.modules.toc.$toc.data('positionMode','regular');width=context.$wikitext.width()-context.$ui.find('.wikiEditor-ui-left').width();if(width>context.modules.toc.$toc.data('positionModeChangeAt')){width=context.modules.toc.$toc.data('positionModeChangeAt');} |
729 | | -context.$wikitext.css({'position':'','height':''});context.$ui.find('.wikiEditor-ui-right').css($.wikiEditor.modules.toc.cfg.flexProperty,'').css({'position':'','left':'','right':'','float':'','top':'','height':''});context.$ui.find('.wikiEditor-ui-left').css({'width':'','position':'','left':'','float':'','right':''});} |
730 | | -$.wikiEditor.modules.toc.fn.redraw(context,width);},disable:function(context){if(context.modules.toc.$toc.data('collapsed')){context.$ui.find('.wikiEditor-ui-toc-expandControl').hide();}else{if(context.modules.toc.$toc.data('positionMode')=='goofy'){$.wikiEditor.modules.toc.fn.switchLayout(context);} |
731 | | -context.$ui.find('.wikiEditor-ui-right').hide();context.$ui.find('.wikiEditor-ui-left').css($.wikiEditor.modules.toc.cfg.flexProperty,'').children().css($.wikiEditor.modules.toc.cfg.flexProperty,'');} |
732 | | -context.modules.toc.$toc.data('positionMode','disabled');},enable:function(context){context.modules.toc.$toc.data('positionMode','regular');if(context.modules.toc.$toc.data('collapsed')){context.$ui.find('.wikiEditor-ui-toc-expandControl').show();}else{context.$ui.find('.wikiEditor-ui-right').show();$.wikiEditor.modules.toc.fn.redraw(context,$.wikiEditor.modules.toc.cfg.minimumWidth);context.modules.toc.$toc.find('div').autoEllipsis({'position':'right','tooltip':true,'restoreText':true});}},unhighlight:function(context){if(context){context.modules.toc.$toc.find('div').removeClass('current');}},update:function(context){var div=context.fn.beforeSelection('wikiEditor-toc-header');if(div===null){return;} |
733 | | -$.wikiEditor.modules.toc.fn.unhighlight(context);var section=div.data('section')||0;if(context.data.outline.length>0){var sectionLink=context.modules.toc.$toc.find('div.section-'+section);sectionLink.addClass('current');var relTop=sectionLink.offset().top-context.modules.toc.$toc.offset().top;var scrollTop=context.modules.toc.$toc.scrollTop();var divHeight=context.modules.toc.$toc.height();var sectionHeight=sectionLink.height();if(relTop<0) |
734 | | -context.modules.toc.$toc.scrollTop(scrollTop+relTop);else if(relTop+sectionHeight>divHeight) |
735 | | -context.modules.toc.$toc.scrollTop(scrollTop+relTop+sectionHeight-divHeight);}},collapse:function(event){var $this=$(this),context=$this.data('context');if(context.modules.toc.$toc.data('positionMode')=='goofy'){$.wikiEditor.modules.toc.fn.switchLayout(context);} |
736 | | -var pT=$this.parent().position().top-1;context.modules.toc.$toc.data('collapsed',true);var leftParam={},leftChildParam={};leftParam[$.wikiEditor.modules.toc.cfg.flexProperty]='-1px';leftChildParam[$.wikiEditor.modules.toc.cfg.flexProperty]='1px';context.$ui.find('.wikiEditor-ui-left').animate(leftParam,'fast',function(){$(this).css($.wikiEditor.modules.toc.cfg.flexProperty,0);}).children().animate(leftChildParam,'fast',function(){$(this).css($.wikiEditor.modules.toc.cfg.flexProperty,0);});context.$ui.find('.wikiEditor-ui-right').css({'marginTop':'1px','position':'absolute','left':$.wikiEditor.modules.toc.cfg.rtl?0:'auto','right':$.wikiEditor.modules.toc.cfg.rtl?'auto':0,'top':pT}).fadeOut('fast',function(){$(this).hide().css({'marginTop':'0','width':'1px'});context.$ui.find('.wikiEditor-ui-toc-expandControl').fadeIn('fast');context.fn.trigger('tocCollapse');context.fn.trigger('resize');});$.cookie('wikiEditor-'+context.instance+'-toc-width',0);return false;},expand:function(event){var $this=$(this),context=$this.data('context'),openWidth=parseFloat(context.modules.toc.$toc.data('openWidth')),availableSpace=context.$wikitext.width()-parseFloat($.wikiEditor.modules.toc.cfg.textMinimumWidth);if(availableSpace<$.wikiEditor.modules.toc.cfg.textMinmumWidth)return false;context.modules.toc.$toc.data('collapsed',false);if(availableSpace<openWidth)openWidth=availableSpace;context.$ui.find('.wikiEditor-ui-toc-expandControl').hide();var leftParam={},leftChildParam={};leftParam[$.wikiEditor.modules.toc.cfg.flexProperty]=parseFloat(openWidth)*-1;leftChildParam[$.wikiEditor.modules.toc.cfg.flexProperty]=openWidth;context.$ui.find('.wikiEditor-ui-left').animate(leftParam,'fast').children().animate(leftChildParam,'fast');context.$ui.find('.wikiEditor-ui-right').show().css('marginTop','1px').animate({'width':openWidth},'fast',function(){context.$content.trigger('mouseup');$(this).css({'marginTop':'0','position':'relative','right':'auto','left':'auto','top':'auto'});context.fn.trigger('tocExpand');context.fn.trigger('resize');});$.cookie('wikiEditor-'+context.instance+'-toc-width',context.modules.toc.$toc.data('openWidth'));return false;},build:function(context){function buildStructure(outline,offset,level){if(offset==undefined)offset=0;if(level==undefined)level=1;var sections=[];for(var i=offset;i<outline.length;i++){if(outline[i].nLevel==level){var sub=buildStructure(outline,i+1,level+1);if(sub.length){outline[i].sections=sub;} |
737 | | -sections[sections.length]=outline[i];}else if(outline[i].nLevel<level){break;}} |
738 | | -return sections;} |
739 | | -function buildList(structure){var list=$('<ul />');for(i in structure){var div=$('<div />').addClass('section-'+structure[i].index).data('index',structure[i].index).mousedown(function(){return false;}).click(function(event){var wrapper=context.$content.find('.wikiEditor-toc-section-'+$(this).data('index'));if(wrapper.size()==0) |
740 | | -wrapper=context.$content;context.fn.scrollToTop(wrapper,true);context.$textarea.textSelection('setSelection',{'start':0,'startContainer':wrapper});context.fn.highlightLine($(wrapper));$.wikiEditor.modules.toc.fn.unhighlight(context);$(this).addClass('current');if(typeof $.trackAction!='undefined') |
741 | | -$.trackAction('ntoc.heading');event.preventDefault();}).text(structure[i].text);if(structure[i].text=='') |
742 | | -div.html(' ');var item=$('<li />').append(div);if(structure[i].sections!==undefined){item.append(buildList(structure[i].sections));} |
743 | | -list.append(item);} |
744 | | -return list;} |
745 | | -function buildCollapseControls(){var $collapseControl=$('<div />'),$expandControl=$('<div />');$collapseControl.addClass('tab').addClass('tab-toc').append('<a href="#" />').mousedown(function(e){e.preventDefault();return false;}).bind('click.wikiEditor-toc',function(e){context.modules.toc.$toc.trigger('collapse.wikiEditor-toc');e.preventDefault();return false;}).find('a').text(mw.usability.getMsg('wikieditor-toc-hide'));$expandControl.addClass('wikiEditor-ui-toc-expandControl').append('<a href="#" />').mousedown(function(e){e.preventDefault();return false;}).bind('click.wikiEditor-toc',function(e){context.modules.toc.$toc.trigger('expand.wikiEditor-toc');e.preventDefault();return false;}).hide().find('a').text(mw.usability.getMsg('wikieditor-toc-show'));$collapseControl.insertBefore(context.modules.toc.$toc);context.$ui.find('.wikiEditor-ui-left .wikiEditor-ui-top').append($expandControl);} |
746 | | -function buildResizeControls(){context.$ui.data('resizableDone',true).find('.wikiEditor-ui-right').data('wikiEditor-ui-left',context.$ui.find('.wikiEditor-ui-left')).resizable({handles:'w,e',preventPositionLeftChange:true,minWidth:parseFloat($.wikiEditor.modules.toc.cfg.minimumWidth),start:function(e,ui){var $this=$(this);$('<div />').addClass('wikiEditor-ui-resize-mask').css({'position':'absolute','z-index':2,'left':0,'top':0,'bottom':0,'right':0}).appendTo(context.$ui.find('.wikiEditor-ui-left'));$this.resizable('option','maxWidth',$this.parent().width()- |
747 | | -parseFloat($.wikiEditor.modules.toc.cfg.textMinimumWidth));if(context.modules.toc.$toc.data('positionMode')=='goofy'){$.wikiEditor.modules.toc.fn.switchLayout(context);}},resize:function(e,ui){$(this).css({'width':ui.size.width,'top':'auto','height':'auto'}).data('wikiEditor-ui-left').css($.wikiEditor.modules.toc.cfg.flexProperty,(-1*ui.size.width)).children().css($.wikiEditor.modules.toc.cfg.flexProperty,ui.size.width);context.fn.trigger('resize');},stop:function(e,ui){context.$ui.find('.wikiEditor-ui-resize-mask').remove();context.$content.trigger('mouseup');if(ui.size.width<=parseFloat($.wikiEditor.modules.toc.cfg.minimumWidth)){context.modules.toc.$toc.trigger('collapse.wikiEditor-toc');}else{context.modules.toc.$toc.find('div').autoEllipsis({'position':'right','tooltip':true,'restoreText':true});context.modules.toc.$toc.data('openWidth',ui.size.width);$.cookie('wikiEditor-'+context.instance+'-toc-width',ui.size.width);} |
748 | | -context.fn.trigger('resize');}});var handle=$.wikiEditor.modules.toc.cfg.rtl?'w':'e';context.$ui.find('.ui-resizable-'+handle).removeClass('ui-resizable-'+handle).addClass('ui-resizable-'+(handle=='w'?'e':'w')).addClass('wikiEditor-ui-toc-resize-grip');context.modules.toc.$toc.bind('collapse.wikiEditor-toc',$.wikiEditor.modules.toc.fn.collapse).bind('expand.wikiEditor-toc',$.wikiEditor.modules.toc.fn.expand);context.modules.toc.$toc.data('openWidth',$.wikiEditor.modules.toc.cfg.defaultWidth);if($.cookie('wikiEditor-'+context.instance+'-toc-width')==0){context.modules.toc.$toc.trigger('collapse.wikiEditor-toc',{data:context});}else if($.cookie('wikiEditor-'+context.instance+'-toc-width')>0){var initialWidth=$.cookie('wikiEditor-'+context.instance+'-toc-width');if(initialWidth<parseFloat($.wikiEditor.modules.toc.cfg.minimumWidth)) |
749 | | -initialWidth=parseFloat($.wikiEditor.modules.toc.cfg.minimumWidth)+1;context.modules.toc.$toc.data('openWidth',initialWidth+'px');$.wikiEditor.modules.toc.fn.redraw(context,initialWidth);}} |
750 | | -if(context.data.outline){var outline=context.data.outline;var lastLevel=0;var nLevel=0;for(var i=0;i<outline.length;i++){if(outline[i].level>lastLevel){nLevel++;} |
751 | | -else if(outline[i].level<lastLevel){nLevel-=Math.max(1,lastLevel-outline[i].level);} |
752 | | -if(nLevel<=0){nLevel=1;} |
753 | | -outline[i].nLevel=nLevel;lastLevel=outline[i].level;} |
754 | | -var structure=buildStructure(outline);if($('input[name=wpSection]').val()==''){structure.unshift({'text':wgPageName.replace(/_/g,' '),'level':1,'index':0});} |
755 | | -context.modules.toc.$toc.html(buildList(structure));if(wgNavigableTOCResizable&&!context.$ui.data('resizableDone')){buildResizeControls();buildCollapseControls();} |
756 | | -context.modules.toc.$toc.find('div').autoEllipsis({'position':'right','tooltip':true,'restoreText':true});}}}};$.ui.plugin.add("resizable","preventPositionLeftChange",{resize:function(event,ui){$(this).data("resizable").position.left=0;}});})(jQuery);(function($){$.wikiEditor.modules.toolbar={api:{addToToolbar:function(context,data){for(type in data){switch(type){case'sections':var $sections=context.modules.toolbar.$toolbar.find('div.sections');var $tabs=context.modules.toolbar.$toolbar.find('div.tabs');for(section in data[type]){if(section=='main'){context.modules.toolbar.$toolbar.prepend($.wikiEditor.modules.toolbar.fn.buildSection(context,section,data[type][section]));continue;} |
| 384 | +maxTI=ti;});var tabIndex=maxTI+1;$elements.each(function(){$j(this).attr('tabindex',tabIndex++);});}},modules:{},quickDialog:function(body,settings){$('<div />').text(body).appendTo($('body')).dialog($.extend({bgiframe:true,modal:true},settings)).dialog('open');}};})(jQuery);(function($){$.wikiEditor.modules.toolbar={api:{addToToolbar:function(context,data){for(type in data){switch(type){case'sections':var $sections=context.modules.toolbar.$toolbar.find('div.sections');var $tabs=context.modules.toolbar.$toolbar.find('div.tabs');for(section in data[type]){if(section=='main'){context.modules.toolbar.$toolbar.prepend($.wikiEditor.modules.toolbar.fn.buildSection(context,section,data[type][section]));continue;} |
757 | 385 | $sections.append($.wikiEditor.modules.toolbar.fn.buildSection(context,section,data[type][section]));$tabs.append($.wikiEditor.modules.toolbar.fn.buildTab(context,section,data[type][section]));$section=$sections.find('.section:visible');if($section.size()){$sections.animate({'height':$section.outerHeight()},'fast');}} |
758 | 386 | break;case'groups':if(!('section'in data)){continue;} |
759 | 387 | var $section=context.modules.toolbar.$toolbar.find('div[rel='+data.section+'].section');for(group in data[type]){$section.append($.wikiEditor.modules.toolbar.fn.buildGroup(context,group,data[type][group]));} |
— | — | @@ -806,54 +434,4 @@ |
807 | 435 | $section.append($index).append($pages);$.wikiEditor.modules.toolbar.fn.updateBookletSelection(context,page,$pages,$index);break;}},updateBookletSelection:function(context,id,$pages,$index){var cookie='wikiEditor-'+context.instance+'-booklet-'+id+'-page';var selected=$.cookie(cookie);if(selected!=null){$.cookie(cookie,selected,{expires:30,path:'/'});} |
808 | 436 | var $selectedIndex=$index.find('*[rel='+selected+']');if($selectedIndex.size()==0){selected=$index.children().eq(0).attr('rel');$.cookie(cookie,selected,{expires:30,path:'/'});} |
809 | 437 | $pages.children().hide();$pages.find('*[rel='+selected+']').show();$index.children().removeClass('current');$selectedIndex.addClass('current');},build:function(context,config){var $tabs=$('<div />').addClass('tabs').appendTo(context.modules.toolbar.$toolbar);var $sections=$('<div />').addClass('sections').appendTo(context.modules.toolbar.$toolbar);context.modules.toolbar.$toolbar.append($('<div />').css('clear','both'));var sectionQueue=[];for(section in config){if(section=='main'){context.modules.toolbar.$toolbar.prepend($.wikiEditor.modules.toolbar.fn.buildSection(context,section,config[section]));}else{sectionQueue.push({'$sections':$sections,'context':context,'id':section,'config':config[section]});$tabs.append($.wikiEditor.modules.toolbar.fn.buildTab(context,section,config[section]));}} |
810 | | -$.eachAsync(sectionQueue,{'bulk':0,'end':function(){var oldValue=$('body').css('position');$('body').css('position','static');$('body').css('position',oldValue);},'loop':function(i,s){s.$sections.append($.wikiEditor.modules.toolbar.fn.buildSection(s.context,s.id,s.config));var $section=s.$sections.find('.section:visible');if($section.size()){$sections.animate({'height':$section.outerHeight()},$section.outerHeight()*2,function(){context.fn.trigger('resize');});}}});}}};})(jQuery);var _MAX_LIST_LEVEL=8;function sanitizeUnicode(s){return s.replace(/[\uffff\ufffe\ufeff\ufdd0-\ufdef\ud800-\udfff]/g,'?');} |
811 | | -function makeContentCollector(browser,domInterface){browser=browser||{};var dom=domInterface||{isNodeText:function(n){return(n.nodeType==3);},nodeTagName:function(n){return n.tagName;},nodeValue:function(n){return n.nodeValue;},nodeNumChildren:function(n){return n.childNodes.length;},nodeChild:function(n,i){return n.childNodes.item(i);},nodeProp:function(n,p){return n[p];},nodeAttr:function(n,a){return n.getAttribute(a);},optNodeInnerHTML:function(n){return n.innerHTML;}};var _blockElems={"div":1,"p":1,"pre":1,"li":1};function isBlockElement(n){return!!_blockElems[(dom.nodeTagName(n)||"").toLowerCase()];} |
812 | | -function textify(str){return sanitizeUnicode(str.replace(/[\n\r ]/g,' ').replace(/\xa0/g,' ').replace(/\t/g,' '));} |
813 | | -function getAssoc(node,name){return dom.nodeProp(node,"_magicdom_"+name);} |
814 | | -var lines=(function(){var textArray=[];var self={length:function(){return textArray.length;},atColumnZero:function(){return textArray[textArray.length-1]==="";},startNew:function(){textArray.push("");self.flush(true);},textOfLine:function(i){return textArray[i];},appendText:function(txt,attrString){textArray[textArray.length-1]+=txt;},textLines:function(){return textArray.slice();},flush:function(withNewline){}};self.startNew();return self;}());var cc={};function _ensureColumnZero(state){if(!lines.atColumnZero()){_startNewLine(state);}} |
815 | | -var selection,startPoint,endPoint;var selStart=[-1,-1],selEnd=[-1,-1];var blockElems={"div":1,"p":1,"pre":1};function _isEmpty(node,state){if(dom.nodeNumChildren(node)==0) |
816 | | -return true;if(dom.nodeNumChildren(node)==1&&getAssoc(node,"shouldBeEmpty")&&dom.optNodeInnerHTML(node)==" "&&!getAssoc(node,"unpasted")){if(state){var child=dom.nodeChild(node,0);_reachPoint(child,0,state);_reachPoint(child,1,state);} |
817 | | -return true;} |
818 | | -return false;} |
819 | | -function _pointHere(charsAfter,state){var ln=lines.length()-1;var chr=lines.textOfLine(ln).length;if(chr==0&&state.listType&&state.listType!='none'){chr+=1;} |
820 | | -chr+=charsAfter;return[ln,chr];} |
821 | | -function _reachBlockPoint(nd,idx,state){if(!dom.isNodeText(nd)) |
822 | | -_reachPoint(nd,idx,state);} |
823 | | -function _reachPoint(nd,idx,state){if(startPoint&&nd==startPoint.node&&startPoint.index==idx){selStart=_pointHere(0,state);} |
824 | | -if(endPoint&&nd==endPoint.node&&endPoint.index==idx){selEnd=_pointHere(0,state);}} |
825 | | -function _incrementFlag(state,flagName){state.flags[flagName]=(state.flags[flagName]||0)+1;} |
826 | | -function _decrementFlag(state,flagName){state.flags[flagName]--;} |
827 | | -function _enterList(state,listType){var oldListType=state.listType;state.listLevel=(state.listLevel||0)+1;if(listType!='none'){state.listNesting=(state.listNesting||0)+1;} |
828 | | -state.listType=listType;return oldListType;} |
829 | | -function _exitList(state,oldListType){state.listLevel--;if(state.listType!='none'){state.listNesting--;} |
830 | | -state.listType=oldListType;} |
831 | | -function _produceListMarker(state){} |
832 | | -function _startNewLine(state){if(state){var atBeginningOfLine=lines.textOfLine(lines.length()-1).length==0;if(atBeginningOfLine&&state.listType&&state.listType!='none'){_produceListMarker(state);}} |
833 | | -lines.startNew();} |
834 | | -cc.notifySelection=function(sel){if(sel){selection=sel;startPoint=selection.startPoint;endPoint=selection.endPoint;}};cc.collectContent=function(node,state){if(!state){state={flags:{}};} |
835 | | -var isBlock=isBlockElement(node);var isEmpty=_isEmpty(node,state);if(isBlock) |
836 | | -_ensureColumnZero(state);var startLine=lines.length()-1;_reachBlockPoint(node,0,state);if(dom.isNodeText(node)){var txt=dom.nodeValue(node);var rest='';var x=0;if(txt.length==0){if(startPoint&&node==startPoint.node){selStart=_pointHere(0,state);} |
837 | | -if(endPoint&&node==endPoint.node){selEnd=_pointHere(0,state);}} |
838 | | -while(txt.length>0){var consumed=0;if(!browser.firefox||state.flags.preMode){var firstLine=txt.split('\n',1)[0];consumed=firstLine.length+1;rest=txt.substring(consumed);txt=firstLine;}else{} |
839 | | -if(startPoint&&node==startPoint.node&&startPoint.index-x<=txt.length){selStart=_pointHere(startPoint.index-x,state);} |
840 | | -if(endPoint&&node==endPoint.node&&endPoint.index-x<=txt.length){selEnd=_pointHere(endPoint.index-x,state);} |
841 | | -var txt2=txt;if((!state.flags.preMode)&&/^[\r\n]*$/.exec(txt)){txt2="";} |
842 | | -var atBeginningOfLine=lines.textOfLine(lines.length()-1).length==0;if(atBeginningOfLine){txt2=txt2.replace(/^\n*/,'');} |
843 | | -if(atBeginningOfLine&&state.listType&&state.listType!='none'){_produceListMarker(state);} |
844 | | -lines.appendText(textify(txt2));x+=consumed;txt=rest;if(txt.length>0){_startNewLine(state);}}}else{var tname=(dom.nodeTagName(node)||"").toLowerCase();if(tname=="br"){_startNewLine(state);}else if(tname=="script"||tname=="style"){}else if(!isEmpty){var styl=dom.nodeAttr(node,"style");var cls=dom.nodeProp(node,"className");var isPre=(tname=="pre");if((!isPre)&&browser.safari){isPre=(styl&&/\bwhite-space:\s*pre\b/i.exec(styl));} |
845 | | -if(isPre) |
846 | | -_incrementFlag(state,'preMode');var oldListTypeOrNull=null;var nc=dom.nodeNumChildren(node);for(var i=0;i<nc;i++){var c=dom.nodeChild(node,i);cc.collectContent(c,state);} |
847 | | -if(isPre) |
848 | | -_decrementFlag(state,'preMode');if(oldListTypeOrNull){_exitList(state,oldListTypeOrNull);}}} |
849 | | -if(!browser.msie){_reachBlockPoint(node,1,state);} |
850 | | -if(isBlock){if(lines.length()-1==startLine){_startNewLine(state);}else{_ensureColumnZero(state);}} |
851 | | -if(browser.msie){}};cc.notifyNextNode=function(node){if((!node)||(isBlockElement(node)&&!_isEmpty(node))){_ensureColumnZero(null);}};var getSelectionStart=function(){return selStart;};var getSelectionEnd=function(){return selEnd;};cc.getLines=function(){return lines.textLines();};cc.finish=function(){lines.flush();var lineStrings=cc.getLines();lineStrings.length--;var ss=getSelectionStart();var se=getSelectionEnd();function fixLongLines(){var lineLimit=2000;var buffer=10;var linesWrapped=0;var numLinesAfter=0;for(var i=lineStrings.length-1;i>=0;i--){var oldString=lineStrings[i];if(oldString.length>lineLimit+buffer){var newStrings=[];while(oldString.length>lineLimit){lengthToTake=lineLimit;newStrings.push(oldString.substring(0,lengthToTake));oldString=oldString.substring(lengthToTake);} |
852 | | -if(oldString.length>0){newStrings.push(oldString);} |
853 | | -function fixLineNumber(lineChar){if(lineChar[0]<0) |
854 | | -return;var n=lineChar[0];var c=lineChar[1];if(n>i){n+=(newStrings.length-1);}else if(n==i){var a=0;while(c>newStrings[a].length){c-=newStrings[a].length;a++;} |
855 | | -n+=a;} |
856 | | -lineChar[0]=n;lineChar[1]=c;} |
857 | | -fixLineNumber(ss);fixLineNumber(se);linesWrapped++;numLinesAfter+=newStrings.length;newStrings.unshift(i,1);lineStrings.splice.apply(lineStrings,newStrings);}} |
858 | | -return{linesWrapped:linesWrapped,numLinesAfter:numLinesAfter};} |
859 | | -var wrapData=fixLongLines();return{selStart:ss,selEnd:se,linesWrapped:wrapData.linesWrapped,numLinesAfter:wrapData.numLinesAfter,lines:lineStrings};} |
860 | | -return cc;} |
\ No newline at end of file |
| 438 | +$.eachAsync(sectionQueue,{'bulk':0,'end':function(){var oldValue=$('body').css('position');$('body').css('position','static');$('body').css('position',oldValue);},'loop':function(i,s){s.$sections.append($.wikiEditor.modules.toolbar.fn.buildSection(s.context,s.id,s.config));var $section=s.$sections.find('.section:visible');if($section.size()){$sections.animate({'height':$section.outerHeight()},$section.outerHeight()*2,function(){context.fn.trigger('resize');});}}});}}};})(jQuery); |
\ No newline at end of file |
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Makefile |
— | — | @@ -5,21 +5,16 @@ |
6 | 6 | CSS := \ |
7 | 7 | css/suggestions.css\ |
8 | 8 | css/vector.collapsibleNav.css\ |
9 | | - css/vector.expandableSearch.css\ |
10 | 9 | css/wikiEditor.css\ |
11 | 10 | css/wikiEditor.dialogs.css\ |
12 | | - css/wikiEditor.toc.css\ |
13 | 11 | css/wikiEditor.toolbar.css\ |
14 | | - css/wikiEditor.preview.css |
15 | 12 | |
16 | 13 | PLUGINS := \ |
17 | 14 | js/usability.js\ |
18 | 15 | js/js2stopgap/ui.core.js\ |
19 | | - js/js2stopgap/ui.datepicker.js\ |
20 | 16 | js/js2stopgap/ui.dialog.js\ |
21 | 17 | js/js2stopgap/ui.draggable.js\ |
22 | 18 | js/js2stopgap/ui.resizable.js\ |
23 | | - js/js2stopgap/ui.tabs.js\ |
24 | 19 | js/plugins/jquery.async.js\ |
25 | 20 | js/plugins/jquery.autoEllipsis.js\ |
26 | 21 | js/plugins/jquery.browser.js\ |
— | — | @@ -27,34 +22,19 @@ |
28 | 23 | js/plugins/jquery.color.js\ |
29 | 24 | js/plugins/jquery.cookie.js\ |
30 | 25 | js/plugins/jquery.delayedBind.js\ |
31 | | - js/plugins/jquery.expandableField.js\ |
32 | 26 | js/plugins/jquery.suggestions.js\ |
33 | 27 | js/plugins/jquery.textSelection.js\ |
34 | 28 | js/plugins/jquery.wikiEditor.js\ |
35 | 29 | js/plugins/jquery.wikiEditor.dialogs.js\ |
36 | | - js/plugins/jquery.wikiEditor.highlight.js\ |
37 | | - js/plugins/jquery.wikiEditor.preview.js\ |
38 | | - js/plugins/jquery.wikiEditor.publish.js\ |
39 | | - js/plugins/jquery.wikiEditor.templateEditor.js\ |
40 | | - js/plugins/jquery.wikiEditor.toc.js\ |
41 | | - js/plugins/jquery.wikiEditor.toolbar.js\ |
42 | | - js/thirdparty/contentCollector.js |
| 30 | + js/plugins/jquery.wikiEditor.toolbar.js |
43 | 31 | |
44 | 32 | WIKIEDITOR_MODULES := \ |
45 | | - WikiEditor/Modules/Highlight/Highlight.js\ |
46 | | - WikiEditor/Modules/Preview/Preview.js\ |
47 | | - WikiEditor/Modules/Publish/Publish.js\ |
48 | | - WikiEditor/Modules/Toc/Toc.js\ |
49 | | - WikiEditor/Modules/Toolbar/Toolbar.js\ |
50 | | - WikiEditor/Modules/TemplateEditor/TemplateEditor.js\ |
51 | | - WikiEditor/Modules/AddMediaWizard/AddMediaWizard.js |
| 33 | + WikiEditor/Modules/Toolbar/Toolbar.js |
52 | 34 | |
53 | 35 | VECTOR_MODULES := \ |
54 | 36 | Vector/Modules/CollapsibleNav/CollapsibleNav.js\ |
55 | 37 | Vector/Modules/CollapsibleTabs/CollapsibleTabs.js\ |
56 | 38 | Vector/Modules/EditWarning/EditWarning.js\ |
57 | | - Vector/Modules/ExpandableSearch/ExpandableSearch.js\ |
58 | | - Vector/Modules/FooterCleanup/FooterCleanup.js\ |
59 | 39 | Vector/Modules/SimpleSearch/SimpleSearch.js |
60 | 40 | |
61 | 41 | all: \ |