Skip to content

Issue parsing "lesson" #14

@Sobuno

Description

@Sobuno
<a href='javascript: void' onclick="javascript: LectioContextMenu.ShowContextMenu(event);" class="s2skemabrik s2bgbox s2bgboxeksamen s2withlink lec-context-menu-instance" style="position:absolute; top:0em; left:0.55em;height:38.18em;width:6.73em;word-wrap:break-word;"
    data-additionalInfo="----REDACTED---
xx/x-xxxx xx:xx til xx:xx
Lærer: x

Note:
x">
    <div class='s2skemabrikInnerContainer'><span class='s2skemabrikIcons'><img alt="" class="picwidth14" src="/lectio/img/note.auto" /></span>
        <div class="s2timeline">xx:xx-xx:xx</div>
        <div class="s2skemabrikcontent">
            <span style='word-wrap:break-word;'>----REDACTED---</span><br />
            <span data-lectioContextCard='----REDACTED---'>x</span></div>
    </div>
</a>
<div class='lec-context-menu'>
    <ul>
        <li><a href='---Actual link 1 with ID 1----'>---REDACTED---</a></li>
        <li><a href='---Actual link 2 with ID 2----'>---REDACTED---</a></li>
    </ul>
</div>

LecToCal fails when it encounters the above entry in my wife's calendar (Redacted a lot of information). Notice that href is pointing to javascript: void, which means LecToCall will throw an error about not finding an ID. When you click on the entry in Lectio, it gives you a popup/context menu with the two links mentioned in the bottom of the code.

Lectio's own handling of finding the proper context menu is seen here:

        var etarget = $(e.target);
        var target = etarget.closest('.lec-context-menu-instance');
        if (target == null || target.length === 0) {
            target = etarget.parent('.lec-context-menu-instance'); //fallback to parent
        }
        if (target && target.length > 0) {
            var content = LectioContextMenu.GetContextMenuContent(target);

and GetContextMenuContent looks like this

        if (instance && instance.length > 0) {
            var content = instance.hasClass('.lec-context-menu') ? instance : null;
            if (content && content.length > 0) {
                return content;
            }
            content = instance.next('.lec-context-menu');
            if (content && content.length > 0) {
                return content;
            }
            content = instance.children('.lec-context-menu');
            if (content && content.length > 0) {
                return content;
            }
        }
        return null;
    };

In other words, it first checks if itself is the context-menu, then if the next sibling is (which is the case in my example) and finally if the children are.

I am satisfied with the information in the original entry; my problem is how to generate an ID I can reference again later if something changes as what we would usually get the ID from is replaced by javascript: void. LecToCal's structure doesn't really lean itself to looking at the next sibling to obtain an ID. Also note that the two links in the context menu have different IDs, meaning it actually does not link back to the "main" lesson.

Metadata

Metadata

Assignees

Labels

bugpending verificationThe issue is believed to be resolved, but should be verified in production.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions