Index: branches/REL1_18/extensions/ProofreadPage/ProofreadPage_body.php |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | * Constructor |
35 | 35 | */ |
36 | 36 | function __construct() { |
37 | | - global $wgHooks, $wgScriptPath; |
| 37 | + global $wgHooks, $wgExtensionAssetsPath; |
38 | 38 | $wgHooks['ParserFirstCallInit'][] = array( $this, 'parserFirstCallInit' ); |
39 | 39 | $wgHooks['BeforePageDisplay'][] = array( &$this, 'beforePageDisplay' ); |
40 | 40 | $wgHooks['GetLinkColours'][] = array( &$this, 'getLinkColoursHook' ); |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | $this->index_namespace = preg_quote( wfMsgForContent( 'proofreadpage_index_namespace' ), '/' ); |
55 | 55 | |
56 | 56 | /* Navigation icons */ |
57 | | - $path = $wgScriptPath . '/extensions/ProofreadPage'; |
| 57 | + $path = $wgExtensionAssetsPath . '/ProofreadPage'; |
58 | 58 | $this->prev_icon = Html::element( 'img', array( 'src' => $path . '/leftarrow.png', |
59 | 59 | 'alt' => wfMsg( 'proofreadpage_prevpage' ), |
60 | 60 | 'width' => 15, 'height' => 15 ) ); |
Index: branches/REL1_18/extensions/ProofreadPage/ProofreadPage.i18n.php |
— | — | @@ -66,6 +66,14 @@ |
67 | 67 | 'proofreadpage_source' => 'Source', |
68 | 68 | 'proofreadpage_source_message' => 'Scanned edition used to establish this text', |
69 | 69 | 'right-pagequality' => 'Modify page quality flag', |
| 70 | + 'proofreadpage-section-tools' => 'Proofread tools', |
| 71 | + 'proofreadpage-group-zoom' => 'Zoom', |
| 72 | + 'proofreadpage-group-other' => 'Other', |
| 73 | + 'proofreadpage-button-toggle-visibility-label' => 'Show/hide this page\'s header and footer', |
| 74 | + 'proofreadpage-button-zoom-out-label' => 'Zoom out', |
| 75 | + 'proofreadpage-button-reset-zoom-label' => 'Reset zoom', |
| 76 | + 'proofreadpage-button-zoom-in-label' => 'Zoom in', |
| 77 | + 'proofreadpage-button-toggle-layout-label' => 'Vertical/horizontal layout' |
70 | 78 | ); |
71 | 79 | |
72 | 80 | /** Message documentation (Message documentation) |
Index: branches/REL1_18/extensions/ProofreadPage/proofread.js |
— | — | @@ -767,76 +767,127 @@ |
768 | 768 | |
769 | 769 | // add buttons |
770 | 770 | if( proofreadPageIsEdit ) { |
771 | | - var toolbar = document.getElementById( 'toolbar' ); |
| 771 | + var tools = { |
| 772 | + 'section': 'proofreadpage-tools', |
| 773 | + 'groups': { |
| 774 | + 'zoom': { |
| 775 | + 'label': mw.msg( 'proofreadpage-group-zoom' ), |
| 776 | + 'tools': { |
| 777 | + 'zoom-in': { |
| 778 | + label: mw.msg( 'proofreadpage-button-zoom-in-label' ), |
| 779 | + type: 'button', |
| 780 | + icon: mw.config.get( 'wgExtensionAssetsPath' ) + '/ProofreadPage/Button_zoom_in.png', |
| 781 | + action: { |
| 782 | + type: 'callback', |
| 783 | + execute: function() { |
| 784 | + xx=0; |
| 785 | + yy=0; |
| 786 | + pr_zoom(2); |
| 787 | + } |
| 788 | + } |
| 789 | + }, |
| 790 | + 'zoom-out': { |
| 791 | + label: mw.msg( 'proofreadpage-button-zoom-out-label' ), |
| 792 | + type: 'button', |
| 793 | + icon: mw.config.get( 'wgExtensionAssetsPath' ) + '/ProofreadPage/Button_zoom_out.png', |
| 794 | + action: { |
| 795 | + type: 'callback', |
| 796 | + execute: function() { |
| 797 | + xx=0; |
| 798 | + yy=0; |
| 799 | + pr_zoom(-2); |
| 800 | + } |
| 801 | + } |
| 802 | + }, |
| 803 | + 'reset-zoom': { |
| 804 | + label: mw.msg( 'proofreadpage-button-reset-zoom-label' ), |
| 805 | + type: 'button', |
| 806 | + icon: mw.config.get( 'wgExtensionAssetsPath' ) + '/ProofreadPage/Button_examine.png', |
| 807 | + action: { |
| 808 | + type: 'callback', |
| 809 | + execute: function() { |
| 810 | + pr_zoom(0); |
| 811 | + } |
| 812 | + } |
| 813 | + } |
| 814 | + } |
| 815 | + }, |
| 816 | + 'other': { |
| 817 | + 'label': mw.msg( 'proofreadpage-group-other' ), |
| 818 | + 'tools': { |
| 819 | + 'toggle-visibility': { |
| 820 | + label: mw.msg( 'proofreadpage-button-toggle-visibility-label' ), |
| 821 | + type: 'button', |
| 822 | + icon: mw.config.get( 'wgExtensionAssetsPath' ) + '/ProofreadPage/button_category_plus.png', |
| 823 | + action: { |
| 824 | + type: 'callback', |
| 825 | + execute: function() { |
| 826 | + pr_toggle_visibility(); |
| 827 | + } |
| 828 | + } |
| 829 | + }, |
| 830 | + 'toggle-layout': { |
| 831 | + label: mw.msg( 'proofreadpage-button-toggle-layout-label' ), |
| 832 | + type: 'button', |
| 833 | + icon: mw.config.get( 'wgExtensionAssetsPath' ) + '/ProofreadPage/Button_multicol.png', |
| 834 | + action: { |
| 835 | + type: 'callback', |
| 836 | + execute: function() { |
| 837 | + pr_toggle_layout(); |
| 838 | + } |
| 839 | + } |
| 840 | + } |
| 841 | + } |
| 842 | + } |
| 843 | + } |
| 844 | + }; |
772 | 845 | |
773 | | - var image = document.createElement( 'img' ); |
774 | | - image.width = 23; |
775 | | - image.height = 22; |
776 | | - image.className = 'mw-toolbar-editbutton'; |
777 | | - image.src = wgScriptPath + '/extensions/ProofreadPage/button_category_plus.png'; |
778 | | - image.border = 0; |
779 | | - image.alt = mediaWiki.msg( 'proofreadpage_toggleheaders' ); |
780 | | - image.title = mediaWiki.msg( 'proofreadpage_toggleheaders' ); |
781 | | - image.style.cursor = 'pointer'; |
782 | | - image.onclick = pr_toggle_visibility; |
| 846 | + var $edit = $( '#wpTextbox1' ); |
| 847 | + if( typeof $edit.wikiEditor == 'function' ) { |
| 848 | + setTimeout(function() { |
| 849 | + $edit.wikiEditor( 'addToToolbar', { |
| 850 | + 'sections': { |
| 851 | + 'proofreadpage-tools': { |
| 852 | + 'type': 'toolbar', |
| 853 | + 'label': mw.msg( 'proofreadpage-section-tools' ) |
| 854 | + } |
| 855 | + } |
| 856 | + } ) |
| 857 | + .wikiEditor( 'addToToolbar', tools); |
| 858 | + }, 500); |
| 859 | + } else { |
| 860 | + var toolbar = document.getElementById( 'toolbar' ); |
783 | 861 | |
784 | | - var image3 = document.createElement( 'img' ); |
785 | | - image3.width = 23; |
786 | | - image3.height = 22; |
787 | | - image3.border = 0; |
788 | | - image3.className = 'mw-toolbar-proofread'; |
789 | | - image3.style.cursor = 'pointer'; |
790 | | - image3.alt = '-'; |
791 | | - image3.title = 'zoom out'; |
792 | | - image3.src = wgScriptPath + '/extensions/ProofreadPage/Button_zoom_out.png'; |
793 | | - image3.onclick = new Function( 'xx=0;yy=0;pr_zoom(-2);' ); |
| 862 | + pr_rect = document.createElement( 'div' ); |
| 863 | + pr_container_parent.appendChild( pr_rect ); |
794 | 864 | |
795 | | - var image4 = document.createElement( 'img' ); |
796 | | - image4.width = 23; |
797 | | - image4.height = 22; |
798 | | - image4.border = 0; |
799 | | - image4.className = 'mw-toolbar-proofread'; |
800 | | - image4.style.cursor = 'pointer'; |
801 | | - image4.alt = '-'; |
802 | | - image4.title = 'reset zoom'; |
803 | | - image4.src = wgScriptPath + '/extensions/ProofreadPage/Button_examine.png'; |
804 | | - image4.onclick = new Function("pr_zoom(0);"); |
| 865 | + if( ( !toolbar ) || ( self.wgWikiEditorPreferences && self.wgWikiEditorPreferences['toolbar'] ) ) { |
| 866 | + toolbar = document.createElement( 'div' ); |
| 867 | + toolbar.style.cssText = 'position:absolute;'; |
| 868 | + pr_container_parent.appendChild( toolbar ); |
| 869 | + } |
805 | 870 | |
806 | | - var image2 = document.createElement( 'img' ); |
807 | | - image2.width = 23; |
808 | | - image2.height = 22; |
809 | | - image2.border = 0; |
810 | | - image2.className = 'mw-toolbar-proofread'; |
811 | | - image2.style.cursor = 'pointer'; |
812 | | - image2.alt = '+'; |
813 | | - image2.title = 'zoom in'; |
814 | | - image2.src = wgScriptPath + '/extensions/ProofreadPage/Button_zoom_in.png'; |
815 | | - image2.onclick = new Function( 'xx=0;yy=0;pr_zoom(2);' ); |
816 | | - |
817 | | - var image1 = document.createElement( 'img' ); |
818 | | - image1.width = 23; |
819 | | - image1.height = 22; |
820 | | - image1.className = 'mw-toolbar-editbutton'; |
821 | | - image1.src = wgScriptPath + '/extensions/ProofreadPage/Button_multicol.png'; |
822 | | - image1.border = 0; |
823 | | - image1.alt = ' '; |
824 | | - image1.title = 'vertical/horizontal layout'; |
825 | | - image1.style.cursor = 'pointer'; |
826 | | - image1.onclick = pr_toggle_layout; |
827 | | - |
828 | | - pr_rect = document.createElement( 'div' ); |
829 | | - pr_container_parent.appendChild( pr_rect ); |
830 | | - |
831 | | - if( ( !toolbar ) || ( self.wgWikiEditorPreferences && self.wgWikiEditorPreferences['toolbar'] ) ) { |
832 | | - toolbar = document.createElement( 'div' ); |
833 | | - toolbar.style.cssText = 'position:absolute;'; |
834 | | - pr_container_parent.appendChild( toolbar ); |
| 871 | + var bits = [ |
| 872 | + tools.groups.other.tools['toggle-visibility'], |
| 873 | + tools.groups.zoom.tools['zoom-out'], |
| 874 | + tools.groups.zoom.tools['reset-zoom'], |
| 875 | + tools.groups.zoom.tools['zoom-in'], |
| 876 | + tools.groups.other.tools['toggle-layout'] |
| 877 | + ]; |
| 878 | + $.each(bits, function(i, button) { |
| 879 | + var image = document.createElement( 'img' ); |
| 880 | + image.width = 23; |
| 881 | + image.height = 22; |
| 882 | + image.className = 'mw-toolbar-editbutton'; |
| 883 | + image.src = button.icon; |
| 884 | + image.border = 0; |
| 885 | + image.alt = button.label; |
| 886 | + image.title = button.label; |
| 887 | + image.style.cursor = 'pointer'; |
| 888 | + image.onclick = button.action.execute; |
| 889 | + toolbar.appendChild( image ); |
| 890 | + }); |
835 | 891 | } |
836 | | - toolbar.appendChild( image ); |
837 | | - toolbar.appendChild( image3 ); |
838 | | - toolbar.appendChild( image4 ); |
839 | | - toolbar.appendChild( image2 ); |
840 | | - toolbar.appendChild( image1 ); |
841 | 892 | } |
842 | 893 | } |
843 | 894 | |
Index: branches/REL1_18/extensions/ProofreadPage/ProofreadPage.php |
— | — | @@ -78,6 +78,14 @@ |
79 | 79 | 'proofreadpage_quality2_category', |
80 | 80 | 'proofreadpage_quality3_category', |
81 | 81 | 'proofreadpage_quality4_category', |
| 82 | + 'proofreadpage-section-tools', |
| 83 | + 'proofreadpage-group-zoom', |
| 84 | + 'proofreadpage-group-other', |
| 85 | + 'proofreadpage-button-toggle-visibility-label', |
| 86 | + 'proofreadpage-button-zoom-out-label', |
| 87 | + 'proofreadpage-button-reset-zoom-label', |
| 88 | + 'proofreadpage-button-zoom-in-label', |
| 89 | + 'proofreadpage-button-toggle-layout-label', |
82 | 90 | ) |
83 | 91 | ), |
84 | 92 | 'ext.proofreadpage.article' => $prpResourceTemplate + array( |