قالب وردپرس درنا توس
Home / Health / How to analyze sleep

How to analyze sleep



How to analyze sleep? Here are the useful tools to understand if we sleep well.

  How to analyze sleep

How to analyze sleep ? We all know that a Good Night not only guarantees a better awakening, but also excellent health. If you sleep well at night, our body can not only prepare for a new day, but also strengthen it again. Unfortunately, sleep disorders are common today

Quality of sleep is very important, provided you do not overdo it: we have actually discovered that there is a real obsession called orthosomy. We must not make the analysis of sleep mania, but checking how you sleep might be the key to solving minor or major nightmare problems.

How to analyze sleep

How to analyze sleep

? There are many activity trackers on the market, electronic devices worn all day and even at night to monitor sports activities, heartbeats and other health information. The Sleep Trackers are able to monitor sleep, understand how we sleep, and whether we need to do something to improve our sleep.

In practice, these devices can analyze the duration of sleep and movement at night to understand not only the quantity but also the quality of sleep. They are available in the form of apps, bracelets or sensors and can be synchronized with smartphones to analyze all available data in the morning to understand how much we slept, how awake we were and how we went to sleep [19659006]

The Modern Sleep and Activity Tracker is very accurate, but be careful not to abuse it. They are useful tools for understanding whether we sleep well, but we do not have to make a diagnosis: it's up to the doctor, maybe we'll let him know about the data we've acquired.

iStock Photo

// FB object _p.FB = FB;

// the current FB user status _p.currentUserFbStatus = & # 39; unknown & # 39 ;;

// Automatic sharing enabled by BlogoUser? _p.frictionlessSharingEnabled = BlogoUser.shareAppActive;

// Timeout for auto-release _p.frictionlessSharingTimeout = 10000;

// read article on fb _p.articles = null; _p.articlesPerPages = 4; _p.articlesCurrentPage = 0; _p.fb_pushing = false;

// Check if a console exists if (typeof console == "undefined") _p.console = {protocol: function () {}}; otherwise _p.console = console;

var debugging = false;

if (! debugging) _p.console = {protocol: function () {}};

_p.isPushing = Function () { return _p.fb_pushing; }; _p.setPushing = Function (_v) { _p.fb_pushing = _v; }; _p.getPermalink = function () { var permalink = (_p.permalink)? _p.permalink: window.location.href; var _url = permalink.replace (/#.*/, ""); return _url; }

// Init pub.init = function () {

_p.console.log (& # 39; FBManager init & # 39;);

// Check the Fb login status _p.FB.getLoginStatus (Function (Response) {

if (answer.status === & # 39; connected & # 39;) {

_p.console.log (& # 39; Connected to FB & # 39;); _p.currentUserFbStatus = & # 39; connected & # 39 ;;

var accessToken = response.authResponse.accessToken;

// If the user is logged in to the community, you do not have to proceed if (BlogoUser.loggedInCommunity) { _p.console.log (& # 39; connected to "community" & # 39;); _p.handleTabArticles (); Return; }

if (! BlogoUser.loggedInFacebook) { // checks if the user is registered in the community and uses the interface $ Snippets ({ url: BlogoConfig.siteUrl + & # 39; / ajax / is-logged & # 39 ;, xhrFields: {withCredentials: true}, File type: & # 39; json & # 39 ;, Data: {# accessToken # accessToken}, Success: Function (Data, Status, xhr) { _p.initInterface (data, response, xhr); }, }); } otherwise { _p.console.log (& # 39; Not connected to FB, the current user status is: & # 39; + response.status + & # 39; & # 39; & # 39; } });

// triggers an event for loaded data $ (Window) .trigger (& # 39; FBManager.init_finish & # 39;); };

pub.fbLogin = function () { if (_p.FB) { _p.FB.login (function (response) { if (answer.status == & # 39; connected & # 39;) {

_p.console.log (& # 39; Connected to FB & # 39;); _p.currentUserFbStatus = & # 39; connected & # 39 ;;

var accessToken = response.authResponse.accessToken;

// checks if the user is registered in the community and uses the interface $ Snippets ({ url: BlogoConfig.siteUrl + & # 39; / ajax / is-logged & # 39 ;, xhrFields: {withCredentials: true}, File type: & # 39; json & # 39 ;, Data: {accessToken #: accessToken, # 39; onlyFbLogin #: true}, Success: Function (Data, Status, xhr) { _p.initInterface (data, response, xhr); }, }); } }, {scope: & # 39; email & # 39;}); otherwise { _p.console.log (& # 39; FB object not present & # 39;); }

};

// renders the HTML code for the menu and the comment field _p.initInterface = function (data, response, xhr) { if (data.ret == & # 39; ok & # 39; && data.userdata) { // sets the current FB user status _p.currentUserFbStatus = & # 39; connected & # 39 ;;

// sets the BlogoUser object BlogoUser.loggedInCommunity = data.logged; BlogoUser.loggedInFacebook = true; BlogoUser.userdata.avatar = data.userdata.avatar; BlogoUser.userdata.visibleName = data.userdata.visibleName;

// triggers an event for loaded data $ (Window) .trigger (& # 39; FBManager.facebook_data_loaded & # 39;);

// is logged in the community if (data.logged) { // replaces the menu if (data.profile_menu) { _p.console.log (& # 39; Rendering Menu & # 39;); $ (# Nav #) ReplaceWith (data.profile_menu). $ (& # 39; # fbAct_Logout & # 39;). bind (& # 39; click & # 39 ;, {}, _p.logout); } // set ShareAppActive if (data.userdata.shareAppActive) { _p.frictionlessSharingEnabled = data.userdata.shareAppActive; } } // render the shared articles _p.handleTabArticles (); otherwise { _p.console.log (data.message); } };

pub.postAction = function () { if (_p.isPushing ()) { _p.console.log (& # 39; Pushing news.reads in progress ... & # 39;); Return; } if (_p.isCurrentArticleAlreadyPushed ()) { _p.console.log (& # 39; current article is already pushed ... & # 39;); Return; } _p.setPushing (true); _p.fbPostAction (_p.fbPostedAction); };

_p.fbPostAction = Function (_callback) { var permalink = _p.getPermalink (); _p.FB.api ( & # 39; /me/news.reads article = & # 39?; + encodeURIComponent (permalink), & # 39; Post & # 39 ;, Function (answer) { if (! answer || answer.error) { if (answer.error) { _p.console.log (response.error.message); } otherwise { _p.current_url_id = Answer.id; if (typeof _callback! = & # 39; undefined & # 39;) _callback (response); _p.console.log (response.id); } }); }

_p.fbPostedAction = Function (_Answer) { _p.FB.api ( , /'+_response.id, & # 39; Get & # 39 ;, Function (answer) { if (! answer || answer.error) { _p.console.log (response.error.message); otherwise { _p.console.log (& # 39; Fb news.reads pushed & # 39;); _p.console.log (response); _p.articles.splice (0,0, response); _p.renderTabArticles (); } }); };

_p.isCurrentArticleAlreadyPushed = Function () { if (! _p.articles) Return wrong; var _data = _p.articles; var _url = _p.getPermalink (); var article_url = null; for (var n in _data) { article_url = _data [n] .data.article.url; if (article_url == _url) { // Deactivate Return true; } } Return wrong; };

_p.handleTabArticles = function () { _p.FB.api (& # 39; / me / Permissions & # 39 ;, Function (Response) { if (answer.error) { _p.console.log (& # 39; / me error: & # 39; + response.error); Return; }

var publish_permission = false; if (response.data && response.data.length> 0) { for (i in response.data) { if (response.data [i] .permission == & # 39; publish_actions & # 39; && response.data [i] .status == & # 39; granted & # 39; publish_permission = true; } } }

if (publish_permission) { _p.console.log (& # 39; FB publish permission accepted & # 39;); _p.fbGetActivitiesHistory (_p.gotActivitiesHistory); if (_p.frictionlessSharingEnabled && BlogoConfig.pageType == & # 39; post & # 39;) { window.setTimeout (pub.postAction, _p.frictionlessSharingTimeout); } otherwise { _p.console.log (& # 39; No FB publishing permission & # 39;); _p.frictionlessSharingEnabled = false } }); };

_p.gotActivitiesHistory = Function () { _p.renderTabArticles (); };

_p.fbGetActivitiesHistory = Function (_targetFunct, _offset, _limit) { if (typeof_offset == & # 39; undefined & # 39;) _offset = & # 39; 0 & # 39 ;; if (typeof_limit == & # 39; undefined & # 39;) _limit = & # 39; 100 & # 39 ;; _p.FB.api ( & # 39; /me/news.reads&#39 ;, {method: & # 39; get, # limit, _limit, offset: _offset}, Function (answer) { if (! answer || answer.error) { _p.console.log (response.error.message); otherwise { if (response.data) { _p.articles = Answer.data; _targetFunct (); } otherwise { _p.console.log (& # 39; No FB news.reads data found & # 39;); } } }); };

// renders the box of the article _p.renderTabArticles = Function () {

var _data = _p.articles; if (_data == null) Return; var totalPages = Math.ceil (_data.length / _p.articlesPerPages); var itemsCounter = 0; if (_p.articlesCurrentPage < 0) _p.articlesCurrentPage = 0; if (_p.articlesCurrentPage > = totalPages) _p.articlesCurrentPage = totalPages-1;

, $ (& # 39; # FbAct_Pages & # 39;) text ((p.articlesCurrentPage + 1) + "/" + totalpages);

if (_data.length) { var start = _p.articlesCurrentPage * _p.articlesPerPages; var end = Math.min (Start + _p.articlesPerPages, _data.length);

// deletes all

  • except titles $ ("ul.readarticles li: gt (0)"). remove ();

    for (var n = start; n < end; n++) { var title = (_data[n].data.article.title.length > _p.maxTitleLength)? Date [n] .data.article.title.slice (0, _p.maxTitleLength - 1) + "...": _data [n] .data.article.title; var tpl = & # 39; & # 39 ;; tpl + = & # 39;

  • & # 39; + Title + & # 39;
  • & # 39 ;; $ ('Readarticles.) Append (dwt). $ (& # 39; # FbAct_ArticleDelete _ & # 39; + _ date [n] .id) .bind (& # 39; Click & # 39 ;, {id: _data [n]. id, callback: _p.removeArticlesPaged}, _p.clickDeleteAction); itemsCounter ++; } } $ ('Sharedarticles.) Show ().

    totalpages> 1 ? $ (& # 39; # FbAct_PageTab & # 39;). Show () : $ (# # FbAct_PageTab #). hide ();

    $ (& # 39; # fbAct_PagesPrev & # 39;). click (-1, _p.clickShowArticlesPaged); $ (& # 39; # fbAct_PagesNext & # 39;). click (1, _p.clickShowArticlesPaged); };

    _p.deleteArticle = Function (_id) { for (c in _p.articles) { if (_p.articles [c]. id == _id) { _p.articles.splice (c, 1); _p.renderTabArticles (); break; } } };

    _p.clickDeleteAction = Function (_e) { _e.stopPropagation (); if (typeof _e! = & # 39; undefined & # 39; &&_e.data.id &&_e.data.callback) { var anchor_id = & # 39; #fbAct_ArticleAnchor _ & # 39; + _ e.data.id; var span_id = & # 39; #fbAct_ArticleDelete _ & # 39; + _ e.data.id; $ (anchor_id) .css ({opacity: 0.5}); $ (Span_id) .removeClass (& # 39; deleteRead & # 39;). AddClass (& # 39; deleteLoad & # 39;) _p.fbDeleteAction (_e.data.id, _e.data.callback); } Return wrong; };

    _p.removeArticlesPaged = Function (_Response) { _p.renderTabArticles (); };

    _p.fbDeleteAction = function (_id, _callback) { _p.FB.api ( & # 39; / & # 39; + _id, ,Clear', Function (answer) { if (! answer || answer.error) { // ugly hack ... definitely delete. _p.deleteArticle (_id); if (_callback) _callback (response); _p.console.log (response.error.message); otherwise { _p.deleteArticle (_id); if (_callback) _callback (response); _p.console.log (& # 39; Fb news.reads delete done succeeded & # 39;); _p.renderTabArticles (); } }); };

    _p.clickShowArticlesPaged = Function (_e) { if (typeof _e! = "undefined") { _e.preventDefault (); _p.articlesCurrentPage + = _e.data; } _p.renderTabArticles (); };

    _p.logout = function (s) { e.preventDefault (); var href = this.href;

    if (_p.currentUserFbStatus == & # 39; connected & # 39;) { _p.FB.logout (function (response) { // When a community member is redirected to the project if (BlogoUser.loggedInCommunity) { href = window.location.href; } }); } href = window.location.href; }

    $ (& # 39; # fbAct_Logout & # 39;). bind (& # 39; click & # 39 ;, {}, _p.logout);

    Return pub; }

    window.fbAsyncInit = function () { FB.init ({ appId: BlogoConfig.fbAppId, Version: & # 39; v2.2 & # 39 ;, xfbml: 1, Cookies: true }); window.fbManager = new FBManager (FB); window.fbManager.init (); };

    (Function (d, s, id) { var js, fjs = d.getElementsByTagName (s) [0]; if (d.getElementById (id)) {return;} js = d.createElement (s); js.id = id; js.src = "http://connect.facebook.net/en_US/sdk.js"; fjs.parentNode.insertBefore (js, fjs); } (Document, & # 39; script & # 39 ;, & # 39; Facebook-JSSDK & # 39;));
    Source link