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

Schoolwiki സംരംഭത്തിൽ നിന്ന്
(ചെ.)No edit summary
(ചെ.)No edit summary
 
(ഒരേ ഉപയോക്താവ് ചെയ്ത ഇടയ്ക്കുള്ള 3 നാൾപ്പതിപ്പുകൾ പ്രദർശിപ്പിക്കുന്നില്ല)
വരി 24: വരി 24:
                 expensiveCalls = expensiveCalls + 1 -- Increment for each existence check
                 expensiveCalls = expensiveCalls + 1 -- Increment for each existence check
                 table.insert(output, string.format(
                 table.insert(output, string.format(
                     '<div class="grade-item" 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 class="grade-item" style="text-align: center; padding: 0.75em; font-weight: normal; line-height: 1.15; font-size: 1.05em; margin-bottom: 0.2em; min-width: 80px; max-width: 130px; flex: 1 1 0px; margin-right: 1px; ' ..
                     'background: linear-gradient(135deg, #E3FDFD, #CBF1F5); box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); border-radius: 12px; transition: transform 0.3s ease, box-shadow 0.3s ease; position: relative;">' ..
                     'background: linear-gradient(135deg, #ffffcc, #ffccff); box-shadow: 0 8px 10px rgba(0, 0, 0, 0.1); border-radius: 50px;">' ..
                     '<span class="tooltip" style="visibility: hidden; background-color: #333; color: #fff; text-align: center; border-radius: 6px; padding: 5px; position: absolute; bottom: 110%%; left: 50%%; transform: translateX(-50%%); z-index: 1; opacity: 0; transition: opacity 0.3s ease;">%s</span>' ..
                     '<span class="tooltip" style="visibility: hidden; background-color: #333; color: #fff; text-align: center; border-radius: 6px; padding: 5px; position: absolute; bottom: 110%%; left: 50%%; transform: translateX(-50%%); z-index: 1; opacity: 0; transition: opacity 0.3s ease;">%s</span>' ..
                     '<span aria-hidden="true" role="presentation">[[File:%s|45px|link=%s|frameless|center]]</span>' ..
                     '<span aria-hidden="true" role="presentation">[[File:%s|45px|link=%s|frameless|center]]</span>' ..
വരി 38: വരി 38:
     if #output > 0 then
     if #output > 0 then
         return string.format(
         return string.format(
             '<div style="margin: 8px 0; background: linear-gradient(135deg, #ffff99, #ffcc99); padding-bottom: 10px; border-radius: 10px; box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15); overflow: hidden;">' ..
             '<div style="margin: 8px 0; padding-bottom: 10px; border-radius: 10px; box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15); overflow: hidden;">' ..
             '<div style="color: #fff; padding: 6px 2px; margin: 0; border-bottom: 1px solid #ccc; background: linear-gradient(105deg, #993300, ##000066); border-radius: 10px 10px 0 0;">' ..
             '<div style="color: #fff; padding: 6px 2px; margin: 0; border-bottom: 1px solid #ccc; background: linear-gradient(135deg, #ff9933, #ff3399); border-radius: 10px 10px 0 0;">' ..
             '<p style="padding: 0 10px; margin: 0; font-weight: bold; font-size: 1.2em; text-align: center; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);">%s</p>' ..
             '<p style="padding: 0 10px; margin: 0; font-weight: bold; font-size: 1.2em; text-align: center; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);">%s</p>' ..
             '</div>' ..
             '</div>' ..

14:24, 6 ജനുവരി 2025-നു നിലവിലുള്ള രൂപം

ഈ ഘടകത്തിന്റെ വിവരണം ഘടകം:GradeLinks/വിവരണം എന്ന താളിൽ നിർമ്മിക്കാവുന്നതാണ്

local p = {}

function p.render(frame)
    local args = frame:getParent().args
    local mainUrl = args.MainUrl or ""
    local itemName = args.ItemName or ""
    local grades = {
        { suffix = "A ഗ്രേഡ്", file = "MedelA.svg", label = "A ഗ്രേഡ്", description = "This is an A grade." },
        { suffix = "B ഗ്രേഡ്", file = "MedelB.svg", label = "B ഗ്രേഡ്", description = "This is a B grade." },
        { suffix = "C ഗ്രേഡ്", file = "MedelC.svg", label = "C ഗ്രേഡ്", description = "This is a C grade." },
        { suffix = "മറ്റുള്ളവ", file = "MedelO.svg", label = "മറ്റുള്ളവ", description = "Other grades fall here." },
    }

    local output = {}
    local expensiveCalls = 0
    local maxExpensiveCalls = 250 -- Stay below the limit

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

        if titleObj and expensiveCalls < maxExpensiveCalls then
            if titleObj.exists then
                expensiveCalls = expensiveCalls + 1 -- Increment for each existence check
                table.insert(output, string.format(
                    '<div class="grade-item" style="text-align: center; padding: 0.75em; font-weight: normal; line-height: 1.15; font-size: 1.05em; margin-bottom: 0.2em; min-width: 80px; max-width: 130px; flex: 1 1 0px; margin-right: 1px; ' ..
                    'background: linear-gradient(135deg, #ffffcc, #ffccff); box-shadow: 0 8px 10px rgba(0, 0, 0, 0.1); border-radius: 50px;">' ..
                    '<span class="tooltip" style="visibility: hidden; background-color: #333; color: #fff; text-align: center; border-radius: 6px; padding: 5px; position: absolute; bottom: 110%%; left: 50%%; transform: translateX(-50%%); z-index: 1; opacity: 0; transition: opacity 0.3s ease;">%s</span>' ..
                    '<span aria-hidden="true" role="presentation">[[File:%s|45px|link=%s|frameless|center]]</span>' ..
                    '[[%s|<b>%s</b>]]' ..
                    '</div>',
                    grade.description, grade.file, pageTitle, pageTitle, grade.label
                ))
            end
        end
    end

    if #output > 0 then
        return string.format(
            '<div style="margin: 8px 0; padding-bottom: 10px; border-radius: 10px; box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15); overflow: hidden;">' ..
            '<div style="color: #fff; padding: 6px 2px; margin: 0; border-bottom: 1px solid #ccc; background: linear-gradient(135deg, #ff9933, #ff3399); border-radius: 10px 10px 0 0;">' ..
            '<p style="padding: 0 10px; margin: 0; font-weight: bold; font-size: 1.2em; text-align: center; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);">%s</p>' ..
            '</div>' ..
            '<div style="display: flex; flex-flow: row wrap; justify-content: space-evenly; padding: 15px; width: 95%%;" role="navigation">%s</div>' ..
            '</div>',
            args.MainTitle or "", table.concat(output)
        )
    end

    return ""
end

return p
"https://schoolwiki.in/index.php?title=ഘടകം:GradeLinks&oldid=2624115" എന്ന താളിൽനിന്ന് ശേഖരിച്ചത്