|
|
@@ -14,14 +14,14 @@ include "../pcdl/html_head.php";
|
|
|
}
|
|
|
#main_tag span{
|
|
|
margin: 2px;
|
|
|
- padding: 2px 12px;
|
|
|
- font-weight: 500;
|
|
|
- transition-duration: 0.2s;
|
|
|
- cursor: pointer;
|
|
|
- display: inline-flex;
|
|
|
- align-items: center;
|
|
|
- flex-wrap: nowrap;
|
|
|
- justify-content: center;
|
|
|
+ padding: 2px 12px;
|
|
|
+ font-weight: 500;
|
|
|
+ transition-duration: 0.2s;
|
|
|
+ cursor: pointer;
|
|
|
+ display: inline-flex;
|
|
|
+ align-items: center;
|
|
|
+ flex-wrap: nowrap;
|
|
|
+ justify-content: center;
|
|
|
font-size:110%;
|
|
|
border: unset;
|
|
|
border-radius: 0;
|
|
|
@@ -47,7 +47,11 @@ include "../pcdl/html_head.php";
|
|
|
tag .icon:hover{
|
|
|
background-color: silver;
|
|
|
}
|
|
|
+ var tag_level = <?php echo file_get_contents("../public/book_tag/tag_list.json"); ?>;
|
|
|
</style>
|
|
|
+<script>
|
|
|
+ var tag_level = <?php echo file_get_contents("../public/book_tag/tag_list.json"); ?>;
|
|
|
+</script>
|
|
|
<?php
|
|
|
//
|
|
|
|
|
|
@@ -56,8 +60,6 @@ require_once "../public/_pdo.php";
|
|
|
require_once '../media/function.php';
|
|
|
require_once '../public/function.php';
|
|
|
|
|
|
-
|
|
|
-
|
|
|
echo "<div id='course_head_bar' style='background-color:var(--tool-bg-color1);padding:1em 10px 10px 10px;'>";
|
|
|
echo "<div class='index_inner '>";
|
|
|
echo "<div style='font-size:140%'>";
|
|
|
@@ -71,8 +73,15 @@ echo '<span tag="aṭṭhakathā">Aṭṭhakathā</span>';
|
|
|
echo '<span tag="ṭīkā">ṭīkā</span>';
|
|
|
echo '<span tag="añña">añña</span>';
|
|
|
echo '</div>';
|
|
|
-echo '<div id="tag_selected" class="summary" style="padding-bottom:5px;margin:0.5em 0;"></div>';
|
|
|
-echo '<div id="tag_others" class="summary" style="padding-bottom:5px;"></div>';
|
|
|
+echo '<div id="tag_selected" class="" style="padding-bottom:5px;margin:0.5em 0;"></div>';
|
|
|
+echo '<div level="0" class="tag_others" style="padding-bottom:5px;"></div>';
|
|
|
+echo '<div level="1" class="tag_others" style="padding-bottom:5px;"></div>';
|
|
|
+echo '<div level="2" class="tag_others" style="padding-bottom:5px;"></div>';
|
|
|
+echo '<div level="3" class="tag_others" style="padding-bottom:5px;"></div>';
|
|
|
+echo '<div level="4" class="tag_others" style="padding-bottom:5px;"></div>';
|
|
|
+echo '<div level="5" class="tag_others" style="padding-bottom:5px;"></div>';
|
|
|
+echo '<div level="100" class="tag_others" style="padding-bottom:5px;"></div>';
|
|
|
+echo '<div level="8" class="tag_others" style="padding-bottom:5px;"></div>';
|
|
|
echo "</div>";
|
|
|
echo '</div>';
|
|
|
?>
|
|
|
@@ -83,7 +92,7 @@ echo '</div>';
|
|
|
<script>
|
|
|
var main_tag="";
|
|
|
var list_tag=new Array();
|
|
|
-
|
|
|
+ var currTagLevel0= new Array();
|
|
|
|
|
|
$("span[tag]").click(function(){
|
|
|
$(this).siblings().removeClass("select");
|
|
|
@@ -92,18 +101,6 @@ echo '</div>';
|
|
|
list_tag=new Array();
|
|
|
tag_changed();
|
|
|
render_tag_list();
|
|
|
- /*
|
|
|
- const tagSelected = document.getElementsByClassName("select");
|
|
|
- if(tagSelected){
|
|
|
- let tagList = new Array();
|
|
|
- for (const iterator of tagSelected) {
|
|
|
- tagList.push(iterator.getAttributeNode("tag").value);
|
|
|
- }
|
|
|
- main_tag = tagList[0];
|
|
|
-
|
|
|
- tag_changed();
|
|
|
- }
|
|
|
- */
|
|
|
});
|
|
|
var allTags = new Array();
|
|
|
function tag_changed(){
|
|
|
@@ -124,13 +121,7 @@ echo '</div>';
|
|
|
let html="";
|
|
|
allTags = new Array();
|
|
|
for (const iterator of arrBookList) {
|
|
|
- html += "<div style='width:25%;padding:0.5em;'>";
|
|
|
- html += "<div class='card' style='padding:10px;'>";
|
|
|
- html += "<div style='font-weight:700'><a href='../pcdl/reader.php?view=chapter&book="+iterator[0].book+"¶="+iterator[0].para+"' target = '_blank'>"+iterator[0].title+"</a></div>";
|
|
|
- html += "<div style=''>book:"+iterator[0].book+" para:"+iterator[0].para+"</div>";
|
|
|
- html += "<div style='overflow-wrap: anywhere;'>tag="+ iterator[0].tag+"</div>";
|
|
|
- html += "</div>";
|
|
|
- html += "</div>";
|
|
|
+ let tag0="";
|
|
|
let tags = iterator[0].tag.split("::");
|
|
|
let currTag = new Array();
|
|
|
currTag[main_tag] = 1;
|
|
|
@@ -144,7 +135,9 @@ echo '</div>';
|
|
|
if(tag.slice(-1)==":"){
|
|
|
tag = tag.slice(0,-1);
|
|
|
}
|
|
|
-
|
|
|
+ if(currTagLevel0.hasOwnProperty(tag)){
|
|
|
+ tag0 = tag;
|
|
|
+ }
|
|
|
if(!currTag.hasOwnProperty(tag)){
|
|
|
if(allTags.hasOwnProperty(tag) ){
|
|
|
allTags[tag] += 1;
|
|
|
@@ -154,7 +147,26 @@ echo '</div>';
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ html += "<div style='width:25%;padding:0.5em;'>";
|
|
|
+ html += "<div class='card' style='padding:10px;'>";
|
|
|
+ html += "<div class='' style='position: absolute;background-color: #862002;margin-top: -10px;margin-left: 12em;color: white;padding: 0 3px;display: inline-block;'>"+tag0+"</div>";
|
|
|
+ html += "<div style='font-weight:700'><a href='../pcdl/reader.php?view=chapter&book="+iterator[0].book+"¶="+iterator[0].para+"' target = '_blank'>"+iterator[0].title+"</a></div>";
|
|
|
+ html += "<div style=''>book:"+iterator[0].book+" para:"+iterator[0].para+"</div>";
|
|
|
+ html += "<div style='overflow-wrap: anywhere;'>tag="+ iterator[0].tag+"</div>";
|
|
|
+ html += "</div>";
|
|
|
+ html += "</div>";
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ let newTags = new Array();
|
|
|
+ for (const oneTag in allTags) {
|
|
|
+ if(allTags[oneTag]<arrBookList.length){
|
|
|
+ newTags[oneTag] = allTags[oneTag];
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
+ allTags = newTags;
|
|
|
allTags.sort(sortNumber);
|
|
|
tag_render_others();
|
|
|
$("#book_list").html(html);
|
|
|
@@ -165,24 +177,35 @@ echo '</div>';
|
|
|
$("#tag_input").keypress(function(){
|
|
|
tag_render_others();
|
|
|
});
|
|
|
+
|
|
|
function tag_render_others(){
|
|
|
let strOthersTag = "";
|
|
|
+ currTagLevel0= new Array();
|
|
|
+ $(".tag_others").html("");
|
|
|
for (const key in allTags) {
|
|
|
if (allTags.hasOwnProperty(key)) {
|
|
|
if($("#tag_input").val().length>0){
|
|
|
if(key.indexOf($("#tag_input").val())>=0){
|
|
|
- strOthersTag += "<button onclick =\"tag_click('"+key+"')\" >"+key+"</button>";
|
|
|
+ strOthersTag = "<button onclick =\"tag_click('"+key+"')\" >"+key+"</button>";
|
|
|
}
|
|
|
}
|
|
|
else{
|
|
|
- strOthersTag += "<button onclick =\"tag_click('"+key+"')\" >"+key+"</button>";
|
|
|
+ strOthersTag = "<button onclick =\"tag_click('"+key+"')\" >"+key+"</button>";
|
|
|
+ }
|
|
|
+ let thisLevel = 100;
|
|
|
+ if(tag_level.hasOwnProperty(key)){
|
|
|
+ thisLevel = tag_level[key].level;
|
|
|
+ if(tag_level[key].level==0){
|
|
|
+ currTagLevel0[key] = 1;
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
+ $(".tag_others[level='"+thisLevel+"']").html($(".tag_others[level='"+thisLevel+"']").html()+strOthersTag);
|
|
|
}
|
|
|
}
|
|
|
- $("#tag_others").html(strOthersTag);
|
|
|
+
|
|
|
|
|
|
}
|
|
|
+
|
|
|
function tag_click(tag){
|
|
|
list_tag.push(tag);
|
|
|
render_tag_list();
|