document simplification; document metrika -> analytics;
This commit is contained in:
1 parent
ba2891d09b
commit
af5f5dc5b1
5 files changed
+37
-260
No files matched your search
+14
-33
@@ -1,36 +1,17 @@
|
||||
var app = angular.module("hudozhka.document", ["ngRoute", "hudozhka.data"]);
|
||||
var app = angular.module("hudozhka.document", [
|
||||
"hudozhka.data",
|
||||
"angulartics",
|
||||
"angulartics.google.analytics"
|
||||
]);
|
||||
|
||||
app.config(function ($locationProvider, $sceDelegateProvider, $routeProvider) {
|
||||
$locationProvider.html5Mode(true);
|
||||
//$routeProvider
|
||||
// .when("/document/:doc", {
|
||||
// controller: "DocumentPageController"
|
||||
// })
|
||||
// .otherwise({
|
||||
// redirectTo: "/"
|
||||
// });
|
||||
|
||||
$sceDelegateProvider.resourceUrlWhitelist([
|
||||
"self",
|
||||
"http://static.shburg.org/**",
|
||||
"http://static.shlisselburg.org/**"
|
||||
]);
|
||||
});
|
||||
|
||||
//app.factory("document", function () {
|
||||
// var document;
|
||||
// return {
|
||||
// init:function(doc) {
|
||||
// document = doc;
|
||||
// },
|
||||
//
|
||||
// document: document
|
||||
// };
|
||||
//});
|
||||
|
||||
app.controller("DocumentPageController", function ($scope) {
|
||||
app.controller("DocumentController", function ($scope, $location, docs) {
|
||||
$scope.pageClass = "page-document";
|
||||
});
|
||||
$scope.showControls = false;
|
||||
|
||||
require("./ui/pdf")(app);
|
||||
require("./ui/doc-controller")(app);
|
||||
var abs = $location.absUrl();
|
||||
var doc_uri = /\/([\w-]+)$/.exec(abs);
|
||||
|
||||
if(doc_uri.length >= 2) {
|
||||
$scope.document = docs.doc(doc_uri[1]);
|
||||
}
|
||||
});
|
||||
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* Created by tmshv on 24/11/14.
|
||||
*/
|
||||
|
||||
module.exports = function (app) {
|
||||
app.controller("DocumentController", function ($scope, $location, docs) {
|
||||
$scope.showControls = false;
|
||||
|
||||
var doc_uri = $location.$$path.replace("/document/", "");
|
||||
$scope.document = docs.doc(doc_uri);
|
||||
//$scope.document.currentPage = 0;
|
||||
//
|
||||
//$scope.totalPages = $scope.document.url.length;
|
||||
//$scope.currentPage = 1;
|
||||
//
|
||||
//$scope.prevPage = function () {
|
||||
// var i = $scope.currentPage - 1;
|
||||
// if (i > 0) {
|
||||
// $scope.currentPage = i;
|
||||
// $scope.document.currentPage = i - 1;
|
||||
// }
|
||||
//};
|
||||
//
|
||||
//$scope.nextPage = function () {
|
||||
// var i = $scope.currentPage + 1;
|
||||
// if (i <= $scope.totalPages) {
|
||||
// $scope.currentPage = i;
|
||||
// $scope.document.currentPage = i - 1;
|
||||
// }
|
||||
//};
|
||||
//
|
||||
//$scope.update = function () {
|
||||
// var i = $scope.currentPage;
|
||||
// if (i > 0 && i <= $scope.totalPages) {
|
||||
// $scope.currentPage = i;
|
||||
// $scope.document.currentPage = i - 1;
|
||||
// }
|
||||
//};
|
||||
});
|
||||
};
|
||||
@@ -1,148 +0,0 @@
|
||||
/**
|
||||
* Created by tmshv on 24/11/14.
|
||||
*/
|
||||
|
||||
module.exports = function (app) {
|
||||
app.directive("pdf", function () {
|
||||
return {
|
||||
scope: {
|
||||
document: "="
|
||||
},
|
||||
templateUrl: "/views/pdf.html",
|
||||
link: function (scope, element, attrs) {
|
||||
|
||||
},
|
||||
|
||||
controller: function ($scope) {
|
||||
var doc = $scope.document;
|
||||
if (doc.extra && doc.extra.style) {
|
||||
angular.element("head").append('<link href="' + doc.extra.style + '" rel="stylesheet">');
|
||||
}
|
||||
|
||||
$scope.$watch(
|
||||
function () {
|
||||
return $scope.document.currentPage;
|
||||
},
|
||||
function (value) {
|
||||
value = parseInt(value);
|
||||
try{
|
||||
$scope.pageURL = $scope.document.url[value];
|
||||
}catch (error){
|
||||
$scope.pageURL = "";
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
//const PAGES = [];
|
||||
//var currentPageIndex = 0;
|
||||
//var doc = new Document(location.pathname.replace(/\/\d+$/, ""));
|
||||
|
||||
//$(document).ready(function(){
|
||||
// try{
|
||||
// var hrefPage = /\/(\d+)$/.exec(location.href)[1];
|
||||
// currentPageIndex = parseInt(hrefPage) - 1;
|
||||
// }catch(error){
|
||||
//
|
||||
// }
|
||||
|
||||
//$("#buttonNext").click(function(event){
|
||||
// loadNext();
|
||||
//});
|
||||
//
|
||||
//$("#buttonPrev").click(function(event){
|
||||
// loadPrevious();
|
||||
//});
|
||||
//
|
||||
//$("#page-container .pf").each(function(index, elem){
|
||||
// var url = $(elem).data("page-url");
|
||||
// doc.pages.push(url);
|
||||
//});
|
||||
//
|
||||
//$("#currentPage").attr("max", doc.pages.length);
|
||||
//$("#totalPages").text(doc.pages.length);
|
||||
//$("#currentPage").change(function(){
|
||||
// var i = parseInt($(this).val()) - 1;
|
||||
// if(i && doc.hasPage(i)){
|
||||
// loadPage(i);
|
||||
// }
|
||||
//});
|
||||
//
|
||||
//$("#page-container").html("");
|
||||
//loadPage(currentPageIndex);
|
||||
//
|
||||
//window.addEventListener("popstate", function(event){
|
||||
// console.log("pops");
|
||||
// console.log(event);
|
||||
// var i = event.state;
|
||||
// loadPage(i);
|
||||
//});
|
||||
//});
|
||||
|
||||
//function loadNext(){
|
||||
// var i = currentPageIndex + 1;
|
||||
// if(doc.hasPage(i)){
|
||||
// loadPage(i);
|
||||
// }else{
|
||||
//
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//function loadPrevious(){
|
||||
// var i = currentPageIndex - 1;
|
||||
// if(doc.hasPage(i)){
|
||||
// loadPage(i);
|
||||
// }else{
|
||||
//
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//function loadPage(index){
|
||||
// if(doc.hasPage(index)){
|
||||
// var url = doc.pages[index];
|
||||
// // $.ajax(
|
||||
// // url,
|
||||
//
|
||||
// // {
|
||||
// // xhrFields: {
|
||||
// // crossDomain: true,
|
||||
// // withCredentials: true
|
||||
// // },
|
||||
//
|
||||
// // success: function(data, status){
|
||||
// // currentPageIndex = index;
|
||||
// // $("#currentPage").val(doc.page(currentPageIndex));
|
||||
// // $("#page-container").html(data);
|
||||
//
|
||||
// // var p = doc.page(currentPageIndex);
|
||||
// // console.log("look at page ", p);
|
||||
// // window.history.pushState(
|
||||
// // currentPageIndex,
|
||||
// // "State 2013 — " + p,
|
||||
// // doc.getPageURL(p)
|
||||
// // );
|
||||
// // },
|
||||
//
|
||||
// // error: function(xhr, aaa, error){
|
||||
// // console.log(error);
|
||||
// // }
|
||||
// // }
|
||||
// // );
|
||||
// $.get(url, function(data){
|
||||
// currentPageIndex = index;
|
||||
// $("#currentPage").val(doc.page(currentPageIndex));
|
||||
// $("#page-container").html(data);
|
||||
//
|
||||
// var p = doc.page(currentPageIndex);
|
||||
// console.log("look at page ", p);
|
||||
// window.history.pushState(
|
||||
// currentPageIndex,
|
||||
// "State 2013 — " + p,
|
||||
// doc.getPageURL(p)
|
||||
// );
|
||||
// });
|
||||
// }
|
||||
//}
|
||||
}
|
||||
};
|
||||
});
|
||||
};
|
||||
Reference in new issue
Block a user