본문으로 이동
  • 이 서버는 리버티게임의 개발용 베타 서버로, 게임 플레이 용도로 제작된 사이트가 아닙니다.
  • 리버티게임의 자동 인증된 사용자라면 개발에 필요한 관리자 권한을 신청할 수 있습니다.
  • 틀 및 기능별 소도구를 필요한 문서에만 선택적으로 로딩하는 테스트를 진행하고 있습니다. 작동하지 않는 문서가 있다면 담당자에게 알려주세요.

미디어위키:Gadget-MetadataEditor.js

리버티게임(개발), 모두가 만들어가는 자유로운 게임
Senouis (토론 | 기여)님의 2024년 12월 22일 (일) 15:56 판

참고: 설정을 저장한 후에 바뀐 점을 확인하기 위해서는 브라우저의 캐시를 새로 고쳐야 합니다.

  • 파이어폭스 / 사파리: Shift 키를 누르면서 새로 고침을 클릭하거나, Ctrl-F5 또는 Ctrl-R을 입력 (Mac에서는 ⌘-R)
  • 구글 크롬: Ctrl-Shift-R키를 입력 (Mac에서는 ⌘-Shift-R)
  • 엣지: Ctrl 키를 누르면서 새로 고침을 클릭하거나, Ctrl-F5를 입력.
function LoadJSONEditor() {
  if (document.getElementsByClassName("jsoneditor-container").length === 0) return;
  var targetJSON = "https://dev.libertygame.work/index.php/RPG_in_City/game.json?action=raw";
  	mw.loader.getScript("https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/jsoneditor.min.js").then(function() {
		  fetch(targetJSON).then(function(result){return result.json(); }).then(function (response) {
		  	  console.log(result);
			  const jsonEditorContainer = document.querySelector('.json-editor-container');
			  const value = document.querySelector('#value');
			
			  var schema = result;
			  const editor = new JSONEditor(jsonEditorContainer, {
			    theme: 'bootstrap4',
			    show_errors: 'always',
			    iconlib: 'fontawesome5',
			    keep_oneof_values: true
			  }, response);
			
			  editor.on('change', function () {
			    value.value = JSON.stringify(editor.getValue(), null, 2);
			  });
		  }).catch(function (e) { console.log('JSON 에디터 로딩 후 JSON 타겟 가져오기 실패');});
  });
}

$(LoadJSONEditor);