OSDN Git Service

[update] : チャンネルの指定を追加
authorhayao <shun819.mail@gmail.com>
Fri, 18 Sep 2020 11:44:08 +0000 (20:44 +0900)
committerhayao <shun819.mail@gmail.com>
Fri, 18 Sep 2020 11:44:08 +0000 (20:44 +0900)
alteriso-options-generator/index.php
alteriso-options-generator/main.js

index b75f652..b2f69fa 100644 (file)
                     </div>
                     <!-- ユーザー ここまで-->
 
+                    <!-- チャンネル ここから-->
+                    <div class="option_box_child">
+                        <p class="option_title"><h3>チャンネル</h3></p>
+                        <p class="option_description">
+                            ビルドするチャンネルを指定します。
+                            <br>
+                            <span style="color: red;">この項目は必須です。</span>
+                        </p>
+                        <p class="option_form">
+                            <input type="text" id="channel" placeholder="xfce" list="channel_list">
+                            <datalist id="channel_list">
+                            </datalist>
+                        </p>
+                        <script>
+                            var channel_list = ['basic', 'cinnamon', 'deepin', 'gnome', 'gnome-mac', 'i3', 'lxde', 'plasma', 'releng', 'xfce', 'xfce-pro']
+                            channel_list.forEach(function (_channel){
+                                var _option_channel = document.createElement('option');
+                                _option_channel.value = _channel;
+                                document.getElementById("channel_list").appendChild(_option_channel);
+                            });
+                        </script>
+                    </div>
+                    <!-- チャンネル ここまで-->
+
                     <!-- デバッグ用オプション ここから -->
                     <div class="option_box_child">
                         <p class="option_title"><h3>Shell版のmkalteriso</h3></p>
                         <p>このジェネレータでは引数はデフォルト値ではない場合のみ指定するようになっています。</p>
                         <textarea id="output" disabled></textarea><br>
                         <label for="only_no_default"><input name="only_no_default" type="checkbox" id="only_no_default">デフォルトの値も引数で指定する。</label>
+                        <label for="allow_no_channel"><input name="allow_no_channel" type="checkbox" id="allow_no_channel">チャンネルの省略を許可する。</label>
                         <input type="button" value="生成" onclick="startgen()">
                         <input type="button" value="コピー" onclick="copy_to_clipboard()">
                         <input type="button" value="ツイートする" onclick="tweetArguments()">
index e0da8d7..9aca03f 100644 (file)
@@ -1,6 +1,7 @@
 
-var ARGUMENTS = ""
-var ONLY_NO_DEFAULT = true
+var ARGUMENTS = "" ;
+var ONLY_NO_DEFAULT = true ;
+var ALLOW_NO_CHANNEL = false ;
 document.getElementById("log_nosave").checked = false;
 window.onload = Initialize()
 
@@ -38,6 +39,11 @@ function writeLog(_msg) {
     }
 }
 
+function writeErr(_msg) {
+    writeLog(_msg);
+    document.getElementById('output').value = "エラーが発生しました。ログを参照して下さい。";
+}
+
 function getPlymouth(){
     var _IsPlymouth = document.getElementById("plymouth_enable");
     if (_IsPlymouth.checked) {
@@ -135,16 +141,29 @@ function getShmkalteriso () {
     }
 }
 
+function getChannel() {
+    var _Channel = document.getElementById("channel").value;
+    console.log(document.getElementById("channel").value);
+    ARGUMENTS = ARGUMENTS + ' ' + _Channel;
+}
+
 function startgen() {
     // 初期化
     ARGUMENTS = ""
 
     if (document.getElementById("only_no_default").checked) {
-        ONLY_NO_DEFAULT = false
+        ONLY_NO_DEFAULT = false;
     } else {
-        ONLY_NO_DEFAULT = true
+        ONLY_NO_DEFAULT = true;
     }
 
+    if (document.getElementById("allow_no_channel").checked) {
+        ALLOW_NO_CHANNEL = true;
+    } else {
+        ALLOW_NO_CHANNEL = false;
+    }
+
+
     getPlymouth();
     getClean();
     getTarball();
@@ -157,11 +176,16 @@ function startgen() {
     getGitversion();
     getDebug();
     getBashDebug();
+
+    // チャンネル取得
+    getChannel();
     
     // 出力
     document.getElementById('output').innerHTML = "";
     if (ARGUMENTS == "") {
         writeLog ("引数は必要ありません");
+    } else if ( ! document.getElementById("channel").value && ALLOW_NO_CHANNEL == false ) {
+        writeErr ("チャンネルを指定して下さい。");
     } else {
         document.getElementById('output').value = ARGUMENTS;
         writeLog( "「" + ARGUMENTS + "」を生成しました");
@@ -188,7 +212,7 @@ function copy_to_clipboard() {
 
         writeLog("「" + output_value + "」" + "をクリップボードにコピーしました!");
     } else {
-        writeLog("コピーするものがありません");
+        writeErr ("コピーするものがありません");
     }
 }
 
@@ -228,7 +252,7 @@ function tweetArguments() {
     var output_value = document.getElementById("output").value;
 
     if ( output_value == "") {
-        writeLog ("引数が生成されていないのでツイートできません。");
+        writeErr ("引数が生成されていないのでツイートできません。");
     } else {
         var url = "http://localhost/alteriso-options-generator/index.php"
         var account = "Fascode_SPT"