Advertisement
aidahalitaj

Untitled

Mar 27th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.26 KB | None | 0 0
  1.  
  2. if(Meteor.isClient){
  3.  
  4. toastr.options = {
  5. "closeButton": false,
  6. "debug": false,
  7. "newestOnTop": false,
  8. "progressBar": false,
  9. "positionClass": "toast-top-center",
  10. "preventDuplicates": false,
  11. "onclick": null,
  12. "showDuration": "300",
  13. "hideDuration": "1000",
  14. "timeOut": "5000",
  15. "extendedTimeOut": "1000",
  16. "showEasing": "swing",
  17. "hideEasing": "linear",
  18. "showMethod": "fadeIn",
  19. "hideMethod": "fadeOut"
  20. }
  21. Tracker.autorun(function(){
  22. Meteor.subscribe("roles");
  23. Meteor.subscribe("UrlQuality");
  24. Meteor.subscribe("DigitalMarketingStandards")
  25. });
  26. Tracker.autorun(function(){
  27. if(Meteor.user()){
  28. Meteor.subscribe("Company",Meteor.userId());
  29. if(Meteor.user().profile.role == "admin"){
  30. Meteor.subscribe("images",Meteor.userId());
  31. }else{
  32. Meteor.subscribe("images",Meteor.user().profile.company_id);
  33. }
  34. Meteor.subscribe("CompanyImages",Meteor.userId());
  35. company_id = Meteor.user().profile.company_id;
  36. // Meteor.subscribe("digital_assessment_for_company",company_id)
  37. if(!Iron.Location.get().path.includes("timeline")){
  38. if(Meteor.user().profile.role == "Admin"){
  39. company = Company.findOne({base_company:true})
  40. }else{
  41. company_id = Meteor.user().profile.company_id;
  42. company = Company.findOne({_id:company_id})
  43. }
  44. if(company){
  45. Meteor.subscribe("digital_assessment_for_company",company._id)
  46. }
  47. }
  48. }else{
  49. var website_name = Cookie.get('digi_page_url') == undefined ? "" : Cookie.get('digi_page_url');
  50. Meteor.subscribe("digital_assessment_for_domain",website_name)
  51. }
  52.  
  53. });
  54. $.fn.extend({
  55. animateCss: function (animationName) {
  56. var animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
  57. this.addClass('animated ' + animationName).one(animationEnd, function() {
  58. $(this).removeClass('animated ' + animationName);
  59. });
  60. }
  61. });
  62. }
  63.  
  64. url_validate = function(url){
  65. var url_regx = new RegExp(/(http(s)?:\\)?([\w-]+\.)+[\w-]+[.com|.in|.org]+(\[\?%&=]*)?/);
  66. if(url_regx.test(url)){
  67. if(url.includes("http://") || url.includes("https://")){
  68. return url;
  69. }else{
  70. return "http://"+url
  71. }
  72. }else{
  73. return false;
  74. }
  75. }
  76. delay = function (fn, t)
  77. {
  78. // private instance variables
  79. var queue = [], self, timer;
  80.  
  81. function schedule(fn, t) {
  82. timer = setTimeout(function() {
  83. timer = null;
  84. fn();
  85. if (queue.length) {
  86. var item = queue.shift();
  87. schedule(item.fn, item.t);
  88. }
  89. }, t);
  90. }
  91. self = {
  92. delay: function(fn, t) {
  93. // if already queuing things or running a timer,
  94. // then just add to the queue
  95. if (queue.length || timer) {
  96. queue.push({fn: fn, t: t});
  97. } else {
  98. // no queue or timer yet, so schedule the timer
  99. schedule(fn, t);
  100. }
  101. return self;
  102. },
  103. cancel: function() {
  104. clearTimeout(timer);
  105. queue = [];
  106. }
  107. };
  108. return self.delay(fn, t);
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement