Problem/Motivation

The module was ported to 8.x when Drupal 8 was in initial development phase. The idea for this meta is to update the module to work correctly with latest D8 release.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

piyuesh23 created an issue. See original summary.

sumitmadan’s picture

Assigned: Unassigned » sumitmadan

Working on it with latest release.

sumitmadan’s picture

Assigned: sumitmadan » Unassigned
Status: Active » Needs review
StatusFileSize
new3.09 KB

Please review.

wolfhowling’s picture

When i try to apply this patch i get an error:

error: patch failed: js/time_spent.js:2
error: js/time_spent.js patch does not apply
navneet0693’s picture

Status: Needs review » Reviewed & tested by the community

Tested on Drupal 8.1.3. It's working as required. No errors while applying patch.

wolfhowling’s picture

How are you applying the patch? I am Using git apply.

Image

Also maybe i have a different copy of the dev module because when i try to apply the patch manually most of the code that is being replace is not in time_spent.js

This is the state of the current time_spent.js i have and it does not have any old callbackURLs code to be replaced.

(function ($, Drupal) {
  Drupal.behaviors.time_spent = {
    attach: function(context, settings) {
      // Detect if is in an iframe, like overlay module.
      var isInIFrame = (window.location != window.parent.location);
      // Initialize the timer.
      var timer = setInterval( time_spent_ajax, (settings.time_spent.timer * 1000));
      // Limit how long the timer will run (in minutes).
      setTimeout(function() {clearInterval(timer);}, drupalSettings.time_spent.limit * 1000 * 60);
      window.parent.enabled = true;
      if(!isInIFrame){
      }
      else{
        // If a page is loaded into a overlay iframe
        // cancel the timespent from the page under overlay.
        window.parent.enabled = false;
      }
      $('#overlay-close').click(function() {
        window.parent.enabled = true;
      });

      /**
       * Send pings to the backend for to update time spent.
       */
      function time_spent_ajax() {
        if(isInIFrame || window.parent.enabled){
          $.ajax({
            type: 'get',
            url: drupalSettings.path.baseUrl + 'js/time_spent/ajax/' + drupalSettings.time_spent.nid + '?token=' + drupalSettings.time_spent.sectoken,
            dataType: 'json',
            data: 'js=1'
          });
        }
      }
    }
  };
})(jQuery, Drupal);
sumitmadan’s picture

Hi wolfhowling,

This patch is created on Linux. So it might give this warning on Window system. You can ignore it.

navneet0693’s picture

StatusFileSize
new62.13 KB

Hi @wolfhowling,

I am using the following command to apply patch:
curl https://www.drupal.org/files/issues/meta_make_module-2658042-3_0.patch | git apply

Please see the screenshot attached.

wolfhowling’s picture

Is there any way to get this committed to this branch or does someone has a copy of this file on GitHub or some where else that i can access cause even when i try with curl i still get an error. Thanks

ScreenShot

yogeshmpawar’s picture

rahul.shinde’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.