• Y
  • List All
  • Feedback
    • This Project
    • All Projects
Profile Account Log out
  • Favorite
  • Project
  • Recent History
Loading...
  • Log in
  • Sign up
kadrians / Testing_for_YONA star
  • Project homeH
  • CodeC
  • IssueI 1
  • Pull requestP
  • Review R
  • MilestoneM
  • BoardB 2
  • Files
  • Commit
  • Branches
Testing_for_YONAsourcepublicjavascriptscommonyona.Tasklist.js
Download as .zip file
File name
Commit message
Commit date
bin
Yona 1.16.0 Upload
02-04
lib
Yona 1.16.0 Upload
02-04
share/doc/api
Yona 1.16.0 Upload
02-04
source
Source Code Upload
02-04
README.md
Yona 1.16.0 Upload
02-04
File name
Commit message
Commit date
app
Source Code Upload
02-04
conf
Source Code Upload
02-04
docs
Source Code Upload
02-04
lib
Source Code Upload
02-04
project
Source Code Upload
02-04
public
Source Code Upload
02-04
support-script
Source Code Upload
02-04
test
Source Code Upload
02-04
.gitignore
Source Code Upload
02-04
.mailmap
Source Code Upload
02-04
.travis.yml
Source Code Upload
02-04
AUTHORS
Source Code Upload
02-04
LICENSE
Source Code Upload
02-04
NOTICE
Source Code Upload
02-04
README.md
Source Code Upload
02-04
build.sbt
Source Code Upload
02-04
dev.sh
Source Code Upload
02-04
dist.sh
Source Code Upload
02-04
is-alive-bot.sh
Source Code Upload
02-04
minify-js.sh
Source Code Upload
02-04
restart.sh
Source Code Upload
02-04
File name
Commit message
Commit date
bootstrap
Source Code Upload
02-04
help
Source Code Upload
02-04
images
Source Code Upload
02-04
javascripts
Source Code Upload
02-04
stylesheets
Source Code Upload
02-04
compiler.jar
Source Code Upload
02-04
File name
Commit message
Commit date
common
Source Code Upload
02-04
lib
Source Code Upload
02-04
service
Source Code Upload
02-04
template
Source Code Upload
02-04
yona-common.js
Source Code Upload
02-04
yona-layout.js
Source Code Upload
02-04
yona-lib.js
Source Code Upload
02-04
File name
Commit message
Commit date
yobi.Attachments.js
Source Code Upload
02-04
yobi.CodeCommentBlock.js
Source Code Upload
02-04
yobi.CodeCommentBox.js
Source Code Upload
02-04
yobi.Comment.js
Source Code Upload
02-04
yobi.CommentForm.js
Source Code Upload
02-04
yobi.Common.js
Source Code Upload
02-04
yobi.Files.js
Source Code Upload
02-04
yobi.Interval.js
Source Code Upload
02-04
yobi.LoginDialog.js
Source Code Upload
02-04
yobi.Markdown.js
Source Code Upload
02-04
yobi.Mention.js
Source Code Upload
02-04
yobi.OriginalMessage.js
Source Code Upload
02-04
yobi.Pagination.js
Source Code Upload
02-04
yobi.ShortcutKey.js
Source Code Upload
02-04
yobi.WatcherList.js
Source Code Upload
02-04
yobi.ui.Calendar.js
Source Code Upload
02-04
yobi.ui.Dialog.js
Source Code Upload
02-04
yobi.ui.Dropdown.js
Source Code Upload
02-04
yobi.ui.Mergely.js
Source Code Upload
02-04
yobi.ui.Select2.js
Source Code Upload
02-04
yobi.ui.Tabs.js
Source Code Upload
02-04
yobi.ui.Toast.js
Source Code Upload
02-04
yobi.ui.Typeahead.js
Source Code Upload
02-04
yona.CommentAttachmentsUpdate.js
Source Code Upload
02-04
yona.KeyControl.js
Source Code Upload
02-04
yona.ReceiverList.js
Source Code Upload
02-04
yona.Sha1.js
Source Code Upload
02-04
yona.SubComment.js
Source Code Upload
02-04
yona.Subtask.js
Source Code Upload
02-04
yona.Tasklist.js
Source Code Upload
02-04
yona.TitleHeadAutoCompletion.js
Source Code Upload
02-04
yona.Usermenu.js
Source Code Upload
02-04
Nell 02-04 2600fe6 Source Code Upload UNIX
Raw Open in browser Change history
/** * Yona, 21st Century Project Hosting SW * <p> * Copyright Yona & Yobi Authors & NAVER Corp. & NAVER LABS Corp. * https://yona.io **/ $(function () { var $markdownWrap = $(".markdown-wrap"); var inputCheckBox = "input[type='checkbox']"; checkTasklistDoneCount($markdownWrap); disableCheckboxIfNeeds($markdownWrap); $markdownWrap.find(inputCheckBox).each(function () { var $this = $(this); var $parent = $this.closest(); $parent .click(function () { $this.trigger('click'); }) .hover(function(){ $(this).css({ cursor: 'pointer' }); }); }); $markdownWrap.find(inputCheckBox).on("click", function () { var $this = $(this); var $form = $this.closest("div[id]").prev().find("form"); var url = $form.attr("action"); var originalText = $form.find("textarea").val(); checkTask($this); var text = $form.find("textarea").val(); $.ajax({ method: "PATCH", url: url, contentType: "application/json", data: JSON.stringify({ content: text, original: originalText }), beforeSend: function() { NProgress.start(); } }) .done(function (msg) { NProgress.done(); checkTasklistDoneCount($markdownWrap); }) .fail(function(jqXHR, textStatus){ var response = JSON.parse(jqXHR.responseText); var message = '[' + jqXHR.statusText + '] ' + response.message + '\n\nRefresh the page!'; $yobi.showAlert(message); NProgress.done(); }); }); function checkTask(that, checked) { var $this = that; var isChecked; if(checked === undefined) { isChecked = $this.prop("checked"); } else { isChecked = checked; } $this.prop('checked', isChecked); var $parent = $this.closest(".markdown-wrap"); var index = $parent.find(inputCheckBox).index($this); var $form = $this.closest("div[id]").prev().find("form"); var $textarea = $form.find("textarea"); var text = $textarea.val(); var counter = 0; // See: https://regex101.com/r/uIC2RM/2 text = text.replace(/^([ ]*[-+*] \[[ xX]?])([ ]?.+)/gm, function replacer(match, checkbox, text){ var composedText = checkbox + text; if(index === counter) { if(isChecked) { composedText = checkbox.replace(/\[[ ]?]/, "[x]") + text } else { composedText = checkbox.replace(/\[[xX]?]/, "[ ]") + text } } counter++; return composedText; }); $textarea.val(text); $this.next().find(inputCheckBox).each(function () { checkTask($(this), isChecked); }); } function checkTasklistDoneCount($target) { $target.each(function( index ) { var $this = $(this); var total = 0; var checked = 0; $this.find(inputCheckBox).each(function () { total++; if($(this).prop("checked")) { checked++; } }); var $tasklist = $this.prev(); var percentage = checked / total * 100; $tasklist.find(".done-counter").html("(" + checked + "/" + total + ")"); $tasklist.find(".bar").width(percentage + "%"); $tasklist.find(".task-title").width(percentage + "%"); if(total > 0) { $tasklist.addClass("task-show"); } if(percentage === 100) { $tasklist.find(".bar").removeClass("red").addClass("green"); } else { $tasklist.find(".bar").removeClass("green").addClass("red"); } }); } function disableCheckboxIfNeeds($target){ $target.each(function() { var $this = $(this); if($this.data("allowedUpdate") !== true) { $this.find(inputCheckBox).each(function () { $(this).prop("disabled", true); }); } }); } // See: addTaskListButtonListener() at views/common/scripts.scala.html });

          
        
    
    
Copyright Yona authors & © NAVER Corp. & NAVER LABS Supported by NAVER CLOUD PLATFORM

or
login with Google Sign in with Google
Reset password | Sign up