From cd838655c6f138a9c440453fe20703532ccac445 Mon Sep 17 00:00:00 2001 From: Colin Devroe Date: Mon, 18 Feb 2019 15:28:25 -0500 Subject: [PATCH 1/9] Added functionality for adding URLs using a form --- application/config/routes.php | 1 + application/controllers/Marks.php | 60 ++++++++++++++++++++------ application/views/marks/add_by_url.php | 31 +++++++++++++ 3 files changed, 79 insertions(+), 13 deletions(-) create mode 100644 application/views/marks/add_by_url.php diff --git a/application/config/routes.php b/application/config/routes.php index 9c80e98e..e607d1cd 100644 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -56,6 +56,7 @@ // Single Mark Actions $route['marks?/add(.*?)'] = 'marks/add$1'; +$route['marks?/add_by_url(.*?)'] = 'marks/add_by_url$1'; $route['mark/archive(.*?)'] = 'marks/archive$1'; $route['marks?/archive/old.*?'] = 'marks/archive/old'; $route['mark/check(.*?)'] = 'marks/check'; diff --git a/application/controllers/Marks.php b/application/controllers/Marks.php index e513459e..4906450c 100644 --- a/application/controllers/Marks.php +++ b/application/controllers/Marks.php @@ -11,6 +11,12 @@ public function __construct() $this->load->model('users_to_marks_model', 'user_marks'); } + public function add_by_url() + { + // Figure view + $this->figureView('marks/add_by_url'); + } + /* - Add a mark - URLS @@ -24,13 +30,48 @@ public function __construct() */ public function add() { - $redirect = null; - $view = null; - $url = (isset($this->db_clean->url)) ? $this->db_clean->url : null; - $title = (isset($this->db_clean->title)) ? $this->db_clean->title : null; - $options = array('url' => $url, 'title' => $title); + $redirect = null; + $view = null; + $add_from_url = ($this->input->post('add_from_url') !== null ) ? true : false; + + if ( $add_from_url ) : // URL submitted by form within app + $url = $this->input->post('url'); + if (!preg_match("~^(?:f|ht)tps?://~i", $url)) { // Adds HTTP if needed + $url = "http://" . $url; + } + $title = ''; + $dom = new DOMDocument(); + libxml_use_internal_errors(true); + if (!$dom->loadHTMLFile($url, LIBXML_NOWARNING)) { + foreach (libxml_get_errors() as $error) { + // handle errors here + echo '

There was an error adding the mark.

'; + if ( $error->code == 1549 ) { + echo '

Most likely the URL is invalid or the web site isn\'t currently available.

'; + } + //print_r($error); - //print_r( $_GET ); + } + libxml_clear_errors(); + exit; + + } else { + $list = $dom->getElementsByTagName("title"); + if ($list->length > 0) { + $title = $list->item(0)->textContent; + } + } + + if ( strlen($title) == 0 ) : + $title = "Unknown Page Title"; + endif; + + else : // URL submitted via bookmarklet, API, or mobile app + $url = (isset($this->db_clean->url)) ? $this->db_clean->url : null; + $title = (isset($this->db_clean->title)) ? $this->db_clean->title : null; + endif; + + $options = array('url' => $url, 'title' => $title); if ( empty($url) ) { // May be from an app via "share" if ( isset($this->db_clean->notes) && ! empty($this->db_clean->notes) ) { @@ -47,13 +88,6 @@ public function add() } } - // print_r($url); - // print_r($title); - // exit; - - //print_r( $_SERVER['REQUEST_URI'] ); - //exit; - // If label id was passed, use it. if (isset($this->clean->label_id) && is_numeric($this->clean->label_id)) { $options['label_id'] = $this->clean->label_id; diff --git a/application/views/marks/add_by_url.php b/application/views/marks/add_by_url.php new file mode 100644 index 00000000..1b0dea9e --- /dev/null +++ b/application/views/marks/add_by_url.php @@ -0,0 +1,31 @@ +URL:' . $url . '

'; + + $title = ''; + $dom = new DOMDocument(); + libxml_use_internal_errors(true); + if ($dom->loadHTMLFile($_POST['url'])) { + $list = $dom->getElementsByTagName("title"); + if ($list->length > 0) { + $title = $list->item(0)->textContent; + } + } + $time_end = microtime(true); + if ( strlen($title) > 0 ) : echo '

Title: ' . $title . '

'; endif; + $execution_time = ($time_end - $time_start); + echo '

Total Execution Time: '.$execution_time.' seconds

'; + +endif; ?> + +
+ + + +
+ From 3cd3a262fd60d4c7dec07279e7f6f83a412e687f Mon Sep 17 00:00:00 2001 From: Colin Devroe Date: Fri, 8 Mar 2019 15:35:22 -0500 Subject: [PATCH 2/9] Fixed an issue where the sub menu wasnt being hidden when Archive button was clicked. Fixes #240 --- assets/js/unmark.actions.js | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/assets/js/unmark.actions.js b/assets/js/unmark.actions.js index 3115f632..dfc5c218 100644 --- a/assets/js/unmark.actions.js +++ b/assets/js/unmark.actions.js @@ -67,31 +67,42 @@ unmark.interact_nav = function (e, elem_ckd) { e.preventDefault(); - var panel_to_show = (elem_ckd.data('panel')) ? elem_ckd.data('panel') : '', // kept in data attribute - panel_name = (panel_to_show !== '') ? panel_to_show.replace(/^#/, '') : '', // just removes # - is_label_menu = (panel_name.indexOf('label') !== -1) ? true : false, // checks name of panel to see if this is label menu - is_label_filter = (elem_ckd.attr('href').indexOf('label') !== -1) ? true : false, // checks href to see if this is label filter - is_tag_menu = (panel_name.indexOf('tags') !== -1) ? true : false, // checks name of panel to see if it is tags menu - is_tag_filter = (elem_ckd.attr('href').indexOf('tag') !== -1) ? true : false; // checks href to see if this is an actual hashtag + var panel_to_show = (elem_ckd.data('panel')) ? elem_ckd.data('panel') : '', // kept in data attribute + panel_name = (panel_to_show !== '') ? panel_to_show.replace(/^#/, '') : '', // just removes # + is_label_menu = (panel_name.indexOf('label') !== -1) ? true : false, // checks name of panel to see if this is label menu + is_label_filter = (elem_ckd.attr('href').indexOf('label') !== -1) ? true : false, // checks href to see if this is label filter + is_tag_menu = (panel_name.indexOf('tags') !== -1) ? true : false, // checks name of panel to see if it is tags menu + is_tag_filter = (elem_ckd.attr('href').indexOf('tag') !== -1) ? true : false, // checks href to see if this is an actual hashtag + is_archive_menu = (panel_name.indexOf('archive') !== -1) ? true : false, // checks panel name to see if this is the archive menu + hide_mobile_sub_menu = false; // on mobile, hide the submenu, default false // This means one of the labels was clicked. if ( is_label_menu || is_label_filter ) { - panel_name = 'panel-label'; - panel_to_show = '#'+panel_name; - + panel_name = 'panel-label'; + panel_to_show = '#'+panel_name; + hide_mobile_sub_menu = true; // hiding submenu } // For the tag menu, or actual hashtags if ( is_tag_menu || is_tag_filter ) { - panel_name = 'panel-tags'; - panel_to_show = '#'+panel_name; + panel_name = 'panel-tags'; + panel_to_show = '#'+panel_name; + if ( is_tag_menu && is_tag_filter ) { + hide_mobile_sub_menu = true; + } else if ( is_tag_menu && !is_tag_filter ) { // tag menu was clicked, but _Not_ tag filter + hide_mobile_sub_menu = false; + } + } + + if ( is_archive_menu ) { + hide_mobile_sub_menu = true; } // Add / Remove Class for current navigation $('.menu-item').removeClass('active-menu'); $('.navigation-content').find("[data-menu='" + panel_name + "']").addClass('active-menu'); - // For all panels run pjax manually. + // For all panels (except settings) run pjax manually. if ( panel_to_show !== "#panel-settings" ) { $.pjax({ url: elem_ckd.attr('href'), container: '.main-content', timeout:6000 }); } @@ -104,7 +115,7 @@ // clicked on any main navigation item other than hashtags // click on an actual hashtag // click on an actual label - if (Modernizr.mq('only screen and (max-width: 480px)') && panel_to_show !== '#panel-settings' && (is_label_menu || is_tag_filter || is_label_filter)) { + if (Modernizr.mq('only screen and (max-width: 480px)') && hide_mobile_sub_menu ) { unmark.mobile_nav(true); } return false; From 829cbb24110cb900cd6d9057e18c53d373bf1a33 Mon Sep 17 00:00:00 2001 From: Kyle Ruane Date: Sat, 16 Mar 2019 15:45:45 -0400 Subject: [PATCH 3/9] Include markup for add mark bar --- .../views/layouts/topbar/searchform.php | 11 +++++++++ assets/css/partials/_main.scss | 24 ++++++++++++++++--- assets/js/unmark.init.js | 9 +++++++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/application/views/layouts/topbar/searchform.php b/application/views/layouts/topbar/searchform.php index 679a7a6c..5af6b4cd 100644 --- a/application/views/layouts/topbar/searchform.php +++ b/application/views/layouts/topbar/searchform.php @@ -2,6 +2,9 @@ + + + +
+ +
+ + +
+ +
diff --git a/assets/css/partials/_main.scss b/assets/css/partials/_main.scss index 4029329f..627a05b7 100644 --- a/assets/css/partials/_main.scss +++ b/assets/css/partials/_main.scss @@ -92,7 +92,7 @@ padding: 16px 20px 16px 30px; height: 80px; } - .search-bar { + .search-bar, .add-mark-bar { height: 100%; width: 100%; padding: 14px 100px 16px 18px; @@ -190,6 +190,23 @@ } } } + .add-mark-bar { + @include sm { + padding: 16px 170px 16px 60px; + } + button { + width: 42px; + @include sm { + width: 86px; + } + span { + display: none; + @include sm { + display: inline; + } + } + } + } .buttons { display: block; width: auto; @@ -204,15 +221,16 @@ right: 20px; } > a { - display: block; + display: inline-block; width: 28px; height: 28px; border-radius: 50%; - margin-left: 10px; + margin-left: 4px; @include sm { border: 1px solid darken(desaturate($color_gray, 10%), 18%); width: 32px; height: 32px; + margin-left: 10px; } svg { fill: darken(desaturate($color_gray, 10%), 18%); diff --git a/assets/js/unmark.init.js b/assets/js/unmark.init.js index 7ef7e32c..d1dbf21d 100644 --- a/assets/js/unmark.init.js +++ b/assets/js/unmark.init.js @@ -215,6 +215,15 @@ e.preventDefault(); $(this).closest('.search-bar').fadeOut(300); }); + // Show & Hide Add Mark Bar + $(document).on('click', '.marks-heading-bar .add-mark-button', function(e) { + e.preventDefault(); + $(this).closest('.marks-heading-bar').find('.add-mark-bar').fadeIn(300); + }); + $(document).on('click', '.marks-heading-bar .add-mark-bar .close-button', function(e) { + e.preventDefault(); + $(this).closest('.add-mark-bar').fadeOut(300); + }); }; From 210319721d6c4e7f407b60777bb14fe35ca05904 Mon Sep 17 00:00:00 2001 From: Colin Devroe Date: Tue, 19 Mar 2019 16:37:03 -0400 Subject: [PATCH 4/9] Connected the wires to the add by URL form. --- application/controllers/Marks.php | 11 ++++++++++- application/views/layouts/topbar/searchform.php | 7 ++++--- application/views/marks/info.php | 8 +++++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/application/controllers/Marks.php b/application/controllers/Marks.php index 4906450c..09102ed4 100644 --- a/application/controllers/Marks.php +++ b/application/controllers/Marks.php @@ -110,7 +110,11 @@ public function add() } else { $this->data['mark'] = $user_mark; - $redirect = '/mark/info/' . $user_mark->mark_id . '?bookmarklet=true'; + if ( $add_from_url ) { + $redirect = '/mark/info/' . $user_mark->mark_id . '?bookmarklet=false'; + } else { + $redirect = '/mark/info/' . $user_mark->mark_id . '?bookmarklet=true'; + } } // Figure what to do here (api, redirect or generate view) @@ -607,6 +611,11 @@ public function info($mark_id=0) $this->data['no_header'] = true; $this->data['no_footer'] = true; + // print_r($_GET['bookmarklet']); + // exit; + + $this->data['bookmarklet'] = (isset($_GET['bookmarklet'])) ? $_GET['bookmarklet'] : true; + // Figure view $this->figureView('marks/info'); } diff --git a/application/views/layouts/topbar/searchform.php b/application/views/layouts/topbar/searchform.php index d6a8330c..35c1ba80 100644 --- a/application/views/layouts/topbar/searchform.php +++ b/application/views/layouts/topbar/searchform.php @@ -16,9 +16,10 @@
-
- - + + + +
diff --git a/application/views/marks/info.php b/application/views/marks/info.php index da1b8e1d..2a9cbab4 100644 --- a/application/views/marks/info.php +++ b/application/views/marks/info.php @@ -47,11 +47,17 @@
+
+
- + + + + +
From 8a197bb9aa8e230f5c63663ea77baeb80c0b7932 Mon Sep 17 00:00:00 2001 From: Colin Devroe Date: Wed, 20 Mar 2019 16:21:59 -0400 Subject: [PATCH 5/9] Added ability to delete from main marks list. Fixes #111 --- assets/js/templates/JS-Templates.html | 4 +--- assets/js/templates/unmark-templates.js | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/assets/js/templates/JS-Templates.html b/assets/js/templates/JS-Templates.html index a81e0d9b..1970e6b3 100644 --- a/assets/js/templates/JS-Templates.html +++ b/assets/js/templates/JS-Templates.html @@ -25,9 +25,7 @@

Preview

Notes (click to edit)

- {{#archived_on}} - - {{/archived_on}} + diff --git a/assets/js/templates/unmark-templates.js b/assets/js/templates/unmark-templates.js index 3b2d9e1d..5640f403 100644 --- a/assets/js/templates/unmark-templates.js +++ b/assets/js/templates/unmark-templates.js @@ -2,7 +2,7 @@ if (unmark === undefined) { var unmark = {}; } unmark.template = unmark.template || {}; -unmark.template.sidebar = '

URL

{{#archived_on}}{{/archived_on}}
'; +unmark.template.sidebar = '

URL

'; //unmark.template.marks = '

{{title}}

{{nice_time}}{{prettyurl}}
'; unmark.template.marks = '

{{title}}

{{nice_time}} {{prettyurl}}
{{#archived_on}} {{/archived_on}} {{^archived_on}} {{/archived_on}}
'; From 796e451bd62cff86f0d4b6d3a64fb769b650545d Mon Sep 17 00:00:00 2001 From: Colin Devroe Date: Wed, 20 Mar 2019 16:33:02 -0400 Subject: [PATCH 6/9] Updated version number --- application/config/config.php | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/application/config/config.php b/application/config/config.php index b43cecfe..68077fd2 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -11,7 +11,7 @@ | version.point.release | */ -$config['unmark_version'] = '1.8.1'; +$config['unmark_version'] = '1.9.0'; /* |-------------------------------------------------------------------------- diff --git a/package.json b/package.json index 83960d46..899113d7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "unmark", "url": "http://unmark.it", - "version": "1.8.0", + "version": "1.9.0", "description": "The open source to-do application for bookmarks.", "author": "https://unmark.it/", "main": "Gruntfile.js", From 4af7b9eabc09fa039c1d59983e4bd52206cf066c Mon Sep 17 00:00:00 2001 From: Colin Devroe Date: Thu, 21 Mar 2019 09:10:15 -0400 Subject: [PATCH 7/9] Removed changelog from OS version. Updated readme to include that mySQL 5.7+ is now required. --- application/views/singletons/changelog.php | 57 ---------------------- readme.md | 2 +- 2 files changed, 1 insertion(+), 58 deletions(-) delete mode 100644 application/views/singletons/changelog.php diff --git a/application/views/singletons/changelog.php b/application/views/singletons/changelog.php deleted file mode 100644 index 40514d95..00000000 --- a/application/views/singletons/changelog.php +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - <?php echo unmark_phrase('Unmark : Version Changelog'); ?> - - - - - - - - - -

Changelog

- -

This changelog relates to the hosted version of Unmark at unmark.it

- -

Wednesday, February 27, 2019

-Version: 1.8.1 -
    -
  • Fix: The information sidebar wasn't loading correct bookmark's info
  • -
  • Fix: On iPad Pro you no longer need to double-tap to visit or archive a bookmark.
  • -
  • Fix: On iPad Pro the bookmark information sidebar can now be shown.
  • -
  • New: This changelog! Clicking on the version number shows this changelog on Unmark.it
  • -
- -

Saturday, February 23, 2019

-Version: 1.8.095 -
    -
  • New: An all-new design
  • -
  • New: A new icon!
  • -
  • New: Support for importing from Pocket
  • -
  • Fix: Better compatibility with password managers
  • -
  • New: Progressive Web App Support (to install, Add To Homescreen on your mobile device)
  • -
  • New: Share to Unmark (Android only)
  • -
  • Fix: Speed improvements throughout the app
  • -
- - - - - - - - diff --git a/readme.md b/readme.md index 85a306ec..f6e4b100 100644 --- a/readme.md +++ b/readme.md @@ -18,7 +18,7 @@ Running Unmark is only recommended for intermediate users. This doesn't mean if - Apache 2.x - PHP 5.6 or greater -- mySQL 5.5 or greater +- mySQL 5.7 or greater **Experimental: Docker** If you're going to use Docker we've included the appropriate Docker Compose, Dockerfile, and PHP.ini files to do so. This is still in its experimental phase though. We will update this readme with better instructions. From c8a26e8670b5cdb883b13d42df8e5f29205f6450 Mon Sep 17 00:00:00 2001 From: Colin Devroe Date: Thu, 21 Mar 2019 11:17:51 -0400 Subject: [PATCH 8/9] Addressed an issue with mobile navigation for hashtags --- assets/js/unmark.actions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/unmark.actions.js b/assets/js/unmark.actions.js index dfc5c218..52ecd7fd 100644 --- a/assets/js/unmark.actions.js +++ b/assets/js/unmark.actions.js @@ -87,7 +87,7 @@ if ( is_tag_menu || is_tag_filter ) { panel_name = 'panel-tags'; panel_to_show = '#'+panel_name; - if ( is_tag_menu && is_tag_filter ) { + if ( !is_tag_menu && is_tag_filter ) { // tag filter was clicked hide_mobile_sub_menu = true; } else if ( is_tag_menu && !is_tag_filter ) { // tag menu was clicked, but _Not_ tag filter hide_mobile_sub_menu = false; From 4d3ae0a2f7d91bc3d9216680c6509a74fa6969ee Mon Sep 17 00:00:00 2001 From: Colin Devroe Date: Thu, 21 Mar 2019 12:57:05 -0400 Subject: [PATCH 9/9] Fixed an issue with long URLs showing full length in the bookmark list. --- assets/css/partials/_stream.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/css/partials/_stream.scss b/assets/css/partials/_stream.scss index 4587810f..6f05ddbd 100644 --- a/assets/css/partials/_stream.scss +++ b/assets/css/partials/_stream.scss @@ -102,7 +102,7 @@ .mark-link a { text-decoration: none; color: darken($color_light, 15%); - display: inline; + display: inline-block; vertical-align: bottom; @include unmark-truncate(65%); }