Skip to content

Commit

Permalink
fix(helper): Fix missing timestamp on safari (close #12)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnnyTheTank committed Jan 24, 2016
1 parent 9970154 commit e3fc0e1
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"authors": [
"Jonathan Hornung <[email protected]>"
],
"version": "0.7.6",
"version": "0.7.7",
"description": "Twitter plugin for apiNG",
"main": "dist/aping-plugin-codebird.min.js",
"moduleType": [],
Expand Down
6 changes: 2 additions & 4 deletions demo/template.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<div class="aping-design-sample">
<div>
<div ng-repeat="item in results">
<pre>{{item | json}}</pre>
</div>
<div ng-repeat="item in results">
<pre>{{item | json}}</pre>
</div>
</div>
14 changes: 9 additions & 5 deletions dist/aping-plugin-codebird.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
@name: aping-plugin-codebird
@version: 0.7.6 (24-01-2016)
@version: 0.7.7 (24-01-2016)
@author: Jonathan Hornung <[email protected]>
@url: https://github.com/JohnnyTheTank/apiNG-plugin-codebird
@license: MIT
Expand Down Expand Up @@ -251,13 +251,15 @@ angular.module("jtt_aping_codebird")
blog_id: _item.user.id_str,
blog_link: this.getThisPlattformLink() + _item.user.screen_name + "/",
intern_id: _item.id_str,
timestamp: new Date(Date.parse(_item.created_at.replace(/( \+)/, ' UTC$1'))).getTime(),
timestamp: new Date(Date.parse(_item.created_at.replace(/^\w+ (\w+) (\d+) ([\d:]+) \+0000 (\d+)$/, "$1 $2 $4 $3 UTC"))).getTime(),
text: _item.text,
shares: _item.retweet_count,
likes: _item.favorite_count,
});

socialObject.date_time = new Date(socialObject.timestamp);
if(socialObject.timestamp) {
socialObject.date_time = new Date(socialObject.timestamp);
}

if (_item.entities && _item.entities.media && _item.entities.media.length > 0) {
socialObject.source = _item.entities.media;
Expand Down Expand Up @@ -286,13 +288,15 @@ angular.module("jtt_aping_codebird")
blog_id: _item.user.id_str,
blog_link: this.getThisPlattformLink() + _item.user.screen_name + "/",
intern_id: _item.id_str,
timestamp: new Date(Date.parse(_item.created_at.replace(/( \+)/, ' UTC$1'))).getTime(),
timestamp: new Date(Date.parse(_item.created_at.replace(/^\w+ (\w+) (\d+) ([\d:]+) \+0000 (\d+)$/, "$1 $2 $4 $3 UTC"))).getTime(),
text: _item.text,
shares: _item.retweet_count,
likes: _item.favorite_count,
});

imageObject.date_time = new Date(imageObject.timestamp);
if(imageObject.timestamp) {
imageObject.date_time = new Date(imageObject.timestamp);
}

if (_item.entities && _item.entities.media && _item.entities.media.length > 0) {

Expand Down
4 changes: 2 additions & 2 deletions dist/aping-plugin-codebird.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aping-plugin-codebird",
"version": "0.7.6",
"version": "0.7.7",
"description": "Twitter plugin for apiNG",
"main": "dist/aping-plugin-codebird.min.js",
"scripts": {
Expand Down
12 changes: 8 additions & 4 deletions src/aping-codebird-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,15 @@ angular.module("jtt_aping_codebird")
blog_id: _item.user.id_str,
blog_link: this.getThisPlattformLink() + _item.user.screen_name + "/",
intern_id: _item.id_str,
timestamp: new Date(Date.parse(_item.created_at.replace(/( \+)/, ' UTC$1'))).getTime(),
timestamp: new Date(Date.parse(_item.created_at.replace(/^\w+ (\w+) (\d+) ([\d:]+) \+0000 (\d+)$/, "$1 $2 $4 $3 UTC"))).getTime(),
text: _item.text,
shares: _item.retweet_count,
likes: _item.favorite_count,
});

socialObject.date_time = new Date(socialObject.timestamp);
if(socialObject.timestamp) {
socialObject.date_time = new Date(socialObject.timestamp);
}

if (_item.entities && _item.entities.media && _item.entities.media.length > 0) {
socialObject.source = _item.entities.media;
Expand Down Expand Up @@ -174,13 +176,15 @@ angular.module("jtt_aping_codebird")
blog_id: _item.user.id_str,
blog_link: this.getThisPlattformLink() + _item.user.screen_name + "/",
intern_id: _item.id_str,
timestamp: new Date(Date.parse(_item.created_at.replace(/( \+)/, ' UTC$1'))).getTime(),
timestamp: new Date(Date.parse(_item.created_at.replace(/^\w+ (\w+) (\d+) ([\d:]+) \+0000 (\d+)$/, "$1 $2 $4 $3 UTC"))).getTime(),
text: _item.text,
shares: _item.retweet_count,
likes: _item.favorite_count,
});

imageObject.date_time = new Date(imageObject.timestamp);
if(imageObject.timestamp) {
imageObject.date_time = new Date(imageObject.timestamp);
}

if (_item.entities && _item.entities.media && _item.entities.media.length > 0) {

Expand Down

0 comments on commit e3fc0e1

Please sign in to comment.