1angular.module(app_name).factory("editorService",["$rootScope","$http","$uibModal","$location",function($rootScope,$http,$uibModal,$location){var Service={"data":{"instance":null,"compile_mode":"equation","autocompilation":true,"centermathjax":true,"noteLoadedObservers":[]}};var observerCallbacks=[];Service.registerCallback=function(callbacklist,callback){var self=this;callbacklist.push(callback)};Service.notifyObservers=function(callbacklist){var self=this;angular.forEach(callbacklist,function(callback){callback()})}; 2Service.init=function(editor){var self=this;OutConsole.log("info",["Editor-Service: init"]);var editor={};editor=ace.edit("editor_box");editor.setTheme("ace/theme/cobalt");editor.setShowPrintMargin(false);editor.setFontSize("14px");editor.setShowInvisibles(true);editor.setDisplayIndentGuides(true);editor.setPrintMarginColumn(false);editor.$blockScrolling=Infinity;Service.data.instance=editor;var jsonUrl="js/l4t/proce.json";var langTools=ace.require("ace/ext/language_tools");var rhymeCompleter={getCompletions:function(editor, 3session,pos,prefix,callback){if(prefix.length===0){callback(null,[]);return}$.getJSON(jsonUrl,function(wordList){callback(null,wordList.map(function(ea){return{name:ea.name,value:"\\"+ea.name,meta:ea.meta}}))})}};langTools.addCompleter(rhymeCompleter);editor.autocompletion_finished=function(){if(Service.data.autocompilation)Service.Compile()};Service.setAutoCompletion(true);var noteid=$location.search().note;if(noteid){OutConsole.log("info",["Load Note:"+noteid]);Service.getNote(noteid,"")}else{Service.set_compile_mode("equation"); 4Service.writeContent(JSON.stringify("\\int_{a}^{b} f(x)dx = F(b) - F(a)"));Service.Compile()}};Service.loadExampleCode=function(){switch(Service.data.compile_mode){case "equation":Service.writeContent(JSON.stringify("\\int_{a}^{b} f(x)dx = F(b) - F(a)"));break;case "minimal":Service.writeContent(JSON.stringify("Write text and equation in one note: $$\\int_{a}^{b} f(x)dx = F(b) - F(a)$$ \n$a^2+b^2=c^2$"));break;case "full":Service.writeContent(JSON.stringify("\\documentclass{article}\n\\pagenumbering{gobble}\n\\usepackage{amsmath}\n\\usepackage{amsfonts}\n\\usepackage{amssymb}\n\\begin{document}\nMy important equation\n\\begin{eqnarray}\n\\int_{a}^{b} f(x)dx = F(b) - F(a)\n\\end{eqnarray}\n\\end{document}")); 5break}Service.Compile()};Service.createMathML=function(){var self=this;var jax=MathJax.Hub.getAllJax("myeqn");var MathMLoutput;for(var i=0;i<jax.length;i++)self.toMathML(jax[i],function(mml){MathMLoutput=mml});return MathMLoutput};Service.toMathML=function(jax,callback){var self=this;var mml;try{mml=jax.root.toMathML("")}catch(err){if(!err.restart)throw err;return MathJax.Callback.After([toMathML,jax,callback],err.restart)}MathJax.Callback(callback)(mml)};Service.setAutoCompletion=function(status){if(status== 6true)Service.data.instance.setOptions({enableBasicAutocompletion:true,enableLiveAutocompletion:true});else Service.data.instance.setOptions({enableBasicAutocompletion:false,enableLiveAutocompletion:false})};Service.setAutocompilation=function(value){Service.data.autocompilation=value};Service.ReplaceContentInContainer=function(tag1,tag2){var self=this;OutConsole.log("info",["Editor-Service: ReplaceContentInContainer"]);tag1=" "+tag1;tag2=tag2+" ";selectionRange=Service.data.instance.getSelectionRange(); 7startLine=selectionRange.start.row;endLine=selectionRange.end.row;content=Service.data.instance.session.getTextRange(selectionRange);x=Service.data.instance.selection.getRange();Service.data.instance.session.insert({row:x.end.row,column:x.end.column},tag2);Service.data.instance.session.insert({row:x.start.row,column:x.start.column},tag1);console.log(Service.data.autocompilation);if(Service.data.autocompilation)Service.Compile()};Service.ReplaceContentInContainer2=function(tag1){var self=this;OutConsole.log("info", 8["Editor-Service: ReplaceContentInContainer2"]);x=Service.data.instance.selection.getRange();if(x.end.row==x.start.row&&x.end.column==x.start.column)Service.ReplaceContentInContainer(tag1+"abc}","");else Service.ReplaceContentInContainer(tag1,"}")};Service.Compile=function(){var self=this;console.log("Compile");
8if(Service.data.compile_mode!="full"){tr=Service.data.instance.getValue();t=Service.getEqLimiter(Service.data.compile_mode)+tr+Service.getEqLimiter(Service.data.compile_mode);document.getElementById("myeqn").innerText= 9t;Service.CompileMathJax()}$rootScope.$broadcast("compileLatexPNG:started",{"data":123});Service.CompileLaTeX("png",170,true,function(response){$rootScope.$broadcast("compileLatexPNG:finished",{response:response})})};Service.CompileMathJax=function(){MathJax.Hub.Queue(["Typeset",MathJax.Hub])};Service.CompileLaTeX=function(format,resolution,crop,callback){$http.post("/compileLatex",{"content":Service.data.instance.getValue(),"format":format,"compile_mode":Service.data.compile_mode,"resolution":resolution, 10"crop":crop}).then(function(response){console.log(response);callback(response)})};Service.deleteNote=function(id,callback){$http.post("/deleteNote",{"id":id}).then(function(response){callback(response)})};Service.createNote=function(title,description,tags,callback){var editor_content=Service.data.compile_mode;$http.post("/createNote",{"content":JSON.stringify(Service.data.instance.getSession().doc.$lines),"latexcontent":Service.data.instance.getValue(),"compile_mode":crossHelpers.CompileModeString2Num(Service.data.compile_mode), 11"title":title,"description":description,"tags":tags,"heritance":$location.search().note}).then(function(response){callback(response)})};Service.updateNote=function(title,description,tags,noteid,callback){var editor_content=Service.data.compile_mode;$http.post("/updateNote",{"content":JSON.stringify(Service.data.instance.getSession().doc.$lines),"latexcontent":Service.data.instance.getValue(),"compile_mode":crossHelpers.CompileModeString2Num(Service.data.compile_mode),"title":title,"description":description, 12"tags":tags,"noteid":noteid}).then(function(response){callback(response)})};Service.checkNoteOwnership=function(noteid,callback){$http.post("/checkNoteOwnership",{"noteid":noteid}).then(function(response){callback(response)})};Service.getEqLimiter=function(compile_mode){var eqlimiter;switch(compile_mode){case "equation":eqlimiter="$$";break;case "minimal":eqlimiter="";break;case "full":eqlimiter="";break}return eqlimiter};Service.set_compile_mode=function(value){Service.data.compile_mode=value;switch(value){case "equation":$rootScope.$broadcast("changedMode:equation", 13{});break;case "minimal":$rootScope.$broadcast("changedMode:minimal",{});break;case "full":$rootScope.$broadcast("changedMode:full",{});break}};Service.setDesign=function(design){Service.data.instance.setTheme("ace/theme/"+design)};Service.setMathjaxcenter=function(value){console.log(value);$("#myeqn").toggleClass("leftAlignMathJax",!value)};Service.setFontSize=function(value){Service.data.instance.setOption("fontSize",value)};Service.checkIfNotePW=function(noteid){$http.post("/checkIfNotePW",{"noteid":noteid}).then(function(response){console.log(response); 14if(response.content)$uibModal.open({animation:true,size:"lg",templateUrl:"/modals/unlocknote.modal.html",controller:function($scope,$uibModalInstance){$scope.ok=function(){$uibModalInstance.close({})};$scope.cancel=function(){$uibModalInstance.close({})}}}).result.then(function(response){},function(){})})};Service.writeContent=function(content){console.log(content);console.log($.parseJSON(content));var temp_sess=ace.createEditSession($.parseJSON(content),"ace/mode/latex");console.log(temp_sess);temp_sess.setUseWrapMode(true); 15Service.data.instance.setSession(temp_sess)};Service.getUserNotes=function(uid,callback){$http.post("/getUserNotes",{"uid":uid}).then(function(response){callback(response)})};Service.getOwnUserNotes=function(callback){$http.post("/getOwnUserNotes",{}).then(function(response){callback(response)})};Service.getNote=function(noteid,pw){$http.post("/getNote",{"noteid":noteid,"pw":pw}).then(function(response){if(!response.data.error){Service.writeContent(response.data.content.EQ);Service.set_compile_mode(crossHelpers.CompileModeNum2String(response.data.content.MODE)); 16Service.Compile();Service.notifyObservers(Service.data.noteLoadedObservers)}else if(response.data.statuscode==statuscode.note_not_found){Service.set_compile_mode("equation");Service.loadExampleCode();$location.search("note",null);$uibModal.open({animation:true,size:"lg",templateUrl:"/modals/note_notfound.modal.html",controller:function($scope,$uibModalInstance){$scope.ok=function(){$uibModalInstance.close({})};$scope.cancel=function(){$uibModalInstance.close({})}}}).result.then(function(response){}, 17function(){})}})};return Service}]);angular.module(app_name).factory("layoutService",["$rootScope","$http","editorService","userService",function($rootScope,$http,editorService,userService){var Service={"data":{"layout":null}};Service.init=function(elm){var self=this;Service.data.layout=elm.layout({resizeWhileDragging:true,animatePaneSizing:true,autoResize:true,fxSpeed:"slow",center__paneSelector:".outer-center",center__minWidth:250,center__onresize:function(){editorService.data.instance.resize()},west__paneSelector:".outer-west",west__size:.2, 18east__paneSelector:".outer-east",east__size:.3,east__childOptions:{center__paneSelector:".middle-center",south__paneSelector:".middle-south",
18south__size:.5}});editorService.init();userService.init()};$rootScope.$on("changedMode:equation",function(e,data){console.log("Ha\u00f6\u00f6p");Service.showSegment("south")});$rootScope.$on("changedMode:minimal",function(e,data){Service.showSegment("south")});$rootScope.$on("changedMode:full",function(e,data){Service.hideSegment("south")});Service.showSegment= 19function(segment){Service.data.layout.east.children.layout1.show(segment)};Service.hideSegment=function(segment){console.log("hide="+segment);Service.data.layout.east.children.layout1.hide(segment)};return Service}]);angular.module(app_name).factory("userService",["$rootScope","$http","$uibModal","$location",function($rootScope,$http,$uibModal,$location){var Service={"data":{"user":null,"userObserver":[],"imgupdate":[]}};Service.registerCallback=function(callbacklist,callback){var self=this;callbacklist.push(callback)};Service.notifyObservers=function(callbacklist,data){var self=this;angular.forEach(callbacklist,function(callback){callback(data)})};Service.init=function(elm){var self=this;var activation_uid=$location.search().uid; 20var activation_key=$location.search().akey;var password_key=$location.search().pwkey;if(password_key&&activation_uid)$uibModal.open({animation:true,size:"lg",templateUrl:"/modals/user_resetpw.modal.html",controller:function($scope,$uibModalInstance){$scope.serverreply={"data":{"content":""}};$scope.password="";$scope.confirmed_password="";$scope.resetPWbyId=function(){$http.post("/resetPWbyId",{"uid":activation_uid,"password":$scope.password,"confirmed_password":$scope.confirmed_password,"pwkey":password_key}).then(function(response){$scope.serverreply= 21response;$location.search("pwkey",null);$location.search("uid",null)})};$scope.cancel=function(){$uibModalInstance.close({})}}}).result.then(function(response){},function(){$location.search("pwkey",null);$location.search("uid",null)});if(activation_key&&activation_uid)Service.activateUserById(activation_uid,activation_key,function(response){$uibModal.open({animation:true,size:"lg",templateUrl:"/modals/user_activation.modal.html",controller:function($scope,$uibModalInstance){$scope.activation_serverreply= 22response.data.content;$scope.cancel=function(){$uibModalInstance.close({})}}}).result.then(function(response){},function(){})})};Service.login=function(email,password,grecaptcharesponse,callback){$http.post("/login",{"email":email,"password":password,"g-recaptcha-response":grecaptcharesponse}).then(function(response){Service.data.user=response;callback(response)})};Service.logout=function(callback){$http.get("/logout").then(function(response){callback(response)})};Service.checkSessionStatus=function(callback){$http.get("/checkSessionStatus").then(function(response){callback(response); 23Service.notifyObservers(Service.data.userObserver)})};Service.addUser=function(name,email,password,confirmed_password,grecaptcharesponse,callback){$http.post("/addUser",{"name":name,"email":email,"password":password,"confirmed_password":confirmed_password,"g-recaptcha-response":grecaptcharesponse}).then(function(response){callback(response);console.log(response)})};Service.updateUser=function(name,email,password,confirmed_password,grecaptcharesponse,callback){$http.post("/addUser",{"name":name,"email":email, 24"password":password,"confirmed_password":confirmed_password,"g-recaptcha-response":grecaptcharesponse}).then(function(response){callback(response);console.log(response)})};Service.forgotPW=function(email,grecaptcharesponse,callback){$http.post("/forgotPW",{"email":email,"g-recaptcha-response":grecaptcharesponse}).then(function(response){callback(response)})};Service.activateUser=function(email,activation_key,callback){$http.post("/activateUserByMail",{"email":email,"activation_key":activation_key}).then(function(response){callback(response)})}; 25Service.activateUserById=function(uid,activation_key,callback){$http.post("/activateUserById",{"uid":uid,"activation_key":activation_key}).then(function(response){callback(response)})};Service.resendActivationKeyByMail=function(email,callback){$http.post("/resendActivationKeyByMail",{"email":email}).then(function(response){callback(response)})};Service.getUserMetaInfo=function(id,callback){$http.post("/getUserMetaInfo",{"uid":id}).then(function(response){callback(response)})};Service.updateUserMeta= 26function(user,callback){$http.post("/updateUserMeta",{"user":user}).then(function(response){callback(response)})};Service.updateUserAvatar=function(croppedimg,callback){$http.post("/updateUserAvatar",{"croppedimg":croppedimg}).then(function(response){console.log(response);callback(response)})};return Service}]);angular.module(app_name).factory("modalService",["$rootScope","$http","$uibModal","userService","editorService","$sce","$compile","$timeout","$location",function($rootScope,$http,$uibModal,userService,editorService,$sce,$compile,$timeout,$location){var Service={"data":{"usersignup":null,"login":null,"changeMode":null,"forgotpw":null,"createNote":null,"log":null,"userCard":null}};Service.close_Modal=function(modal_instance){console.log(modal_instance);modal_instance.close({})};Service.open_logModal= 27function(logcontent){$uibModal.open({animation:true,size:"lg",scope:false,templateUrl:"/modals/note_log.modal.html",controller:function($scope,$uibModalInstance){Service.data.log=$uibModalInstance;$scope.logcontent=$sce.trustAsHtml(logcontent);$scope.cancel=function(){$uibModalInstance.close({})}}}).result.then(function(response){},function(){})};Service.open_editAvatarModal=function(callback){$uibModal.open({animation:true,size:"lg",scope:false,templateUrl:"/modals/user_editavatar.modal.html",controller:function($scope, 28$uibModalInstance){Service.data.editavatar=$uibModalInstance;$scope.myImage="";$scope.myCroppedImage="";var handleFileSelect=function(evt){var file=evt.currentTarget.files[0];var reader=new FileReader;reader.onload=function(evt){$scope.$apply(function($scope){$scope.myImage=evt.target.result})};
28reader.readAsDataURL(file)};$scope.registerHandle=function(){angular.element(document.querySelector("#fileInput")).on("change",handleFileSelect)};$scope.updateUserAvatar=function(){console.log("$scope.myCroppedImage"); 29console.log($scope.myCroppedImage);userService.updateUserAvatar($scope.myCroppedImage,function(response){$uibModalInstance.close({});callback(response)})};$scope.cancel=function(){$uibModalInstance.close({})}}}).result.then(function(response){},function(){})};Service.open_changeModeModal=function(){Service.data.changeMode=$uibModal.open({animation:true,size:"lg",scope:false,templateUrl:"/modals/load_example.modal.html",controller:function($scope,$uibModalInstance){Service.data.changeMode=$uibModalInstance; 30$scope.loadExampleCode=function(){editorService.loadExampleCode();$uibModalInstance.close({})};$scope.cancel=function(){$uibModalInstance.close({})}}}).result.then(function(){},function(res){editorService.Compile()})};Service.open_createNoteModal=function(){$uibModal.open({animation:true,size:"lg",scope:false,templateUrl:"/modals/note_save.modal.html",controller:function($scope,$uibModalInstance){Service.data.createNote=$uibModalInstance;$scope.userData=userService.data.user;$scope.showLoaderGif= 31false;
31$scope.allowUpdate=false;$scope.serverreply={"data":{"error":"","content":{"text":""}}};var noteid=$location.search().note;if(noteid!=""&¬eid!=undefined)editorService.checkNoteOwnership(noteid,function(response){console.log(response.data.content);$scope.allowUpdate=response.data.content});$scope.updateNote=function(){$scope.showLoaderGif=true;var note_title=$("#note_title").val();var note_description=$("#note_description").val();var note_tags=$("#note_tags").val();editorService.updateNote(note_title, 32note_description,note_tags,noteid,function(response){$scope.serverreply=response;$scope.showLoaderGif=false})};$scope.createNote=function(){$scope.showLoaderGif=true;var note_title=$("#note_title").val();var note_description=$("#note_description").val();var note_tags=$("#note_tags").val();editorService.createNote(note_title,note_description,note_tags,function(response){$scope.serverreply=response;$scope.showLoaderGif=false})};$scope.cancel=function(){$uibModalInstance.close({})}}}).result.then(function(response){}, 33function(){})};Service.open_loginModal=function(callback){var self=this;$uibModal.open({animation:true,size:"lg",scope:false,templateUrl:"/modals/user_login.modal.html",controller:function($scope,$uibModalInstance){Service.data.login=$uibModalInstance;$scope.login_email="";$scope.login_password="";$scope.recaptchadata={};$scope.recaptchadata.response="";var myCallBack=function(){$scope.recaptchadata.response=grecaptcha.getResponse(widgetId)};$scope.dynamicid=Math.random().toString(36).substring(7); 34$scope.template="<div id={{dynamicid}} class='g-recaptcha'></div>";var widgetId;$timeout(function(){var html=$compile($scope.template)($scope);console.log(document.getElementById("captchaholder_login"));angular.element(document.getElementById("captchaholder_login")).append(html);$timeout(function(){console.log($scope.dynamicid);widgetId=grecaptcha.render($scope.dynamicid,{"sitekey":config.sitekey_recaptchav2,"theme":"light","callback":myCallBack})},300)},300);$scope.login_serverreply={"data":{"content":""}}; 35$scope.resendActivationKeyByMail=function(mail){userService.resendActivationKeyByMail(mail,function(response){$scope.login_serverreply=response})};$scope.showResendActivationMail=function(){return _.get($scope.login_serverreply,"data.statuscode",-1)==statuscode.user_not_activated};$scope.open_user_signup=function(){Service.open_usersignupModal()};$scope.open_forgot_password=function(){Service.open_forgotpwModal()};$scope.login=function(){userService.login($scope.login_email,$scope.login_password, 36$scope.recaptchadata.response,function(response){grecaptcha.reset(widgetId);userService.data.user=response.data.content;if(!response.data.error)$uibModalInstance.close(response.data.content);else $scope.login_serverreply=response})};$scope.cancel=function(){$uibModalInstance.close({})}}}).result.then(function(response){callback(response)},function(){})};Service.open_usersignupModal=function(){console.log("open_usersignupModal");if(Service.data.login!=null)Service.close_Modal(Service.data.login);Service.data.usersignup= 37$uibModal.open({animation:true,size:"lg",scope:false,templateUrl:"/modals/user_signup.modal.html",controller:function($scope,$uibModalInstance){$scope.cancel=function(){$uibModalInstance.close({})}}}).result.then(function(response){},function(){})};Service.open_forgotpwModal=function(){if(Service.data.login!=null)Service.close_Modal(Service.data.login);$uibModal.open({animation:true,size:"lg",scope:false,templateUrl:"/modals/user_forgotpw.modal.html",controller:function($scope,$uibModalInstance){Service.data.forgotpw= 38$uibModalInstance;$scope.cancel=function(){$uibModalInstance.close({})}}}).result.then(function(response){},function(){})};Service.open_exportModal=function(){$uibModal.open({animation:true,size:"lg",templateUrl:"/modals/exportImage.modal.html",controller:function($scope,$uibModalInstance){Service.data.exportModal=$uibModalInstance;$scope.userData=userService.data.user;$scope.resolution={"slider":100,"input":100};$scope.sliderToNumber=function(){$scope.resolution.input=parseInt($scope.resolution.slider)}; 39$scope.numberToSlider=function(){$scope.resolution.slider=parseInt($scope.resolution.input)};$scope.compile_mode=editorService.data.compile_mode;$scope.format="png";$scope.crop=true;$scope.bloburl="";$scope.link="";$scope.setExportFormat=function(format){console.log(format);$scope.format=format};$scope.setCrop=function(crop){console.log(crop);$scope.crop=crop};
39$scope.showLoaderGif=false;$scope.showError=false;$scope.showMenu=true;$scope.ok=function(){$scope.showMenu=false;$scope.showLoaderGif=true; 40if($scope.format=="MathML"){$scope.mathmlcontent=editorService.createMathML();console.log($scope.mathmlcontent);$scope.showLoaderGif=false}else editorService.CompileLaTeX($scope.format,$scope.resolution.input,$scope.crop,function(response){$scope.showError=response.data.error;$scope.showLoaderGif=false;if(!response.data.error){console.log(response);var blob=crossHelpers.b64toBlob(response.data.content,$scope.format);var blobUrl=URL.createObjectURL(blob);$scope.bloburl=$sce.trustAsResourceUrl(blobUrl)}else; 41})};$scope.cancel=function(){$uibModalInstance.close({})}}}).result.then(function(response){},function(){})};Service.open_userCard=function(uid){console.log("open_userCard");$uibModal.open({animation:true,size:"lg",scope:false,templateUrl:"/modals/user_card.modal.html",controller:function($scope,$uibModalInstance){Service.data.userCard=$uibModalInstance;$scope.uid=uid;$scope.cancel=function(){$uibModalInstance.close({})}}}).result.then(function(response){},function(){})};Service.open_deleteNote=function(note, 42callback){$uibModal.open({animation:true,size:"lg",scope:false,templateUrl:"/modals/note_delete.modal.html",controller:function($scope,$uibModalInstance){Service.data.deleteNote=$uibModalInstance;$scope.deleteNote=note;$scope.ok=function(){editorService.deleteNote(note.NOTEIDB36,function(response){callback(response)});$uibModalInstance.close({})};$scope.cancel=function(){$uibModalInstance.close({})}}}).result.then(function(response){},function(){})};return Service}]);angular.module(app_name).controller("mainController",function($rootScope,$scope,$location,editorService,hotkeys,modalService){OutConsole.log("h1",["LaTeX4technics","Version 0.9 - 31.12.2019"]);OutConsole.log("info",["mainController running"]);$("body").on("click",".tagit-label",function(event){var url="./codesearch?q="+$(this).text();window.open(url,"_blank")});window.addEventListener("beforeunload",function(e){var confirmationMessage="";e.returnValue=confirmationMessage;return confirmationMessage}); 43hotkeys.add({combo:"ctrl+space",description:"",allowIn:["INPUT","SELECT","TEXTAREA"],callback:function(){event.preventDefault();editorService.Compile()}});hotkeys.add({combo:"ctrl+s",description:"",allowIn:["INPUT","SELECT","TEXTAREA"],callback:function(){event.preventDefault();modalService.open_createNoteModal()}});hotkeys.add({combo:"ctrl+e",description:"",allowIn:["INPUT","SELECT","TEXTAREA"],callback:function(){event.preventDefault();modalService.open_exportModal()}});$scope.openUserCard=function(uid){}});angular.module(app_name).directive("wrapper",function(editorService,layoutService){return{restrict:"C",link:function(scope,elm,attrs){layoutService.init(elm)}}});angular.module(app_name).directive("slimfooter",function($rootScope){return{restrict:"E",scope:true,templateUrl:"/templates/slim_footer.tpl.html",link:function(scope,element,attrs){}}});angular.module(app_name).directive("editorheader",function($rootScope,editorService,$uibModal,modalService){return{restrict:"E",scope:true,templateUrl:"/templates/editor_header.tpl.html",link:function(scope,element,attrs){scope.actual_design=editorService.data.instance.getTheme().split("/").pop();scope.actual_fontsize=parseInt(editorService.data.instance.getFontSize(),10);scope.actual_autocompletion=editorService.data.instance.completers.length>0?true:false;scope.compile_mode=editorService.data.compile_mode; 44scope.actual_autocompilation=editorService.data.autocompilation;scope.actual_centermathjax=editorService.data.centermathjax;var getCompileMode=function(){scope.compile_mode=editorService.data.compile_mode};editorService.registerCallback(editorService.data.noteLoadedObservers,getCompileMode);scope.Compile=function(){editorService.Compile()};$(".dropdown-menu").on("click",function(event){console.log("DROPDOWN");event.stopPropagation()});scope.set_compile_mode=function(value){editorService.set_compile_mode(value); 45modalService.open_changeModeModal()};scope.setDesign=function(design){editorService.setDesign(design)};scope.setMathjaxcenter=function(value){editorService.setMathjaxcenter(value)};scope.setFontSize=function(value){editorService.setFontSize(parseInt(value))};scope.setAutoCompletion=function(value){console.log(editorService.data.instance.completers);editorService.setAutoCompletion(value)};scope.setAutocompilation=function(value){editorService.setAutocompilation(value)};scope.CreateNote=function(value){}; 46scope.ExportImage=function(value){OutConsole.log("info",["ExportImage"]);
46modalService.open_exportModal()};scope.createnewNote=function(){modalService.open_createNoteModal()}}}});angular.module(app_name).directive("editorsidebar",function($rootScope){return{restrict:"E",scope:true,templateUrl:"/templates/editor_sidebar.tpl.html",link:function(scope,element,attrs){}}});angular.module(app_name).directive("editorcatalogue",function($rootScope,editorService,$timeout){return{restrict:"E",scope:true,templateUrl:"/templates/editor_catalogue.tpl.html",link:function(scope,element,attrs){scope.active_catalogue_chapter="greek";scope.activecoltyp="letter";var schcolor="red";var hincolor="white";var rahcolor="red";var matrix_freeze=-1;var matrix_maxz=0;var matrix_maxs=0;var matrix_colinactive="#f7f7f7";var matrix_colactive="#ff3b31";var matrix_beginlimiter="";var matrix_endlimiter= 47"";scope.active_matrixtype="";scope.MenuChange=function(new_chapter){OutConsole.log("info",["MenuChange:"+new_chapter]);scope.active_catalogue_chapter=new_chapter;if(new_chapter=="style")$timeout(function(){editorService.CompileMathJax()},0)};scope.ReplaceContentInContainer=function(tag1,tag2){editorService.ReplaceContentInContainer(tag1,tag2)};scope.ReplaceContentInContainer2=function(tag1,tag2){editorService.ReplaceContentInContainer2(tag1,tag2)};scope.setColorMode=function(activecoltyp){scope.activecoltyp= 48activecoltyp};scope.setcolor=function(id_col){console.log(scope.activecoltyp);if(scope.activecoltyp=="letter")schcolor=id_col;else if(scope.activecoltyp=="background")hincolor=id_col;else rahcolor=id_col;$("#col_preview").html("$$\\fcolorbox{"+rahcolor+"}{"+hincolor+"}{${\\color{"+schcolor+"}\\Huge L_4t}$}$$");editorService.CompileMathJax()};scope.insertColorBox=function(){var x=editorService.data.instance.selection.getRange();if(x.end.row==x.start.row&&x.end.column==x.start.column)editorService.ReplaceContentInContainer("\\fcolorbox{"+ 49rahcolor+"}{"+hincolor+"}{${\\color{"+schcolor+"} L_4t}$}","");else editorService.ReplaceContentInContainer("\\fcolorbox{"+rahcolor+"}{"+hincolor+"}{${\\color{"+schcolor+"}","}$}")};
49scope.setMatrixType=function(type){scope.active_matrixtype=type;matrix_beginlimiter="\\begin{"+type+"}";matrix_endlimiter="\\end{"+type+"}"};scope.insertMatrix=function(){var content="";if(matrix_freeze==1){for(var z=1;z<=matrix_maxz;z++){for(var k=1;k<=matrix_maxs;k++)if(k<matrix_maxs)matrix_beginlimiter=matrix_beginlimiter+ 50"a_{"+z+k+"}&";else matrix_beginlimiter=matrix_beginlimiter+"a_{"+z+k+"}";if(z<matrix_maxz)matrix_beginlimiter=matrix_beginlimiter+"\\\\"}matrix_beginlimiter=matrix_beginlimiter+matrix_endlimiter;editorService.ReplaceContentInContainer(matrix_beginlimiter,"")}};scope.setMatrixDimensions=function(maxz,maxs){matrix_freeze=matrix_freeze*-1;matrix_maxz=maxz;matrix_maxs=maxs};scope.hovercolor=function(object,active){if(active)color=matrix_colactive;else color=matrix_colinactive;if(matrix_freeze==-1){document.getElementById(object).style.backgroundColor= 51color;actzeil=parseInt(object.charAt(1));actspal=parseInt(object.charAt(2));for(var z=0;z<actzeil;z++)for(var k=0;k<actspal;k++){neib="a"+(actzeil-z)+(actspal-k);document.getElementById(neib).style.backgroundColor=color}for(var z=actzeil+1;z<=5;z++)for(var k=1;k<=5;k++){neib="a"+z+k;document.getElementById(neib).style.backgroundColor=matrix_colinactive}for(var z=1;z<=5;z++)for(var k=actspal+1;k<=5;k++){neib="a"+z+k;document.getElementById(neib).style.backgroundColor=matrix_colinactive}if(color==matrix_colactive)$("#DimDisplay").html(actzeil+ 52"x"+actspal);else $("#DimDisplay").html("0x0")}}}}});angular.module(app_name).directive("convertToNumber",function(){return{require:"ngModel",link:function(scope,element,attrs,ngModel){ngModel.$parsers.push(function(val){return val!=null?parseInt(val,10):null});ngModel.$formatters.push(function(val){return val!=null?""+val:null})}}});angular.module(app_name).directive("lateximg",function($rootScope,editorService,$location,modalService){return{restrict:"E",scope:true,templateUrl:"/templates/lateximg.tpl.html",link:function(scope,element,attrs){scope.showLoaderGif=true;scope.serverreply={"error":false,"content":""};$rootScope.$on("compileLatexPNG:started",function(e,data){scope.showLoaderGif=true});$rootScope.$on("compileLatexPNG:finished",function(e,data){scope.showLoaderGif=false;scope.serverreply=data.response.data});scope.openLogModal= 53function(){modalService.open_logModal(scope.serverreply.content)}}}});angular.module(app_name).directive("userloginbtn",["$rootScope","$http","userService","modalService","$state","$window",function($rootScope,$http,userService,modalService,$state,$window){return{restrict:"E",scope:true,templateUrl:"/templates/userloginbtn.tpl.html",link:function(scope,element,attrs){scope.loggedin_user=null;scope.imgincrementer=0;userService.registerCallback(userService.data.imgupdate,function(data){scope.imgincrementer=data});userService.checkSessionStatus(function(response){scope.loggedin_user= 54response.data.content;userService.data.user=response.data});var loginmodal_instance;scope.logout=function(){userService.logout(function(response){if(!response.data.error){scope.loggedin_user=null;userService.data.user=null;if($state.includes("notes")||$state.includes("account"))$window.location.href="/"}})};scope.open_user_login=function(){modalService.open_loginModal(function(response){scope.loggedin_user=userService.data.user})}}}}]);angular.module(app_name).directive("signup",function($rootScope,$location,$compile,$timeout,userService){return{restrict:"E",scope:true,templateUrl:"/templates/signup.tpl.html",link:function(scope,element,attrs){scope.showInputs=true;scope.recaptchadata={};scope.recaptchadata.response="";scope.signup_name="";scope.signup_email="";scope.signup_password="";scope.confirmed_password="";scope.signup_serverreply="";scope.activation_key="";var myCallBack=function(){scope.recaptchadata.response=grecaptcha.getResponse(widgetId)}; 55scope.dynamicid=Math.random().toString(36).substring(7);scope.template="<div id={{dynamicid}} class='g-recaptcha'></div>";var widgetId;var html=$compile(scope.template)(scope);angular.element(document.getElementById("captchaholder")).append(html);$timeout(function(){widgetId=grecaptcha.render(scope.dynamicid,{"sitekey":config.sitekey_recaptchav2,"theme":"light","callback":myCallBack})},0);scope.activate_user=function(){userService.activateUser(scope.signup_email,scope.activation_key,function(response){console.log(response)})}; 56scope.sign_up=function(){userService.addUser(scope.signup_name,scope.signup_email,scope.signup_password,scope.confirmed_password,scope.recaptchadata.response,function(response){scope.signup_serverreply=response.data.content;grecaptcha.reset(widgetId);if(!response.data.error)scope.showInputs=false})}}}});angular.module(app_name).directive("forgotpw",function($rootScope,$location,$compile,$timeout,userService){return{restrict:"E",scope:true,templateUrl:"/templates/forgotpw.tpl.html",link:function(scope,element,attrs){scope.showInputs=true;scope.recaptchadata={};scope.recaptchadata.response="";scope.signup_email="";scope.serverreply="";scope.activation_key="";var myCallBack=function(){scope.recaptchadata.response=grecaptcha.getResponse(widgetId)};scope.dynamicid=Math.random().toString(36).substring(7); 57scope.template="<div id={{dynamicid}} class='g-recaptcha'></div>";var widgetId;var html=$compile(scope.template)(scope);angular.element(document.getElementById("captchaholder")).append(html);$timeout(function(){widgetId=grecaptcha.render(scope.dynamicid,{"sitekey":config.sitekey_recaptchav2,"theme":"light","callback":myCallBack})},0);scope.activate_user=function(){userService.activateUser(scope.signup_email,scope.activation_key,function(response){console.log(response)})};scope.forgotPW=function(){userService.forgotPW(scope.signup_email, 58scope.recaptchadata.response,function(response){scope.serverreply=response.data.content;grecaptcha.reset(widgetId);if(!response.data.error)scope.showInputs=false})}}}});angular.module(app_name).directive("taginput",function($rootScope,$location,$compile,$timeout){return{restrict:"E",scope:{tags:"="},templateUrl:"/templates/taginput.tpl.html",link:function(scope,element,attrs){var elm=angular.element(element[0].querySelector(".tagsinput"));elm.val(scope.tags);elm.tagit({placeholderText:"Tags",afterTagAdded:function(event,ui){},afterTagRemoved:function(event,ui){}})}}});angular.module(app_name).directive("usercard",["$rootScope","$http","userService",function($rootScope,$http,userService){return{restrict:"E",scope:{authorid:"@"},templateUrl:"/templates/user_card.tpl.html",link:function(scope,element,attrs){userService.getUserMetaInfo(scope.authorid,function(response){console.log(response);scope.author_name=response.data.content.name;scope.author_occupation=response.data.content.Occupation;scope.author_about=response.data.content.About})}}}]);angular.module(app_name).directive("cookiealert",function($rootScope){return{restrict:"E",scope:true,templateUrl:"/templates/cookiealert.tpl.html",link:function(scope,element,attrs){console.log("cookiealert")}}});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.