TagSpaces is an offline, open source, document manager with tagging support
adding updating the angular experiment
Ilian789587d76985
diff --git a/data/ext/perspectiveFlow/angular-touch.min.js b/data/ext/perspectiveFlow/angular-touch.min.jsnew file mode 100644index 000000000..dbc76f919--- /dev/null+++ b/data/ext/perspectiveFlow/angular-touch.min.js@@ -0,0 +1,13 @@+/*+ AngularJS v1.3.0-beta.8+ (c) 2010-2014 Google, Inc. http://angularjs.org+ License: MIT+*/+(function(y,w,z){'use strict';function u(f,a,c){r.directive(f,["$parse","$swipe",function(m,p){var q=75,g=0.3,e=30;return function(h,n,l){function k(d){if(!b)return!1;var s=Math.abs(d.y-b.y);d=(d.x-b.x)*a;return v&&s<q&&0<d&&d>e&&s/d<g}var s=m(l[f]),b,v;p.bind(n,{start:function(d,s){b=d;v=!0},cancel:function(b){v=!1},end:function(b,a){k(b)&&h.$apply(function(){n.triggerHandler(c);s(h,{$event:a})})}})}}])}var r=w.module("ngTouch",[]);r.factory("$swipe",[function(){function f(a){var c=a.touches&&a.touches.length?+a.touches:[a];a=a.changedTouches&&a.changedTouches[0]||a.originalEvent&&a.originalEvent.changedTouches&&a.originalEvent.changedTouches[0]||c[0].originalEvent||c[0];return{x:a.clientX,y:a.clientY}}return{bind:function(a,c){var m,p,q,g,e=!1;a.on("touchstart mousedown",function(a){q=f(a);e=!0;p=m=0;g=q;c.start&&c.start(q,a)});a.on("touchcancel",function(a){e=!1;c.cancel&&c.cancel(a)});a.on("touchmove mousemove",function(a){if(e&&q){var n=f(a);m+=Math.abs(n.x-g.x);p+=Math.abs(n.y-g.y);g=n;10>m&&10>p||+(p>m?(e=!1,c.cancel&&c.cancel(a)):(a.preventDefault(),c.move&&c.move(n,a)))}});a.on("touchend mouseup",function(a){e&&(e=!1,c.end&&c.end(f(a),a))})}}}]);r.config(["$provide",function(f){f.decorator("ngClickDirective",["$delegate",function(a){a.shift();return a}])}]);r.directive("ngClick",["$parse","$timeout","$rootElement",function(f,a,c){function m(a,b,c){for(var d=0;d<a.length;d+=2)if(Math.abs(a[d]-b)<e&&Math.abs(a[d+1]-c)<e)return a.splice(d,d+2),!0;return!1}function p(a){if(!(Date.now()-n>g)){var b=+a.touches&&a.touches.length?a.touches:[a],c=b[0].clientX,b=b[0].clientY;1>c&&1>b||k&&k[0]===c&&k[1]===b||(k&&(k=null),"label"===a.target.tagName.toLowerCase()&&(k=[c,b]),m(l,c,b)||(a.stopPropagation(),a.preventDefault(),a.target&&a.target.blur()))}}function q(c){c=c.touches&&c.touches.length?c.touches:[c];var b=c[0].clientX,e=c[0].clientY;l.push(b,e);a(function(){for(var a=0;a<l.length;a+=2)if(l[a]==b&&l[a+1]==e){l.splice(a,a+2);break}},g,!1)}var g=2500,e=25,h="ng-click-active",n,l,k;return function(a,+b,e){function d(){k=!1;b.removeClass(h)}var g=f(e.ngClick),k=!1,t,r,u,x;b.on("touchstart",function(a){k=!0;t=a.target?a.target:a.srcElement;3==t.nodeType&&(t=t.parentNode);b.addClass(h);r=Date.now();a=a.touches&&a.touches.length?a.touches:[a];a=a[0].originalEvent||a[0];u=a.clientX;x=a.clientY});b.on("touchmove",function(a){d()});b.on("touchcancel",function(a){d()});b.on("touchend",function(a){var g=Date.now()-r,f=a.changedTouches&&a.changedTouches.length?a.changedTouches:a.touches&&a.touches.length?+a.touches:[a],h=f[0].originalEvent||f[0],f=h.clientX,h=h.clientY,s=Math.sqrt(Math.pow(f-u,2)+Math.pow(h-x,2));k&&(750>g&&12>s)&&(l||(c[0].addEventListener("click",p,!0),c[0].addEventListener("touchstart",q,!0),l=[]),n=Date.now(),m(l,f,h),t&&t.blur(),w.isDefined(e.disabled)&&!1!==e.disabled||b.triggerHandler("click",[a]));d()});b.onclick=function(a){};b.on("click",function(b,c){a.$apply(function(){g(a,{$event:c||b})})});b.on("mousedown",function(a){b.addClass(h)});b.on("mousemove mouseup",function(a){b.removeClass(h)})}}]);+u("ngSwipeLeft",-1,"swipeleft");u("ngSwipeRight",1,"swiperight")})(window,window.angular);+//# sourceMappingURL=angular-touch.min.js.mapdiff --git a/data/ext/perspectiveFlow/controller.js b/data/ext/perspectiveFlow/controller.jsindex 880533717..3fbee95b3 100644--- a/data/ext/perspectiveFlow/controller.js+++ b/data/ext/perspectiveFlow/controller.js@@ -1,26 +1,45 @@-function TodoCtrl($scope) {- $scope.todos = [- {text:'learn angular', done:true},- {text:'build an angular app', done:false}];-- $scope.addTodo = function() {- $scope.todos.push({text:$scope.todoText, done:false});- $scope.todoText = '';+function myCtrl($scope) {+ $scope.data;+ $scope.TSCORE;++ $scope.update = function() {+ $scope.data = $scope.TSCORE.Search.searchData($scope.TSCORE.fileList, $scope.TSCORE.Search.nextQuery);+ $scope.$apply();+ };++ $scope.setTSCORE = function(tscore) {+ $scope.TSCORE = tscore;+ };++ $scope.selectFile = function(file) {+ console.log("Selecting file..."+file);+ $scope.TSCORE.PerspectiveManager.clearSelectedFiles();++ //var titleBut = $($event.target).parent().find(".fileTitleButton");++ //$(titleBut).parent().parent().toggleClass("ui-selected");+ //$(titleBut).parent().parent().find(".fileSelection").find("i")+ // .toggleClass("fa-check-square")+ // .toggleClass("fa-square-o");++ $scope.TSCORE.selectedFiles.push(file);};- $scope.remaining = function() {- var count = 0;- angular.forEach($scope.todos, function(todo) {- count += todo.done ? 0 : 1;- });- return count;+ $scope.openFile = function(file) {+ console.log("Open file..."+file);+ $scope.TSCORE.FileOpener.openFile(file);};- $scope.archive = function() {- var oldTodos = $scope.todos;- $scope.todos = [];- angular.forEach(oldTodos, function(todo) {- if (!todo.done) $scope.todos.push(todo);- });+ $scope.openContextMenu = function($event, file, tag) {+ console.log("Open context menu..."+file);+ $scope.TSCORE.hideAllDropDownMenus();+ //self.selectFile(this, $(this).attr("filepath"));+ $scope.TSCORE.openTagMenu($event.target, tag, file);+ $scope.TSCORE.showContextMenu("#tagMenu", $event.target);+};+}++function myToolbarCtrl($scope) {+ $scope.TSCORE;}\ No newline at end of filediff --git a/data/ext/perspectiveFlow/extension.js b/data/ext/perspectiveFlow/extension.jsindex 6998a04e7..defd53f5a 100644--- a/data/ext/perspectiveFlow/extension.js+++ b/data/ext/perspectiveFlow/extension.js@@ -24,6 +24,8 @@ define(function(require, exports, module) {$viewToolbar,$viewFooter;+ var tableScope;+function init() {console.log("Initializing perspective "+extensionID);@@ -35,16 +37,52 @@ define(function(require, exports, module) {$viewToolbar.empty();$viewFooter.empty();- //$viewContainer.html('<div ng-app><input type="text" ng-model="yourName" placeholder="Enter a name here"><hr><h1>Hello {{yourName}}!</h1></div>');-- $viewContainer.html('<div ng-app><div ng-controller="TodoCtrl"><span>{{remaining()}} of {{todos.length}} remaining</span>[ <a href="" ng-click="archive()">archive</a> ]<ul class="unstyled"><li ng-repeat="todo in todos"><input type="checkbox" ng-model="todo.done">' +- '<span class="done-{{todo.done}}">{{todo.text}}</span></li></ul><form ng-submit="addTodo()"><input type="text" ng-model="todoText" size="30" placeholder="add new todo here"><input class="btn-primary" type="submit" value="add"></form></div></div>');+ $viewToolbar.html('<div id="myToolbar"><div class="btn-group">'+ // ng-app ng-controller="myToolbarCtrl"+ '<button class="btn btn-link" data-i18n="[title]ns.perspectiveList:toggleSelectAll" title="" id="{{id}}ToogleSelectAll"><i class="fa fa-square-o fa-lg fa-fw"></i></button>'++ '</div>'++ '<div class="btn-group">'++ '<button class="btn btn-link" data-i18n="[title]ns.perspectiveList:createNewFileTooltip" id="{{id}}CreateFileButton"><i class="glyphicon glyphicon-plus fa-lg"></i></button>'++ '<button class="btn btn-link" data-i18n="[title]ns.perspectiveList:showSubfolderContentTooltip" id="{{id}}IncludeSubDirsButton"><i class="fa fa-retweet fa-lg"></i></button>'++ '<button class="btn btn-link" data-i18n="[title]ns.perspectiveList:addRemoveTagsTooltip" id="{{id}}TagButton"><i class="fa fa-tag fa-lg"></i></button>'++ '<button class="btn btn-link" data-i18n="[title]ns.perspectiveList:toggleThumbnailsTooltip" data-toggle="button" id="{{id}}ShowTmbButton"><i class="fa fa-picture-o fa-lg"></i></button>'++ '<button class="btn btn-link" data-i18n="[title]ns.perspectiveList:increasThumbnailsTooltip" id="{{id}}IncreaseThumbsButton"><i class="fa fa-search-plus fa-lg"></i></button>'++ '</div>'++ '<div class="btn-group" data-toggle="buttons-checkbox">'++ '<button class="btn btn-link" data-i18n="[title]ns.perspectiveList:toggleFileDetailsTooltip" id="{{id}}ShowFileDetailsButton"><i class="fa fa-list-alt fa-lg"></i></button>'++ '</div></div>');++ $viewContainer.html('<table ng-app ng-controller="myCtrl" id="myTable" cellpadding="0" cellspacing="0" border="0" style="width: 100%" class="table content disableTextSelection"><thead>'++ '<tr role="row">'++ '<th class="fileTitle noWrap" tabindex="0" rowspan="1" colspan="1">File Ext.</th>'++ '<th class="fileTitle forceWrap" tabindex="0" rowspan="1" colspan="1" aria-sort="ascending">Title</th>'++ '<th class="fileTitle" tabindex="0" rowspan="1" colspan="1" >Tags</th>'++ '<th class="fileTitle" rowspan="1" colspan="1">Size</th>'++ '<th class="fileTitle" tabindex="0" rowspan="1" colspan="1">Last Modified</th>'++ '<th class="fileTitle sorting" tabindex="0" rowspan="1" colspan="1">File Path</th>'++ '</tr></thead><tbody>'++ '<tr ng-repeat="entry in data" ng-click="selectFile(entry[5])" ng-dblclick="openFile(entry[5])">'++ '<td class="fileTitle noWrap">'++ '<button filepath="{{entry[5]}}" class="btn btn-link fileSelection"><i class="fa fa-square-o"></i></button>'++ '<button filepath="{{entry[5]}}" ng-click="" class="btn btn-link fileTitleButton ui-draggable"><span class="fileExt"><span>{{entry[0]}}</span> <span class="caret white-caret"></span></span></button>'++ '</td>'++ '<td class="fileTitle forceWrap">{{entry[1]}}</td>'++ '<td class="fileTitle">'++ '<button ng-repeat="tag in entry[2]" ng-click="openContextMenu($event, entry[5], tag)" class="btn btn-sm tagButton ui-draggable" tag="{{tag}}" filepath="{{entry[5]}}" style="">{{tag}} <span class="caret"></span></button>'++ '</td>'++ '<td class="fileTitle">{{entry[3]}}</td>'++ '<td class="fileTitle">{{entry[4]}}</td>'++ '<td class="fileTitle">{{entry[5]}}</td>'++ '</tr>'++ '</tbody></table>');require([extensionDirectory+'/angular.min.js',+ extensionDirectory+'/angular-touch.min.js',extensionDirectory+'/controller.js'], function() {-+ angular.module('app', ['ngTouch']);+ tableScope = angular.element($("#myTable")).scope();+ tableScope.setTSCORE(TSCORE);});}@@ -52,6 +90,23 @@ define(function(require, exports, module) {var load = function () {console.log("Loading perspective "+extensionID);+ if(tableScope === undefined) {+ window.setTimeout( function() { tableScope.update(); }, 1000);+ } else {+ tableScope.update();+ }+ };++ var selectFile = function(uiElement, filePath) {+ TSCORE.PerspectiveManager.clearSelectedFiles();++ $(uiElement).parent().parent().toggleClass("ui-selected");+ $(uiElement).parent().parent().find(".fileSelection").find("i")+ .toggleClass("fa-check-square")+ .toggleClass("fa-square-o");++ TSCORE.selectedFiles.push(filePath);+ //handleElementActivation();};var clearSelectedFiles = function() {diff --git a/data/ext/perspectiveFlow/template.html b/data/ext/perspectiveFlow/template.htmlnew file mode 100644index 000000000..e69de29bb