Преглед изворни кода

Ajout du langage javascript

idleman пре 5 година
родитељ
комит
790dd727d9
1 измењених фајлова са 39 додато и 0 уклоњено
  1. 39 0
      plugin/hackpoint/types/JsType.class.php

+ 39 - 0
plugin/hackpoint/types/JsType.class.php

@@ -0,0 +1,39 @@
+<?php
+require_once(__DIR__.SLASH.'ReadmeType.class.php');
+class JsType extends ReadmeType{
+
+	public static function manifest(){
+		return array(
+			'uid' => 'js',
+			'label' => 'Javascript',
+			'icon' => 'fab fa-js',
+			'color' => '#ffffff',
+			'background' => '#f0db4f',
+			'description' => 'Fichier contenant du langage Javascript',
+			'fromExtension' => array('js'),
+			'toExtension' => 'js',
+			'default' => '',
+
+		);
+	}
+
+	/* EDITION */
+	public static function toHtml($resource,$sketch=null){
+		$infos = self::manifest();
+		return array(
+			'html'=>'<textarea id="content" onblur="hackpoint_resource_save_content()" class="arduino-text">'.$resource->content.'</textarea>',
+			'javascript' => "
+				hackpoint_resource_mirrorify('.arduino-text',{
+					mode : 'js',	
+					lineNumbers : true,
+					theme : 'monokai',
+					readOnly : false
+				});
+			"
+		);
+	}
+
+
+	
+}
+?>