- ...
This commit is contained in:
		
							parent
							
								
									b78339c19f
								
							
						
					
					
						commit
						f94fade56c
					
				@ -430,8 +430,12 @@ class Game extends AutoStoring
 | 
			
		||||
 | 
			
		||||
            // obfuscate image filename
 | 
			
		||||
            if ($a["image_data"] !== "") {
 | 
			
		||||
                $a["image_data"] = $this->obfuscateAttachedImage($a["image_data"]);
 | 
			
		||||
                $a["image_type"] = "url";
 | 
			
		||||
                if (in_array("codeimage", $flags)) {
 | 
			
		||||
                    $a["image_type"] = "code";
 | 
			
		||||
                } else {
 | 
			
		||||
                    $a["image_data"] = $this->obfuscateAttachedImage($a["image_data"]);
 | 
			
		||||
                    $a["image_type"] = "url";
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // generate the task
 | 
			
		||||
 | 
			
		||||
@ -10,6 +10,7 @@ class PicturedTask extends Task
 | 
			
		||||
    function __construct(string $type, array &$a = null)
 | 
			
		||||
    {
 | 
			
		||||
        parent::__construct($type, $a);
 | 
			
		||||
 | 
			
		||||
        $this->image_data = $a["image_data"] ?? ($a["image_url"] ?? "");
 | 
			
		||||
        $this->image_type = $a["image_type"] ?? "none";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										18
									
								
								js/tasks.js
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								js/tasks.js
									
									
									
									
									
								
							@ -283,11 +283,27 @@ class PicturedTask extends Task {
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
            case "html":
 | 
			
		||||
            case "code":
 | 
			
		||||
            {
 | 
			
		||||
                this.img = document.createElement("section");
 | 
			
		||||
                this.img.classList.add("question-image");
 | 
			
		||||
                this.img.innerHTML = data;
 | 
			
		||||
 | 
			
		||||
                if (this.img_type === "html") {
 | 
			
		||||
                    this.img.innerHTML = data;
 | 
			
		||||
                } else if (this.img_type === "code") {
 | 
			
		||||
                    let pre = document.createElement("pre");
 | 
			
		||||
                    let code = document.createElement("code");
 | 
			
		||||
                    pre.append(code);
 | 
			
		||||
                    code.innerHTML = data;
 | 
			
		||||
                    hljs.highlightElement(pre);
 | 
			
		||||
 | 
			
		||||
                    this.img.innerHTML = `<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/base16/google-light.min.css"/>`;
 | 
			
		||||
                    this.img.style.textAlign = "left";
 | 
			
		||||
                    this.img.append(pre);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -37,6 +37,9 @@ if ($testid === "") {
 | 
			
		||||
    <script type="text/javascript" src="https://nturley.github.io/netlistsvg/elk.bundled.js"></script>
 | 
			
		||||
    <script type="text/javascript" src="https://nturley.github.io/netlistsvg/built/netlistsvg.bundle.js"></script>
 | 
			
		||||
    <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.43.3/ace.min.js" integrity="sha512-BHJlu9vUXVrcxhRwbBdNv3uTsbscp8pp3LJ5z/sw9nBJUegkNlkcZnvODRgynJWhXMCsVUGZlFuzTrr5I2X3sQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
 | 
			
		||||
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/base16/google-light.min.css"/>
 | 
			
		||||
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/highlight.min.js"></script>
 | 
			
		||||
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/languages/verilog.min.js"></script>
 | 
			
		||||
</head>
 | 
			
		||||
<body>
 | 
			
		||||
<section id="test_display">
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user