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) {
|
app.controller("DocumentController", function ($scope, $location, docs) {
|
||||||
$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) {
|
|
||||||
$scope.pageClass = "page-document";
|
$scope.pageClass = "page-document";
|
||||||
});
|
$scope.showControls = false;
|
||||||
|
|
||||||
require("./ui/pdf")(app);
|
var abs = $location.absUrl();
|
||||||
require("./ui/doc-controller")(app);
|
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)
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
};
|
|
||||||
+23
-36
@@ -1,20 +1,39 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<base href="/document">
|
<!--<base href="/document">-->
|
||||||
|
<base href="/">
|
||||||
<link rel="stylesheet" href="/style.css">
|
<link rel="stylesheet" href="/style.css">
|
||||||
<link rel="stylesheet" href="/s/animate.min.css">
|
|
||||||
<link rel="stylesheet" href="/fonts/stylesheet.css">
|
<link rel="stylesheet" href="/fonts/stylesheet.css">
|
||||||
<meta name="google-site-verification" content="8BxOTw-Q02DS2KAdcGcnIMwiPZ58DVB18XpOfRibCcg">
|
<meta name="google-site-verification" content="8BxOTw-Q02DS2KAdcGcnIMwiPZ58DVB18XpOfRibCcg">
|
||||||
|
|
||||||
<script src="/bower_components/jquery/dist/jquery.min.js"></script>
|
<script src="/bower_components/jquery/dist/jquery.min.js"></script>
|
||||||
<script src="/bower_components/angular/angular.min.js"></script>
|
<script src="/bower_components/angular/angular.min.js"></script>
|
||||||
<script src="/bower_components/angular-route/angular-route.min.js"></script>
|
<script src="/bower_components/angulartics/dist/angulartics.min.js"></script>
|
||||||
|
<script src="/bower_components/angulartics/dist/angulartics-ga.min.js"></script>
|
||||||
|
|
||||||
<script src="data.js"></script>
|
<script src="data.js"></script>
|
||||||
<script src="document.js"></script>
|
<script src="document.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
(function (i, s, o, g, r, a, m) {
|
||||||
|
i['GoogleAnalyticsObject'] = r;
|
||||||
|
i[r] = i[r] || function () {
|
||||||
|
(i[r].q = i[r].q || []).push(arguments)
|
||||||
|
}, i[r].l = 1 * new Date();
|
||||||
|
a = s.createElement(o),
|
||||||
|
m = s.getElementsByTagName(o)[0];
|
||||||
|
a.async = 1;
|
||||||
|
a.src = g;
|
||||||
|
m.parentNode.insertBefore(a, m)
|
||||||
|
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
|
||||||
|
|
||||||
|
ga('create', 'UA-60209057-1', 'auto');
|
||||||
|
// ga('send', 'pageview');
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body ng-app="hudozhka.document" ng-controller="DocumentPageController">
|
<body ng-app="hudozhka.document">
|
||||||
<div class="document-block" ng-controller="DocumentController">
|
<div class="document-block" ng-controller="DocumentController">
|
||||||
<div class="menu transparent">
|
<div class="menu transparent">
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
@@ -30,37 +49,5 @@
|
|||||||
<img ng-src="{{url}}" alt="" ng-repeat="url in document.files"/>
|
<img ng-src="{{url}}" alt="" ng-repeat="url in document.files"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Yandex.Metrika counter -->
|
|
||||||
<script>(function (d, w, c) {
|
|
||||||
(w[c] = w[c] || []).push(function () {
|
|
||||||
try {
|
|
||||||
w.yaCounter24027460 = new Ya.Metrika({
|
|
||||||
id: 24027460,
|
|
||||||
webvisor: true,
|
|
||||||
clickmap: true,
|
|
||||||
trackLinks: true,
|
|
||||||
accurateTrackBounce: true
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
var n = d.getElementsByTagName("script")[0], s = d.createElement("script"), f = function () {
|
|
||||||
n.parentNode.insertBefore(s, n);
|
|
||||||
};
|
|
||||||
s.type = "text/javascript";
|
|
||||||
s.async = true;
|
|
||||||
s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//mc.yandex.ru/metrika/watch.js";
|
|
||||||
if (w.opera == "[object Opera]") {
|
|
||||||
d.addEventListener("DOMContentLoaded", f, false);
|
|
||||||
} else {
|
|
||||||
f();
|
|
||||||
}
|
|
||||||
})(document, window, "yandex_metrika_callbacks");</script>
|
|
||||||
<noscript>
|
|
||||||
<div><img src="//mc.yandex.ru/watch/24027460" style="position: absolute; left: -9999px;" alt=""></div>
|
|
||||||
</noscript>
|
|
||||||
<!-- Yandex.Metrika counter -->
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
<div id="page-container" ng-include="pageURL">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
Reference in new issue
Block a user