angular.module('handd', ['ngRoute'])

.value('wikiUrl', 'http://wiki.hackersanddesigners.nl/mediawiki/api.php')
.filter('unsafe', function($sce) {
  return function(val) {
    return $sce.trustAsHtml(val);
  };
})

/*
.service('Utils', function() {
  var self = this;
  this.cleanLinks = function(html) {
    var el = angular.element(html)
    var links = el.find('a');
    console.log(links);
    for(var i = 0; i < links.length; i++) {
      var href  = angular.element(links[i]).attr('href');
      if(href.indexOf('mediawiki') != -1) {
        var params = href.split('?');
        if(params.length > 1) {
          var keyValues = params[1].split('&');
          for(var j = 0; j < keyValues.length; j++) {
            var keyValue = keyValues[j].split('=');
            if(keyValue[0] == 'title') {
              return '{{ keyValue[1] }}' 
            }
          }
        }
        return 'http://wiki.hackersanddesigners.nl' + href;
      }
      return href;
    }
  };
})
*/

.service('Homepage', function(wikiUrl, $http) {
  var self = this;
  this.fetch = function(callback) {
    $http.get(wikiUrl+'?action=parse&page=Hackers_%26_Designers&format=json').then(function(res) {
      var obj = res.data;
      html = obj.parse.text['*'];
      callback(html);
    });
  };
})

.config(function($routeProvider) {
  $routeProvider
  .when('/', {
    controller:'HomepageController as homepage',
    templateUrl:'homepage.html',
    resolve: {
    }
  })
})

.controller('HomepageController', function(Homepage) {
  var homepage = this;
  Homepage.fetch(function(html) {
    //Utils.cleanLinks(html); 
    homepage.html = html; 
  });
});
        

@@ -212,781 +212,8 @@
 %7D)%0A%0A
-/*%0A.service('Utils', function() %7B%0A  var self = this;%0A  this.cleanLinks = function(html) %7B%0A    var el = angular.element(html)%0A    var links = el.find('a');%0A    console.log(links);%0A    for(var i = 0; i %3C links.length; i++) %7B%0A      var href  = angular.element(links%5Bi%5D).attr('href');%0A      if(href.indexOf('mediawiki') != -1) %7B%0A        var params = href.split('?');%0A        if(params.length %3E 1) %7B%0A          var keyValues = params%5B1%5D.split('&');%0A          for(var j = 0; j %3C keyValues.length; j++) %7B%0A            var keyValue = keyValues%5Bj%5D.split('=');%0A            if(keyValue%5B0%5D == 'title') %7B%0A              return '%7B%7B keyValue%5B1%5D %7D%7D' %0A            %7D%0A          %7D%0A        %7D%0A        return 'http://wiki.hackersanddesigners.nl' + href;%0A      %7D%0A      return href;%0A    %7D%0A  %7D;%0A%7D)%0A*/%0A%0A
 .ser
@@ -357,29 +357,25 @@
 age=
-Hackers_%2526_Designers
+Jeremy_Bailey_ad1
 &for
@@ -762,16 +762,16 @@
 = this;%0A
+
   Homepa
@@ -800,39 +800,8 @@
 ) %7B%0A
-    //Utils.cleanLinks(html); %0A
     

change to image