Advertisement
Guest User

wunderlist.html

a guest
Nov 17th, 2018
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.91 KB | None | 0 0
  1. <style type="text/css">
  2.     .wunderlist-item
  3.     {
  4.         width: calc(50% - 16px);
  5.  
  6.         display: inline-block;
  7.         margin: 0 8px;
  8.         padding: 4px 0;
  9.         min-height: 48px;
  10.  
  11.         font-family: "Helvetica", "Arial", sans-serif;
  12.         font-size: 14px;
  13.         font-weight: 400;
  14.         line-height: 20px;
  15.         color: #616161;
  16.  
  17.         border-bottom: 1px solid #cccccc;
  18.     }
  19.  
  20.     .wunderlist-item img
  21.     {
  22.         margin-right: 12px;
  23.         position: relative;
  24.         top: 10px;
  25.     }
  26.  
  27.     @media only screen and (max-width: 839px)
  28.     {
  29.         .wunderlist-item
  30.         {
  31.             width: calc(100% - 16px);
  32.         }
  33.     }
  34. </style>
  35.  
  36. <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script>
  37. <script type="text/javascript">
  38.     var wunderlistApp = angular.module("wunderlistApp", []);
  39.     wunderlistApp.controller("wunderlistCtrl", function($scope, $http) {
  40.  
  41.         // get "list" parameter value
  42.         name= "list";
  43.         name = name.replace(/[\[\]]/g, "\\$&");
  44.         var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)");
  45.         var results = regex.exec(document.location.href);
  46.         if (!results) return null;
  47.         if (!results[2]) return '';
  48.         listId = decodeURIComponent(results[2].replace(/\+/g, " "));
  49.  
  50.         // grab data
  51.         $scope.wunderlistInterval = null;
  52.         $scope.wunderlistRefresh = function()
  53.         {      
  54.             $http({
  55.                 method: 'GET',
  56.                 url: "PATH_TO_WUNDERLIST.PHP/?list=" + listId,
  57.                 timeout: 2000
  58.             }).then(function(response) {
  59.                 $scope.wunderlistTasks = response.data.data.tasks;  
  60.             });
  61.             $scope.wunderlistInterval = setTimeout($scope.wunderlistRefresh, 3000);
  62.         }
  63.         $scope.wunderlistRefresh();
  64.  
  65.     });
  66.  
  67. </script>
  68.  
  69.  
  70.  
  71. <section ng-app="wunderlistApp" ng-controller="wunderlistCtrl">
  72.     <div class="wunderlist-item" ng-repeat="task in wunderlistTasks">
  73.         <img src="PATH_TO_ICON_32x32" width="32">
  74.         {{task.title}} <small ng-if="task.due_date != ''">{{task.due_date}}</small>
  75.     </div>   
  76. </section>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement