Skip to content

Commit c78d064

Browse files
authored
Remove unused addGlobalJSVariables() (#925)
* "srfVersion" is not used anywhere. * "srfgScriptPath" used but never via mw.config.get(). Instead, the onResourceLoaderGetConfigVars hook adds 'srf-config' (which includes a srfgScriptPath subkey) to mw.config.get(). Then, ext.stf.js uses this to implement srf.settings.get(), which is what various JavaScript files use to read srfgScriptPath. The global "srfgScriptPath" key is not used anywhere.
1 parent e09a547 commit c78d064

File tree

3 files changed

+1
-18
lines changed

3 files changed

+1
-18
lines changed

SemanticResultFormats.hooks.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ public static function addToAdminLinks( ALTree &$admin_links_tree ) {
9494
* @return true
9595
*/
9696
public static function onResourceLoaderGetConfigVars( &$vars ) {
97+
// Powers srf.settings.get(), via ext.stf.js.
9798
$vars['srf-config'] = [
9899
'version' => SRF_VERSION,
99100
'settings' => [

SemanticResultFormats.utils.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,6 @@ public static function htmlProcessingElement( $isHtml = true ) {
2727
);
2828
}
2929

30-
/**
31-
* Add JavaScript variables to the output
32-
*
33-
* @since 1.8
34-
*/
35-
public static function addGlobalJSVariables() {
36-
$options = [
37-
'srfgScriptPath' => $GLOBALS['srfgScriptPath'],
38-
'srfVersion' => SRF_VERSION
39-
];
40-
41-
$requireHeadItem = [ 'srf.options' => $options ];
42-
SMWOutputs::requireHeadItem( 'srf.options', self::makeVariablesScript( $requireHeadItem ) );
43-
}
44-
4530
/**
4631
* Returns semantic search link for the current query
4732
*

formats/gallery/Gallery.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,6 @@ public function getResultText( QueryResult $results, $outputmode ) {
147147
$this->addImagePages( $results, $ig );
148148
}
149149

150-
// SRF Global settings
151-
SRFUtils::addGlobalJSVariables();
152-
153150
// Display a processing image as long as the DOM is no ready
154151
if ( $this->params['widget'] !== '' ) {
155152
$processing = SRFUtils::htmlProcessingElement();

0 commit comments

Comments
 (0)