Site Notice

hello, world

Difference between revisions of "Generate Image Download Links"

From Project-EPB Commons
m ([InPageEdit] 没有编辑摘要)
m ([InPageEdit] 没有编辑摘要)
 
(3 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
<input id="html" value="https://no-game-no-life.fandom.com/wiki/Special:Filepath/"></input>
 
<input id="html" value="https://no-game-no-life.fandom.com/wiki/Special:Filepath/"></input>
 
</label>
 
</label>
<label for="jsonList"><h4>JSON file</h4></label>
+
<label for="list"><h4>JSON file</h4></label>
<textarea id="jsonList"></textarea>
+
<textarea id="list"></textarea>
 
<button onclick="generate()">Generate</button>
 
<button onclick="generate()">Generate</button>
 
<h4>File list</h4>
 
<h4>File list</h4>
<ol style="height: 500px; overflow:auto" id="fileList"></ol>
+
<div style="height: 500px; overflow:auto" ><ol id="fileList"></ol></div>
 
<script>
 
<script>
 
function generate() {
 
function generate() {
   var html = $('#html').val(),
+
   var files = $('#list').val().split('\n'),
      files = eval('(' + $('#jsonList').val() + ')'),
 
 
       output = '';
 
       output = '';
   for (var i = 0; i < files.query.allpages.length; i++) {
+
   for (var i = 0; i < files.length; i++) {
     // output = output + '<li>' + html + files.query.allpages[i].title.replace(/\ /g, '_') + '</li>';
+
     output = output + '<li>' + files[i].split('/revision/')[0] + '</li>';
     output = output + '\n*' + '{{filepath:' + files.query.allpages[i].title + '}}';
+
     // output = output + '\n*' + '{{filepath:' + files.query.allpages[i].title + '}}';
 
   }
 
   }
   $.ajax({
+
   $('#fileList').html(output);
    url: 'https://no-game-no-life.fandom.com/api.php',
 
    data: {
 
      action: 'parse',
 
      text: output,
 
      preview: true,
 
      prop: 'text',
 
      format: 'json'
 
    },
 
    dataType: 'jsonp',
 
    success: function(data) {
 
      console.info(data.parse.text['*']);
 
    }
 
  })
 
  // $('#fileList').html(output);
 
 
}
 
}
 
</script>
 
</script>
 
<style>h4{margin: 4px 0 2px 0 !important}</style>
 
<style>h4{margin: 4px 0 2px 0 !important}</style>
 
</html>
 
</html>

Latest revision as of 18:23, 8 April 2020

<html> <label> <h4>URL</h4> <input id="html" value="https://no-game-no-life.fandom.com/wiki/Special:Filepath/"></input> </label> <label for="list"><h4>JSON file</h4></label> <textarea id="list"></textarea> <button onclick="generate()">Generate</button> <h4>File list</h4> <div style="height: 500px; overflow:auto" ><ol id="fileList"></ol></div> <script> function generate() {

 var files = $('#list').val().split('\n'),
     output = '';
 for (var i = 0; i < files.length; i++) {
   output = output + '<li>' + files[i].split('/revision/')[0] + '</li>';
   // output = output + '\n*' + '{{filepath:' + files.query.allpages[i].title + '}}';
 }
 $('#fileList').html(output);

} </script> <style>h4{margin: 4px 0 2px 0 !important}</style> </html>