Index: branches/salvatoreingala/Gadgets/backend/GadgetResourceLoaderModule.php |
— | — | @@ -66,31 +66,11 @@ |
67 | 67 | * @return String |
68 | 68 | */ |
69 | 69 | public function getScript( ResourceLoaderContext $context ) { |
70 | | - $prefs = $this->gadget->getPrefs(); |
71 | | - |
72 | 70 | //Enclose gadget's code in a closure, with "this" bound to the |
73 | 71 | //configuration object (or to "window" for non-configurable gadgets) |
74 | | - $header = "(function(){"; |
75 | | - |
76 | | - if ( $prefs !== null ) { |
77 | | - //Bind gadget info to "this". |
78 | | - $footer = "}).apply( mw.gadgets.info.get('{$this->gadget->getName()}') );"; |
79 | | - } else { |
80 | | - //Bind window to "this" |
81 | | - $footer = "}).apply( window );"; |
82 | | - } |
83 | | - |
84 | | - return $header . parent::getScript( $context ) . $footer; |
| 72 | + return "( function() {\n" |
| 73 | + . parent::getScript( $context ) |
| 74 | + . "} ).apply( mw.gadgets.info.get( '{$this->gadget->getName()}' ) || window );"; |
85 | 75 | } |
86 | | - |
87 | | - /** |
88 | | - * Overrides ResourceLoaderModule::getModifiedTime() |
89 | | - * @param $context ResourceLoaderContext |
90 | | - * @return Integer |
91 | | - */ |
92 | | - public function getModifiedTime( ResourceLoaderContext $context ) { |
93 | | - //TODO: should also depend on the mTime of preferences description page |
94 | | - return parent::getModifiedTime( $context ); |
95 | | - } |
96 | 76 | } |
97 | 77 | |