comparison develop/js/taggingtext.js @ 21:c805470cefee

Remove bootstrap.TaggingText UI layout modification
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 24 Feb 2015 16:09:59 +0100
parents 04db1dd9d10d
children b55f5d3564c4
comparison
equal deleted inserted replaced
20:04db1dd9d10d 21:c805470cefee
617 //alert( "Tagged "+str.match(new RegExp(replaceSmartRegexString, "g")).length+" entities!" ); 617 //alert( "Tagged "+str.match(new RegExp(replaceSmartRegexString, "g")).length+" entities!" );
618 //el.innerHTML = str.replace(new RegExp(replaceSmartRegexString, "g"), replaceSmartReplaceString); 618 //el.innerHTML = str.replace(new RegExp(replaceSmartRegexString, "g"), replaceSmartReplaceString);
619 } 619 }
620 620
621 function smartRegexSave(topic_id) { 621 function smartRegexSave(topic_id) {
622
623 console.log(topic_id); 622 console.log(topic_id);
624
625
626 var name=prompt("Please enter this Regex name",RegexLoadedName); 623 var name=prompt("Please enter this Regex name",RegexLoadedName);
627 if (name!=null){ 624 if (name!=null){
628 $.ajax({ 625 $.ajax({
629 type : 'POST', 626 type : 'POST',
630 url : './TaggingText', 627 url : './TaggingText',
736 $('#smartRegexShowDiv').html(name ); 733 $('#smartRegexShowDiv').html(name );
737 $('#load_regex_div').css("display", "none"); 734 $('#load_regex_div').css("display", "none");
738 } 735 }
739 // === 736 // ===
740 737
741 // === for exporttable.php ===
742 function exportTable( range, container ) {
743 //MsgBox("enter function");
744 var form = document.createElement("form");
745 form.setAttribute("method", "post");
746 form.setAttribute("action", "./ExportTable");
747 form.setAttribute("target", "_blank");
748
749 var hiddenField = document.createElement("input");
750 hiddenField.setAttribute("name", "content");
751 hiddenField.setAttribute("value", container.innerHTML);
752 form.appendChild(hiddenField);
753
754 var hiddenField = document.createElement("input");
755 hiddenField.setAttribute("name", "sectionid");
756 hiddenField.setAttribute("value", "<?php echo $section_id; ?>");
757 form.appendChild(hiddenField);
758
759 var hiddenField2 = document.createElement("input");
760 hiddenField2.setAttribute("name", "topic");
761 hiddenField2.setAttribute("value", topic_id);
762 form.appendChild(hiddenField2);
763
764 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
765 document.body.appendChild(form);
766 form.submit();
767 } else {
768 form.submit(); // works under IE and Chrome, but not FF
769 }
770 }
771
772 function exportPage() {
773 var startPage = $('#exportPageStart').val();
774 var endPage = $('#exportPageEnd').val();
775
776 var el = document.getElementById("editable-area");
777 var str="" + el.innerHTML;
778
779 var regexText="【<a([^<>]*?)>"+startPage+"</a>】(.*?)【<a([^<>]*?)>"+endPage+"</a>】";
780
781 var form = document.createElement("form");
782 form.setAttribute("method", "post");
783 form.setAttribute("action", "./ExportTable");
784 form.setAttribute("target", "_blank");
785
786 var hiddenField = document.createElement("input");
787 hiddenField.setAttribute("name", "content");
788 hiddenField.setAttribute("value", str.match(new RegExp(regexText, "g")));
789 form.appendChild(hiddenField);
790
791 var hiddenField = document.createElement("input");
792 hiddenField.setAttribute("name", "sectionid");
793 hiddenField.setAttribute("value", "<?php echo $section_id; ?>");
794 form.appendChild(hiddenField);
795
796 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
797 document.body.appendChild(form);
798 form.submit();
799 } else {
800 form.submit(); // works under IE and Chrome, but not FF
801 }
802 }
803
804 function exportAll(topic_id) {
805 var el = document.getElementById("editable-area");
806 var str= "" + el.innerHTML;
807 var form = document.createElement("form");
808 form.setAttribute("method", "post");
809 //form.setAttribute("action", "exportTable.php");
810 form.setAttribute("action", "./ExportTable");//+section_id); // hand to controller
811 form.setAttribute("target", "_blank");
812
813 var hiddenField = document.createElement("input");
814 hiddenField.setAttribute("name", "content");
815 hiddenField.setAttribute("value", str);
816 form.appendChild(hiddenField);
817
818 var hiddenField = document.createElement("input");
819 hiddenField.setAttribute("name", "topic");
820 hiddenField.setAttribute("value", topic_id);
821 form.appendChild(hiddenField);
822
823 console.log(topic_id);
824
825 /*
826 var hiddenField = document.createElement("input");
827 hiddenField.setAttribute("name", "sectionid");
828 hiddenField.setAttribute("value", section_id);
829 form.appendChild(hiddenField);
830 */
831
832 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
833 document.body.appendChild(form);
834 form.submit();
835 } else {
836 form.submit(); // works under IE and Chrome, but not FF
837 }
838
839
840 }
841 // ===========
842 738
843 // === for editwordlist.php === 739 // === for editwordlist.php ===
844 function addNewList() { 740 function addNewList() {
845 var el = document.getElementById("listNameText"); 741 var el = document.getElementById("listNameText");
846 $.ajax({ 742 $.ajax({