"ഘടകം:GradeLinks" എന്ന താളിന്റെ പതിപ്പുകൾ തമ്മിലുള്ള വ്യത്യാസം

10 ബൈറ്റുകൾ നീക്കംചെയ്തിരിക്കുന്നു ,  6 ജനുവരി
തിരുത്തലിനു സംഗ്രഹമില്ല
No edit summary
No edit summary
റ്റാഗ്: Manual revert
വരി 5: വരി 5:
     local mainUrl = args.MainUrl or ""
     local mainUrl = args.MainUrl or ""
     local itemName = args.ItemName or ""
     local itemName = args.ItemName or ""
    local mainTitle = args.MainTitle or ""
     local grades = {
     local grades = {
         { suffix = "A ഗ്രേഡ്", file = "MedelA.svg", label = "A ഗ്രേഡ്" },
         { suffix = "A ഗ്രേഡ്", file = "MedelA.svg", label = "A ഗ്രേഡ്" },
വരി 15: വരി 13:


     local output = {}
     local output = {}
     local shouldContinue = true
     local expensiveCalls = 0
    local maxExpensiveCalls = 99 -- Stay below the limit


     for _, grade in ipairs(grades) do
     for _, grade in ipairs(grades) do
         if shouldContinue then
         local pageTitle = mainUrl .. "/" .. itemName .. "/" .. grade.suffix
            local pageTitle = mainUrl .. "/" .. itemName .. "/" .. grade.suffix
        local titleObj = mw.title.new(pageTitle)
            local titleObj = mw.title.new(pageTitle)


            if titleObj and titleObj.exists then
        if titleObj and expensiveCalls < maxExpensiveCalls then
            if titleObj.exists then
                expensiveCalls = expensiveCalls + 1 -- Increment for each existence check
                 table.insert(output, string.format(
                 table.insert(output, string.format(
                     '<div style="text-align: center; padding: 0.75em; font-weight: normal; line-height: 1.15; font-size: 1.05em; margin-bottom: 0.2em; min-width: 120px; max-width: 250px; flex: 1 1 0px; margin-right: 1px;">' ..
                     '<div style="text-align: center; padding: 0.75em; font-weight: normal; line-height: 1.15; font-size: 1.05em; margin-bottom: 0.2em; min-width: 120px; max-width: 250px; flex: 1 1 0px; margin-right: 1px;">' ..
വരി 29: വരി 29:
                     grade.file, pageTitle, pageTitle, grade.label
                     grade.file, pageTitle, pageTitle, grade.label
                 ))
                 ))
            else
                -- Stop checking further if the current grade does not exist
                shouldContinue = false
             end
             end
         end
         end
വരി 44: വരി 41:
             '<div style="display: flex; flex-flow: row wrap; justify-content: space-evenly; width: 95%%;" role="navigation">%s</div>' ..
             '<div style="display: flex; flex-flow: row wrap; justify-content: space-evenly; width: 95%%;" role="navigation">%s</div>' ..
             '</div>',
             '</div>',
             mainTitle, table.concat(output)
             args.MainTitle or "", table.concat(output)
         )
         )
     end
     end
"https://schoolwiki.in/പ്രത്യേകം:മൊബൈൽവ്യത്യാസം/2623975" എന്ന താളിൽനിന്ന് ശേഖരിച്ചത്