|
@@ -5,9 +5,9 @@
|
|
|
.module('appMessage')
|
|
|
.directive('ngCurrentMsg', CurrentMsg);
|
|
|
|
|
|
- CurrentMsg.inject = ['$location', '$anchorScroll', '$compile'];
|
|
|
+ CurrentMsg.inject = ['$location', '$anchorScroll', '$compile', '$timeout'];
|
|
|
|
|
|
- function CurrentMsg($location, $anchorScroll, $compile) {
|
|
|
+ function CurrentMsg($location, $anchorScroll, $compile, $timeout) {
|
|
|
var directive = {
|
|
|
link: link,
|
|
|
restrict: 'A',
|
|
@@ -68,41 +68,37 @@
|
|
|
scope.imgWidth = 715;
|
|
|
scope.imgHeight = 395;
|
|
|
var html = '<a class="thumbnail"' + '>' +
|
|
|
- '<img onclick="javascript:window.open(this.src,\'\',\'height=' + scope.imgHeight + ',width=' + scope.imgWidth + ',top=200,left=200,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no\')" style="max-width:270px;max-height:250px;" src="local://' + scope.appContent.directory.received + g[1] + '.JPG' + '" onError= "this.src = \'../img/loading.gif\'" alt="截图缩略图" >' +
|
|
|
+ // '<img img-load="gotoBottom(item)" img-error="errorImg()" onclick="javascript:window.open(this.src,\'\',\'height=' + scope.imgHeight + ',width=' + scope.imgWidth + ',top=200,left=200,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no\')" style="max-width:270px;max-height:250px;" src="local://' + scope.appContent.directory.received + g[1] + '.JPG' + '" onError= "this.src = \'../img/loading.gif\'" alt="截图缩略图" >' +
|
|
|
+ '<img ng-click="gotoBottom()" onclick="javascript:window.open(this.src,\'\',\'height=600,width=800,top=200,left=200\')" class="lazy" style="max-width:270px;max-height:250px;" src="../img/loading.gif" data-original="local://' + scope.appContent.directory.received + g[1] + '.JPG' + '" alt="截图缩略图" >' +
|
|
|
'</a>';
|
|
|
// '<div class="bigImg">' +
|
|
|
// '<img ng-click="hover = false" ng-show="hover" src="local://' + scope.appContent.directory.received + g[1] + '.JPG' + '" alt="" >' +
|
|
|
// '</div>';
|
|
|
|
|
|
- var imgSize = loadImg("local://" + scope.appContent.directory.received + g[1] + ".JPG", addImg, errorImg);
|
|
|
- console.log(imgSize);
|
|
|
-
|
|
|
- function loadImg(url, callback, error) {
|
|
|
- var img = new Image();
|
|
|
- img.onload = function() {
|
|
|
- img.onload = null;
|
|
|
- callback(img);
|
|
|
- var imgSize = { height: img.height, width: img.width };
|
|
|
- console.log(imgSize);
|
|
|
- return imgSize;
|
|
|
- }
|
|
|
- img.onerror = function() {
|
|
|
- //alert("error!");
|
|
|
- img.onerror = null;
|
|
|
- error(img);
|
|
|
- }
|
|
|
- img.src = url;
|
|
|
- angular.element("img").attr("defaulturl", "../img/loading.jpg");
|
|
|
- }
|
|
|
-
|
|
|
- function errorImg(img) {
|
|
|
- gotoBottom();
|
|
|
- }
|
|
|
-
|
|
|
- function addImg(img) {
|
|
|
- //$(img).appendTo($(".image"));
|
|
|
- gotoBottom();
|
|
|
- }
|
|
|
+ // loadImg("local://" + scope.appContent.directory.received + g[1] + ".JPG", addImg, errorImg);
|
|
|
+ // function loadImg(url, callback, error) {
|
|
|
+ // var img = new Image();
|
|
|
+ // img.onload = function() {
|
|
|
+ // img.onload = null;
|
|
|
+ // callback(img);
|
|
|
+ // }
|
|
|
+ // img.onerror = function() {
|
|
|
+ // //alert("error!");
|
|
|
+ // img.onerror = null;
|
|
|
+ // error(img);
|
|
|
+ // }
|
|
|
+ // img.src = url;
|
|
|
+ // angular.element("img").attr("defaulturl", "../img/loading.jpg");
|
|
|
+ // }
|
|
|
+
|
|
|
+ // function errorImg() {
|
|
|
+ // gotoBottom();
|
|
|
+ // }
|
|
|
+
|
|
|
+ // function addImg() {
|
|
|
+ // //$(img).appendTo($(".image"));
|
|
|
+ // gotoBottom();
|
|
|
+ // }
|
|
|
return html;
|
|
|
});
|
|
|
g = (/\[image\-src=\"([\w\W]+?)\"\]/i).exec(content);
|
|
@@ -235,11 +231,12 @@
|
|
|
// 添加到文档中
|
|
|
var newElement = angular.element($dom);
|
|
|
element.append(newElement);
|
|
|
+ angular.element("img.lazy").lazyload();
|
|
|
message.addEventListener('load', gotoBottom());
|
|
|
}
|
|
|
};
|
|
|
/* @ngInject */
|
|
|
- function ControllerController($scope) {
|
|
|
+ function ControllerController($scope, $timeout) {
|
|
|
$scope.OpenFile = function(item) {
|
|
|
var file = JSON.parse(item);
|
|
|
return lxtalkClient.Invoke('{15180DEF-D508-45F7-BAEB-6486CD8752C8}', 'OpenFile', JSON.stringify(file), $scope);
|
|
@@ -250,11 +247,9 @@
|
|
|
return lxtalkClient.Invoke('{15180DEF-D508-45F7-BAEB-6486CD8752C8}', 'OpenDirectory', JSON.stringify(file), $scope);
|
|
|
|
|
|
};
|
|
|
- // $scope.showBigImg = function(str) {
|
|
|
- // str = "local://E:\ZWT\Users\002682BECE10-kehu01\ReceivedFaces\55d8b2073fb83e2450eff0fccbb85ab4.JPG";
|
|
|
- // console.log(str);
|
|
|
- // var newwin = window.open();
|
|
|
- // newwin.document.write("<img src=" + str + " />");
|
|
|
- // }
|
|
|
+ $scope.gotoBottom = function() {
|
|
|
+ console.log("11111111111111");
|
|
|
+ $scope.$apply();
|
|
|
+ };
|
|
|
}
|
|
|
})();
|