Remove wiki extension
This commit is contained in:
parent
560e4c937e
commit
1ae309326d
@ -26,8 +26,3 @@ Embeddable
|
||||
This is the embeddable version of the viewer:
|
||||
- In this case you should host the 3D models.
|
||||
- See examples for more information.
|
||||
|
||||
Wiki Extension
|
||||
--------------
|
||||
|
||||
This is a WikiMedia extension for viewing 3D models. It is in experimental phase currently.
|
||||
|
||||
@ -36,14 +36,6 @@ def BuildEmbeddable (rootFolder, resultFolder):
|
||||
ReplaceInFile (indexFilePath, '../jsmodeler/', 'jsmodeler/')
|
||||
indexFilePath = os.path.join (targetFolder, 'fullscreen.html')
|
||||
ReplaceInFile (indexFilePath, '../jsmodeler/', 'jsmodeler/')
|
||||
|
||||
def BuildWikiExtension (rootFolder, resultFolder):
|
||||
targetFolder = os.path.join (resultFolder, 'wikiextension')
|
||||
shutil.copytree (os.path.join (rootFolder, 'wikiextension'), targetFolder)
|
||||
shutil.copy (os.path.join (rootFolder, 'jsmodeler', 'three.min.js'), os.path.join (targetFolder, 'three.min.js'))
|
||||
shutil.copy (os.path.join (rootFolder, 'jsmodeler', 'jsmodeler.js'), os.path.join (targetFolder, 'jsmodeler.js'))
|
||||
shutil.copy (os.path.join (rootFolder, 'jsmodeler', 'jsmodeler.ext.three.js'), os.path.join (targetFolder, 'jsmodeler.ext.three.js'))
|
||||
shutil.copy (os.path.join (rootFolder, 'embeddable', 'include', 'online3dembedder.js'), os.path.join (targetFolder, 'online3dembedder.js'))
|
||||
|
||||
def Main ():
|
||||
rootFolder = os.path.abspath ('..')
|
||||
@ -57,9 +49,7 @@ def Main ():
|
||||
|
||||
PrintInfo ('Building embeddable example to folder <' + resultFolder + '>.')
|
||||
BuildEmbeddable (rootFolder, resultFolder)
|
||||
|
||||
PrintInfo ('Building wiki extension to folder <' + resultFolder + '>.')
|
||||
BuildWikiExtension (rootFolder, resultFolder)
|
||||
|
||||
return 0
|
||||
|
||||
sys.exit (Main ())
|
||||
|
||||
@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
$viewerCounter = 0;
|
||||
|
||||
class Viewer3DHooks {
|
||||
public static function OnParserFirstCallInit (&$parser)
|
||||
{
|
||||
$parser->setHook ('viewer3d', 'Viewer3DHooks::OnSampleTag');
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function OnSampleTag ($data, $attribs, $parser, $frame)
|
||||
{
|
||||
$parser->getOutput ()->addModules ('ext.Viewer3D');
|
||||
|
||||
global $viewerCounter;
|
||||
$viewerCounter++;
|
||||
|
||||
$width = 300;
|
||||
if (in_array ('width', array_keys ($attribs))) {
|
||||
$width = $attribs['width'];
|
||||
}
|
||||
|
||||
$height = 200;
|
||||
if (in_array ('height', array_keys ($attribs))) {
|
||||
$height = $attribs['height'];
|
||||
}
|
||||
|
||||
$originalFiles = '';
|
||||
if (in_array ('sourcefiles', array_keys ($attribs))) {
|
||||
$originalFiles = $attribs['sourcefiles'];
|
||||
}
|
||||
|
||||
$sourceFiles = '';
|
||||
$splitted = explode ('|', $originalFiles);
|
||||
for ($i = 0; $i < count ($splitted); $i++) {
|
||||
$fileObject = wfFindFile ($splitted[$i]);
|
||||
if ($fileObject) {
|
||||
$filePath = $fileObject->getFullUrl ();
|
||||
$sourceFiles .= $filePath;
|
||||
if ($i < count ($splitted) - 1) {
|
||||
$sourceFiles .= '|';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$html = '';
|
||||
$html .= '<canvas class="3dviewer" width="'.$width.'" height="'.$height.'" sourcefiles="'.$sourceFiles.'"></canvas>';
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,3 +0,0 @@
|
||||
mw.loader.using ('ext.Viewer3D', function () {
|
||||
LoadOnline3DModels ();
|
||||
});
|
||||
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
$dir = dirname (__FILE__);
|
||||
$dirbasename = basename ($dir);
|
||||
|
||||
$wgExtensionCredits['viewer3d'][] = array(
|
||||
'path' => __FILE__,
|
||||
'name' => 'Viewer3D',
|
||||
'author' => 'Viktor Kovacs',
|
||||
'url' => 'https://www.mediawiki.org/wiki/Extension:Viewer3D',
|
||||
'description' => 'With this extension you can view 3D models with WebGL.',
|
||||
'version' => 0.1,
|
||||
'license-name' => "MIT"
|
||||
);
|
||||
|
||||
$wgAutoloadClasses['Viewer3DHooks'] = $dir.'/Viewer3D.hooks.php';
|
||||
$wgHooks['ParserFirstCallInit'][] = 'Viewer3DHooks::OnParserFirstCallInit';
|
||||
|
||||
$wgResourceModules['ext.Viewer3D'] = array(
|
||||
'scripts' => array ('three.min.js', 'jsmodeler.js', 'online3dembedder.js', 'Viewer3D.js'),
|
||||
'localBasePath' => $dir,
|
||||
'remoteExtPath' => 'Viewer3D'
|
||||
);
|
||||
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user